Use mipmapPrecisionBits when calculating LOD error
Affected tests:
- dEQP-VK.pipeline.image.sampling_type.*
- dEQP-VK.pipeline.image_view.view_type.*
- dEQP-VK.pipeline.sampler.view_type.*
Khronos issue: #554
Change-Id: I7cb3bedd8df6b033dd6e7ae2d1631e5e2f25673e
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineImageSamplingInstance.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineImageSamplingInstance.cpp
index 606bbb8..70d0dc6 100644
--- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineImageSamplingInstance.cpp
+++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineImageSamplingInstance.cpp
@@ -1249,6 +1249,7 @@
tcu::TestStatus ImageSamplingInstance::verifyImage (void)
{
+ const VkPhysicalDeviceLimits& limits = m_context.getDeviceProperties().limits;
// \note Color buffer is used to capture coordinates - not sampled texture values
const tcu::TextureFormat colorFormat (tcu::TextureFormat::RGBA, tcu::TextureFormat::FLOAT);
const tcu::TextureFormat depthStencilFormat; // Undefined depth/stencil format.
@@ -1283,8 +1284,8 @@
{
const tcu::Sampler sampler = mapVkSampler(m_samplerParams);
const float referenceLod = de::clamp(m_samplerParams.mipLodBias + m_samplerLod, m_samplerParams.minLod, m_samplerParams.maxLod);
- const float lodError = 1.0f / 255.f;
- const tcu::Vec2 lodBounds (referenceLod-lodError, referenceLod+lodError);
+ const float lodError = 1.0f / static_cast<float>((1u << limits.mipmapPrecisionBits) - 1u);
+ const tcu::Vec2 lodBounds (referenceLod - lodError, referenceLod + lodError);
const vk::VkImageSubresourceRange subresource = resolveSubresourceRange(*m_texture, m_subresourceRange);
const tcu::ConstPixelBufferAccess resultAccess = result->getAccess();