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 67 { 68 return m_shaderType; 69 } getVersion(void) const70 glu::GLSLVersion getVersion(void) const 71 { 72 return m_version; 73 } 74 bool isValid(void) const; 75 getDefaultBlock(void)76 DefaultBlock &getDefaultBlock(void) 77 { 78 return m_defaultBlock; 79 } getDefaultBlock(void) const80 const DefaultBlock &getDefaultBlock(void) const 81 { 82 return m_defaultBlock; 83 } 84 85 private: 86 Shader(glu::ShaderType type, glu::GLSLVersion version); 87 ~Shader(void); 88 89 Shader(const Shader &); 90 Shader &operator=(const Shader &); 91 92 const glu::ShaderType m_shaderType; 93 const glu::GLSLVersion m_version; 94 DefaultBlock m_defaultBlock; 95 96 friend class Program; 97 }; 98 99 class Program 100 { 101 public: 102 Program(void); 103 ~Program(void); 104 105 Shader *addShader(glu::ShaderType type, glu::GLSLVersion version); 106 107 void setSeparable(bool separable); 108 bool isSeparable(void) const; 109 110 const std::vector<Shader *> &getShaders(void) const; 111 glu::ShaderType getFirstStage(void) const; 112 glu::ShaderType getLastStage(void) const; 113 bool hasStage(glu::ShaderType stage) const; 114 115 void addTransformFeedbackVarying(const std::string &varName); 116 const std::vector<std::string> &getTransformFeedbackVaryings(void) const; 117 void setTransformFeedbackMode(uint32_t mode); 118 uint32_t getTransformFeedbackMode(void) const; 119 120 uint32_t getGeometryNumOutputVertices(void) const; 121 void setGeometryNumOutputVertices(uint32_t); 122 uint32_t getTessellationNumOutputPatchVertices(void) const; 123 void setTessellationNumOutputPatchVertices(uint32_t); 124 125 bool isValid(void) const; 126 127 private: 128 Program &operator=(const Program &); 129 Program(const Program &); 130 131 bool m_separable; 132 std::vector<Shader *> m_shaders; 133 std::vector<std::string> m_xfbVaryings; 134 uint32_t m_xfbMode; 135 uint32_t m_geoNumOutputVertices; 136 uint32_t m_tessNumOutputVertices; 137 }; 138 139 } // namespace ProgramInterfaceDefinition 140 141 } // namespace Functional 142 } // namespace gles31 143 } // namespace deqp 144 145 #endif // _ES31FPROGRAMINTERFACEDEFINITION_HPP 146