Lines Matching refs:glu

77 const char* getSimpleShaderSource (const glu::ShaderType shaderType)
96 case glu::SHADERTYPE_VERTEX:
98 case glu::SHADERTYPE_FRAGMENT:
107 void setShaderSources (glu::Shader& shader, const ShaderSources& sources)
148 void queryShaderInfo (glu::RenderContext& renderCtx, deUint32 shader, glu::ShaderInfo& info)
188 void drawWithProgram (glu::RenderContext& renderCtx, deUint32 program)
204 glu::VertexArrayBinding vertexArrays[] =
206 glu::va::Float("a_position", 4, 4, 0, &position[0])
208 glu::draw(renderCtx, program, DE_LENGTH_OF_ARRAY(vertexArrays), &vertexArrays[0], glu::pr::Triangles(DE_LENGTH_OF_ARRAY(quadIndices), &quadIndices[0]));
221 virtual std::string next (const glu::ShaderType shaderType) = 0;
222 virtual bool finished (const glu::ShaderType shaderType) const = 0;
231 bool finished (const glu::ShaderType shaderType) const { DE_UNREF(shaderType); return false; }
233 std::string next (const glu::ShaderType shaderType);
239 std::string ConstantShaderGenerator::next (const glu::ShaderType shaderType)
241 DE_ASSERT(shaderType == glu::SHADERTYPE_VERTEX || shaderType == glu::SHADERTYPE_FRAGMENT);
245 const std::string outputName = (shaderType == glu::SHADERTYPE_VERTEX) ? "gl_Position" : "o_fragColor";
251 if (shaderType == glu::SHADERTYPE_FRAGMENT)
267 ShaderAllocator (glu::RenderContext& context, SourceGenerator& generator);
270 bool hasShader (const glu::ShaderType shaderType);
272 void setSource (const glu::ShaderType shaderType);
274 glu::Shader& createShader (const glu::ShaderType shaderType);
275 void deleteShader (const glu::ShaderType shaderType);
277 glu::Shader& get (const glu::ShaderType shaderType) { DE_ASSERT(hasShader(shaderType)); return *m_shaders[shaderType]; }
280 const glu::RenderContext& m_context;
282 std::map<glu::ShaderType, glu::Shader*> m_shaders;
285 ShaderAllocator::ShaderAllocator (glu::RenderContext& context, SourceGenerator& generator)
293 for (std::map<glu::ShaderType, glu::Shader*>::iterator shaderIter = m_shaders.begin(); shaderIter != m_shaders.end(); shaderIter++)
298 bool ShaderAllocator::hasShader (const glu::ShaderType shaderType)
306 glu::Shader& ShaderAllocator::createShader (const glu::ShaderType shaderType)
310 glu::Shader* const shader = new glu::Shader(m_context, shaderType);
318 void ShaderAllocator::deleteShader (const glu::ShaderType shaderType)
326 void ShaderAllocator::setSource (const glu::ShaderType shaderType)
339 void logShader (TestLog& log, glu::RenderContext& renderCtx, glu::Shader& shader)
341 glu::ShaderInfo info;
348 void logProgram (TestLog& log, glu::RenderContext& renderCtx, glu::Program& program, ShaderAllocator& shaders)
352 for (int shaderTypeInt = 0; shaderTypeInt < glu::SHADERTYPE_LAST; shaderTypeInt++)
354 const glu::ShaderType shaderType = (glu::ShaderType)shaderTypeInt;
363 void logVertexFragmentProgram (TestLog& log, glu::RenderContext& renderCtx, glu::Program& program, glu::Shader& vertShader, glu::Shader& fragShader)
365 DE_ASSERT(vertShader.getType() == glu::SHADERTYPE_VERTEX && fragShader.getType() == glu::SHADERTYPE_FRAGMENT);
382 CreateShaderCase (Context& context, const char* name, const char* desc, glu::ShaderType shaderType)
390 const GLuint shaderObject = glCreateShader(glu::getGLShaderType(m_shaderType));
398 const glu::ShaderType m_shaderType;
406 CompileShaderCase (Context& context, const char* name, const char* desc, glu::ShaderType shaderType)
424 const GLuint shaderObject = glCreateShader(glu::getGLShaderType(m_shaderType));
437 const glu::ShaderType m_shaderType;
459 const char* vertSource = getSimpleShaderSource(glu::SHADERTYPE_VERTEX);
460 const char* fragSource = getSimpleShaderSource(glu::SHADERTYPE_FRAGMENT);
584 ShaderSourceReplaceCase (Context& context, const char* name, const char* desc, glu::ShaderType shaderType)
602 if (m_shaderType == glu::SHADERTYPE_FRAGMENT)
609 if (m_shaderType == glu::SHADERTYPE_VERTEX) out << " gl_Position = vec4(variable);\n";
610 else if (m_shaderType == glu::SHADERTYPE_FRAGMENT) out << " o_fragColor = vec4(variable);\n";
617 GLint getSourceLength (glu::Shader& shader)
626 std::string readSource (glu::Shader& shader)
636 void verifyShaderSourceReplaced (glu::Shader& shader, const std::string& firstSource, const std::string& secondSource)
657 glu::Shader shader (m_context.getRenderContext(), m_shaderType);
679 glu::ShaderType m_shaderType;
687 ShaderSourceSplitCase (Context& context, const char* name, const char* desc, glu::ShaderType shaderType, const int numSlices, const deUint32 flags = 0)
695 DE_ASSERT(m_shaderType == glu::SHADERTYPE_VERTEX || m_shaderType == glu::SHADERTYPE_FRAGMENT);
709 if (m_shaderType == glu::SHADERTYPE_FRAGMENT)
716 if (m_shaderType == glu::SHADERTYPE_VERTEX) out << " gl_Position = vec4(variable);\n";
717 else if (m_shaderType == glu::SHADERTYPE_FRAGMENT) out << " o_fragColor = vec4(variable);\n";
759 void buildProgram (glu::Shader& shader)
762 glu::RenderContext& renderCtx = m_context.getRenderContext();
764 const glu::ShaderType supportShaderType = (m_shaderType == glu::SHADERTYPE_FRAGMENT ? glu::SHADERTYPE_VERTEX : glu::SHADERTYPE_FRAGMENT);
766 glu::Shader supportShader (renderCtx, supportShaderType);
768 glu::Program program (renderCtx);
778 if (m_shaderType == glu::SHADERTYPE_VERTEX)
787 glu::RenderContext& renderCtx = m_context.getRenderContext();
790 glu::Shader shader (renderCtx, m_shaderType);
808 const glu::ShaderType m_shaderType;
820 ProgramStateCase (Context& context, const char* name, const char* desc, glu::ShaderType shaderType);
823 void buildProgram (glu::Program& program, ShaderAllocator& shaders);
824 void verify (glu::Program& program, const glu::ProgramInfo& reference);
828 virtual void executeForProgram (glu::Program& program, ShaderAllocator& shaders) = 0;
832 const glu::ShaderType m_shaderType;
835 ProgramStateCase::ProgramStateCase (Context& context, const char* name, const char* desc, glu::ShaderType shaderType)
840 DE_ASSERT(m_shaderType == glu::SHADERTYPE_VERTEX || m_shaderType == glu::SHADERTYPE_FRAGMENT);
843 void ProgramStateCase::buildProgram (glu::Program& program, ShaderAllocator& shaders)
847 glu::Shader& vertShader = shaders.createShader(glu::SHADERTYPE_VERTEX);
848 glu::Shader& fragShader = shaders.createShader(glu::SHADERTYPE_FRAGMENT);
860 void ProgramStateCase::verify (glu::Program& program, const glu::ProgramInfo& reference)
863 const glu::ProgramInfo& programInfo = program.getInfo();
887 glu::RenderContext& renderCtx = m_context.getRenderContext();
892 glu::Program program (renderCtx);
898 glu::ProgramInfo programInfo = program.getInfo();
923 const glu::ShaderType shaderType = (shaderTypeInt == 1) ? glu::SHADERTYPE_FRAGMENT : glu::SHADERTYPE_VERTEX;
940 ProgramStateDetachShaderCase (Context& context, const char* name, const char* desc, glu::ShaderType shaderType)
949 void executeForProgram (glu::Program& program, ShaderAllocator& shaders)
952 glu::Shader& caseShader = shaders.get(m_shaderType);
962 ProgramStateReattachShaderCase (Context& context, const char* name, const char* desc, glu::ShaderType shaderType)
971 void executeForProgram (glu::Program& program, ShaderAllocator& shaders)
974 glu::Shader& caseShader = shaders.get(m_shaderType);
985 ProgramStateDeleteShaderCase (Context& context, const char* name, const char* desc, glu::ShaderType shaderType)
994 void executeForProgram (glu::Program& program, ShaderAllocator& shaders)
997 glu::Shader& caseShader = shaders.get(m_shaderType);
1008 ProgramStateReplaceShaderCase (Context& context, const char* name, const char* desc, glu::ShaderType shaderType)
1017 void executeForProgram (glu::Program& program, ShaderAllocator& shaders)
1020 glu::Shader& caseShader = shaders.get(m_shaderType);
1032 ProgramStateRecompileShaderCase (Context& context, const char* name, const char* desc, glu::ShaderType shaderType)
1041 void executeForProgram (glu::Program& program, ShaderAllocator& shaders)
1044 glu::Shader& caseShader = shaders.get(m_shaderType);
1055 ProgramStateReplaceSourceCase (Context& context, const char* name, const char* desc, glu::ShaderType shaderType)
1064 void executeForProgram (glu::Program& program, ShaderAllocator& shaders)
1067 glu::Shader& caseShader = shaders.get(m_shaderType);
1099 class ProgramBinaryCase : public TestCase, protected glu::CallLogWrapper
1233 const std::string vertSrc = getSimpleShaderSource(glu::SHADERTYPE_VERTEX);
1234 const std::string fragSrc = getSimpleShaderSource(glu::SHADERTYPE_FRAGMENT);
1236 const glu::ProgramSources sources = glu::makeVtxFragSources(vertSrc, fragSrc);
1238 glu::ShaderProgram program (m_context.getRenderContext(), sources);
1265 std::string getShaderSource (const glu::ShaderType shaderType) const
1289 DE_ASSERT(shaderType == glu::SHADERTYPE_VERTEX || shaderType == glu::SHADERTYPE_FRAGMENT);
1291 return (shaderType == glu::SHADERTYPE_VERTEX) ? vertSrc : fragSrc;
1294 void setUniformsRandom (glu::ShaderProgram& program)
1317 void verifyUniformInt (glu::ShaderProgram& program, const std::string& name)
1331 void verifyUniformFloat (glu::ShaderProgram& program, const std::string& name)
1345 void verifyUniformsReset (glu::ShaderProgram& program)
1358 const std::string vertSrc = getShaderSource(glu::SHADERTYPE_VERTEX);
1359 const std::string fragSrc = getShaderSource(glu::SHADERTYPE_FRAGMENT);
1361 const glu::ProgramSources sources = glu::makeVtxFragSources(vertSrc, fragSrc);
1363 glu::ShaderProgram program (m_context.getRenderContext(), sources);
1394 ProgramBinaryPersistenceCase (Context& context, const char* name, const char* desc, glu::ShaderType shaderType);
1397 void buildProgram (glu::Program& program, ShaderAllocator& shaders);
1401 virtual void executeForProgram (glu::Program& program, ShaderAllocator& shaders) = 0;
1402 virtual void verify (glu::Program& program, const ProgramBinary& binary);
1406 const glu::ShaderType m_shaderType;
1409 ProgramBinaryPersistenceCase::ProgramBinaryPersistenceCase (Context& context, const char* name, const char* desc, glu::ShaderType shaderType)
1414 DE_ASSERT(m_shaderType == glu::SHADERTYPE_VERTEX || m_shaderType == glu::SHADERTYPE_FRAGMENT);
1417 void ProgramBinaryPersistenceCase::buildProgram (glu::Program& program, ShaderAllocator& shaders)
1421 glu::Shader& vertShader = shaders.createShader(glu::SHADERTYPE_VERTEX);
1422 glu::Shader& fragShader = shaders.createShader(glu::SHADERTYPE_FRAGMENT);
1434 void ProgramBinaryPersistenceCase::verify (glu::Program& program, const ProgramBinary& binary)
1451 glu::RenderContext& renderCtx = m_context.getRenderContext();
1456 glu::Program program (renderCtx);
1488 const glu::ShaderType shaderType = (shaderTypeInt == 1) ? glu::SHADERTYPE_FRAGMENT : glu::SHADERTYPE_VERTEX;
1505 ProgramBinaryPersistenceDetachShaderCase (Context& context, const char* name, const char* desc, glu::ShaderType shaderType)
1514 void executeForProgram (glu::Program& program, ShaderAllocator& shaders)
1517 glu::Shader& caseShader = shaders.get(m_shaderType);
1527 ProgramBinaryPersistenceReattachShaderCase (Context& context, const char* name, const char* desc, glu::ShaderType shaderType)
1536 void executeForProgram (glu::Program& program, ShaderAllocator& shaders)
1539 glu::Shader& caseShader = shaders.get(m_shaderType);
1550 ProgramBinaryPersistenceDeleteShaderCase (Context& context, const char* name, const char* desc, glu::ShaderType shaderType)
1559 void executeForProgram (glu::Program& program, ShaderAllocator& shaders)
1562 glu::Shader& caseShader = shaders.get(m_shaderType);
1573 ProgramBinaryPersistenceReplaceShaderCase (Context& context, const char* name, const char* desc, glu::ShaderType shaderType)
1582 void executeForProgram (glu::Program& program, ShaderAllocator& shaders)
1585 glu::Shader& caseShader = shaders.get(m_shaderType);
1597 ProgramBinaryPersistenceRecompileShaderCase (Context& context, const char* name, const char* desc, glu::ShaderType shaderType)
1606 void executeForProgram (glu::Program& program, ShaderAllocator& shaders)
1609 glu::Shader& caseShader = shaders.get(m_shaderType);
1620 ProgramBinaryPersistenceReplaceSourceCase (Context& context, const char* name, const char* desc, glu::ShaderType shaderType)
1629 void executeForProgram (glu::Program& program, ShaderAllocator& shaders)
1632 glu::Shader& caseShader = shaders.get(m_shaderType);
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));
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));
1683 const glu::ShaderType shaderType = (shaderTypeInt == 1) ? glu::SHADERTYPE_FRAGMENT : glu::SHADERTYPE_VERTEX;
1697 const glu::ShaderType shaderType = (shaderTypeInt == 1) ? glu::SHADERTYPE_FRAGMENT : glu::SHADERTYPE_VERTEX;
1708 + ((shaderType == glu::SHADERTYPE_FRAGMENT) ? "_fragment" : "_vertex");
1710 const std::string caseDesc = std::string((shaderType == glu::SHADERTYPE_FRAGMENT) ? "Fragment" : "Vertex")