Use mipmapPrecisionBits when calculating LOD error
authorMaciej Jesionowski <maciej.jesionowski@mobica.com>
Wed, 7 Dec 2016 12:37:15 +0000 (13:37 +0100)
committerPyry Haulos <phaulos@google.com>
Fri, 9 Dec 2016 19:16:03 +0000 (14:16 -0500)
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

external/vulkancts/modules/vulkan/pipeline/vktPipelineImageSamplingInstance.cpp

index 606bbb8..70d0dc6 100644 (file)
@@ -1249,6 +1249,7 @@ MovePtr<tcu::Texture3DView> getTexture3DView (const TestTexture& testTexture, co
 
 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 @@ tcu::TestStatus ImageSamplingInstance::verifyImage (void)
        {
                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();