ShaderRenderCase: improve filter mode mapping
authorPeter Gal <pgal.u-szeged@partner.samsung.com>
Thu, 29 Oct 2015 17:13:05 +0000 (18:13 +0100)
committerPeter Gal <pgal.u-szeged@partner.samsung.com>
Thu, 12 Nov 2015 18:54:16 +0000 (19:54 +0100)
external/vulkancts/framework/vulkan/vkImageUtil.cpp

index e064cf9..39d2c93 100644 (file)
@@ -628,59 +628,57 @@ void imageUtilSelfTest (void)
 
 VkTexFilter mapFilterMode (tcu::Sampler::FilterMode filterMode)
 {
-       // \todo [2015-09-07 elecro] dobule check the mappings
+       DE_STATIC_ASSERT(tcu::Sampler::FILTERMODE_LAST == 6);
+
        switch(filterMode)
        {
                case tcu::Sampler::NEAREST:                                     return VK_TEX_FILTER_NEAREST;
                case tcu::Sampler::LINEAR:                                      return VK_TEX_FILTER_LINEAR;
                case tcu::Sampler::NEAREST_MIPMAP_NEAREST:      return VK_TEX_FILTER_NEAREST;
-               case tcu::Sampler::LINEAR_MIPMAP_NEAREST:       return VK_TEX_FILTER_NEAREST;
+               case tcu::Sampler::NEAREST_MIPMAP_LINEAR:       return VK_TEX_FILTER_NEAREST;
+               case tcu::Sampler::LINEAR_MIPMAP_NEAREST:       return VK_TEX_FILTER_LINEAR;
                case tcu::Sampler::LINEAR_MIPMAP_LINEAR:        return VK_TEX_FILTER_LINEAR;
                default:
-                       DE_ASSERT(false);
-       }
+                       DE_FATAL("Illegal filter mode");
+                       return (VkTexFilter)0;
 
-       return VK_TEX_FILTER_NEAREST;
+       }
 }
 
 VkTexMipmapMode mapMipmapMode (tcu::Sampler::FilterMode filterMode)
 {
-       // \todo [2015-09-07 elecro] dobule check the mappings
+       DE_STATIC_ASSERT(tcu::Sampler::FILTERMODE_LAST == 6);
+
        switch(filterMode)
        {
                case tcu::Sampler::NEAREST:                                     return VK_TEX_MIPMAP_MODE_BASE;
                case tcu::Sampler::LINEAR:                                      return VK_TEX_MIPMAP_MODE_BASE;
                case tcu::Sampler::NEAREST_MIPMAP_NEAREST:      return VK_TEX_MIPMAP_MODE_NEAREST;
+               case tcu::Sampler::NEAREST_MIPMAP_LINEAR:       return VK_TEX_MIPMAP_MODE_LINEAR;
                case tcu::Sampler::LINEAR_MIPMAP_NEAREST:       return VK_TEX_MIPMAP_MODE_NEAREST;
                case tcu::Sampler::LINEAR_MIPMAP_LINEAR:        return VK_TEX_MIPMAP_MODE_LINEAR;
                default:
-                       DE_ASSERT(false);
+                       DE_FATAL("Illegal filter mode");
+                       return (VkTexMipmapMode)0;
        }
-
-       return VK_TEX_MIPMAP_MODE_BASE;
 }
 
 VkTexAddressMode mapWrapMode (tcu::Sampler::WrapMode wrapMode)
 {
-       // \todo [2015-09-07 elecro] dobule check the mappings
        switch(wrapMode)
        {
                case tcu::Sampler::CLAMP_TO_EDGE:               return VK_TEX_ADDRESS_MODE_CLAMP;
                case tcu::Sampler::CLAMP_TO_BORDER:             return VK_TEX_ADDRESS_MODE_CLAMP_BORDER;
                case tcu::Sampler::REPEAT_GL:                   return VK_TEX_ADDRESS_MODE_WRAP;
-               case tcu::Sampler::REPEAT_CL:                   return VK_TEX_ADDRESS_MODE_WRAP;
                case tcu::Sampler::MIRRORED_REPEAT_GL:  return VK_TEX_ADDRESS_MODE_MIRROR;
-               case tcu::Sampler::MIRRORED_REPEAT_CL:  return VK_TEX_ADDRESS_MODE_MIRROR;
                default:
-                       DE_ASSERT(false);
+                       DE_FATAL("Wrap mode can't be mapped to Vulkan");
+                       return (vk::VkTexAddressMode)0;
        }
-
-       return VK_TEX_ADDRESS_MODE_WRAP;
 }
 
 vk::VkCompareOp mapCompareMode (tcu::Sampler::CompareMode mode)
 {
-       // \todo [2015-09-07 elecro] dobule check the mappings
        switch(mode)
        {
                case tcu::Sampler::COMPAREMODE_NONE:                            return vk::VK_COMPARE_OP_NEVER;
@@ -693,10 +691,9 @@ vk::VkCompareOp mapCompareMode (tcu::Sampler::CompareMode mode)
                case tcu::Sampler::COMPAREMODE_ALWAYS:                          return vk::VK_COMPARE_OP_ALWAYS;
                case tcu::Sampler::COMPAREMODE_NEVER:                           return vk::VK_COMPARE_OP_NEVER;
                default:
-                       DE_ASSERT(false);
+                       DE_FATAL("Illegal compare mode");
+                       return (vk::VkCompareOp)0;
        }
-
-       return vk::VK_COMPARE_OP_NEVER;
 }
 
 } // vk