1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 3.1 Module
3 * -------------------------------------------------
5 * Copyright 2017 The Android Open Source Project
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief Texture format tests.
22 *//*--------------------------------------------------------------------*/
24 #include "es31fSRGBDecodeTests.hpp"
25 #include "gluContextInfo.hpp"
26 #include "gluCallLogWrapper.hpp"
27 #include "gluRenderContext.hpp"
28 #include "gluTexture.hpp"
29 #include "glsTextureTestUtil.hpp"
30 #include "tcuPixelFormat.hpp"
31 #include "tcuTestContext.hpp"
32 #include "tcuRenderTarget.hpp"
33 #include "gluTextureUtil.hpp"
34 #include "tcuTextureUtil.hpp"
35 #include "glwFunctions.hpp"
36 #include "gluDefs.hpp"
37 #include "glwEnums.hpp"
38 #include "deUniquePtr.hpp"
39 #include "gluPixelTransfer.hpp"
40 #include "tcuDefs.hpp"
41 #include "tcuVectorUtil.hpp"
42 #include "gluObjectWrapper.hpp"
43 #include "gluStrUtil.hpp"
44 #include "tcuTestLog.hpp"
45 #include "deStringUtil.hpp"
56 using glu::TextureTestUtil::TEXTURETYPE_2D;
60 SRGBDECODE_SKIP_DECODE = 0,
62 SRGBDECODE_DECODE_DEFAULT
67 SHADEROUTPUTS_ONE = 1,
73 SHADERUNIFORMS_ONE = 1,
77 enum ShaderSamplingGroup
79 SHADERSAMPLINGGROUP_TEXTURE = 0,
80 SHADERSAMPLINGGROUP_TEXEL_FETCH
83 enum ShaderSamplingType
85 TEXTURESAMPLING_TEXTURE = 0,
86 TEXTURESAMPLING_TEXTURE_LOD,
87 TEXTURESAMPLING_TEXTURE_GRAD,
88 TEXTURESAMPLING_TEXTURE_OFFSET,
89 TEXTURESAMPLING_TEXTURE_PROJ,
90 TEXTURESAMPLING_TEXELFETCH,
91 TEXTURESAMPLING_TEXELFETCH_OFFSET,
93 // ranges required for looping mechanism in a case nodes iteration function
94 TEXTURESAMPLING_TEXTURE_START = TEXTURESAMPLING_TEXTURE,
95 TEXTURESAMPLING_TEXTURE_END = TEXTURESAMPLING_TEXTURE_PROJ + 1,
96 TEXTURESAMPLING_TEXELFETCH_START = TEXTURESAMPLING_TEXELFETCH,
97 TEXTURESAMPLING_TEXELFETCH_END = TEXTURESAMPLING_TEXELFETCH_OFFSET + 1
100 enum FunctionParameters
102 FUNCTIONPARAMETERS_ONE = 1,
103 FUNCTIONPARAMETERS_TWO
108 BLENDING_REQUIRED = 0,
109 BLENDING_NOT_REQUIRED
114 TOGGLING_REQUIRED = 0,
115 TOGGLING_NOT_REQUIRED
118 tcu::Vec4 getColorReferenceLinear (void)
120 return tcu::Vec4(0.2f, 0.3f, 0.4f, 1.0f);
123 tcu::Vec4 getColorReferenceSRGB (void)
125 return tcu::linearToSRGB(tcu::Vec4(0.2f, 0.3f, 0.4f, 1.0f));
128 tcu::Vec4 getColorGreenPass (void)
130 return tcu::Vec4(0.0f, 1.0f, 0.0f, 1.0f);
133 namespace TestDimensions
135 const int WIDTH = 128;
136 const int HEIGHT = 128;
137 } // global test texture dimensions
139 namespace TestSamplingPositions
143 } // global test sampling positions
145 const char* getFunctionDefinitionSRGBToLinearCheck (void)
147 static const char* functionDefinition =
148 "mediump vec4 srgbToLinearCheck(in mediump vec4 texelSRGBA, in mediump vec4 texelLinear) \n"
150 " const int NUM_CHANNELS = 4;"
151 " mediump vec4 texelSRGBAConverted; \n"
152 " mediump vec4 epsilonErr = vec4(0.005); \n"
153 " mediump vec4 testResult; \n"
154 " for (int idx = 0; idx < NUM_CHANNELS; idx++) \n"
156 " texelSRGBAConverted[idx] = pow( (texelSRGBA[idx] + 0.055) / 1.055, 1.0 / 0.4116); \n"
158 " if ( all(lessThan(abs(texelSRGBAConverted - texelLinear), epsilonErr)) || all(equal(texelSRGBAConverted, texelLinear)) ) \n"
160 " return testResult = vec4(0.0, 1.0, 0.0, 1.0); \n"
164 " return testResult = vec4(1.0, 0.0, 0.0, 1.0); \n"
168 return functionDefinition;
171 const char* getFunctionDefinitionEqualCheck (void)
173 static const char* functionDefinition =
174 "mediump vec4 colorsEqualCheck(in mediump vec4 colorA, in mediump vec4 colorB) \n"
176 " mediump vec4 epsilonErr = vec4(0.005); \n"
177 " mediump vec4 testResult; \n"
178 " if ( all(lessThan(abs(colorA - colorB), epsilonErr)) || all(equal(colorA, colorB)) ) \n"
180 " return testResult = vec4(0.0, 1.0, 0.0, 1.0); \n"
184 " return testResult = vec4(1.0, 0.0, 0.0, 1.0); \n"
188 return functionDefinition;
191 namespace EpsilonError
193 const float CPU = 0.005f;
196 struct TestGroupConfig
198 TestGroupConfig (const char* groupName, const char* groupDescription, const tcu::TextureFormat groupInternalFormat)
200 , description (groupDescription)
201 , internalFormat (groupInternalFormat) {}
203 ~TestGroupConfig (void) {};
206 const char* description;
207 const tcu::TextureFormat internalFormat;
212 UniformData (glw::GLuint uniformLocation, const std::string& uniformName)
213 : location (uniformLocation)
215 , toggleDecode (false) {}
217 ~UniformData (void) {}
219 glw::GLuint location;
224 struct UniformToToggle
226 UniformToToggle (const int uniformProgramIdx, const std::string& uniformName)
227 : programIdx (uniformProgramIdx)
228 , name (uniformName) {}
230 ~UniformToToggle (void) {}
236 struct ComparisonFunction
238 ComparisonFunction (const std::string& funcName, const FunctionParameters funcParameters, const std::string& funcImplementation)
240 , parameters (funcParameters)
241 , implementation (funcImplementation) {}
243 ~ComparisonFunction (void) {}
246 FunctionParameters parameters;
247 std::string implementation;
250 struct FragmentShaderParameters
252 FragmentShaderParameters (const ShaderOutputs outputTotal,
253 const ShaderUniforms uniformTotal,
254 ComparisonFunction* comparisonFunction,
255 Blending blendRequired,
256 Toggling toggleRequired);
258 ~FragmentShaderParameters (void);
260 ShaderOutputs outputTotal;
261 ShaderUniforms uniformTotal;
262 ShaderSamplingType samplingType;
263 std::string functionName;
264 FunctionParameters functionParameters;
265 std::string functionImplementation;
267 Blending blendRequired;
268 Toggling toggleRequired;
269 std::vector<std::string> uniformsToToggle;
272 FragmentShaderParameters::FragmentShaderParameters (const ShaderOutputs paramsOutputTotal,
273 const ShaderUniforms paramsUniformTotal,
274 ComparisonFunction* paramsComparisonFunction,
275 Blending paramsBlendRequired,
276 Toggling paramsToggleRequired)
277 : outputTotal (paramsOutputTotal)
278 , uniformTotal (paramsUniformTotal)
279 , blendRequired (paramsBlendRequired)
280 , toggleRequired (paramsToggleRequired)
282 if (paramsComparisonFunction != DE_NULL)
284 functionName = paramsComparisonFunction->name;
285 functionParameters = paramsComparisonFunction->parameters;
286 functionImplementation = paramsComparisonFunction->implementation;
296 FragmentShaderParameters::~FragmentShaderParameters (void)
300 class SRGBTestSampler
303 SRGBTestSampler (Context& context,
304 const tcu::Sampler::WrapMode wrapS,
305 const tcu::Sampler::WrapMode wrapT,
306 const tcu::Sampler::FilterMode minFilter,
307 const tcu::Sampler::FilterMode magFilter,
308 const SRGBDecode decoding);
309 ~SRGBTestSampler (void);
311 void setDecode (const SRGBDecode decoding);
312 void setTextureUnit (const deUint32 textureUnit);
313 void setIsActive (const bool isActive);
315 bool getIsActive (void) const;
317 void bindToTexture (void);
320 const glw::Functions* m_gl;
321 deUint32 m_samplerHandle;
322 tcu::Sampler::WrapMode m_wrapS;
323 tcu::Sampler::WrapMode m_wrapT;
324 tcu::Sampler::FilterMode m_minFilter;
325 tcu::Sampler::FilterMode m_magFilter;
326 SRGBDecode m_decoding;
327 deUint32 m_textureUnit;
331 SRGBTestSampler::SRGBTestSampler (Context& context,
332 const tcu::Sampler::WrapMode wrapS,
333 const tcu::Sampler::WrapMode wrapT,
334 const tcu::Sampler::FilterMode minFilter,
335 const tcu::Sampler::FilterMode magFilter,
336 const SRGBDecode decoding)
337 : m_gl (&context.getRenderContext().getFunctions())
340 , m_minFilter (minFilter)
341 , m_magFilter (magFilter)
344 m_gl->genSamplers(1, &m_samplerHandle);
346 m_gl->samplerParameteri(m_samplerHandle, GL_TEXTURE_WRAP_S, glu::getGLWrapMode(m_wrapS));
347 m_gl->samplerParameteri(m_samplerHandle, GL_TEXTURE_WRAP_T, glu::getGLWrapMode(m_wrapT));
348 m_gl->samplerParameteri(m_samplerHandle, GL_TEXTURE_MIN_FILTER, glu::getGLFilterMode(m_minFilter));
349 m_gl->samplerParameteri(m_samplerHandle, GL_TEXTURE_MAG_FILTER, glu::getGLFilterMode(m_magFilter));
351 this->setDecode(decoding);
354 SRGBTestSampler::~SRGBTestSampler (void)
356 m_gl->deleteSamplers(1, &m_samplerHandle);
359 void SRGBTestSampler::setDecode (const SRGBDecode decoding)
361 if (decoding == SRGBDECODE_SKIP_DECODE)
363 m_gl->samplerParameteri(m_samplerHandle, GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT);
364 GLU_EXPECT_NO_ERROR(m_gl->getError(), "samplerParameteri(m_samplerID, GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT)");
366 else if (decoding == SRGBDECODE_DECODE)
368 m_gl->samplerParameteri(m_samplerHandle, GL_TEXTURE_SRGB_DECODE_EXT, GL_DECODE_EXT);
369 GLU_EXPECT_NO_ERROR(m_gl->getError(), "samplerParameteri(m_samplerID, GL_TEXTURE_SRGB_DECODE_EXT, GL_DECODE_EXT)");
373 DE_FATAL("sRGB texture sampler must have either GL_SKIP_DECODE_EXT or GL_DECODE_EXT settings");
376 m_decoding = decoding;
379 void SRGBTestSampler::setTextureUnit (const deUint32 textureUnit)
381 m_textureUnit = textureUnit;
384 void SRGBTestSampler::setIsActive (const bool isActive)
386 m_isActive = isActive;
389 bool SRGBTestSampler::getIsActive (void) const
394 void SRGBTestSampler::bindToTexture (void)
396 m_gl->bindSampler(m_textureUnit, m_samplerHandle);
399 class SRGBTestTexture
402 SRGBTestTexture (Context& context,
403 const glu::TextureTestUtil::TextureType targetType,
404 const tcu::TextureFormat internalFormat,
407 const tcu::Vec4 color,
408 const tcu::Sampler::WrapMode wrapS,
409 const tcu::Sampler::WrapMode wrapT,
410 const tcu::Sampler::FilterMode minFilter,
411 const tcu::Sampler::FilterMode magFilter,
412 const SRGBDecode decoding);
413 ~SRGBTestTexture (void);
415 void setParameters (void);
416 void setDecode (const SRGBDecode decoding);
417 void setHasSampler (const bool hasSampler);
419 deUint32 getHandle (void) const;
420 deUint32 getGLTargetType (void) const;
421 SRGBDecode getDecode (void) const;
426 void setColor (void);
429 glu::Texture2D m_source;
430 glu::TextureTestUtil::TextureType m_targetType;
431 const tcu::TextureFormat m_internalFormat;
435 tcu::Sampler::WrapMode m_wrapS;
436 tcu::Sampler::WrapMode m_wrapT;
437 tcu::Sampler::FilterMode m_minFilter;
438 tcu::Sampler::FilterMode m_magFilter;
439 SRGBDecode m_decoding;
443 SRGBTestTexture::SRGBTestTexture (Context& context,
444 const glu::TextureTestUtil::TextureType targetType,
445 const tcu::TextureFormat internalFormat,
448 const tcu::Vec4 color,
449 const tcu::Sampler::WrapMode wrapS,
450 const tcu::Sampler::WrapMode wrapT,
451 const tcu::Sampler::FilterMode minFilter,
452 const tcu::Sampler::FilterMode magFilter,
454 : m_context (context)
455 , m_source (context.getRenderContext(), glu::getInternalFormat(internalFormat), width, height)
456 , m_targetType (targetType)
457 , m_internalFormat (internalFormat)
463 , m_minFilter (minFilter)
464 , m_magFilter (magFilter)
465 , m_decoding (decoding)
466 , m_hasSampler (false)
471 SRGBTestTexture::~SRGBTestTexture (void)
475 void SRGBTestTexture::setParameters (void)
477 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
479 gl.bindTexture(this->getGLTargetType(), this->getHandle());
481 gl.texParameteri(this->getGLTargetType(), GL_TEXTURE_WRAP_S, glu::getGLWrapMode(m_wrapS));
482 gl.texParameteri(this->getGLTargetType(), GL_TEXTURE_WRAP_T, glu::getGLWrapMode(m_wrapT));
483 gl.texParameteri(this->getGLTargetType(), GL_TEXTURE_MIN_FILTER, glu::getGLFilterMode(m_minFilter));
484 gl.texParameteri(this->getGLTargetType(), GL_TEXTURE_MAG_FILTER, glu::getGLFilterMode(m_magFilter));
486 gl.bindTexture(this->getGLTargetType(), 0);
488 setDecode(m_decoding);
491 void SRGBTestTexture::setDecode (const SRGBDecode decoding)
493 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
495 gl.bindTexture(this->getGLTargetType(), this->getHandle());
499 case SRGBDECODE_SKIP_DECODE:
501 gl.texParameteri(this->getGLTargetType(), GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT);
502 GLU_EXPECT_NO_ERROR(gl.getError(), "glTexParameteri(this->getGLTargetType(), GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT)");
505 case SRGBDECODE_DECODE:
507 gl.texParameteri(this->getGLTargetType(), GL_TEXTURE_SRGB_DECODE_EXT, GL_DECODE_EXT);
508 GLU_EXPECT_NO_ERROR(gl.getError(), "glTexParameteri(this->getGLTargetType(), GL_TEXTURE_SRGB_DECODE_EXT, GL_DECODE_EXT)");
511 case SRGBDECODE_DECODE_DEFAULT:
513 // do not use srgb decode options. Set to default
517 DE_FATAL("Error: Decoding option not recognised");
520 gl.bindTexture(this->getGLTargetType(), 0);
522 m_decoding = decoding;
525 void SRGBTestTexture::setHasSampler (const bool hasSampler)
527 m_hasSampler = hasSampler;
530 deUint32 SRGBTestTexture::getHandle (void) const
532 return m_source.getGLTexture();
535 deUint32 SRGBTestTexture::getGLTargetType (void) const
537 switch (m_targetType)
541 return GL_TEXTURE_2D;
545 DE_FATAL("Error: Target type not recognised");
551 SRGBDecode SRGBTestTexture::getDecode (void) const
556 void SRGBTestTexture::upload (void)
561 void SRGBTestTexture::setColor (void)
563 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
565 gl.bindTexture(this->getGLTargetType(), this->getHandle());
567 m_source.getRefTexture().allocLevel(0);
569 for (int py = 0; py < m_height; py++)
571 for (int px = 0; px < m_width; px++)
573 m_source.getRefTexture().getLevel(0).setPixel(m_color, px, py);
577 gl.bindTexture(this->getGLTargetType(), 0);
580 class SRGBTestProgram
583 SRGBTestProgram (Context& context, const FragmentShaderParameters& shaderParameters);
584 ~SRGBTestProgram (void);
586 void setBlendRequired (bool blendRequired);
587 void setToggleRequired (bool toggleRequired);
588 void setUniformToggle (int location, bool toggleDecodeValue);
590 const std::vector<UniformData>& getUniformDataList (void) const;
591 int getUniformLocation (const std::string& name);
592 deUint32 getHandle (void) const;
593 bool getBlendRequired (void) const;
596 std::string genFunctionCall (ShaderSamplingType samplingType, const int uniformIdx);
597 void genFragmentShader (void);
600 de::MovePtr<glu::ShaderProgram> m_program;
601 FragmentShaderParameters m_shaderFragmentParameters;
602 std::string m_shaderVertex;
603 std::string m_shaderFragment;
604 std::vector<UniformData> m_uniformDataList;
605 bool m_blendRequired;
606 bool m_toggleRequired;
609 SRGBTestProgram::SRGBTestProgram (Context& context, const FragmentShaderParameters& shaderParameters)
610 : m_context (context)
611 , m_shaderFragmentParameters (shaderParameters)
612 , m_blendRequired (false)
613 , m_toggleRequired (false)
615 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
616 tcu::TestLog& log = m_context.getTestContext().getLog();
617 glu::ShaderProgramInfo buildInfo;
618 const int totalShaderStages = 2;
620 // default vertex shader used in all tests
621 m_shaderVertex = "#version 310 es \n"
622 "layout (location = 0) in mediump vec3 aPosition; \n"
623 "layout (location = 1) in mediump vec2 aTexCoord; \n"
624 "out mediump vec2 vs_aTexCoord; \n"
627 " gl_Position = vec4(aPosition, 1.0); \n"
628 " vs_aTexCoord = aTexCoord; \n"
631 this->genFragmentShader();
633 m_program = de::MovePtr<glu::ShaderProgram>(new glu::ShaderProgram(m_context.getRenderContext(), glu::makeVtxFragSources(m_shaderVertex, m_shaderFragment)));
635 if (!m_program->isOk())
637 TCU_FAIL("Failed to compile shaders and link program");
640 glw::GLint activeUniforms, maxLen;
641 glw::GLint size, location;
644 gl.getProgramiv(this->getHandle(), GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxLen);
645 gl.getProgramiv(this->getHandle(), GL_ACTIVE_UNIFORMS, &activeUniforms);
647 std::vector<glw::GLchar> uniformName(static_cast<int>(maxLen));
648 for (int idx = 0; idx < activeUniforms; idx++)
650 gl.getActiveUniform(this->getHandle(), idx, maxLen, NULL, &size, &type, &uniformName[0]);
651 location = gl.getUniformLocation(this->getHandle(), &uniformName[0]);
653 UniformData uniformData(location, std::string(&uniformName[0], strlen(&uniformName[0])));
654 m_uniformDataList.push_back(uniformData);
657 // log shader program info. Only vertex and fragment shaders included
658 buildInfo.program = m_program->getProgramInfo();
659 for (int shaderIdx = 0; shaderIdx < totalShaderStages; shaderIdx++)
661 glu::ShaderInfo shaderInfo = m_program->getShaderInfo(static_cast<glu::ShaderType>(static_cast<int>(glu::SHADERTYPE_VERTEX) + static_cast<int>(shaderIdx)), 0);
662 buildInfo.shaders.push_back(shaderInfo);
668 SRGBTestProgram::~SRGBTestProgram (void)
670 m_program = de::MovePtr<glu::ShaderProgram>(DE_NULL);
673 void SRGBTestProgram::setBlendRequired (bool blendRequired)
675 m_blendRequired = blendRequired;
678 void SRGBTestProgram::setToggleRequired (bool toggleRequired)
680 m_toggleRequired = toggleRequired;
683 void SRGBTestProgram::setUniformToggle (int location, bool toggleDecodeValue)
685 if ( (m_uniformDataList.empty() == false) && (location >= 0) && (location <= (int)m_uniformDataList.size()) )
687 m_uniformDataList[location].toggleDecode = toggleDecodeValue;
691 TCU_THROW(TestError, "Error: Uniform location not found. glGetActiveUniforms returned uniforms incorrectly ");
695 const std::vector<UniformData>& SRGBTestProgram::getUniformDataList (void) const
697 return m_uniformDataList;
700 int SRGBTestProgram::getUniformLocation (const std::string& name)
702 for (std::size_t idx = 0; idx < m_uniformDataList.size(); idx++)
704 if (m_uniformDataList[idx].name == name)
706 return m_uniformDataList[idx].location;
710 TCU_THROW(TestError, "Error: If name correctly requested then glGetActiveUniforms() returned active uniform data incorrectly");
714 glw::GLuint SRGBTestProgram::getHandle (void) const
716 return m_program->getProgram();
719 bool SRGBTestProgram::getBlendRequired (void) const
721 return m_blendRequired;
724 std::string SRGBTestProgram::genFunctionCall (ShaderSamplingType samplingType, const int uniformIdx)
726 std::ostringstream functionCall;
728 functionCall << " mediump vec4 texelColor" << uniformIdx << " = ";
730 switch (samplingType)
732 case TEXTURESAMPLING_TEXTURE:
734 functionCall << "texture(uTexture" << uniformIdx << ", vs_aTexCoord); \n";
737 case TEXTURESAMPLING_TEXTURE_LOD:
739 functionCall << "textureLod(uTexture" << uniformIdx << ", vs_aTexCoord, 0.0); \n";
742 case TEXTURESAMPLING_TEXTURE_GRAD:
744 functionCall << "textureGrad(uTexture" << uniformIdx << ", vs_aTexCoord, vec2(0.0, 0.0), vec2(0.0, 0.0)); \n";
747 case TEXTURESAMPLING_TEXTURE_OFFSET:
749 functionCall << "textureOffset(uTexture" << uniformIdx << ", vs_aTexCoord, ivec2(0.0, 0.0)); \n";
752 case TEXTURESAMPLING_TEXTURE_PROJ:
754 functionCall << "textureProj(uTexture" << uniformIdx << ", vec3(vs_aTexCoord, 1.0)); \n";
757 case TEXTURESAMPLING_TEXELFETCH:
759 functionCall << "texelFetch(uTexture" << uniformIdx << ", ivec2(vs_aTexCoord), 0); \n";
762 case TEXTURESAMPLING_TEXELFETCH_OFFSET:
764 functionCall << "texelFetchOffset(uTexture" << uniformIdx << ", ivec2(vs_aTexCoord), 0, ivec2(0.0, 0.0)); \n";
769 DE_FATAL("Error: Sampling type not recognised");
773 return functionCall.str();
776 void SRGBTestProgram::genFragmentShader (void)
778 std::ostringstream source;
779 std::ostringstream sampleTexture;
780 std::ostringstream functionParameters;
781 std::ostringstream shaderOutputs;
783 // if comparison function is present resulting shader requires precisely one output
784 DE_ASSERT( !(m_shaderFragmentParameters.hasFunction && (static_cast<int>(m_shaderFragmentParameters.outputTotal) != static_cast<int>(SHADEROUTPUTS_ONE))) );
786 // function parameters must equal the number of uniforms i.e. textures passed into the function
787 DE_ASSERT( !(m_shaderFragmentParameters.hasFunction && (static_cast<int>(m_shaderFragmentParameters.uniformTotal) != static_cast<int>(m_shaderFragmentParameters.functionParameters))) );
789 // fragment shader cannot contain more outputs than the number of texture uniforms
790 DE_ASSERT( !(static_cast<int>(m_shaderFragmentParameters.outputTotal) > static_cast<int>(m_shaderFragmentParameters.uniformTotal)) ) ;
792 source << "#version 310 es \n"
793 << "in mediump vec2 vs_aTexCoord; \n";
795 for (int output = 0; output < m_shaderFragmentParameters.outputTotal; output++)
797 source << "layout (location = " << output << ") out mediump vec4 fs_aColor" << output << "; \n";
800 for (int uniform = 0; uniform < m_shaderFragmentParameters.uniformTotal; uniform++)
802 source << "uniform sampler2D uTexture" << uniform << "; \n";
805 if (m_shaderFragmentParameters.hasFunction == true)
807 source << m_shaderFragmentParameters.functionImplementation;
810 source << "void main () \n"
813 for (int uniformIdx = 0; uniformIdx < m_shaderFragmentParameters.uniformTotal; uniformIdx++)
815 source << this->genFunctionCall(m_shaderFragmentParameters.samplingType, uniformIdx);
818 if (m_shaderFragmentParameters.hasFunction == true)
820 switch ( static_cast<FunctionParameters>(m_shaderFragmentParameters.functionParameters) )
822 case FUNCTIONPARAMETERS_ONE:
824 functionParameters << "(texelColor0)";
827 case FUNCTIONPARAMETERS_TWO:
829 functionParameters << "(texelColor0, texelColor1)";
834 DE_FATAL("Error: Number of comparison function parameters invalid");
838 shaderOutputs << " fs_aColor0 = " << m_shaderFragmentParameters.functionName << functionParameters.str() << "; \n";
842 for (int output = 0; output < m_shaderFragmentParameters.outputTotal; output++)
844 shaderOutputs << " fs_aColor" << output << " = texelColor" << output << "; \n";
848 source << shaderOutputs.str();
851 m_shaderFragment = source.str();
854 class SRGBTestCase : public TestCase
857 SRGBTestCase (Context& context, const char* name, const char* description, const tcu::TextureFormat internalFormat);
858 ~SRGBTestCase (void);
862 virtual IterateResult iterate (void);
864 void setSamplingGroup (const ShaderSamplingGroup samplingGroup);
865 void setSamplingLocations (const int px, const int py);
866 void setUniformToggle (const int programIdx, const std::string& uniformName, bool toggleDecode);
868 void addTexture (const glu::TextureTestUtil::TextureType targetType,
871 const tcu::Vec4 color,
872 const tcu::Sampler::WrapMode wrapS,
873 const tcu::Sampler::WrapMode wrapT,
874 const tcu::Sampler::FilterMode minFilter,
875 const tcu::Sampler::FilterMode magFilter,
876 const SRGBDecode decoding);
877 void addSampler (const tcu::Sampler::WrapMode wrapS,
878 const tcu::Sampler::WrapMode wrapT,
879 const tcu::Sampler::FilterMode minFilter,
880 const tcu::Sampler::FilterMode magFilter,
881 const SRGBDecode decoding);
882 void addShaderProgram (const FragmentShaderParameters& shaderParameters);
884 void genShaderPrograms (ShaderSamplingType samplingType);
885 void deleteShaderPrograms (void);
887 void readResultTextures (void);
888 void storeResultPixels (std::vector<tcu::Vec4>& resultPixelData);
890 void toggleDecode (const std::vector<UniformData>& uniformDataList);
891 void bindSamplerToTexture (const int samplerIdx, const int textureIdx, const deUint32 textureUnit);
892 void activateSampler (const int samplerIdx, const bool active);
893 void logColor (const std::string& colorLogMessage, int colorIdx, tcu::Vec4 color) const;
894 tcu::Vec4 formatReferenceColor (tcu::Vec4 referenceColor);
896 // render function has a default implentation. Can be overriden for special cases
897 virtual void render (void);
899 // following functions must be overidden to perform individual test cases
900 virtual void setupTest (void) = 0;
901 virtual bool verifyResult (void) = 0;
904 de::MovePtr<glu::Framebuffer> m_framebuffer;
905 std::vector<SRGBTestTexture*> m_textureSourceList;
906 std::vector<SRGBTestSampler*> m_samplerList;
907 std::vector<glw::GLuint> m_renderBufferList;
908 const tcu::Vec4 m_epsilonError;
909 std::vector<tcu::TextureLevel> m_textureResultList;
910 int m_resultOutputTotal;
911 tcu::TextureFormat m_resultTextureFormat;
913 glw::GLuint m_vertexDataID;
914 std::vector<FragmentShaderParameters> m_shaderParametersList;
915 std::vector<SRGBTestProgram*> m_shaderProgramList;
916 ShaderSamplingGroup m_samplingGroup;
919 const tcu::TextureFormat m_internalFormat;
922 void uploadTextures (void);
923 void initFrameBuffer (void);
924 void initVertexData (void);
926 SRGBTestCase (const SRGBTestCase&);
927 SRGBTestCase& operator= (const SRGBTestCase&);
930 SRGBTestCase::SRGBTestCase (Context& context, const char* name, const char* description, const tcu::TextureFormat internalFormat)
931 : TestCase (context, name, description)
932 , m_epsilonError (EpsilonError::CPU)
933 , m_resultTextureFormat (tcu::TextureFormat(tcu::TextureFormat::sRGBA, tcu::TextureFormat::UNORM_INT8))
936 , m_samplingGroup (SHADERSAMPLINGGROUP_TEXTURE)
937 , m_internalFormat (internalFormat)
941 SRGBTestCase::~SRGBTestCase (void)
946 void SRGBTestCase::init (void)
948 // extension requirements for test
949 if ( (glu::getInternalFormat(m_internalFormat) == GL_SRGB8_ALPHA8) && !m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_sRGB_decode") )
951 throw tcu::NotSupportedError("Test requires GL_EXT_texture_sRGB_decode extension");
954 if ( (glu::getInternalFormat(m_internalFormat) == GL_SR8_EXT) && !(m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_sRGB_R8")) )
956 throw tcu::NotSupportedError("Test requires GL_EXT_texture_sRGB_R8 extension");
959 m_framebuffer = de::MovePtr<glu::Framebuffer>(new glu::Framebuffer(m_context.getRenderContext()));
962 void SRGBTestCase::deinit (void)
964 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
966 m_framebuffer = de::MovePtr<glu::Framebuffer>(DE_NULL);
968 for (std::size_t renderBufferIdx = 0; renderBufferIdx < m_renderBufferList.size(); renderBufferIdx++)
970 gl.deleteRenderbuffers(1, &m_renderBufferList[renderBufferIdx]);
972 m_renderBufferList.clear();
974 for (std::size_t textureSourceIdx = 0; textureSourceIdx < m_textureSourceList.size(); textureSourceIdx++)
976 delete m_textureSourceList[textureSourceIdx];
978 m_textureSourceList.clear();
980 for (std::size_t samplerIdx = 0; samplerIdx < m_samplerList.size(); samplerIdx++)
982 delete m_samplerList[samplerIdx];
984 m_samplerList.clear();
988 gl.deleteVertexArrays(1, &m_vaoID);
992 if (m_vertexDataID != 0)
994 gl.deleteBuffers(1, &m_vertexDataID);
999 SRGBTestCase::IterateResult SRGBTestCase::iterate (void)
1007 if (m_samplingGroup == SHADERSAMPLINGGROUP_TEXTURE)
1009 startIdx = static_cast<int>(TEXTURESAMPLING_TEXTURE_START);
1010 endIdx = static_cast<int>(TEXTURESAMPLING_TEXTURE_END);
1012 else if (m_samplingGroup == SHADERSAMPLINGGROUP_TEXEL_FETCH)
1014 startIdx = static_cast<int>(TEXTURESAMPLING_TEXELFETCH_START);
1015 endIdx = static_cast<int>(TEXTURESAMPLING_TEXELFETCH_END);
1019 DE_FATAL("Error: Sampling group not defined");
1022 this->initVertexData();
1023 this->initFrameBuffer();
1025 // loop through all sampling types in the required sampling group, performing individual tests for each
1026 for (int samplingTypeIdx = startIdx; samplingTypeIdx < endIdx; samplingTypeIdx++)
1028 this->genShaderPrograms(static_cast<ShaderSamplingType>(samplingTypeIdx));
1029 this->uploadTextures();
1032 result = this->verifyResult();
1034 this->deleteShaderPrograms();
1038 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1042 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Result verification failed");
1050 void SRGBTestCase::setSamplingGroup (const ShaderSamplingGroup samplingGroup)
1052 m_samplingGroup = samplingGroup;
1055 void SRGBTestCase::setSamplingLocations (const int px, const int py)
1061 void SRGBTestCase::addTexture ( const glu::TextureTestUtil::TextureType targetType,
1064 const tcu::Vec4 color,
1065 const tcu::Sampler::WrapMode wrapS,
1066 const tcu::Sampler::WrapMode wrapT,
1067 const tcu::Sampler::FilterMode minFilter,
1068 const tcu::Sampler::FilterMode magFilter,
1069 const SRGBDecode decoding)
1071 SRGBTestTexture* texture = new SRGBTestTexture(m_context, targetType, m_internalFormat, width, height, color, wrapS, wrapT, minFilter, magFilter, decoding);
1072 m_textureSourceList.push_back(texture);
1075 void SRGBTestCase::addSampler ( const tcu::Sampler::WrapMode wrapS,
1076 const tcu::Sampler::WrapMode wrapT,
1077 const tcu::Sampler::FilterMode minFilter,
1078 const tcu::Sampler::FilterMode magFilter,
1079 const SRGBDecode decoding)
1081 SRGBTestSampler *sampler = new SRGBTestSampler(m_context, wrapS, wrapT, minFilter, magFilter, decoding);
1082 m_samplerList.push_back(sampler);
1085 void SRGBTestCase::addShaderProgram (const FragmentShaderParameters& shaderParameters)
1087 m_shaderParametersList.push_back(shaderParameters);
1088 m_resultOutputTotal = shaderParameters.outputTotal;
1091 void SRGBTestCase::genShaderPrograms (ShaderSamplingType samplingType)
1093 for (int shaderParamsIdx = 0; shaderParamsIdx < (int)m_shaderParametersList.size(); shaderParamsIdx++)
1095 m_shaderParametersList[shaderParamsIdx].samplingType = samplingType;
1096 SRGBTestProgram* shaderProgram = new SRGBTestProgram(m_context, m_shaderParametersList[shaderParamsIdx]);
1098 if (m_shaderParametersList[shaderParamsIdx].blendRequired == BLENDING_REQUIRED)
1100 shaderProgram->setBlendRequired(true);
1103 if (m_shaderParametersList[shaderParamsIdx].toggleRequired == TOGGLING_REQUIRED)
1105 shaderProgram->setToggleRequired(true);
1106 std::vector<std::string> uniformsToToggle = m_shaderParametersList[shaderParamsIdx].uniformsToToggle;
1108 for (int uniformNameIdx = 0; uniformNameIdx < (int)uniformsToToggle.size(); uniformNameIdx++)
1110 shaderProgram->setUniformToggle(shaderProgram->getUniformLocation(uniformsToToggle[uniformNameIdx]), true);
1114 m_shaderProgramList.push_back(shaderProgram);
1118 void SRGBTestCase::deleteShaderPrograms (void)
1120 for (std::size_t idx = 0; idx < m_shaderProgramList.size(); idx++)
1122 delete m_shaderProgramList[idx];
1124 m_shaderProgramList.clear();
1127 void SRGBTestCase::readResultTextures (void)
1129 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
1130 int width = m_context.getRenderContext().getRenderTarget().getWidth();
1131 int height = m_context.getRenderContext().getRenderTarget().getHeight();
1133 gl.bindFramebuffer(GL_FRAMEBUFFER, **m_framebuffer);
1135 m_textureResultList.resize(m_renderBufferList.size());
1137 for (std::size_t renderBufferIdx = 0; renderBufferIdx < m_renderBufferList.size(); renderBufferIdx++)
1139 gl.readBuffer(GL_COLOR_ATTACHMENT0 + (glw::GLenum)renderBufferIdx);
1140 m_textureResultList[renderBufferIdx].setStorage(m_resultTextureFormat, width, height);
1141 glu::readPixels(m_context.getRenderContext(), 0, 0, m_textureResultList[renderBufferIdx].getAccess());
1142 GLU_EXPECT_NO_ERROR(gl.getError(), "glReadPixels()");
1145 gl.bindFramebuffer(GL_FRAMEBUFFER, 0);
1148 void SRGBTestCase::storeResultPixels (std::vector<tcu::Vec4>& resultPixelData)
1150 tcu::TestLog& log = m_context.getTestContext().getLog();
1151 std::ostringstream message;
1152 int width = m_context.getRenderContext().getRenderTarget().getWidth();
1153 int height = m_context.getRenderContext().getRenderTarget().getHeight();
1155 // ensure result sampling coordinates are within range of the result color attachment
1156 DE_ASSERT((m_px >= 0) && (m_px < width));
1157 DE_ASSERT((m_py >= 0) && (m_py < height));
1158 DE_UNREF(width && height);
1160 for (int idx = 0; idx < (int)m_textureResultList.size(); idx++)
1162 resultPixelData.push_back(m_textureResultList[idx].getAccess().getPixel(m_px, m_py));
1163 this->logColor(std::string("Result color: "), idx, resultPixelData[idx]);
1166 // log error rate (threshold)
1167 message << m_epsilonError;
1168 log << tcu::TestLog::Message << std::string("Epsilon error: ") << message.str() << tcu::TestLog::EndMessage;
1171 void SRGBTestCase::toggleDecode (const std::vector<UniformData>& uniformDataList)
1173 DE_ASSERT( uniformDataList.size() <= m_textureSourceList.size() );
1175 for (int uniformIdx = 0; uniformIdx < (int)uniformDataList.size(); uniformIdx++)
1177 if (uniformDataList[uniformIdx].toggleDecode == true)
1179 if (m_textureSourceList[uniformIdx]->getDecode() == SRGBDECODE_DECODE_DEFAULT)
1181 // cannot toggle default
1185 // toggle sRGB decode values (ignoring value if set to default)
1186 m_textureSourceList[uniformIdx]->setDecode((SRGBDecode)((m_textureSourceList[uniformIdx]->getDecode() + 1) % SRGBDECODE_DECODE_DEFAULT));
1191 void SRGBTestCase::bindSamplerToTexture (const int samplerIdx, const int textureIdx, const deUint32 textureUnit)
1193 deUint32 enumConversion = textureUnit - GL_TEXTURE0;
1194 m_textureSourceList[textureIdx]->setHasSampler(true);
1195 m_samplerList[samplerIdx]->setTextureUnit(enumConversion);
1198 void SRGBTestCase::activateSampler (const int samplerIdx, const bool active)
1200 m_samplerList[samplerIdx]->setIsActive(active);
1203 void SRGBTestCase::logColor (const std::string& colorLogMessage, int colorIdx, tcu::Vec4 color) const
1205 tcu::TestLog& log = m_context.getTestContext().getLog();
1206 std::ostringstream message;
1208 message << colorLogMessage << colorIdx << " = (" << color.x() << ", " << color.y() << ", " << color.z() << ", " << color.w() << ")";
1209 log << tcu::TestLog::Message << message.str() << tcu::TestLog::EndMessage;
1212 tcu::Vec4 SRGBTestCase::formatReferenceColor (tcu::Vec4 referenceColor)
1214 switch (glu::getInternalFormat(m_internalFormat))
1216 case GL_SRGB8_ALPHA8:
1218 return referenceColor;
1222 // zero unwanted color channels
1223 referenceColor.y() = 0;
1224 referenceColor.z() = 0;
1225 return referenceColor;
1229 DE_FATAL("Error: Internal format not recognised");
1230 return referenceColor;
1235 void SRGBTestCase::render (void)
1237 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
1239 // default rendering only uses one program
1240 gl.bindFramebuffer(GL_FRAMEBUFFER, **m_framebuffer);
1241 gl.bindVertexArray(m_vaoID);
1243 gl.useProgram(m_shaderProgramList[0]->getHandle());
1245 for (int textureSourceIdx = 0; textureSourceIdx < (int)m_textureSourceList.size(); textureSourceIdx++)
1247 gl.activeTexture(GL_TEXTURE0 + (glw::GLenum)textureSourceIdx);
1248 gl.bindTexture(m_textureSourceList[textureSourceIdx]->getGLTargetType(), m_textureSourceList[textureSourceIdx]->getHandle());
1249 glw::GLuint samplerUniformLocationID = gl.getUniformLocation(m_shaderProgramList[0]->getHandle(), (std::string("uTexture") + de::toString(textureSourceIdx)).c_str());
1250 TCU_CHECK(samplerUniformLocationID != (glw::GLuint)-1);
1251 gl.uniform1i(samplerUniformLocationID, (glw::GLenum)textureSourceIdx);
1254 for (int samplerIdx = 0; samplerIdx < (int)m_samplerList.size(); samplerIdx++)
1256 if (m_samplerList[samplerIdx]->getIsActive() == true)
1258 m_samplerList[samplerIdx]->bindToTexture();
1262 gl.drawArrays(GL_TRIANGLES, 0, 6);
1264 for (std::size_t textureSourceIdx = 0; textureSourceIdx < m_textureSourceList.size(); textureSourceIdx++)
1266 gl.bindTexture(m_textureSourceList[textureSourceIdx]->getGLTargetType(), 0);
1268 gl.bindFramebuffer(GL_FRAMEBUFFER, 0);
1269 gl.bindVertexArray(0);
1270 gl.bindBuffer(GL_ARRAY_BUFFER, 0);
1273 void SRGBTestCase::uploadTextures (void)
1275 for (std::size_t idx = 0; idx < m_textureSourceList.size(); idx++)
1277 m_textureSourceList[idx]->upload();
1278 m_textureSourceList[idx]->setParameters();
1282 void SRGBTestCase::initFrameBuffer (void)
1284 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
1285 int width = m_context.getRenderContext().getRenderTarget().getWidth();
1286 int height = m_context.getRenderContext().getRenderTarget().getHeight();
1288 if (m_resultOutputTotal == 0)
1290 throw std::invalid_argument("SRGBTestExecutor must have at least 1 rendered result");
1293 gl.bindFramebuffer(GL_FRAMEBUFFER, **m_framebuffer);
1295 DE_ASSERT(m_renderBufferList.empty());
1296 for (int outputIdx = 0; outputIdx < m_resultOutputTotal; outputIdx++)
1298 glw::GLuint renderBuffer = -1;
1299 m_renderBufferList.push_back(renderBuffer);
1302 for (std::size_t renderBufferIdx = 0; renderBufferIdx < m_renderBufferList.size(); renderBufferIdx++)
1304 gl.genRenderbuffers(1, &m_renderBufferList[renderBufferIdx]);
1305 gl.bindRenderbuffer(GL_RENDERBUFFER, m_renderBufferList[renderBufferIdx]);
1306 gl.renderbufferStorage(GL_RENDERBUFFER, glu::getInternalFormat(m_resultTextureFormat), width, height);
1307 gl.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + (glw::GLenum)renderBufferIdx, GL_RENDERBUFFER, m_renderBufferList[renderBufferIdx]);
1308 GLU_EXPECT_NO_ERROR(gl.getError(), "Create and setup renderbuffer object");
1310 TCU_CHECK(gl.checkFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE);
1312 std::vector<glw::GLenum> renderBufferTargets(m_renderBufferList.size());
1313 for (std::size_t renderBufferIdx = 0; renderBufferIdx < m_renderBufferList.size(); renderBufferIdx++)
1315 renderBufferTargets[renderBufferIdx] = GL_COLOR_ATTACHMENT0 + (glw::GLenum)renderBufferIdx;
1317 gl.drawBuffers((glw::GLsizei)renderBufferTargets.size(), &renderBufferTargets[0]);
1318 GLU_EXPECT_NO_ERROR(gl.getError(), "glDrawBuffer()");
1320 gl.bindFramebuffer(GL_FRAMEBUFFER, 0);
1323 void SRGBTestCase::initVertexData (void)
1325 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
1327 static const glw::GLfloat squareVertexData[] =
1329 // position // texcoord
1330 -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom left corner
1331 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom right corner
1332 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, // Top right corner
1334 -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top left corner
1335 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, // Top right corner
1336 -1.0f, -1.0f, 0.0f, 0.0f, 0.0f // bottom left corner
1339 DE_ASSERT(m_vaoID == 0);
1340 gl.genVertexArrays(1, &m_vaoID);
1341 gl.bindVertexArray(m_vaoID);
1343 gl.genBuffers(1, &m_vertexDataID);
1344 gl.bindBuffer(GL_ARRAY_BUFFER, m_vertexDataID);
1345 gl.bufferData(GL_ARRAY_BUFFER, (glw::GLsizei)sizeof(squareVertexData), squareVertexData, GL_STATIC_DRAW);
1347 gl.vertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * (glw::GLsizei)sizeof(GL_FLOAT), (glw::GLvoid *)0);
1348 gl.enableVertexAttribArray(0);
1349 gl.vertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * (glw::GLsizei)sizeof(GL_FLOAT), (glw::GLvoid *)(3 * sizeof(GL_FLOAT)));
1350 gl.enableVertexAttribArray(1);
1352 gl.bindVertexArray(0);
1353 gl.bindBuffer(GL_ARRAY_BUFFER, 0);
1356 class TextureDecodeSkippedCase : public SRGBTestCase
1359 TextureDecodeSkippedCase (Context& context, const char* name, const char* description, const tcu::TextureFormat internalFormat)
1360 : SRGBTestCase (context, name, description, internalFormat) {}
1362 ~TextureDecodeSkippedCase (void) {}
1364 void setupTest (void);
1365 bool verifyResult (void);
1368 void TextureDecodeSkippedCase::setupTest (void)
1371 // - create and set texture to DECODE_SKIP_EXT
1372 // - store texture on GPU
1373 // - in fragment shader, sample the texture using texture*() and render texel values to a color attachment in the FBO
1374 // - on the host, read back the pixel values into a tcu::TextureLevel
1375 // - analyse the texel values, expecting them in sRGB format i.e. linear space decoding was skipped
1377 FragmentShaderParameters shaderParameters(SHADEROUTPUTS_ONE, SHADERUNIFORMS_ONE, NULL, BLENDING_NOT_REQUIRED, TOGGLING_NOT_REQUIRED);
1379 this->addTexture( TEXTURETYPE_2D,
1380 TestDimensions::WIDTH,
1381 TestDimensions::HEIGHT,
1382 getColorReferenceLinear(),
1383 tcu::Sampler::MIRRORED_REPEAT_GL,
1384 tcu::Sampler::MIRRORED_REPEAT_GL,
1385 tcu::Sampler::LINEAR,
1386 tcu::Sampler::LINEAR,
1387 SRGBDECODE_SKIP_DECODE);
1389 this->addShaderProgram(shaderParameters);
1390 this->setSamplingLocations(TestSamplingPositions::X_POS, TestSamplingPositions::Y_POS);
1392 this->setSamplingGroup(SHADERSAMPLINGGROUP_TEXTURE);
1395 bool TextureDecodeSkippedCase::verifyResult (void)
1397 tcu::TestLog& log = m_context.getTestContext().getLog();
1398 const int resultColorIdx = 0;
1399 std::vector<tcu::Vec4> pixelResultList;
1400 tcu::Vec4 pixelConverted;
1401 tcu::Vec4 pixelReference;
1402 tcu::Vec4 pixelExpected;
1404 this->readResultTextures();
1405 this->storeResultPixels(pixelResultList);
1407 pixelConverted = tcu::sRGBToLinear(pixelResultList[resultColorIdx]);
1408 pixelReference = this->formatReferenceColor(getColorReferenceLinear());
1409 pixelExpected = this->formatReferenceColor(getColorReferenceSRGB());
1411 this->formatReferenceColor(pixelReference);
1412 this->logColor(std::string("Expected color: "), resultColorIdx, pixelExpected);
1414 // result color 0 should be sRGB. Compare with linear reference color
1415 if ( (tcu::boolAll(tcu::lessThan(tcu::abs(pixelConverted - pixelReference), m_epsilonError))) || (tcu::boolAll(tcu::equal(pixelConverted, pixelReference))) )
1417 log << tcu::TestLog::Message << std::string("sRGB as expected") << tcu::TestLog::EndMessage;
1422 log << tcu::TestLog::Message << std::string("not sRGB as expected") << tcu::TestLog::EndMessage;
1427 class TextureDecodeEnabledCase : public SRGBTestCase
1430 TextureDecodeEnabledCase (Context& context, const char* name, const char* description, const tcu::TextureFormat internalFormat)
1431 : SRGBTestCase (context, name, description, internalFormat) {}
1433 ~TextureDecodeEnabledCase (void) {}
1435 void setupTest (void);
1436 bool verifyResult (void);
1439 void TextureDecodeEnabledCase::setupTest (void)
1442 // - create and set texture to DECODE_EXT
1443 // - store texture on GPU
1444 // - in fragment shader, sample the texture using texture*() and render texel values to a color attachment in the FBO
1445 // - on the host, read back the pixel values into a tcu::TextureLevel
1446 // - analyse the texel values, expecting them in lRGB format i.e. linear space decoding was enabled
1448 FragmentShaderParameters shaderParameters(SHADEROUTPUTS_ONE, SHADERUNIFORMS_ONE, NULL, BLENDING_NOT_REQUIRED, TOGGLING_NOT_REQUIRED);
1450 this->addTexture( TEXTURETYPE_2D,
1451 TestDimensions::WIDTH,
1452 TestDimensions::HEIGHT,
1453 getColorReferenceLinear(),
1454 tcu::Sampler::MIRRORED_REPEAT_GL,
1455 tcu::Sampler::MIRRORED_REPEAT_GL,
1456 tcu::Sampler::LINEAR,
1457 tcu::Sampler::LINEAR,
1460 this->addShaderProgram(shaderParameters);
1462 this->setSamplingLocations(TestSamplingPositions::X_POS, TestSamplingPositions::Y_POS);
1464 this->setSamplingGroup(SHADERSAMPLINGGROUP_TEXTURE);
1467 bool TextureDecodeEnabledCase::verifyResult (void)
1469 tcu::TestLog& log = m_context.getTestContext().getLog();
1470 const int resultColorIdx = 0;
1471 std::vector<tcu::Vec4> pixelResultList;
1472 tcu::Vec4 pixelConverted;
1473 tcu::Vec4 pixelReference;
1474 tcu::Vec4 pixelExpected;
1476 this->readResultTextures();
1477 this->storeResultPixels(pixelResultList);
1479 pixelConverted = tcu::linearToSRGB(pixelResultList[resultColorIdx]);
1480 pixelReference = this->formatReferenceColor(getColorReferenceSRGB());
1481 pixelExpected = this->formatReferenceColor(getColorReferenceLinear());
1483 this->logColor(std::string("Expected color: "), resultColorIdx, pixelExpected);
1485 // result color 0 should be SRGB. Compare with sRGB reference color
1486 if ( (tcu::boolAll(tcu::lessThan(tcu::abs(pixelConverted - pixelReference), m_epsilonError))) || (tcu::boolAll(tcu::equal(pixelConverted, pixelReference))) )
1488 log << tcu::TestLog::Message << std::string("linear as expected") << tcu::TestLog::EndMessage;
1493 log << tcu::TestLog::Message << std::string("not linear as expected") << tcu::TestLog::EndMessage;
1498 class TexelFetchDecodeSkippedcase : public SRGBTestCase
1501 TexelFetchDecodeSkippedcase (Context& context, const char* name, const char* description, const tcu::TextureFormat internalFormat)
1502 : SRGBTestCase (context, name, description, internalFormat) {}
1504 ~TexelFetchDecodeSkippedcase (void) {}
1506 void setupTest (void);
1507 bool verifyResult (void);
1510 void TexelFetchDecodeSkippedcase::setupTest (void)
1513 // - create and set texture to DECODE_SKIP_EXT
1514 // - store texture on GPU
1515 // - in fragment shader, sample the texture using texelFetch*() and render texel values to a color attachment in the FBO
1516 // - on the host, read back the pixel values into a tcu::TextureLevel
1517 // - analyse the texel values, expecting them in lRGB format i.e. linear space decoding is always enabled with texelFetch*()
1519 FragmentShaderParameters shaderParameters(SHADEROUTPUTS_ONE, SHADERUNIFORMS_ONE, NULL, BLENDING_NOT_REQUIRED, TOGGLING_NOT_REQUIRED);
1521 this->addTexture( TEXTURETYPE_2D,
1522 TestDimensions::WIDTH,
1523 TestDimensions::HEIGHT,
1524 getColorReferenceLinear(),
1525 tcu::Sampler::MIRRORED_REPEAT_GL,
1526 tcu::Sampler::MIRRORED_REPEAT_GL,
1527 tcu::Sampler::LINEAR,
1528 tcu::Sampler::LINEAR,
1529 SRGBDECODE_SKIP_DECODE);
1531 this->addShaderProgram(shaderParameters);
1533 this->setSamplingLocations(TestSamplingPositions::X_POS, TestSamplingPositions::Y_POS);
1535 this->setSamplingGroup(SHADERSAMPLINGGROUP_TEXEL_FETCH);
1538 bool TexelFetchDecodeSkippedcase::verifyResult (void)
1540 tcu::TestLog& log = m_context.getTestContext().getLog();
1541 const int resultColorIdx = 0;
1542 std::vector<tcu::Vec4> pixelResultList;
1543 tcu::Vec4 pixelReference;
1544 tcu::Vec4 pixelExpected;
1546 this->readResultTextures();
1547 this->storeResultPixels(pixelResultList);
1549 pixelReference = pixelExpected = this->formatReferenceColor(getColorReferenceLinear());
1551 this->logColor(std::string("Expected color: "), resultColorIdx, pixelExpected);
1553 // result color 0 should be linear due to automatic conversion via texelFetch*(). Compare with linear reference color
1554 if ( (tcu::boolAll(tcu::lessThan(tcu::abs(pixelResultList[0] - pixelReference), m_epsilonError))) || (tcu::boolAll(tcu::equal(pixelResultList[0], pixelReference))) )
1556 log << tcu::TestLog::Message << std::string("linear as expected") << tcu::TestLog::EndMessage;
1561 log << tcu::TestLog::Message << std::string("not linear as expected") << tcu::TestLog::EndMessage;
1566 class GPUConversionDecodeEnabledCase : public SRGBTestCase
1569 GPUConversionDecodeEnabledCase (Context& context, const char* name, const char* description, const tcu::TextureFormat internalFormat)
1570 : SRGBTestCase (context, name, description, internalFormat) {}
1572 ~GPUConversionDecodeEnabledCase (void) {}
1574 void setupTest (void);
1575 bool verifyResult (void);
1578 void GPUConversionDecodeEnabledCase::setupTest (void)
1581 // - create and set texture_a to DECODE_SKIP_EXT and texture_b to default
1582 // - store textures on GPU
1583 // - in fragment shader, sample both textures using texture*() and manually perform sRGB to lRGB conversion on texture_b
1584 // - in fragment shader, compare converted texture_b with texture_a
1585 // - render green image for pass or red for fail
1587 ComparisonFunction comparisonFunction("srgbToLinearCheck", FUNCTIONPARAMETERS_TWO, getFunctionDefinitionSRGBToLinearCheck());
1589 FragmentShaderParameters shaderParameters(SHADEROUTPUTS_ONE, SHADERUNIFORMS_TWO, &comparisonFunction, BLENDING_NOT_REQUIRED, TOGGLING_NOT_REQUIRED);
1591 this->addTexture( TEXTURETYPE_2D,
1592 TestDimensions::WIDTH,
1593 TestDimensions::HEIGHT,
1594 getColorReferenceLinear(),
1595 tcu::Sampler::MIRRORED_REPEAT_GL,
1596 tcu::Sampler::MIRRORED_REPEAT_GL,
1597 tcu::Sampler::LINEAR,
1598 tcu::Sampler::LINEAR,
1599 SRGBDECODE_SKIP_DECODE);
1601 this->addTexture( TEXTURETYPE_2D,
1602 TestDimensions::WIDTH,
1603 TestDimensions::HEIGHT,
1604 getColorReferenceLinear(),
1605 tcu::Sampler::MIRRORED_REPEAT_GL,
1606 tcu::Sampler::MIRRORED_REPEAT_GL,
1607 tcu::Sampler::LINEAR,
1608 tcu::Sampler::LINEAR,
1609 SRGBDECODE_DECODE_DEFAULT);
1611 this->addShaderProgram(shaderParameters);
1613 this->setSamplingLocations(TestSamplingPositions::X_POS, TestSamplingPositions::Y_POS);
1615 this->setSamplingGroup(SHADERSAMPLINGGROUP_TEXTURE);
1618 bool GPUConversionDecodeEnabledCase::verifyResult (void)
1620 tcu::TestLog& log = m_context.getTestContext().getLog();
1621 const int resultColorIdx = 0;
1622 std::vector<tcu::Vec4> pixelResultList;
1624 this->readResultTextures();
1625 this->storeResultPixels(pixelResultList);
1626 this->logColor(std::string("Expected color: "), resultColorIdx, getColorGreenPass());
1628 // result color returned from GPU is either green (pass) or fail (red)
1629 if ( tcu::boolAll(tcu::equal(pixelResultList[resultColorIdx], getColorGreenPass())) )
1631 log << tcu::TestLog::Message << std::string("returned pass color from GPU") << tcu::TestLog::EndMessage;
1636 log << tcu::TestLog::Message << std::string("returned fail color from GPU") << tcu::TestLog::EndMessage;
1641 class DecodeToggledCase : public SRGBTestCase
1644 DecodeToggledCase (Context& context, const char* name, const char* description, const tcu::TextureFormat internalFormat)
1645 : SRGBTestCase (context, name, description, internalFormat) {}
1647 ~DecodeToggledCase (void) {}
1650 void setupTest (void);
1651 bool verifyResult (void);
1654 void DecodeToggledCase::render (void)
1656 // override the base SRGBTestCase render function with the purpose of switching between shader programs,
1657 // toggling texture sRGB decode state between draw calls
1658 const glw::Functions& gl = m_context.getRenderContext().getFunctions();
1660 gl.bindFramebuffer(GL_FRAMEBUFFER, **m_framebuffer);
1661 gl.bindVertexArray(m_vaoID);
1663 for (std::size_t programIdx = 0; programIdx < m_shaderProgramList.size(); programIdx++)
1665 gl.useProgram(m_shaderProgramList[programIdx]->getHandle());
1667 this->toggleDecode(m_shaderProgramList[programIdx]->getUniformDataList());
1669 for (int textureSourceIdx = 0; textureSourceIdx < (int)m_textureSourceList.size(); textureSourceIdx++)
1671 gl.activeTexture(GL_TEXTURE0 + (glw::GLenum)textureSourceIdx);
1672 gl.bindTexture(m_textureSourceList[textureSourceIdx]->getGLTargetType(), m_textureSourceList[textureSourceIdx]->getHandle());
1673 glw::GLuint samplerUniformLocationID = gl.getUniformLocation(m_shaderProgramList[programIdx]->getHandle(), (std::string("uTexture") + de::toString(textureSourceIdx)).c_str());
1674 TCU_CHECK(samplerUniformLocationID != (glw::GLuint) - 1);
1675 gl.uniform1i(samplerUniformLocationID, (glw::GLenum)textureSourceIdx);
1678 for (int samplerIdx = 0; samplerIdx < (int)m_samplerList.size(); samplerIdx++)
1680 if (m_samplerList[samplerIdx]->getIsActive() == true)
1682 m_samplerList[samplerIdx]->bindToTexture();
1686 if (m_shaderProgramList[programIdx]->getBlendRequired() == true)
1688 gl.enable(GL_BLEND);
1689 gl.blendEquation(GL_MAX);
1690 gl.blendFunc(GL_ONE, GL_ONE);
1694 gl.disable(GL_BLEND);
1697 gl.drawArrays(GL_TRIANGLES, 0, 6);
1699 // reset sRGB decode state on textures
1700 this->toggleDecode(m_shaderProgramList[programIdx]->getUniformDataList());
1703 for (std::size_t textureSourceIdx = 0; textureSourceIdx < m_textureSourceList.size(); textureSourceIdx++)
1705 gl.bindTexture(m_textureSourceList[textureSourceIdx]->getGLTargetType(), 0);
1707 gl.bindFramebuffer(GL_FRAMEBUFFER, 0);
1708 gl.bindVertexArray(0);
1709 gl.bindBuffer(GL_ARRAY_BUFFER, 0);
1712 void DecodeToggledCase::setupTest (void)
1715 // - create and set texture_a to DECODE_SKIP_EXT and texture_b to DECODE_EXT
1716 // - create and use two seperate shader programs, program_a and program_b, each using different fragment shaders
1717 // - store texture_a and texture_b on GPU
1720 // - in fragment shader, sample both textures using texture*() and manually perform sRGB to lRGB conversion on texture_a
1721 // - in fragment shader, test converted texture_a value with texture_b
1722 // - render green image for pass or red for fail
1723 // - store result in a color attachement 0
1725 // - during rendering, toggle texture_a from DECODE_SKIP_EXT to DECODE_EXT
1728 // - in fragment shader, sample both textures using texture*() and manually perform equality check. Both should be linear
1729 // - blend first pass result with second pass. Anything but a green result equals fail
1731 ComparisonFunction srgbToLinearFunction("srgbToLinearCheck", FUNCTIONPARAMETERS_TWO, getFunctionDefinitionSRGBToLinearCheck());
1732 ComparisonFunction colorsEqualFunction("colorsEqualCheck", FUNCTIONPARAMETERS_TWO, getFunctionDefinitionEqualCheck());
1734 FragmentShaderParameters shaderParametersA(SHADEROUTPUTS_ONE, SHADERUNIFORMS_TWO, &srgbToLinearFunction, BLENDING_NOT_REQUIRED, TOGGLING_NOT_REQUIRED);
1735 FragmentShaderParameters shaderParametersB(SHADEROUTPUTS_ONE, SHADERUNIFORMS_TWO, &colorsEqualFunction, BLENDING_REQUIRED, TOGGLING_REQUIRED);
1737 // need to specify which texture uniform to toggle DECODE_EXT/SKIP_DECODE_EXT
1738 shaderParametersB.uniformsToToggle.push_back("uTexture0");
1740 this->addTexture( TEXTURETYPE_2D,
1741 TestDimensions::WIDTH,
1742 TestDimensions::HEIGHT,
1743 getColorReferenceLinear(),
1744 tcu::Sampler::MIRRORED_REPEAT_GL,
1745 tcu::Sampler::MIRRORED_REPEAT_GL,
1746 tcu::Sampler::LINEAR,
1747 tcu::Sampler::LINEAR,
1748 SRGBDECODE_SKIP_DECODE);
1750 this->addTexture( TEXTURETYPE_2D,
1751 TestDimensions::WIDTH,
1752 TestDimensions::HEIGHT,
1753 getColorReferenceLinear(),
1754 tcu::Sampler::MIRRORED_REPEAT_GL,
1755 tcu::Sampler::MIRRORED_REPEAT_GL,
1756 tcu::Sampler::LINEAR,
1757 tcu::Sampler::LINEAR,
1760 this->addShaderProgram(shaderParametersA);
1761 this->addShaderProgram(shaderParametersB);
1763 this->setSamplingLocations(TestSamplingPositions::X_POS, TestSamplingPositions::Y_POS);
1764 this->setSamplingGroup(SHADERSAMPLINGGROUP_TEXTURE);
1767 bool DecodeToggledCase::verifyResult (void)
1769 tcu::TestLog& log = m_context.getTestContext().getLog();
1770 const int resultColorIdx = 0;
1771 std::vector<tcu::Vec4> pixelResultList;
1773 this->readResultTextures();
1774 this->storeResultPixels(pixelResultList);
1775 this->logColor(std::string("Expected color: "), resultColorIdx, getColorGreenPass());
1777 // result color is either green (pass) or fail (red)
1778 if ( tcu::boolAll(tcu::equal(pixelResultList[resultColorIdx], getColorGreenPass())) )
1780 log << tcu::TestLog::Message << std::string("returned pass color from GPU") << tcu::TestLog::EndMessage;
1785 log << tcu::TestLog::Message << std::string("returned fail color from GPU") << tcu::TestLog::EndMessage;
1790 class DecodeMultipleTexturesCase : public SRGBTestCase
1793 DecodeMultipleTexturesCase (Context& context, const char* name, const char* description, const tcu::TextureFormat internalFormat)
1794 : SRGBTestCase (context, name, description, internalFormat) {}
1796 ~DecodeMultipleTexturesCase (void) {}
1798 void setupTest (void);
1799 bool verifyResult (void);
1802 void DecodeMultipleTexturesCase::setupTest (void)
1805 // - create and set texture_a to DECODE_SKIP_EXT and texture_b to DECODE_EXT
1806 // - upload textures to the GPU and bind to seperate uniform variables
1807 // - sample both textures using texture*()
1808 // - read texel values back to the CPU
1809 // - compare the texel values, both should be different from each other
1811 FragmentShaderParameters shaderParameters(SHADEROUTPUTS_TWO, SHADERUNIFORMS_TWO, NULL, BLENDING_NOT_REQUIRED, TOGGLING_NOT_REQUIRED);
1813 this->addTexture( TEXTURETYPE_2D,
1814 TestDimensions::WIDTH,
1815 TestDimensions::HEIGHT,
1816 getColorReferenceLinear(),
1817 tcu::Sampler::MIRRORED_REPEAT_GL,
1818 tcu::Sampler::MIRRORED_REPEAT_GL,
1819 tcu::Sampler::LINEAR,
1820 tcu::Sampler::LINEAR,
1821 SRGBDECODE_SKIP_DECODE);
1823 this->addTexture( TEXTURETYPE_2D,
1824 TestDimensions::WIDTH,
1825 TestDimensions::HEIGHT,
1826 getColorReferenceLinear(),
1827 tcu::Sampler::MIRRORED_REPEAT_GL,
1828 tcu::Sampler::MIRRORED_REPEAT_GL,
1829 tcu::Sampler::LINEAR,
1830 tcu::Sampler::LINEAR,
1833 this->addShaderProgram(shaderParameters);
1835 this->setSamplingLocations(TestSamplingPositions::X_POS, TestSamplingPositions::Y_POS);
1836 this->setSamplingGroup(SHADERSAMPLINGGROUP_TEXTURE);
1839 bool DecodeMultipleTexturesCase::verifyResult (void)
1841 tcu::TestLog& log = m_context.getTestContext().getLog();
1842 const int resultColorIdx = 0;
1843 std::vector<tcu::Vec4> pixelResultList;
1844 tcu::Vec4 pixelExpected0;
1845 tcu::Vec4 pixelExpected1;
1847 this->readResultTextures();
1848 this->storeResultPixels(pixelResultList);
1850 pixelExpected0 = this->formatReferenceColor(getColorReferenceSRGB());
1851 pixelExpected1 = this->formatReferenceColor(getColorReferenceLinear());
1853 this->logColor(std::string("Expected color: "), resultColorIdx, pixelExpected0);
1854 this->logColor(std::string("Expected color: "), resultColorIdx +1, pixelExpected1);
1856 // check if the two textures have different values i.e. uTexture0 = sRGB and uTexture1 = linear
1857 if ( !(tcu::boolAll(tcu::equal(pixelResultList[resultColorIdx], pixelResultList[resultColorIdx +1]))) )
1859 log << tcu::TestLog::Message << std::string("texel values are different") << tcu::TestLog::EndMessage;
1864 log << tcu::TestLog::Message << std::string("texel values are equal") << tcu::TestLog::EndMessage;
1869 class DecodeSamplerCase : public SRGBTestCase
1872 DecodeSamplerCase (Context& context, const char* name, const char* description, const tcu::TextureFormat internalFormat)
1873 : SRGBTestCase (context, name, description, internalFormat) {}
1875 ~DecodeSamplerCase (void) {}
1877 void setupTest (void);
1878 bool verifyResult (void);
1881 void DecodeSamplerCase::setupTest (void)
1884 // - create and set texture_a to DECODE_SKIP_EXT
1885 // - upload texture to the GPU and bind to sampler
1886 // - sample texture using texture*()
1887 // - read texel values back to the CPU
1888 // - compare the texel values, should be in sampler format (linear)
1890 FragmentShaderParameters shaderParameters(SHADEROUTPUTS_ONE, SHADERUNIFORMS_ONE, NULL, BLENDING_NOT_REQUIRED, TOGGLING_NOT_REQUIRED);
1892 this->addTexture( TEXTURETYPE_2D,
1893 TestDimensions::WIDTH,
1894 TestDimensions::HEIGHT,
1895 getColorReferenceLinear(),
1896 tcu::Sampler::MIRRORED_REPEAT_GL,
1897 tcu::Sampler::MIRRORED_REPEAT_GL,
1898 tcu::Sampler::LINEAR,
1899 tcu::Sampler::LINEAR,
1900 SRGBDECODE_SKIP_DECODE);
1902 this->addSampler( tcu::Sampler::MIRRORED_REPEAT_GL,
1903 tcu::Sampler::MIRRORED_REPEAT_GL,
1904 tcu::Sampler::LINEAR,
1905 tcu::Sampler::LINEAR,
1908 this->addShaderProgram(shaderParameters);
1910 this->bindSamplerToTexture(0, 0, GL_TEXTURE0);
1911 this->activateSampler(0, true);
1913 this->setSamplingLocations(TestSamplingPositions::X_POS, TestSamplingPositions::Y_POS);
1914 this->setSamplingGroup(SHADERSAMPLINGGROUP_TEXTURE);
1917 bool DecodeSamplerCase::verifyResult (void)
1919 tcu::TestLog& log = m_context.getTestContext().getLog();
1920 const int resultColorIdx = 0;
1921 std::vector<tcu::Vec4> pixelResultList;
1922 tcu::Vec4 pixelConverted;
1923 tcu::Vec4 pixelReference;
1924 tcu::Vec4 pixelExpected;
1926 this->readResultTextures();
1927 this->storeResultPixels(pixelResultList);
1929 pixelConverted = tcu::linearToSRGB(pixelResultList[resultColorIdx]);
1930 pixelReference = this->formatReferenceColor(getColorReferenceSRGB());
1931 pixelExpected = this->formatReferenceColor(getColorReferenceLinear());
1933 this->logColor(std::string("Expected color: "), resultColorIdx, pixelExpected);
1935 // texture was rendered using a sampler object with setting DECODE_EXT, therefore, results should be linear
1936 if ( (tcu::boolAll(tcu::lessThan(tcu::abs(pixelConverted - pixelReference), m_epsilonError))) || (tcu::boolAll(tcu::equal(pixelConverted, pixelReference))) )
1938 log << tcu::TestLog::Message << std::string("linear as expected") << tcu::TestLog::EndMessage;
1943 log << tcu::TestLog::Message << std::string("not linear as expected") << tcu::TestLog::EndMessage;
1950 SRGBDecodeTests::SRGBDecodeTests (Context& context)
1951 : TestCaseGroup (context, "skip_decode", "sRGB skip decode tests")
1955 SRGBDecodeTests::~SRGBDecodeTests (void)
1959 void SRGBDecodeTests::init (void)
1961 const TestGroupConfig testGroupConfigList[] =
1963 TestGroupConfig("srgba8", "srgb decode tests using srgba internal format", tcu::TextureFormat(tcu::TextureFormat::sRGBA, tcu::TextureFormat::UNORM_INT8)),
1964 TestGroupConfig("sr8", "srgb decode tests using sr8 internal format", tcu::TextureFormat(tcu::TextureFormat::sR, tcu::TextureFormat::UNORM_INT8))
1967 // create groups for all desired internal formats, adding test cases to each
1968 for (std::size_t idx = 0; idx < DE_LENGTH_OF_ARRAY(testGroupConfigList); idx++)
1970 tcu::TestCaseGroup* const testGroup = new tcu::TestCaseGroup(m_testCtx, testGroupConfigList[idx].name, testGroupConfigList[idx].description);
1971 tcu::TestNode::addChild(testGroup);
1973 testGroup->addChild(new TextureDecodeSkippedCase (m_context, "skipped", "testing for sRGB color values with sRGB texture decoding skipped", testGroupConfigList[idx].internalFormat));
1974 testGroup->addChild(new TextureDecodeEnabledCase (m_context, "enabled", "testing for linear color values with sRGB texture decoding enabled", testGroupConfigList[idx].internalFormat));
1975 testGroup->addChild(new TexelFetchDecodeSkippedcase (m_context, "texel_fetch", "testing for linear color values with sRGB texture decoding skipped", testGroupConfigList[idx].internalFormat));
1976 testGroup->addChild(new GPUConversionDecodeEnabledCase (m_context, "conversion_gpu", "sampling linear values and performing conversion on the gpu", testGroupConfigList[idx].internalFormat));
1977 testGroup->addChild(new DecodeToggledCase (m_context, "toggled", "toggle the sRGB decoding between draw calls", testGroupConfigList[idx].internalFormat));
1978 testGroup->addChild(new DecodeMultipleTexturesCase (m_context, "multiple_textures","upload multiple textures with different sRGB decode values and sample",testGroupConfigList[idx].internalFormat));
1979 testGroup->addChild(new DecodeSamplerCase (m_context, "using_sampler", "testing that sampler object takes priority over texture state", testGroupConfigList[idx].internalFormat));