1 #ifndef _ES31FPROGRAMINTERFACEDEFINITION_HPP 2 #define _ES31FPROGRAMINTERFACEDEFINITION_HPP 3 /*------------------------------------------------------------------------- 4 * drawElements Quality Program OpenGL ES 3.1 Module 5 * ------------------------------------------------- 6 * 7 * Copyright 2014 The Android Open Source Project 8 * 9 * Licensed under the Apache License, Version 2.0 (the "License"); 10 * you may not use this file except in compliance with the License. 11 * You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, software 16 * distributed under the License is distributed on an "AS IS" BASIS, 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 * 21 *//*! 22 * \file 23 * \brief Program interface 24 *//*--------------------------------------------------------------------*/ 25 26 #include "tcuDefs.hpp" 27 #include "tes31TestCase.hpp" 28 #include "gluShaderUtil.hpp" 29 #include "gluVarType.hpp" 30 31 namespace deqp 32 { 33 namespace gles31 34 { 35 namespace Functional 36 { 37 38 enum ProgramInterface 39 { 40 PROGRAMINTERFACE_UNIFORM = 0, 41 PROGRAMINTERFACE_UNIFORM_BLOCK, 42 PROGRAMINTERFACE_ATOMIC_COUNTER_BUFFER, 43 PROGRAMINTERFACE_PROGRAM_INPUT, 44 PROGRAMINTERFACE_PROGRAM_OUTPUT, 45 PROGRAMINTERFACE_TRANSFORM_FEEDBACK_VARYING, 46 PROGRAMINTERFACE_BUFFER_VARIABLE, 47 PROGRAMINTERFACE_SHADER_STORAGE_BLOCK, 48 49 PROGRAMINTERFACE_LAST 50 }; 51 52 namespace ProgramInterfaceDefinition 53 { 54 55 class Program; 56 57 struct DefaultBlock 58 { 59 std::vector<glu::VariableDeclaration> variables; 60 std::vector<glu::InterfaceBlock> interfaceBlocks; 61 }; 62 63 class Shader 64 { 65 public: getType(void) const66 glu::ShaderType getType (void) const { return m_shaderType; } getVersion(void) const67 glu::GLSLVersion getVersion (void) const { return m_version; } 68 bool isValid (void) const; 69 getDefaultBlock(void)70 DefaultBlock& getDefaultBlock (void) { return m_defaultBlock; } getDefaultBlock(void) const71 const DefaultBlock& getDefaultBlock (void) const { return m_defaultBlock; } 72 73 private: 74 Shader (glu::ShaderType type, glu::GLSLVersion version); 75 ~Shader (void); 76 77 Shader (const Shader&); 78 Shader& operator= (const Shader&); 79 80 const glu::ShaderType m_shaderType; 81 const glu::GLSLVersion m_version; 82 DefaultBlock m_defaultBlock; 83 84 friend class Program; 85 }; 86 87 class Program 88 { 89 public: 90 Program (void); 91 ~Program (void); 92 93 Shader* addShader (glu::ShaderType type, glu::GLSLVersion version); 94 95 void setSeparable (bool separable); 96 bool isSeparable (void) const; 97 98 const std::vector<Shader*>& getShaders (void) const; 99 glu::ShaderType getFirstStage (void) const; 100 glu::ShaderType getLastStage (void) const; 101 bool hasStage (glu::ShaderType stage) const; 102 103 void addTransformFeedbackVarying (const std::string& varName); 104 const std::vector<std::string>& getTransformFeedbackVaryings (void) const; 105 void setTransformFeedbackMode (deUint32 mode); 106 deUint32 getTransformFeedbackMode (void) const; 107 108 deUint32 getGeometryNumOutputVertices (void) const; 109 void setGeometryNumOutputVertices (deUint32); 110 deUint32 getTessellationNumOutputPatchVertices (void) const; 111 void setTessellationNumOutputPatchVertices (deUint32); 112 113 bool isValid (void) const; 114 115 private: 116 Program& operator= (const Program&); 117 Program (const Program&); 118 119 bool m_separable; 120 std::vector<Shader*> m_shaders; 121 std::vector<std::string> m_xfbVaryings; 122 deUint32 m_xfbMode; 123 deUint32 m_geoNumOutputVertices; 124 deUint32 m_tessNumOutputVertices; 125 }; 126 127 } // ProgramInterfaceDefinition 128 129 } // Functional 130 } // gles31 131 } // deqp 132 133 #endif // _ES31FPROGRAMINTERFACEDEFINITION_HPP 134