Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 1 | // |
| 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. |
| 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
| 7 | // ProgramGL.cpp: Implements the class methods for ProgramGL. |
| 8 | |
| 9 | #include "libANGLE/renderer/gl/ProgramGL.h" |
| 10 | |
| 11 | #include "common/debug.h" |
Geoff Lang | 5ed74cf | 2015-04-14 13:57:07 -0400 | [diff] [blame] | 12 | #include "common/utilities.h" |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 13 | #include "libANGLE/renderer/gl/FunctionsGL.h" |
| 14 | #include "libANGLE/renderer/gl/ShaderGL.h" |
| 15 | #include "libANGLE/renderer/gl/StateManagerGL.h" |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 16 | |
| 17 | namespace rx |
| 18 | { |
| 19 | |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 20 | ProgramGL::ProgramGL(const FunctionsGL *functions, StateManagerGL *stateManager) |
| 21 | : ProgramImpl(), |
| 22 | mFunctions(functions), |
| 23 | mStateManager(stateManager), |
| 24 | mProgramID(0) |
| 25 | { |
| 26 | ASSERT(mFunctions); |
| 27 | ASSERT(mStateManager); |
Geoff Lang | 0ca5378 | 2015-05-07 13:49:39 -0400 | [diff] [blame^] | 28 | |
| 29 | mProgramID = mFunctions->createProgram(); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 30 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 31 | |
| 32 | ProgramGL::~ProgramGL() |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 33 | { |
Geoff Lang | 0ca5378 | 2015-05-07 13:49:39 -0400 | [diff] [blame^] | 34 | mFunctions->deleteProgram(mProgramID); |
| 35 | mProgramID = 0; |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 36 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 37 | |
| 38 | bool ProgramGL::usesPointSize() const |
| 39 | { |
| 40 | UNIMPLEMENTED(); |
| 41 | return bool(); |
| 42 | } |
| 43 | |
| 44 | int ProgramGL::getShaderVersion() const |
| 45 | { |
| 46 | UNIMPLEMENTED(); |
| 47 | return int(); |
| 48 | } |
| 49 | |
| 50 | GLenum ProgramGL::getTransformFeedbackBufferMode() const |
| 51 | { |
| 52 | UNIMPLEMENTED(); |
| 53 | return GLenum(); |
| 54 | } |
| 55 | |
| 56 | GLenum ProgramGL::getBinaryFormat() |
| 57 | { |
| 58 | UNIMPLEMENTED(); |
| 59 | return GLenum(); |
| 60 | } |
| 61 | |
| 62 | LinkResult ProgramGL::load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream) |
| 63 | { |
| 64 | UNIMPLEMENTED(); |
| 65 | return LinkResult(false, gl::Error(GL_INVALID_OPERATION)); |
| 66 | } |
| 67 | |
| 68 | gl::Error ProgramGL::save(gl::BinaryOutputStream *stream) |
| 69 | { |
| 70 | UNIMPLEMENTED(); |
| 71 | return gl::Error(GL_INVALID_OPERATION); |
| 72 | } |
| 73 | |
| 74 | LinkResult ProgramGL::link(const gl::Data &data, gl::InfoLog &infoLog, |
| 75 | gl::Shader *fragmentShader, gl::Shader *vertexShader, |
| 76 | const std::vector<std::string> &transformFeedbackVaryings, |
| 77 | GLenum transformFeedbackBufferMode, |
| 78 | int *registers, std::vector<gl::LinkedVarying> *linkedVaryings, |
| 79 | std::map<int, gl::VariableLocation> *outputVariables) |
| 80 | { |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 81 | // Reset the program state, delete the current program if one exists |
| 82 | reset(); |
| 83 | |
| 84 | ShaderGL *vertexShaderGL = GetImplAs<ShaderGL>(vertexShader); |
| 85 | ShaderGL *fragmentShaderGL = GetImplAs<ShaderGL>(fragmentShader); |
| 86 | |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 87 | // Attach the shaders |
| 88 | mFunctions->attachShader(mProgramID, vertexShaderGL->getShaderID()); |
| 89 | mFunctions->attachShader(mProgramID, fragmentShaderGL->getShaderID()); |
| 90 | |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 91 | // Link and verify |
| 92 | mFunctions->linkProgram(mProgramID); |
| 93 | |
Geoff Lang | 0ca5378 | 2015-05-07 13:49:39 -0400 | [diff] [blame^] | 94 | // Detach the shaders |
| 95 | mFunctions->detachShader(mProgramID, vertexShaderGL->getShaderID()); |
| 96 | mFunctions->detachShader(mProgramID, fragmentShaderGL->getShaderID()); |
| 97 | |
| 98 | // Verify the link |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 99 | GLint linkStatus = GL_FALSE; |
| 100 | mFunctions->getProgramiv(mProgramID, GL_LINK_STATUS, &linkStatus); |
| 101 | ASSERT(linkStatus == GL_TRUE); |
| 102 | if (linkStatus == GL_FALSE) |
| 103 | { |
| 104 | // Linking failed, put the error into the info log |
| 105 | GLint infoLogLength = 0; |
| 106 | mFunctions->getProgramiv(mProgramID, GL_INFO_LOG_LENGTH, &infoLogLength); |
| 107 | |
| 108 | std::vector<char> buf(infoLogLength); |
| 109 | mFunctions->getProgramInfoLog(mProgramID, infoLogLength, nullptr, &buf[0]); |
| 110 | |
| 111 | mFunctions->deleteProgram(mProgramID); |
| 112 | mProgramID = 0; |
| 113 | |
Jamie Madill | f611316 | 2015-05-07 11:49:21 -0400 | [diff] [blame] | 114 | infoLog << &buf[0]; |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 115 | TRACE("\n%s", &buf[0]); |
| 116 | |
| 117 | // TODO, return GL_OUT_OF_MEMORY or just fail the link? This is an unexpected case |
| 118 | return LinkResult(false, gl::Error(GL_NO_ERROR)); |
| 119 | } |
| 120 | |
| 121 | // Query the uniform information |
| 122 | // TODO: A lot of this logic should be done at the gl::Program level |
| 123 | GLint activeUniformMaxLength = 0; |
| 124 | mFunctions->getProgramiv(mProgramID, GL_ACTIVE_UNIFORM_MAX_LENGTH, &activeUniformMaxLength); |
| 125 | |
| 126 | std::vector<GLchar> uniformNameBuffer(activeUniformMaxLength); |
| 127 | |
| 128 | GLint uniformCount = 0; |
| 129 | mFunctions->getProgramiv(mProgramID, GL_ACTIVE_UNIFORMS, &uniformCount); |
| 130 | for (GLint i = 0; i < uniformCount; i++) |
| 131 | { |
| 132 | GLsizei uniformNameLength = 0; |
| 133 | GLint uniformSize = 0; |
| 134 | GLenum uniformType = GL_NONE; |
| 135 | mFunctions->getActiveUniform(mProgramID, i, uniformNameBuffer.size(), &uniformNameLength, &uniformSize, &uniformType, &uniformNameBuffer[0]); |
| 136 | |
Geoff Lang | 5ed74cf | 2015-04-14 13:57:07 -0400 | [diff] [blame] | 137 | std::string uniformName = gl::ParseUniformName(std::string(&uniformNameBuffer[0], uniformNameLength), nullptr); |
| 138 | |
| 139 | for (size_t arrayIndex = 0; arrayIndex < static_cast<size_t>(uniformSize); arrayIndex++) |
| 140 | { |
| 141 | std::string locationName = uniformName; |
| 142 | if (uniformSize > 1) |
| 143 | { |
| 144 | locationName += "[" + Str(arrayIndex) + "]"; |
| 145 | } |
| 146 | |
| 147 | GLint location = mFunctions->getUniformLocation(mProgramID, locationName.c_str()); |
| 148 | if (location >= 0) |
| 149 | { |
| 150 | // Make sure the uniform index array is large enough |
| 151 | if (static_cast<size_t>(location) >= mUniformIndex.size()) |
| 152 | { |
| 153 | mUniformIndex.resize(location + 1); |
| 154 | } |
| 155 | |
| 156 | mUniformIndex[location] = gl::VariableLocation(uniformName, arrayIndex, static_cast<unsigned int>(mUniforms.size())); |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | // ANGLE uses 0 to identify an non-array uniform. |
| 161 | unsigned int arraySize = (uniformSize > 1) ? static_cast<unsigned int>(uniformSize) : 0; |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 162 | |
| 163 | // TODO: determine uniform precision |
Geoff Lang | 5ed74cf | 2015-04-14 13:57:07 -0400 | [diff] [blame] | 164 | mUniforms.push_back(new gl::LinkedUniform(uniformType, GL_NONE, uniformName, arraySize, -1, sh::BlockMemberInfo::getDefaultBlockInfo())); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 165 | } |
| 166 | |
| 167 | // Query the attribute information |
| 168 | GLint activeAttributeMaxLength = 0; |
| 169 | mFunctions->getProgramiv(mProgramID, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &activeAttributeMaxLength); |
| 170 | |
| 171 | std::vector<GLchar> attributeNameBuffer(activeAttributeMaxLength); |
| 172 | |
| 173 | GLint attributeCount = 0; |
| 174 | mFunctions->getProgramiv(mProgramID, GL_ACTIVE_ATTRIBUTES, &attributeCount); |
| 175 | for (GLint i = 0; i < attributeCount; i++) |
| 176 | { |
| 177 | GLsizei attributeNameLength = 0; |
| 178 | GLint attributeSize = 0; |
| 179 | GLenum attributeType = GL_NONE; |
| 180 | mFunctions->getActiveAttrib(mProgramID, i, attributeNameBuffer.size(), &attributeNameLength, &attributeSize, &attributeType, &attributeNameBuffer[0]); |
| 181 | |
| 182 | std::string attributeName(&attributeNameBuffer[0], attributeNameLength); |
| 183 | |
Geoff Lang | 0ca5378 | 2015-05-07 13:49:39 -0400 | [diff] [blame^] | 184 | GLint location = mFunctions->getAttribLocation(mProgramID, attributeName.c_str()); |
| 185 | |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 186 | // TODO: determine attribute precision |
Geoff Lang | 0ca5378 | 2015-05-07 13:49:39 -0400 | [diff] [blame^] | 187 | setShaderAttribute(static_cast<size_t>(i), attributeType, GL_NONE, attributeName, attributeSize, location); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 188 | } |
| 189 | |
| 190 | return LinkResult(true, gl::Error(GL_NO_ERROR)); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 191 | } |
| 192 | |
Geoff Lang | 0ca5378 | 2015-05-07 13:49:39 -0400 | [diff] [blame^] | 193 | void ProgramGL::bindAttributeLocation(GLuint index, const std::string &name) |
| 194 | { |
| 195 | mFunctions->bindAttribLocation(mProgramID, index, name.c_str()); |
| 196 | } |
| 197 | |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 198 | void ProgramGL::setUniform1fv(GLint location, GLsizei count, const GLfloat *v) |
| 199 | { |
Geoff Lang | 63cbace | 2015-02-26 10:03:12 -0500 | [diff] [blame] | 200 | mStateManager->useProgram(mProgramID); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 201 | mFunctions->uniform1fv(location, count, v); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 202 | } |
| 203 | |
| 204 | void ProgramGL::setUniform2fv(GLint location, GLsizei count, const GLfloat *v) |
| 205 | { |
Geoff Lang | 63cbace | 2015-02-26 10:03:12 -0500 | [diff] [blame] | 206 | mStateManager->useProgram(mProgramID); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 207 | mFunctions->uniform2fv(location, count, v); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 208 | } |
| 209 | |
| 210 | void ProgramGL::setUniform3fv(GLint location, GLsizei count, const GLfloat *v) |
| 211 | { |
Geoff Lang | 63cbace | 2015-02-26 10:03:12 -0500 | [diff] [blame] | 212 | mStateManager->useProgram(mProgramID); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 213 | mFunctions->uniform3fv(location, count, v); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 214 | } |
| 215 | |
| 216 | void ProgramGL::setUniform4fv(GLint location, GLsizei count, const GLfloat *v) |
| 217 | { |
Geoff Lang | 63cbace | 2015-02-26 10:03:12 -0500 | [diff] [blame] | 218 | mStateManager->useProgram(mProgramID); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 219 | mFunctions->uniform4fv(location, count, v); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | void ProgramGL::setUniform1iv(GLint location, GLsizei count, const GLint *v) |
| 223 | { |
Geoff Lang | 63cbace | 2015-02-26 10:03:12 -0500 | [diff] [blame] | 224 | mStateManager->useProgram(mProgramID); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 225 | mFunctions->uniform1iv(location, count, v); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 226 | } |
| 227 | |
| 228 | void ProgramGL::setUniform2iv(GLint location, GLsizei count, const GLint *v) |
| 229 | { |
Geoff Lang | 63cbace | 2015-02-26 10:03:12 -0500 | [diff] [blame] | 230 | mStateManager->useProgram(mProgramID); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 231 | mFunctions->uniform2iv(location, count, v); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 232 | } |
| 233 | |
| 234 | void ProgramGL::setUniform3iv(GLint location, GLsizei count, const GLint *v) |
| 235 | { |
Geoff Lang | 63cbace | 2015-02-26 10:03:12 -0500 | [diff] [blame] | 236 | mStateManager->useProgram(mProgramID); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 237 | mFunctions->uniform3iv(location, count, v); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 238 | } |
| 239 | |
| 240 | void ProgramGL::setUniform4iv(GLint location, GLsizei count, const GLint *v) |
| 241 | { |
Geoff Lang | 63cbace | 2015-02-26 10:03:12 -0500 | [diff] [blame] | 242 | mStateManager->useProgram(mProgramID); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 243 | mFunctions->uniform4iv(location, count, v); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | void ProgramGL::setUniform1uiv(GLint location, GLsizei count, const GLuint *v) |
| 247 | { |
Geoff Lang | 63cbace | 2015-02-26 10:03:12 -0500 | [diff] [blame] | 248 | mStateManager->useProgram(mProgramID); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 249 | mFunctions->uniform1uiv(location, count, v); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 250 | } |
| 251 | |
| 252 | void ProgramGL::setUniform2uiv(GLint location, GLsizei count, const GLuint *v) |
| 253 | { |
Geoff Lang | 63cbace | 2015-02-26 10:03:12 -0500 | [diff] [blame] | 254 | mStateManager->useProgram(mProgramID); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 255 | mFunctions->uniform2uiv(location, count, v); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 256 | } |
| 257 | |
| 258 | void ProgramGL::setUniform3uiv(GLint location, GLsizei count, const GLuint *v) |
| 259 | { |
Geoff Lang | 63cbace | 2015-02-26 10:03:12 -0500 | [diff] [blame] | 260 | mStateManager->useProgram(mProgramID); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 261 | mFunctions->uniform3uiv(location, count, v); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | void ProgramGL::setUniform4uiv(GLint location, GLsizei count, const GLuint *v) |
| 265 | { |
Geoff Lang | 63cbace | 2015-02-26 10:03:12 -0500 | [diff] [blame] | 266 | mStateManager->useProgram(mProgramID); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 267 | mFunctions->uniform4uiv(location, count, v); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 268 | } |
| 269 | |
| 270 | void ProgramGL::setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) |
| 271 | { |
Geoff Lang | 63cbace | 2015-02-26 10:03:12 -0500 | [diff] [blame] | 272 | mStateManager->useProgram(mProgramID); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 273 | mFunctions->uniformMatrix2fv(location, count, transpose, value); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 274 | } |
| 275 | |
| 276 | void ProgramGL::setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) |
| 277 | { |
Geoff Lang | 63cbace | 2015-02-26 10:03:12 -0500 | [diff] [blame] | 278 | mStateManager->useProgram(mProgramID); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 279 | mFunctions->uniformMatrix3fv(location, count, transpose, value); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 280 | } |
| 281 | |
| 282 | void ProgramGL::setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) |
| 283 | { |
Geoff Lang | 63cbace | 2015-02-26 10:03:12 -0500 | [diff] [blame] | 284 | mStateManager->useProgram(mProgramID); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 285 | mFunctions->uniformMatrix4fv(location, count, transpose, value); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 286 | } |
| 287 | |
| 288 | void ProgramGL::setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) |
| 289 | { |
Geoff Lang | 63cbace | 2015-02-26 10:03:12 -0500 | [diff] [blame] | 290 | mStateManager->useProgram(mProgramID); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 291 | mFunctions->uniformMatrix2x3fv(location, count, transpose, value); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 292 | } |
| 293 | |
| 294 | void ProgramGL::setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) |
| 295 | { |
Geoff Lang | 63cbace | 2015-02-26 10:03:12 -0500 | [diff] [blame] | 296 | mStateManager->useProgram(mProgramID); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 297 | mFunctions->uniformMatrix3x2fv(location, count, transpose, value); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 298 | } |
| 299 | |
| 300 | void ProgramGL::setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) |
| 301 | { |
Geoff Lang | 63cbace | 2015-02-26 10:03:12 -0500 | [diff] [blame] | 302 | mStateManager->useProgram(mProgramID); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 303 | mFunctions->uniformMatrix2x4fv(location, count, transpose, value); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 304 | } |
| 305 | |
| 306 | void ProgramGL::setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) |
| 307 | { |
Geoff Lang | 63cbace | 2015-02-26 10:03:12 -0500 | [diff] [blame] | 308 | mStateManager->useProgram(mProgramID); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 309 | mFunctions->uniformMatrix4x2fv(location, count, transpose, value); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 310 | } |
| 311 | |
| 312 | void ProgramGL::setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) |
| 313 | { |
Geoff Lang | 63cbace | 2015-02-26 10:03:12 -0500 | [diff] [blame] | 314 | mStateManager->useProgram(mProgramID); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 315 | mFunctions->uniformMatrix3x4fv(location, count, transpose, value); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 316 | } |
| 317 | |
| 318 | void ProgramGL::setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) |
| 319 | { |
Geoff Lang | 63cbace | 2015-02-26 10:03:12 -0500 | [diff] [blame] | 320 | mStateManager->useProgram(mProgramID); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 321 | mFunctions->uniformMatrix4x3fv(location, count, transpose, value); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 322 | } |
| 323 | |
| 324 | void ProgramGL::getUniformfv(GLint location, GLfloat *params) |
| 325 | { |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 326 | mFunctions->getUniformfv(mProgramID, location, params); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 327 | } |
| 328 | |
| 329 | void ProgramGL::getUniformiv(GLint location, GLint *params) |
| 330 | { |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 331 | mFunctions->getUniformiv(mProgramID, location, params); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 332 | } |
| 333 | |
| 334 | void ProgramGL::getUniformuiv(GLint location, GLuint *params) |
| 335 | { |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 336 | mFunctions->getUniformuiv(mProgramID, location, params); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 337 | } |
| 338 | |
| 339 | GLint ProgramGL::getSamplerMapping(gl::SamplerType type, unsigned int samplerIndex, const gl::Caps &caps) const |
| 340 | { |
| 341 | UNIMPLEMENTED(); |
| 342 | return GLint(); |
| 343 | } |
| 344 | |
| 345 | GLenum ProgramGL::getSamplerTextureType(gl::SamplerType type, unsigned int samplerIndex) const |
| 346 | { |
| 347 | UNIMPLEMENTED(); |
| 348 | return GLenum(); |
| 349 | } |
| 350 | |
| 351 | GLint ProgramGL::getUsedSamplerRange(gl::SamplerType type) const |
| 352 | { |
| 353 | UNIMPLEMENTED(); |
| 354 | return GLint(); |
| 355 | } |
| 356 | |
| 357 | void ProgramGL::updateSamplerMapping() |
| 358 | { |
| 359 | UNIMPLEMENTED(); |
| 360 | } |
| 361 | |
| 362 | bool ProgramGL::validateSamplers(gl::InfoLog *infoLog, const gl::Caps &caps) |
| 363 | { |
Geoff Lang | 35d315c | 2015-03-31 12:48:54 -0400 | [diff] [blame] | 364 | //UNIMPLEMENTED(); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 365 | return true; |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 366 | } |
| 367 | |
| 368 | LinkResult ProgramGL::compileProgramExecutables(gl::InfoLog &infoLog, gl::Shader *fragmentShader, gl::Shader *vertexShader, |
| 369 | int registers) |
| 370 | { |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 371 | //UNIMPLEMENTED(); |
| 372 | return LinkResult(true, gl::Error(GL_NO_ERROR)); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 373 | } |
| 374 | |
| 375 | bool ProgramGL::linkUniforms(gl::InfoLog &infoLog, const gl::Shader &vertexShader, const gl::Shader &fragmentShader, |
| 376 | const gl::Caps &caps) |
| 377 | { |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 378 | //UNIMPLEMENTED(); |
| 379 | return true; |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 380 | } |
| 381 | |
| 382 | bool ProgramGL::defineUniformBlock(gl::InfoLog &infoLog, const gl::Shader &shader, const sh::InterfaceBlock &interfaceBlock, |
| 383 | const gl::Caps &caps) |
| 384 | { |
| 385 | UNIMPLEMENTED(); |
| 386 | return bool(); |
| 387 | } |
| 388 | |
| 389 | gl::Error ProgramGL::applyUniforms() |
| 390 | { |
| 391 | UNIMPLEMENTED(); |
| 392 | return gl::Error(GL_INVALID_OPERATION); |
| 393 | } |
| 394 | |
Gregoire Payen de La Garanderie | 68694e9 | 2015-03-24 14:03:37 +0000 | [diff] [blame] | 395 | gl::Error ProgramGL::applyUniformBuffers(const gl::Data &data, GLuint uniformBlockBindings[]) |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 396 | { |
| 397 | UNIMPLEMENTED(); |
| 398 | return gl::Error(GL_INVALID_OPERATION); |
| 399 | } |
| 400 | |
| 401 | bool ProgramGL::assignUniformBlockRegister(gl::InfoLog &infoLog, gl::UniformBlock *uniformBlock, GLenum shader, |
| 402 | unsigned int registerIndex, const gl::Caps &caps) |
| 403 | { |
| 404 | UNIMPLEMENTED(); |
| 405 | return bool(); |
| 406 | } |
| 407 | |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 408 | void ProgramGL::reset() |
| 409 | { |
| 410 | ProgramImpl::reset(); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 411 | } |
| 412 | |
| 413 | GLuint ProgramGL::getProgramID() const |
| 414 | { |
| 415 | return mProgramID; |
| 416 | } |
| 417 | |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 418 | } |