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 102 void addTransformFeedbackVarying (const std::string& varName); 103 const std::vector<std::string>& getTransformFeedbackVaryings (void) const; 104 void setTransformFeedbackMode (deUint32 mode); 105 deUint32 getTransformFeedbackMode (void) const; 106 107 bool isValid (void) const; 108 109 private: 110 Program& operator= (const Program&); 111 Program (const Program&); 112 113 bool m_separable; 114 std::vector<Shader*> m_shaders; 115 std::vector<std::string> m_xfbVaryings; 116 deUint32 m_xfbMode; 117 }; 118 119 } // ProgramInterfaceDefinition 120 121 } // Functional 122 } // gles31 123 } // deqp 124 125 #endif // _ES31FPROGRAMINTERFACEDEFINITION_HPP 126