Differentiate shader storage blocks needed for VS and FS
authorAlejandro Piñeiro <apinheiro@igalia.com>
Tue, 18 Jun 2019 08:43:58 +0000 (10:43 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 27 Jun 2019 12:14:56 +0000 (08:14 -0400)
Opengl ES shader image load/store tests includes tests for VS and FS,
and it uses SSB for checking the outcome. But right now, when checking
if supported, it checks for the same required value on VS and FS
shaders, even if the test only requires for one or the other. This
leads to some unneeded skips on some drivers (for example, in some
drivers where the supported SSB for VS are 0, but it is supported for
FS).

This commit changes the method that checks the required SSB needed in
order to pass two required parameters (one for VS, other for FS),
instead of one common. This is what it is already done for image
uniforms.

Components: OpenGL-ES

VK-GL-CTS issue: 1834

Affects:
KHR-GLES31.core.shader_image_load_store.*

Change-Id: I30dda05f1f670a779fc8f08c331245559896dd0d

external/openglcts/modules/gles31/es31cShaderImageLoadStoreTests.cpp

index d81948e..75ba38b 100644 (file)
@@ -103,19 +103,19 @@ public:
                        return false;
                }
        }
-       bool IsSSBInVSFSAvailable(int required)
+       bool IsSSBInVSFSAvailable(int requiredVS, int requiredFS)
        {
                GLint blocksVS, blocksFS;
                glGetIntegerv(GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS, &blocksVS);
                glGetIntegerv(GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS, &blocksFS);
-               if (blocksVS >= required && blocksFS >= required)
+               if (blocksVS >= requiredVS && blocksFS >= requiredFS)
                        return true;
                else
                {
                        std::ostringstream reason;
-                       reason << "Required " << required << " VS storage blocks but only " << blocksVS << " available."
+                       reason << "Required " << requiredVS << " VS storage blocks but only " << blocksVS << " available."
                                   << std::endl
-                                  << "Required " << required << " FS storage blocks but only " << blocksFS << " available."
+                                  << "Required " << requiredFS << " FS storage blocks but only " << blocksFS << " available."
                                   << std::endl;
                        OutputNotSupported(reason.str());
                        return false;
@@ -1354,7 +1354,7 @@ class BasicAllFormatsLoadFS : public ShaderImageLoadStoreBase
        }
        virtual long Run()
        {
-               if (!IsVSFSAvailable(0, 1) || !IsSSBInVSFSAvailable(1))
+               if (!IsVSFSAvailable(0, 1) || !IsSSBInVSFSAvailable(0, 1))
                        return NOT_SUPPORTED;
 
                CreateFullViewportQuad(&m_vao, &m_vbo, NULL);
@@ -2256,7 +2256,7 @@ class BasicAllTargetsLoadFS : public ShaderImageLoadStoreBase
 
        virtual long Run()
        {
-               if (!IsVSFSAvailable(0, 4) || !IsSSBInVSFSAvailable(4))
+               if (!IsVSFSAvailable(0, 4) || !IsSSBInVSFSAvailable(0, 4))
                        return NOT_SUPPORTED;
                CreateFullViewportQuad(&m_vao, &m_vbo, NULL);
 
@@ -2703,7 +2703,7 @@ class BasicAllTargetsAtomicFS : public ShaderImageLoadStoreBase
                        return NOT_SUPPORTED;
                if (!AreOutputsAvailable(5))
                        return NOT_SUPPORTED;
-               if (!IsSSBInVSFSAvailable(1))
+               if (!IsSSBInVSFSAvailable(0, 1))
                        return NOT_SUPPORTED;
                CreateFullViewportQuad(&m_vao, &m_vbo, NULL);
 
@@ -3358,7 +3358,7 @@ class BasicAllTargetsLoadStoreVS : public LoadStoreMachine
 {
        virtual long Run()
        {
-               if (!IsVSFSAvailable(4, 0) || !IsSSBInVSFSAvailable(1))
+               if (!IsVSFSAvailable(4, 0) || !IsSSBInVSFSAvailable(1, 0))
                        return NOT_SUPPORTED;
                return RunStage(0);
        }
@@ -3380,7 +3380,7 @@ class BasicAllTargetsAtomicVS : public AtomicMachine
 {
        virtual long Run()
        {
-               if (!IsVSFSAvailable(4, 0) || !IsSSBInVSFSAvailable(1))
+               if (!IsVSFSAvailable(4, 0) || !IsSSBInVSFSAvailable(1, 0))
                        return NOT_SUPPORTED;
                return RunStage(0);
        }
@@ -3415,7 +3415,7 @@ class BasicGLSLMiscFS : public ShaderImageLoadStoreBase
        }
        virtual long Run()
        {
-               if (!IsVSFSAvailable(0, 2) || !IsSSBInVSFSAvailable(1))
+               if (!IsVSFSAvailable(0, 2) || !IsSSBInVSFSAvailable(0, 1))
                        return NOT_SUPPORTED;
 
                const int                  kSize = 32;
@@ -3820,7 +3820,7 @@ class AdvancedSyncImageAccess : public ShaderImageLoadStoreBase
 
        virtual long Run()
        {
-               if (!IsVSFSAvailable(1, 0) || !IsSSBInVSFSAvailable(1))
+               if (!IsVSFSAvailable(1, 0) || !IsSSBInVSFSAvailable(1, 0))
                        return NOT_SUPPORTED;
 
                const int                 kSize = 44;
@@ -4078,7 +4078,7 @@ class AdvancedSyncImageAccess2 : public ShaderImageLoadStoreBase
        virtual long Run()
        {
                const int kSize = 32;
-               if (!IsVSFSAvailable(0, 1) || !IsSSBInVSFSAvailable(1))
+               if (!IsVSFSAvailable(0, 1) || !IsSSBInVSFSAvailable(0, 1))
                        return NOT_SUPPORTED;
                const char* const glsl_vs =
                        NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL "  gl_Position = i_position;" NL "}";
@@ -4262,7 +4262,7 @@ class AdvancedMemoryOrderVSFS : public ShaderImageLoadStoreBase
        virtual long Run()
        {
                const int kSize = 11;
-               if (!IsVSFSAvailable(1, 1) || !IsSSBInVSFSAvailable(1))
+               if (!IsVSFSAvailable(1, 1) || !IsSSBInVSFSAvailable(1, 1))
                        return NOT_SUPPORTED;
                const char* const glsl_vs = NL
                        "layout(location = 0) in vec4 i_position;" NL "out vec4 vs_color;" NL