Lines Matching full:shader
21 * \brief Shader API tests.
107 void setShaderSources (glu::Shader& shader, const ShaderSources& sources)
115 shader.setSources((int)cStrings.size(), &cStrings[0], &sources.lengths[0]);
117 shader.setSources((int)cStrings.size(), &cStrings[0], 0);
148 void queryShaderInfo (glu::RenderContext& renderCtx, deUint32 shader, glu::ShaderInfo& info)
163 gl.getShaderiv(shader, GL_COMPILE_STATUS, &compileStatus);
164 gl.getShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &sourceLen);
165 gl.getShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLen);
173 gl.getShaderSource(shader, (int)source.size(), &unusedLen, &source[0]);
180 gl.getShaderInfoLog(shader, (int)infoLog.size(), &unusedLen, &infoLog[0]);
214 // Shader source generator
262 // Shader allocation utility
274 glu::Shader& createShader (const glu::ShaderType shaderType);
277 glu::Shader& get (const glu::ShaderType shaderType) { DE_ASSERT(hasShader(shaderType)); return *m_shaders[shaderType]; }
282 std::map<glu::ShaderType, glu::Shader*> m_shaders;
293 for (std::map<glu::ShaderType, glu::Shader*>::iterator shaderIter = m_shaders.begin(); shaderIter != m_shaders.end(); shaderIter++)
306 glu::Shader& ShaderAllocator::createShader (const glu::ShaderType shaderType)
310 glu::Shader* const shader = new glu::Shader(m_context, shaderType);
312 m_shaders[shaderType] = shader;
315 return *shader;
339 void logShader (TestLog& log, glu::RenderContext& renderCtx, glu::Shader& shader)
343 queryShaderInfo(renderCtx, shader.getShader(), info);
345 log << TestLog::Shader(getLogShaderType(shader.getType()), info.source, info.compileOk, info.infoLog);
363 void logVertexFragmentProgram (TestLog& log, glu::RenderContext& renderCtx, glu::Program& program, glu::Shader& vertShader, glu::Shader& fragShader)
518 bool checkDeleteStatus(GLuint shader)
521 glGetShaderiv(shader, GL_DELETE_STATUS, &deleteStatus);
617 GLint getSourceLength (glu::Shader& shader)
620 glGetShaderiv(shader.getShader(), GL_SHADER_SOURCE_LENGTH, &sourceLength);
626 std::string readSource (glu::Shader& shader)
628 const GLint sourceLength = getSourceLength(shader);
631 glGetShaderSource(shader.getShader(), (GLsizei)sourceBuffer.size(), 0, &sourceBuffer[0]);
636 void verifyShaderSourceReplaced (glu::Shader& shader, const std::string& firstSource, const std::string& secondSource)
639 const std::string result = readSource(shader);
644 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Shader source nor replaced");
648 log << TestLog::Message << "Fail, invalid shader source." << TestLog::EndMessage;
657 glu::Shader shader (m_context.getRenderContext(), m_shaderType);
665 log << TestLog::Message << "Setting shader source." << TestLog::EndMessage;
667 shader.setSources(1, &firstSource, 0);
670 log << TestLog::Message << "Replacing shader source." << TestLog::EndMessage;
672 shader.setSources(1, &secondSource, 0);
675 verifyShaderSourceReplaced(shader, firstSourceStr, secondSourceStr);
759 void buildProgram (glu::Shader& shader)
766 glu::Shader supportShader (renderCtx, supportShaderType);
773 program.attachShader(shader.getShader());
779 logVertexFragmentProgram(log, renderCtx, program, shader, supportShader);
781 logVertexFragmentProgram(log, renderCtx, program, supportShader, shader);
790 glu::Shader shader (renderCtx, m_shaderType);
793 setShaderSources(shader, sources);
794 shader.compile();
796 buildProgram(shader);
798 if (!shader.getCompileStatus())
847 glu::Shader& vertShader = shaders.createShader(glu::SHADERTYPE_VERTEX);
848 glu::Shader& fragShader = shaders.createShader(glu::SHADERTYPE_FRAGMENT);
927 const std::string caseDesc = "Build program, " + desc + ", for " + shaderTypeName + " shader.";
952 glu::Shader& caseShader = shaders.get(m_shaderType);
954 log << TestLog::Message << "Detaching " + std::string(getShaderTypeName(m_shaderType)) + " shader" << TestLog::EndMessage;
974 glu::Shader& caseShader = shaders.get(m_shaderType);
976 log << TestLog::Message << "Reattaching " + std::string(getShaderTypeName(m_shaderType)) + " shader" << TestLog::EndMessage;
997 glu::Shader& caseShader = shaders.get(m_shaderType);
999 log << TestLog::Message << "Deleting " + std::string(getShaderTypeName(m_shaderType)) + " shader" << TestLog::EndMessage;
1020 glu::Shader& caseShader = shaders.get(m_shaderType);
1022 log << TestLog::Message << "Deleting and replacing " + std::string(getShaderTypeName(m_shaderType)) + " shader" << TestLog::EndMessage;
1044 glu::Shader& caseShader = shaders.get(m_shaderType);
1046 log << TestLog::Message << "Recompiling " + std::string(getShaderTypeName(m_shaderType)) + " shader" << TestLog::EndMessage;
1067 glu::Shader& caseShader = shaders.get(m_shaderType);
1069 log << TestLog::Message << "Replacing " + std::string(getShaderTypeName(m_shaderType)) + " shader source and recompiling" << TestLog::EndMessage;
1421 glu::Shader& vertShader = shaders.createShader(glu::SHADERTYPE_VERTEX);
1422 glu::Shader& fragShader = shaders.createShader(glu::SHADERTYPE_FRAGMENT);
1492 const std::string caseDesc = "Build program, " + desc + ", for " + shaderTypeName + " shader.";
1517 glu::Shader& caseShader = shaders.get(m_shaderType);
1519 log << TestLog::Message << "Detaching " + std::string(getShaderTypeName(m_shaderType)) + " shader" << TestLog::EndMessage;
1539 glu::Shader& caseShader = shaders.get(m_shaderType);
1541 log << TestLog::Message << "Reattaching " + std::string(getShaderTypeName(m_shaderType)) + " shader" << TestLog::EndMessage;
1562 glu::Shader& caseShader = shaders.get(m_shaderType);
1564 log << TestLog::Message << "Deleting " + std::string(getShaderTypeName(m_shaderType)) + " shader" << TestLog::EndMessage;
1585 glu::Shader& caseShader = shaders.get(m_shaderType);
1587 log << TestLog::Message << "Deleting and replacing " + std::string(getShaderTypeName(m_shaderType)) + " shader" << TestLog::EndMessage;
1609 glu::Shader& caseShader = shaders.get(m_shaderType);
1611 log << TestLog::Message << "Recompiling " + std::string(getShaderTypeName(m_shaderType)) + " shader" << TestLog::EndMessage;
1632 glu::Shader& caseShader = shaders.get(m_shaderType);
1634 log << TestLog::Message << "Replacing " + std::string(getShaderTypeName(m_shaderType)) + " shader source and recompiling" << TestLog::EndMessage;
1644 : TestCaseGroup(context, "shader_api", "Shader API Cases")
1659 createDeleteGroup->addChild(new CreateShaderCase(m_context, "create_vertex_shader", "Create vertex shader object", glu::SHADERTYPE_VERTEX));
1660 createDeleteGroup->addChild(new CreateShaderCase(m_context, "create_fragment_shader", "Create fragment shader object", glu::SHADERTYPE_FRAGMENT));
1662 createDeleteGroup->addChild(new DeleteShaderCase(m_context, "delete_vertex_fragment", "Delete vertex shader and fragment shader"));
1670 compileLinkGroup->addChild(new CompileShaderCase(m_context, "compile_vertex_shader", "Compile vertex shader", glu::SHADERTYPE_VERTEX));
1671 compileLinkGroup->addChild(new CompileShaderCase(m_context, "compile_fragment_shader", "Compile fragment shader", glu::SHADERTYPE_FRAGMENT));
1676 // shader source
1687 const std::string caseDesc = std::string("Replace source code of ") + shaderTypeName + " shader.";
1711 + " shader source split into "
1726 addProgramStateCase<ProgramStateDetachShaderCase> (linkStatusGroup, m_context, "detach_shader", "detach shader");
1727 addProgramStateCase<ProgramStateReattachShaderCase> (linkStatusGroup, m_context, "reattach_shader", "reattach shader");
1728 addProgramStateCase<ProgramStateDeleteShaderCase> (linkStatusGroup, m_context, "delete_shader", "delete shader");
1729 shader object");
1730 addProgramStateCase<ProgramStateRecompileShaderCase> (linkStatusGroup, m_context, "recompile_shader", "recompile shader");
1731 addProgramStateCase<ProgramStateReplaceSourceCase> (linkStatusGroup, m_context, "replace_source", "replace shader source");
1743 simpleCaseGroup->addChild(new ProgramBinarySimpleCase (m_context, "get_program_binary_vertex_fragment", "Get vertex and fragment shader program binary"));
1751 addProgramBinaryPersistenceCase<ProgramBinaryPersistenceDetachShaderCase> (binaryPersistenceGroup, m_context, "detach_shader", "detach shader");
1752 addProgramBinaryPersistenceCase<ProgramBinaryPersistenceReattachShaderCase> (binaryPersistenceGroup, m_context, "reattach_shader", "reattach shader");
1753 addProgramBinaryPersistenceCase<ProgramBinaryPersistenceDeleteShaderCase> (binaryPersistenceGroup, m_context, "delete_shader", "delete shader");
1754 addProgramBinaryPersistenceCase<ProgramBinaryPersistenceReplaceShaderCase> (binaryPersistenceGroup, m_context, "replace_shader", "replace shader object");
1755 addProgramBinaryPersistenceCase<ProgramBinaryPersistenceRecompileShaderCase> (binaryPersistenceGroup, m_context, "recompile_shader", "recompile shader");
1756 addProgramBinaryPersistenceCase<ProgramBinaryPersistenceReplaceSourceCase> (binaryPersistenceGroup, m_context, "replace_source", "replace shader source");