OSDN Git Service

Test for 8-bit components instead of not 16-bit components.
authorNicolas Capens <capn@google.com>
Tue, 1 Sep 2015 14:23:33 +0000 (10:23 -0400)
committerNicolas Capens <capn@google.com>
Wed, 2 Sep 2015 13:53:17 +0000 (13:53 +0000)
Bug 21572252

Change-Id: I0c5aedf4fec7238544c1d716f65f0fd91cd59b57
Reviewed-on: https://swiftshader-review.googlesource.com/3937
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
src/Shader/SamplerCore.cpp
src/Shader/SamplerCore.hpp

index bc8a881..93a6480 100644 (file)
@@ -1549,7 +1549,7 @@ namespace sw
                                ASSERT(false);
                        }
                }
-               else if(!has16bitTextureComponents())   // 8-bit components
+               else if(has8bitTextureComponents())
                {
                        switch(textureComponentCount())
                        {
@@ -1659,7 +1659,7 @@ namespace sw
                                ASSERT(false);
                        }
                }
-               else   // 16-bit components
+               else if(has16bitTextureComponents())
                {
                        switch(textureComponentCount())
                        {
@@ -1935,6 +1935,45 @@ namespace sw
                return false;
        }
 
+       bool SamplerCore::has8bitTextureComponents() const
+       {
+               switch(state.textureFormat)
+               {
+               case FORMAT_R5G6B5:
+                       return false;
+               case FORMAT_G8R8:
+               case FORMAT_X8R8G8B8:
+               case FORMAT_X8B8G8R8:
+               case FORMAT_A8R8G8B8:
+               case FORMAT_A8B8G8R8:
+               case FORMAT_V8U8:
+               case FORMAT_Q8W8V8U8:
+               case FORMAT_X8L8V8U8:
+               case FORMAT_A8:
+               case FORMAT_R8:
+               case FORMAT_L8:
+               case FORMAT_A8L8:
+                       return true;
+               case FORMAT_R32F:
+               case FORMAT_G32R32F:
+               case FORMAT_A32B32G32R32F:
+               case FORMAT_D32F_LOCKABLE:
+               case FORMAT_D32FS8_TEXTURE:
+               case FORMAT_D32FS8_SHADOW:
+               case FORMAT_L16:
+               case FORMAT_G16R16:
+               case FORMAT_A16B16G16R16:
+               case FORMAT_V16U16:
+               case FORMAT_A16W16V16U16:
+               case FORMAT_Q16W16V16U16:
+                       return false;
+               default:
+                       ASSERT(false);
+               }
+               
+               return false;
+       }
+
        bool SamplerCore::has16bitTextureComponents() const
        {
                switch(state.textureFormat)
index 6d17d95..139220a 100644 (file)
@@ -61,6 +61,7 @@ namespace sw
                bool hasUnsignedTextureComponent(int component) const;\r
                int textureComponentCount() const;\r
                bool has16bitTextureFormat() const;\r
+               bool has8bitTextureComponents() const;\r
                bool has16bitTextureComponents() const;\r
                bool isRGBComponent(int component) const;\r
 \r