From: Jeannot Breton Date: Thu, 25 May 2017 20:48:20 +0000 (-0500) Subject: Fix sparse cubemap array tests issues X-Git-Tag: upstream/0.1.0~280 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=77bed170bfd1332e9e2bfa0dda777606c2916f81;p=platform%2Fupstream%2FVK-GL-CTS.git Fix sparse cubemap array tests issues Add cubeMapArrayRefZDef, a new shader token used as parameters on some shadow cube map array texture instructions Add to some FunctionToken argument list definitions. It will be replaced by the value of cubeMapArrayRefZDef. Copy the depth reference value to s.cubeMapArrayRefZDef when we generate the shader tokens Change the way cube map array texture coordinate are computed in the shader to support array with more than 6 layers Specify that textureGradClampARB on shadow cubemap array is not supported Generate cube map array texture coordinate attributes as a vec4 with different coordinate for each layer Affects: KHR-GL45.sparse_texture2_tests.* KHR-GL45.sparse_texture_clamp_tests.* Components: OpenGL VK-GL-CTS issue: 445 Change-Id: Ia9fb2240396ab4a34dd697d0b96985da35dfe802 --- diff --git a/external/openglcts/modules/gl/gl4cSparseTexture2Tests.cpp b/external/openglcts/modules/gl/gl4cSparseTexture2Tests.cpp index 4b7944e..a987829 100644 --- a/external/openglcts/modules/gl/gl4cSparseTexture2Tests.cpp +++ b/external/openglcts/modules/gl/gl4cSparseTexture2Tests.cpp @@ -2178,7 +2178,7 @@ void SparseTexture2LookupTestCase::init() mSupportedInternalFormats.push_back(GL_DEPTH_COMPONENT16); FunctionToken f; - f = FunctionToken("sparseTextureARB", ""); + f = FunctionToken("sparseTextureARB", ""); f.allowedTargets.insert(GL_TEXTURE_2D); f.allowedTargets.insert(GL_TEXTURE_2D_ARRAY); f.allowedTargets.insert(GL_TEXTURE_CUBE_MAP); @@ -2449,12 +2449,13 @@ SparseTexture2LookupTestCase::TokenStringsExt SparseTexture2LookupTestCase::crea if ((target == GL_TEXTURE_CUBE_MAP || target == GL_TEXTURE_CUBE_MAP_ARRAY) && funcName.find("Fetch", 0) == std::string::npos) { - s.cubeMapCoordDef = " if (point.z == 0) coord.xyz = vec3(1, coord.y * 2 - 1, -coord.x * 2 + 1);\n" - " if (point.z == 1) coord.xyz = vec3(-1, coord.y * 2 - 1, coord.x * 2 - 1);\n" - " if (point.z == 2) coord.xyz = vec3(coord.x * 2 - 1, 1, coord.y * 2 - 1);\n" - " if (point.z == 3) coord.xyz = vec3(coord.x * 2 - 1, -1, -coord.y * 2 + 1);\n" - " if (point.z == 4) coord.xyz = vec3(coord.x * 2 - 1, coord.y * 2 - 1, 1);\n" - " if (point.z == 5) coord.xyz = vec3(-coord.x * 2 + 1, coord.y * 2 - 1, -1);\n"; + s.cubeMapCoordDef = " int face = point.z % 6;\n" + " if (face == 0) coord.xyz = vec3(1, coord.y * 2 - 1, -coord.x * 2 + 1);\n" + " if (face == 1) coord.xyz = vec3(-1, coord.y * 2 - 1, coord.x * 2 - 1);\n" + " if (face == 2) coord.xyz = vec3(coord.x * 2 - 1, 1, coord.y * 2 - 1);\n" + " if (face == 3) coord.xyz = vec3(coord.x * 2 - 1, -1, -coord.y * 2 + 1);\n" + " if (face == 4) coord.xyz = vec3(coord.x * 2 - 1, coord.y * 2 - 1, 1);\n" + " if (face == 5) coord.xyz = vec3(-coord.x * 2 + 1, coord.y * 2 - 1, -1);\n"; } if (s.coordDef.empty()) @@ -2491,7 +2492,7 @@ SparseTexture2LookupTestCase::TokenStringsExt SparseTexture2LookupTestCase::crea s.coordDef += s.refZDef; } else - funcToken.arguments += s.refZDef; + s.cubeMapArrayRefZDef = s.refZDef; s.componentDef = ".r"; } @@ -2815,6 +2816,7 @@ bool SparseTexture2LookupTestCase::verifyLookupTextureData(const Functions& gl, replaceToken("", s.epsilon.c_str(), shader); replaceToken("", s.sampleDef.c_str(), shader); replaceToken("", s.refZDef.c_str(), shader); + replaceToken("", s.cubeMapArrayRefZDef.c_str(), shader); replaceToken("", s.pointCoord.c_str(), shader); replaceToken("", s.componentDef.c_str(), shader); replaceToken("", s.cubeMapCoordDef.c_str(), shader); diff --git a/external/openglcts/modules/gl/gl4cSparseTexture2Tests.hpp b/external/openglcts/modules/gl/gl4cSparseTexture2Tests.hpp index 55dc0b1..64cada9 100644 --- a/external/openglcts/modules/gl/gl4cSparseTexture2Tests.hpp +++ b/external/openglcts/modules/gl/gl4cSparseTexture2Tests.hpp @@ -237,6 +237,7 @@ protected: std::string coordDef; std::string cubeMapCoordDef; std::string refZDef; + std::string cubeMapArrayRefZDef; std::string offsetDim; std::string offsetType; std::string nOffsetType; diff --git a/external/openglcts/modules/gl/gl4cSparseTextureClampTests.cpp b/external/openglcts/modules/gl/gl4cSparseTextureClampTests.cpp index accf914..021a153 100644 --- a/external/openglcts/modules/gl/gl4cSparseTextureClampTests.cpp +++ b/external/openglcts/modules/gl/gl4cSparseTextureClampTests.cpp @@ -199,7 +199,7 @@ void SparseTextureClampLookupResidencyTestCase::init() mSupportedInternalFormats.push_back(GL_DEPTH_COMPONENT16); FunctionToken f; - f = FunctionToken("sparseTextureClampARB", ", "); + f = FunctionToken("sparseTextureClampARB", ", "); f.allowedTargets.insert(GL_TEXTURE_2D); f.allowedTargets.insert(GL_TEXTURE_2D_ARRAY); f.allowedTargets.insert(GL_TEXTURE_CUBE_MAP); @@ -261,7 +261,8 @@ bool SparseTextureClampLookupResidencyTestCase::funcAllowed(GLint target, GLint if (format == GL_DEPTH_COMPONENT16) { - if (target == GL_TEXTURE_CUBE_MAP_ARRAY && funcToken.name == "sparseTextureGradClampARB") + if (target == GL_TEXTURE_CUBE_MAP_ARRAY && + (funcToken.name == "sparseTextureGradClampARB" || funcToken.name == "textureGradClampARB")) return false; } @@ -374,6 +375,7 @@ bool SparseTextureClampLookupResidencyTestCase::verifyLookupTextureData(const Fu replaceToken("", s.epsilon.c_str(), fragment); replaceToken("", s.sampleDef.c_str(), fragment); replaceToken("", s.refZDef.c_str(), fragment); + replaceToken("", s.cubeMapArrayRefZDef.c_str(), fragment); replaceToken("", s.pointCoord.c_str(), fragment); replaceToken("", s.componentDef.c_str(), fragment); replaceToken("", s.cubeMapCoordDef.c_str(), fragment); @@ -480,6 +482,15 @@ void SparseTextureClampLookupResidencyTestCase::draw(GLint target, GLint layer, floatCoord = glu::va::Float("inCoord", 3, 4, 0, texCoord3D); else if (target == GL_TEXTURE_CUBE_MAP) floatCoord = glu::va::Float("inCoord", 3, 4, 0, texCoordCubeMap[layer]); + else if (target == GL_TEXTURE_CUBE_MAP_ARRAY) + { + GLfloat layerCoord = GLfloat(layer) / 6.0f + 0.01f; + const GLfloat texCoordCubeMapArray[16] = { 0.0f, 0.0f, layerCoord, GLfloat(layer), + 1.0f, 0.0f, layerCoord, GLfloat(layer), + 0.0f, 1.0f, layerCoord, GLfloat(layer), + 1.0f, 1.0f, layerCoord, GLfloat(layer) }; + floatCoord = glu::va::Float("inCoord", 4, 4, 0, texCoordCubeMapArray); + } else floatCoord = glu::va::Float("inCoord", 2, 4, 0, texCoord2D); @@ -510,7 +521,7 @@ void SparseTextureClampLookupColorTestCase::init() mSupportedInternalFormats.push_back(GL_DEPTH_COMPONENT16); FunctionToken f; - f = FunctionToken("sparseTextureClampARB", ", "); + f = FunctionToken("sparseTextureClampARB", ", "); f.allowedTargets.insert(GL_TEXTURE_2D); f.allowedTargets.insert(GL_TEXTURE_2D_ARRAY); f.allowedTargets.insert(GL_TEXTURE_CUBE_MAP); @@ -518,7 +529,7 @@ void SparseTextureClampLookupColorTestCase::init() f.allowedTargets.insert(GL_TEXTURE_3D); mFunctions.push_back(f); - f = FunctionToken("textureClampARB", ", "); + f = FunctionToken("textureClampARB", ", "); f.allowedTargets.insert(GL_TEXTURE_1D); f.allowedTargets.insert(GL_TEXTURE_1D_ARRAY); f.allowedTargets.insert(GL_TEXTURE_2D); @@ -866,6 +877,7 @@ bool SparseTextureClampLookupColorTestCase::verifyLookupTextureData(const Functi replaceToken("", s.epsilon.c_str(), fragment); replaceToken("", s.sampleDef.c_str(), fragment); replaceToken("", s.refZDef.c_str(), fragment); + replaceToken("", s.cubeMapArrayRefZDef.c_str(), fragment); replaceToken("", s.pointCoord.c_str(), fragment); replaceToken("", s.componentDef.c_str(), fragment); replaceToken("", s.cubeMapCoordDef.c_str(), fragment);