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 | |
Jamie Madill | a7d12dc | 2016-12-13 15:08:19 -0500 | [diff] [blame] | 11 | #include "common/BitSetIterator.h" |
Sami Väisänen | 46eaa94 | 2016-06-29 10:26:37 +0300 | [diff] [blame] | 12 | #include "common/angleutils.h" |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 13 | #include "common/debug.h" |
Sami Väisänen | 46eaa94 | 2016-06-29 10:26:37 +0300 | [diff] [blame] | 14 | #include "common/string_utils.h" |
Geoff Lang | 5ed74cf | 2015-04-14 13:57:07 -0400 | [diff] [blame] | 15 | #include "common/utilities.h" |
Jamie Madill | a7d12dc | 2016-12-13 15:08:19 -0500 | [diff] [blame] | 16 | #include "libANGLE/renderer/gl/ContextGL.h" |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 17 | #include "libANGLE/renderer/gl/FunctionsGL.h" |
| 18 | #include "libANGLE/renderer/gl/ShaderGL.h" |
| 19 | #include "libANGLE/renderer/gl/StateManagerGL.h" |
Philippe Hamel | 4091119 | 2016-04-07 16:45:50 -0400 | [diff] [blame] | 20 | #include "libANGLE/renderer/gl/WorkaroundsGL.h" |
Jamie Madill | 53ea9cc | 2016-05-17 10:12:52 -0400 | [diff] [blame] | 21 | #include "libANGLE/Uniform.h" |
unknown | b4a3af2 | 2015-11-25 15:02:51 -0500 | [diff] [blame] | 22 | #include "platform/Platform.h" |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 23 | |
| 24 | namespace rx |
| 25 | { |
| 26 | |
Jamie Madill | 48ef11b | 2016-04-27 15:21:52 -0400 | [diff] [blame] | 27 | ProgramGL::ProgramGL(const gl::ProgramState &data, |
Jamie Madill | 5c6b7bf | 2015-08-17 12:53:35 -0400 | [diff] [blame] | 28 | const FunctionsGL *functions, |
Philippe Hamel | 4091119 | 2016-04-07 16:45:50 -0400 | [diff] [blame] | 29 | const WorkaroundsGL &workarounds, |
Sami Väisänen | 46eaa94 | 2016-06-29 10:26:37 +0300 | [diff] [blame] | 30 | StateManagerGL *stateManager, |
| 31 | bool enablePathRendering) |
Philippe Hamel | 4091119 | 2016-04-07 16:45:50 -0400 | [diff] [blame] | 32 | : ProgramImpl(data), |
| 33 | mFunctions(functions), |
| 34 | mWorkarounds(workarounds), |
| 35 | mStateManager(stateManager), |
Sami Väisänen | 46eaa94 | 2016-06-29 10:26:37 +0300 | [diff] [blame] | 36 | mEnablePathRendering(enablePathRendering), |
Philippe Hamel | 4091119 | 2016-04-07 16:45:50 -0400 | [diff] [blame] | 37 | mProgramID(0) |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 38 | { |
| 39 | ASSERT(mFunctions); |
| 40 | ASSERT(mStateManager); |
Geoff Lang | 0ca5378 | 2015-05-07 13:49:39 -0400 | [diff] [blame] | 41 | |
| 42 | mProgramID = mFunctions->createProgram(); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 43 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 44 | |
| 45 | ProgramGL::~ProgramGL() |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 46 | { |
Geoff Lang | 0ca5378 | 2015-05-07 13:49:39 -0400 | [diff] [blame] | 47 | mFunctions->deleteProgram(mProgramID); |
| 48 | mProgramID = 0; |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 49 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 50 | |
Jamie Madill | a7d12dc | 2016-12-13 15:08:19 -0500 | [diff] [blame] | 51 | LinkResult ProgramGL::load(const ContextImpl *contextImpl, |
| 52 | gl::InfoLog &infoLog, |
| 53 | gl::BinaryInputStream *stream) |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 54 | { |
Geoff Lang | 65a0be9 | 2015-10-02 09:57:30 -0400 | [diff] [blame] | 55 | preLink(); |
| 56 | |
| 57 | // Read the binary format, size and blob |
| 58 | GLenum binaryFormat = stream->readInt<GLenum>(); |
| 59 | GLint binaryLength = stream->readInt<GLint>(); |
| 60 | const uint8_t *binary = stream->data() + stream->offset(); |
| 61 | stream->skip(binaryLength); |
| 62 | |
| 63 | // Load the binary |
| 64 | mFunctions->programBinary(mProgramID, binaryFormat, binary, binaryLength); |
| 65 | |
| 66 | // Verify that the program linked |
| 67 | if (!checkLinkStatus(infoLog)) |
| 68 | { |
Jamie Madill | b0a838b | 2016-11-13 20:02:12 -0500 | [diff] [blame] | 69 | return false; |
Geoff Lang | 65a0be9 | 2015-10-02 09:57:30 -0400 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | postLink(); |
| 73 | |
Jamie Madill | a7d12dc | 2016-12-13 15:08:19 -0500 | [diff] [blame] | 74 | // Re-apply UBO bindings to work around driver bugs. |
| 75 | const WorkaroundsGL &workaroundsGL = GetAs<ContextGL>(contextImpl)->getWorkaroundsGL(); |
| 76 | if (workaroundsGL.reapplyUBOBindingsAfterLoadingBinaryProgram) |
| 77 | { |
| 78 | for (GLuint bindingIndex : angle::IterateBitSet(mState.getActiveUniformBlockBindingsMask())) |
| 79 | { |
| 80 | setUniformBlockBinding(bindingIndex, mState.getUniformBlockBinding(bindingIndex)); |
| 81 | } |
| 82 | } |
| 83 | |
Jamie Madill | b0a838b | 2016-11-13 20:02:12 -0500 | [diff] [blame] | 84 | return true; |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | gl::Error ProgramGL::save(gl::BinaryOutputStream *stream) |
| 88 | { |
Geoff Lang | 65a0be9 | 2015-10-02 09:57:30 -0400 | [diff] [blame] | 89 | GLint binaryLength = 0; |
| 90 | mFunctions->getProgramiv(mProgramID, GL_PROGRAM_BINARY_LENGTH, &binaryLength); |
| 91 | |
| 92 | std::vector<uint8_t> binary(binaryLength); |
| 93 | GLenum binaryFormat = GL_NONE; |
| 94 | mFunctions->getProgramBinary(mProgramID, binaryLength, &binaryLength, &binaryFormat, |
| 95 | &binary[0]); |
| 96 | |
| 97 | stream->writeInt(binaryFormat); |
| 98 | stream->writeInt(binaryLength); |
| 99 | stream->writeBytes(&binary[0], binaryLength); |
| 100 | |
He Yunchao | acd1898 | 2017-01-04 10:46:42 +0800 | [diff] [blame] | 101 | return gl::NoError(); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 102 | } |
| 103 | |
Geoff Lang | c562975 | 2015-12-07 16:29:04 -0500 | [diff] [blame] | 104 | void ProgramGL::setBinaryRetrievableHint(bool retrievable) |
| 105 | { |
Geoff Lang | 65a0be9 | 2015-10-02 09:57:30 -0400 | [diff] [blame] | 106 | // glProgramParameteri isn't always available on ES backends. |
| 107 | if (mFunctions->programParameteri) |
| 108 | { |
| 109 | mFunctions->programParameteri(mProgramID, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, |
| 110 | retrievable ? GL_TRUE : GL_FALSE); |
| 111 | } |
Geoff Lang | c562975 | 2015-12-07 16:29:04 -0500 | [diff] [blame] | 112 | } |
| 113 | |
Yunchao He | 61afff1 | 2017-03-14 15:34:03 +0800 | [diff] [blame^] | 114 | void ProgramGL::setSeparable(bool separable) |
| 115 | { |
| 116 | mFunctions->programParameteri(mProgramID, GL_PROGRAM_SEPARABLE, separable ? GL_TRUE : GL_FALSE); |
| 117 | } |
| 118 | |
Jamie Madill | 8ecf7f9 | 2017-01-13 17:29:52 -0500 | [diff] [blame] | 119 | LinkResult ProgramGL::link(ContextImpl *contextImpl, |
Jamie Madill | 192745a | 2016-12-22 15:58:21 -0500 | [diff] [blame] | 120 | const gl::VaryingPacking &packing, |
| 121 | gl::InfoLog &infoLog) |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 122 | { |
Geoff Lang | 65a0be9 | 2015-10-02 09:57:30 -0400 | [diff] [blame] | 123 | preLink(); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 124 | |
Martin Radev | 4c4c8e7 | 2016-08-04 12:25:34 +0300 | [diff] [blame] | 125 | if (mState.getAttachedComputeShader()) |
Geoff Lang | 1a68346 | 2015-09-29 15:09:59 -0400 | [diff] [blame] | 126 | { |
Martin Radev | 4c4c8e7 | 2016-08-04 12:25:34 +0300 | [diff] [blame] | 127 | const ShaderGL *computeShaderGL = GetImplAs<ShaderGL>(mState.getAttachedComputeShader()); |
Geoff Lang | 1a68346 | 2015-09-29 15:09:59 -0400 | [diff] [blame] | 128 | |
Martin Radev | 4c4c8e7 | 2016-08-04 12:25:34 +0300 | [diff] [blame] | 129 | mFunctions->attachShader(mProgramID, computeShaderGL->getShaderID()); |
| 130 | |
| 131 | // Link and verify |
| 132 | mFunctions->linkProgram(mProgramID); |
| 133 | |
| 134 | // Detach the shaders |
| 135 | mFunctions->detachShader(mProgramID, computeShaderGL->getShaderID()); |
Geoff Lang | 1a68346 | 2015-09-29 15:09:59 -0400 | [diff] [blame] | 136 | } |
| 137 | else |
| 138 | { |
Martin Radev | 4c4c8e7 | 2016-08-04 12:25:34 +0300 | [diff] [blame] | 139 | // Set the transform feedback state |
| 140 | std::vector<const GLchar *> transformFeedbackVaryings; |
| 141 | for (const auto &tfVarying : mState.getTransformFeedbackVaryingNames()) |
Geoff Lang | 1528e56 | 2015-08-24 15:10:58 -0400 | [diff] [blame] | 142 | { |
Martin Radev | 4c4c8e7 | 2016-08-04 12:25:34 +0300 | [diff] [blame] | 143 | transformFeedbackVaryings.push_back(tfVarying.c_str()); |
Geoff Lang | 1528e56 | 2015-08-24 15:10:58 -0400 | [diff] [blame] | 144 | } |
| 145 | |
Martin Radev | 4c4c8e7 | 2016-08-04 12:25:34 +0300 | [diff] [blame] | 146 | if (transformFeedbackVaryings.empty()) |
| 147 | { |
| 148 | if (mFunctions->transformFeedbackVaryings) |
| 149 | { |
| 150 | mFunctions->transformFeedbackVaryings(mProgramID, 0, nullptr, |
| 151 | mState.getTransformFeedbackBufferMode()); |
| 152 | } |
| 153 | } |
| 154 | else |
| 155 | { |
| 156 | ASSERT(mFunctions->transformFeedbackVaryings); |
| 157 | mFunctions->transformFeedbackVaryings( |
| 158 | mProgramID, static_cast<GLsizei>(transformFeedbackVaryings.size()), |
| 159 | &transformFeedbackVaryings[0], mState.getTransformFeedbackBufferMode()); |
| 160 | } |
| 161 | |
| 162 | const ShaderGL *vertexShaderGL = GetImplAs<ShaderGL>(mState.getAttachedVertexShader()); |
| 163 | const ShaderGL *fragmentShaderGL = GetImplAs<ShaderGL>(mState.getAttachedFragmentShader()); |
| 164 | |
| 165 | // Attach the shaders |
| 166 | mFunctions->attachShader(mProgramID, vertexShaderGL->getShaderID()); |
| 167 | mFunctions->attachShader(mProgramID, fragmentShaderGL->getShaderID()); |
| 168 | |
| 169 | // Bind attribute locations to match the GL layer. |
| 170 | for (const sh::Attribute &attribute : mState.getAttributes()) |
| 171 | { |
Corentin Wallez | 6c1cbf5 | 2016-11-23 12:44:35 -0500 | [diff] [blame] | 172 | if (!attribute.staticUse || attribute.isBuiltIn()) |
Martin Radev | 4c4c8e7 | 2016-08-04 12:25:34 +0300 | [diff] [blame] | 173 | { |
| 174 | continue; |
| 175 | } |
| 176 | |
| 177 | mFunctions->bindAttribLocation(mProgramID, attribute.location, attribute.name.c_str()); |
| 178 | } |
| 179 | |
| 180 | // Link and verify |
| 181 | mFunctions->linkProgram(mProgramID); |
| 182 | |
| 183 | // Detach the shaders |
| 184 | mFunctions->detachShader(mProgramID, vertexShaderGL->getShaderID()); |
| 185 | mFunctions->detachShader(mProgramID, fragmentShaderGL->getShaderID()); |
Geoff Lang | 1528e56 | 2015-08-24 15:10:58 -0400 | [diff] [blame] | 186 | } |
| 187 | |
Geoff Lang | 0ca5378 | 2015-05-07 13:49:39 -0400 | [diff] [blame] | 188 | // Verify the link |
Geoff Lang | 65a0be9 | 2015-10-02 09:57:30 -0400 | [diff] [blame] | 189 | if (!checkLinkStatus(infoLog)) |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 190 | { |
Jamie Madill | b0a838b | 2016-11-13 20:02:12 -0500 | [diff] [blame] | 191 | return false; |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 192 | } |
| 193 | |
Philippe Hamel | 4091119 | 2016-04-07 16:45:50 -0400 | [diff] [blame] | 194 | if (mWorkarounds.alwaysCallUseProgramAfterLink) |
| 195 | { |
| 196 | mStateManager->forceUseProgram(mProgramID); |
| 197 | } |
| 198 | |
Geoff Lang | 65a0be9 | 2015-10-02 09:57:30 -0400 | [diff] [blame] | 199 | postLink(); |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 200 | |
Jamie Madill | b0a838b | 2016-11-13 20:02:12 -0500 | [diff] [blame] | 201 | return true; |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 202 | } |
| 203 | |
Jamie Madill | 36cfd6a | 2015-08-18 10:46:20 -0400 | [diff] [blame] | 204 | GLboolean ProgramGL::validate(const gl::Caps & /*caps*/, gl::InfoLog * /*infoLog*/) |
| 205 | { |
| 206 | // TODO(jmadill): implement validate |
| 207 | return true; |
| 208 | } |
| 209 | |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 210 | void ProgramGL::setUniform1fv(GLint location, GLsizei count, const GLfloat *v) |
| 211 | { |
Jiajia Qin | ee9f08c | 2016-11-16 10:06:10 +0800 | [diff] [blame] | 212 | if (mFunctions->programUniform1fv != nullptr) |
| 213 | { |
| 214 | mFunctions->programUniform1fv(mProgramID, uniLoc(location), count, v); |
| 215 | } |
| 216 | else |
| 217 | { |
| 218 | mStateManager->useProgram(mProgramID); |
| 219 | mFunctions->uniform1fv(uniLoc(location), count, v); |
| 220 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 221 | } |
| 222 | |
| 223 | void ProgramGL::setUniform2fv(GLint location, GLsizei count, const GLfloat *v) |
| 224 | { |
Jiajia Qin | ee9f08c | 2016-11-16 10:06:10 +0800 | [diff] [blame] | 225 | if (mFunctions->programUniform2fv != nullptr) |
| 226 | { |
| 227 | mFunctions->programUniform2fv(mProgramID, uniLoc(location), count, v); |
| 228 | } |
| 229 | else |
| 230 | { |
| 231 | mStateManager->useProgram(mProgramID); |
| 232 | mFunctions->uniform2fv(uniLoc(location), count, v); |
| 233 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 234 | } |
| 235 | |
| 236 | void ProgramGL::setUniform3fv(GLint location, GLsizei count, const GLfloat *v) |
| 237 | { |
Jiajia Qin | ee9f08c | 2016-11-16 10:06:10 +0800 | [diff] [blame] | 238 | if (mFunctions->programUniform3fv != nullptr) |
| 239 | { |
| 240 | mFunctions->programUniform3fv(mProgramID, uniLoc(location), count, v); |
| 241 | } |
| 242 | else |
| 243 | { |
| 244 | mStateManager->useProgram(mProgramID); |
| 245 | mFunctions->uniform3fv(uniLoc(location), count, v); |
| 246 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 247 | } |
| 248 | |
| 249 | void ProgramGL::setUniform4fv(GLint location, GLsizei count, const GLfloat *v) |
| 250 | { |
Jiajia Qin | ee9f08c | 2016-11-16 10:06:10 +0800 | [diff] [blame] | 251 | if (mFunctions->programUniform4fv != nullptr) |
| 252 | { |
| 253 | mFunctions->programUniform4fv(mProgramID, uniLoc(location), count, v); |
| 254 | } |
| 255 | else |
| 256 | { |
| 257 | mStateManager->useProgram(mProgramID); |
| 258 | mFunctions->uniform4fv(uniLoc(location), count, v); |
| 259 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 260 | } |
| 261 | |
| 262 | void ProgramGL::setUniform1iv(GLint location, GLsizei count, const GLint *v) |
| 263 | { |
Jiajia Qin | ee9f08c | 2016-11-16 10:06:10 +0800 | [diff] [blame] | 264 | if (mFunctions->programUniform1iv != nullptr) |
| 265 | { |
| 266 | mFunctions->programUniform1iv(mProgramID, uniLoc(location), count, v); |
| 267 | } |
| 268 | else |
| 269 | { |
| 270 | mStateManager->useProgram(mProgramID); |
| 271 | mFunctions->uniform1iv(uniLoc(location), count, v); |
| 272 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 273 | } |
| 274 | |
| 275 | void ProgramGL::setUniform2iv(GLint location, GLsizei count, const GLint *v) |
| 276 | { |
Jiajia Qin | ee9f08c | 2016-11-16 10:06:10 +0800 | [diff] [blame] | 277 | if (mFunctions->programUniform2iv != nullptr) |
| 278 | { |
| 279 | mFunctions->programUniform2iv(mProgramID, uniLoc(location), count, v); |
| 280 | } |
| 281 | else |
| 282 | { |
| 283 | mStateManager->useProgram(mProgramID); |
| 284 | mFunctions->uniform2iv(uniLoc(location), count, v); |
| 285 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 286 | } |
| 287 | |
| 288 | void ProgramGL::setUniform3iv(GLint location, GLsizei count, const GLint *v) |
| 289 | { |
Jiajia Qin | ee9f08c | 2016-11-16 10:06:10 +0800 | [diff] [blame] | 290 | if (mFunctions->programUniform3iv != nullptr) |
| 291 | { |
| 292 | mFunctions->programUniform3iv(mProgramID, uniLoc(location), count, v); |
| 293 | } |
| 294 | else |
| 295 | { |
| 296 | mStateManager->useProgram(mProgramID); |
| 297 | mFunctions->uniform3iv(uniLoc(location), count, v); |
| 298 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 299 | } |
| 300 | |
| 301 | void ProgramGL::setUniform4iv(GLint location, GLsizei count, const GLint *v) |
| 302 | { |
Jiajia Qin | ee9f08c | 2016-11-16 10:06:10 +0800 | [diff] [blame] | 303 | if (mFunctions->programUniform4iv != nullptr) |
| 304 | { |
| 305 | mFunctions->programUniform4iv(mProgramID, uniLoc(location), count, v); |
| 306 | } |
| 307 | else |
| 308 | { |
| 309 | mStateManager->useProgram(mProgramID); |
| 310 | mFunctions->uniform4iv(uniLoc(location), count, v); |
| 311 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 312 | } |
| 313 | |
| 314 | void ProgramGL::setUniform1uiv(GLint location, GLsizei count, const GLuint *v) |
| 315 | { |
Jiajia Qin | ee9f08c | 2016-11-16 10:06:10 +0800 | [diff] [blame] | 316 | if (mFunctions->programUniform1uiv != nullptr) |
| 317 | { |
| 318 | mFunctions->programUniform1uiv(mProgramID, uniLoc(location), count, v); |
| 319 | } |
| 320 | else |
| 321 | { |
| 322 | mStateManager->useProgram(mProgramID); |
| 323 | mFunctions->uniform1uiv(uniLoc(location), count, v); |
| 324 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 325 | } |
| 326 | |
| 327 | void ProgramGL::setUniform2uiv(GLint location, GLsizei count, const GLuint *v) |
| 328 | { |
Jiajia Qin | ee9f08c | 2016-11-16 10:06:10 +0800 | [diff] [blame] | 329 | if (mFunctions->programUniform2uiv != nullptr) |
| 330 | { |
| 331 | mFunctions->programUniform2uiv(mProgramID, uniLoc(location), count, v); |
| 332 | } |
| 333 | else |
| 334 | { |
| 335 | mStateManager->useProgram(mProgramID); |
| 336 | mFunctions->uniform2uiv(uniLoc(location), count, v); |
| 337 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 338 | } |
| 339 | |
| 340 | void ProgramGL::setUniform3uiv(GLint location, GLsizei count, const GLuint *v) |
| 341 | { |
Jiajia Qin | ee9f08c | 2016-11-16 10:06:10 +0800 | [diff] [blame] | 342 | if (mFunctions->programUniform3uiv != nullptr) |
| 343 | { |
| 344 | mFunctions->programUniform3uiv(mProgramID, uniLoc(location), count, v); |
| 345 | } |
| 346 | else |
| 347 | { |
| 348 | mStateManager->useProgram(mProgramID); |
| 349 | mFunctions->uniform3uiv(uniLoc(location), count, v); |
| 350 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 351 | } |
| 352 | |
| 353 | void ProgramGL::setUniform4uiv(GLint location, GLsizei count, const GLuint *v) |
| 354 | { |
Jiajia Qin | ee9f08c | 2016-11-16 10:06:10 +0800 | [diff] [blame] | 355 | if (mFunctions->programUniform4uiv != nullptr) |
| 356 | { |
| 357 | mFunctions->programUniform4uiv(mProgramID, uniLoc(location), count, v); |
| 358 | } |
| 359 | else |
| 360 | { |
| 361 | mStateManager->useProgram(mProgramID); |
| 362 | mFunctions->uniform4uiv(uniLoc(location), count, v); |
| 363 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 364 | } |
| 365 | |
| 366 | void ProgramGL::setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) |
| 367 | { |
Jiajia Qin | ee9f08c | 2016-11-16 10:06:10 +0800 | [diff] [blame] | 368 | if (mFunctions->programUniformMatrix2fv != nullptr) |
| 369 | { |
| 370 | mFunctions->programUniformMatrix2fv(mProgramID, uniLoc(location), count, transpose, value); |
| 371 | } |
| 372 | else |
| 373 | { |
| 374 | mStateManager->useProgram(mProgramID); |
| 375 | mFunctions->uniformMatrix2fv(uniLoc(location), count, transpose, value); |
| 376 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 377 | } |
| 378 | |
| 379 | void ProgramGL::setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) |
| 380 | { |
Jiajia Qin | ee9f08c | 2016-11-16 10:06:10 +0800 | [diff] [blame] | 381 | if (mFunctions->programUniformMatrix3fv != nullptr) |
| 382 | { |
| 383 | mFunctions->programUniformMatrix3fv(mProgramID, uniLoc(location), count, transpose, value); |
| 384 | } |
| 385 | else |
| 386 | { |
| 387 | mStateManager->useProgram(mProgramID); |
| 388 | mFunctions->uniformMatrix3fv(uniLoc(location), count, transpose, value); |
| 389 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 390 | } |
| 391 | |
| 392 | void ProgramGL::setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) |
| 393 | { |
Jiajia Qin | ee9f08c | 2016-11-16 10:06:10 +0800 | [diff] [blame] | 394 | if (mFunctions->programUniformMatrix4fv != nullptr) |
| 395 | { |
| 396 | mFunctions->programUniformMatrix4fv(mProgramID, uniLoc(location), count, transpose, value); |
| 397 | } |
| 398 | else |
| 399 | { |
| 400 | mStateManager->useProgram(mProgramID); |
| 401 | mFunctions->uniformMatrix4fv(uniLoc(location), count, transpose, value); |
| 402 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 403 | } |
| 404 | |
| 405 | void ProgramGL::setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) |
| 406 | { |
Jiajia Qin | ee9f08c | 2016-11-16 10:06:10 +0800 | [diff] [blame] | 407 | if (mFunctions->programUniformMatrix2x3fv != nullptr) |
| 408 | { |
| 409 | mFunctions->programUniformMatrix2x3fv(mProgramID, uniLoc(location), count, transpose, |
| 410 | value); |
| 411 | } |
| 412 | else |
| 413 | { |
| 414 | mStateManager->useProgram(mProgramID); |
| 415 | mFunctions->uniformMatrix2x3fv(uniLoc(location), count, transpose, value); |
| 416 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 417 | } |
| 418 | |
| 419 | void ProgramGL::setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) |
| 420 | { |
Jiajia Qin | ee9f08c | 2016-11-16 10:06:10 +0800 | [diff] [blame] | 421 | if (mFunctions->programUniformMatrix3x2fv != nullptr) |
| 422 | { |
| 423 | mFunctions->programUniformMatrix3x2fv(mProgramID, uniLoc(location), count, transpose, |
| 424 | value); |
| 425 | } |
| 426 | else |
| 427 | { |
| 428 | mStateManager->useProgram(mProgramID); |
| 429 | mFunctions->uniformMatrix3x2fv(uniLoc(location), count, transpose, value); |
| 430 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 431 | } |
| 432 | |
| 433 | void ProgramGL::setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) |
| 434 | { |
Jiajia Qin | ee9f08c | 2016-11-16 10:06:10 +0800 | [diff] [blame] | 435 | if (mFunctions->programUniformMatrix2x4fv != nullptr) |
| 436 | { |
| 437 | mFunctions->programUniformMatrix2x4fv(mProgramID, uniLoc(location), count, transpose, |
| 438 | value); |
| 439 | } |
| 440 | else |
| 441 | { |
| 442 | mStateManager->useProgram(mProgramID); |
| 443 | mFunctions->uniformMatrix2x4fv(uniLoc(location), count, transpose, value); |
| 444 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 445 | } |
| 446 | |
| 447 | void ProgramGL::setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) |
| 448 | { |
Jiajia Qin | ee9f08c | 2016-11-16 10:06:10 +0800 | [diff] [blame] | 449 | if (mFunctions->programUniformMatrix4x2fv != nullptr) |
| 450 | { |
| 451 | mFunctions->programUniformMatrix4x2fv(mProgramID, uniLoc(location), count, transpose, |
| 452 | value); |
| 453 | } |
| 454 | else |
| 455 | { |
| 456 | mStateManager->useProgram(mProgramID); |
| 457 | mFunctions->uniformMatrix4x2fv(uniLoc(location), count, transpose, value); |
| 458 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 459 | } |
| 460 | |
| 461 | void ProgramGL::setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) |
| 462 | { |
Jiajia Qin | ee9f08c | 2016-11-16 10:06:10 +0800 | [diff] [blame] | 463 | if (mFunctions->programUniformMatrix3x4fv != nullptr) |
| 464 | { |
| 465 | mFunctions->programUniformMatrix3x4fv(mProgramID, uniLoc(location), count, transpose, |
| 466 | value); |
| 467 | } |
| 468 | else |
| 469 | { |
| 470 | mStateManager->useProgram(mProgramID); |
| 471 | mFunctions->uniformMatrix3x4fv(uniLoc(location), count, transpose, value); |
| 472 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 473 | } |
| 474 | |
| 475 | void ProgramGL::setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) |
| 476 | { |
Jiajia Qin | ee9f08c | 2016-11-16 10:06:10 +0800 | [diff] [blame] | 477 | if (mFunctions->programUniformMatrix4x3fv != nullptr) |
| 478 | { |
| 479 | mFunctions->programUniformMatrix4x3fv(mProgramID, uniLoc(location), count, transpose, |
| 480 | value); |
| 481 | } |
| 482 | else |
| 483 | { |
| 484 | mStateManager->useProgram(mProgramID); |
| 485 | mFunctions->uniformMatrix4x3fv(uniLoc(location), count, transpose, value); |
| 486 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 487 | } |
| 488 | |
Geoff Lang | 5d124a6 | 2015-09-15 13:03:27 -0400 | [diff] [blame] | 489 | void ProgramGL::setUniformBlockBinding(GLuint uniformBlockIndex, GLuint uniformBlockBinding) |
| 490 | { |
Jamie Madill | 4a3c234 | 2015-10-08 12:58:45 -0400 | [diff] [blame] | 491 | // Lazy init |
| 492 | if (mUniformBlockRealLocationMap.empty()) |
| 493 | { |
Jamie Madill | 48ef11b | 2016-04-27 15:21:52 -0400 | [diff] [blame] | 494 | mUniformBlockRealLocationMap.reserve(mState.getUniformBlocks().size()); |
| 495 | for (const gl::UniformBlock &uniformBlock : mState.getUniformBlocks()) |
Jamie Madill | 4a3c234 | 2015-10-08 12:58:45 -0400 | [diff] [blame] | 496 | { |
| 497 | const std::string &nameWithIndex = uniformBlock.nameWithArrayIndex(); |
| 498 | GLuint blockIndex = mFunctions->getUniformBlockIndex(mProgramID, nameWithIndex.c_str()); |
| 499 | mUniformBlockRealLocationMap.push_back(blockIndex); |
| 500 | } |
| 501 | } |
| 502 | |
| 503 | GLuint realBlockIndex = mUniformBlockRealLocationMap[uniformBlockIndex]; |
| 504 | if (realBlockIndex != GL_INVALID_INDEX) |
| 505 | { |
| 506 | mFunctions->uniformBlockBinding(mProgramID, realBlockIndex, uniformBlockBinding); |
| 507 | } |
Geoff Lang | 5d124a6 | 2015-09-15 13:03:27 -0400 | [diff] [blame] | 508 | } |
| 509 | |
Geoff Lang | b1f435e | 2015-02-20 10:01:01 -0500 | [diff] [blame] | 510 | GLuint ProgramGL::getProgramID() const |
| 511 | { |
| 512 | return mProgramID; |
| 513 | } |
| 514 | |
Jamie Madill | 4a3c234 | 2015-10-08 12:58:45 -0400 | [diff] [blame] | 515 | bool ProgramGL::getUniformBlockSize(const std::string &blockName, size_t *sizeOut) const |
Jamie Madill | 62d31cb | 2015-09-11 13:25:51 -0400 | [diff] [blame] | 516 | { |
Jamie Madill | 4a3c234 | 2015-10-08 12:58:45 -0400 | [diff] [blame] | 517 | ASSERT(mProgramID != 0u); |
Geoff Lang | 5d124a6 | 2015-09-15 13:03:27 -0400 | [diff] [blame] | 518 | |
Jamie Madill | 4a3c234 | 2015-10-08 12:58:45 -0400 | [diff] [blame] | 519 | GLuint blockIndex = mFunctions->getUniformBlockIndex(mProgramID, blockName.c_str()); |
| 520 | if (blockIndex == GL_INVALID_INDEX) |
Geoff Lang | 5d124a6 | 2015-09-15 13:03:27 -0400 | [diff] [blame] | 521 | { |
Jamie Madill | 4a3c234 | 2015-10-08 12:58:45 -0400 | [diff] [blame] | 522 | *sizeOut = 0; |
| 523 | return false; |
Geoff Lang | 5d124a6 | 2015-09-15 13:03:27 -0400 | [diff] [blame] | 524 | } |
| 525 | |
Jamie Madill | 4a3c234 | 2015-10-08 12:58:45 -0400 | [diff] [blame] | 526 | GLint dataSize = 0; |
| 527 | mFunctions->getActiveUniformBlockiv(mProgramID, blockIndex, GL_UNIFORM_BLOCK_DATA_SIZE, |
| 528 | &dataSize); |
| 529 | *sizeOut = static_cast<size_t>(dataSize); |
| 530 | return true; |
| 531 | } |
| 532 | |
| 533 | bool ProgramGL::getUniformBlockMemberInfo(const std::string &memberUniformName, |
| 534 | sh::BlockMemberInfo *memberInfoOut) const |
| 535 | { |
| 536 | GLuint uniformIndex; |
| 537 | const GLchar *memberNameGLStr = memberUniformName.c_str(); |
| 538 | mFunctions->getUniformIndices(mProgramID, 1, &memberNameGLStr, &uniformIndex); |
| 539 | |
| 540 | if (uniformIndex == GL_INVALID_INDEX) |
Geoff Lang | 5d124a6 | 2015-09-15 13:03:27 -0400 | [diff] [blame] | 541 | { |
Jamie Madill | 4a3c234 | 2015-10-08 12:58:45 -0400 | [diff] [blame] | 542 | *memberInfoOut = sh::BlockMemberInfo::getDefaultBlockInfo(); |
| 543 | return false; |
Geoff Lang | 5d124a6 | 2015-09-15 13:03:27 -0400 | [diff] [blame] | 544 | } |
Jamie Madill | 4a3c234 | 2015-10-08 12:58:45 -0400 | [diff] [blame] | 545 | |
| 546 | mFunctions->getActiveUniformsiv(mProgramID, 1, &uniformIndex, GL_UNIFORM_OFFSET, |
| 547 | &memberInfoOut->offset); |
| 548 | mFunctions->getActiveUniformsiv(mProgramID, 1, &uniformIndex, GL_UNIFORM_ARRAY_STRIDE, |
| 549 | &memberInfoOut->arrayStride); |
| 550 | mFunctions->getActiveUniformsiv(mProgramID, 1, &uniformIndex, GL_UNIFORM_MATRIX_STRIDE, |
| 551 | &memberInfoOut->matrixStride); |
| 552 | |
| 553 | // TODO(jmadill): possibly determine this at the gl::Program level. |
| 554 | GLint isRowMajorMatrix = 0; |
| 555 | mFunctions->getActiveUniformsiv(mProgramID, 1, &uniformIndex, GL_UNIFORM_IS_ROW_MAJOR, |
| 556 | &isRowMajorMatrix); |
| 557 | memberInfoOut->isRowMajorMatrix = isRowMajorMatrix != GL_FALSE; |
| 558 | return true; |
Jamie Madill | 62d31cb | 2015-09-11 13:25:51 -0400 | [diff] [blame] | 559 | } |
Jamie Madill | 4a3c234 | 2015-10-08 12:58:45 -0400 | [diff] [blame] | 560 | |
Sami Väisänen | 46eaa94 | 2016-06-29 10:26:37 +0300 | [diff] [blame] | 561 | void ProgramGL::setPathFragmentInputGen(const std::string &inputName, |
| 562 | GLenum genMode, |
| 563 | GLint components, |
| 564 | const GLfloat *coeffs) |
| 565 | { |
| 566 | ASSERT(mEnablePathRendering); |
| 567 | |
| 568 | for (const auto &input : mPathRenderingFragmentInputs) |
| 569 | { |
| 570 | if (input.name == inputName) |
| 571 | { |
| 572 | mFunctions->programPathFragmentInputGenNV(mProgramID, input.location, genMode, |
| 573 | components, coeffs); |
| 574 | ASSERT(mFunctions->getError() == GL_NO_ERROR); |
| 575 | return; |
| 576 | } |
| 577 | } |
| 578 | |
| 579 | } |
| 580 | |
Geoff Lang | 65a0be9 | 2015-10-02 09:57:30 -0400 | [diff] [blame] | 581 | void ProgramGL::preLink() |
| 582 | { |
| 583 | // Reset the program state |
| 584 | mUniformRealLocationMap.clear(); |
| 585 | mUniformBlockRealLocationMap.clear(); |
Sami Väisänen | 46eaa94 | 2016-06-29 10:26:37 +0300 | [diff] [blame] | 586 | mPathRenderingFragmentInputs.clear(); |
Geoff Lang | 65a0be9 | 2015-10-02 09:57:30 -0400 | [diff] [blame] | 587 | } |
| 588 | |
| 589 | bool ProgramGL::checkLinkStatus(gl::InfoLog &infoLog) |
| 590 | { |
| 591 | GLint linkStatus = GL_FALSE; |
| 592 | mFunctions->getProgramiv(mProgramID, GL_LINK_STATUS, &linkStatus); |
| 593 | if (linkStatus == GL_FALSE) |
| 594 | { |
| 595 | // Linking failed, put the error into the info log |
| 596 | GLint infoLogLength = 0; |
| 597 | mFunctions->getProgramiv(mProgramID, GL_INFO_LOG_LENGTH, &infoLogLength); |
| 598 | |
Geoff Lang | 65a0be9 | 2015-10-02 09:57:30 -0400 | [diff] [blame] | 599 | // Info log length includes the null terminator, so 1 means that the info log is an empty |
| 600 | // string. |
| 601 | if (infoLogLength > 1) |
| 602 | { |
| 603 | std::vector<char> buf(infoLogLength); |
| 604 | mFunctions->getProgramInfoLog(mProgramID, infoLogLength, nullptr, &buf[0]); |
| 605 | |
| 606 | mFunctions->deleteProgram(mProgramID); |
| 607 | mProgramID = 0; |
| 608 | |
| 609 | infoLog << buf.data(); |
| 610 | |
Yuly Novikov | bcb3f9b | 2017-01-27 22:45:18 -0500 | [diff] [blame] | 611 | WARN() << "Program link failed unexpectedly: " << buf.data(); |
Geoff Lang | 65a0be9 | 2015-10-02 09:57:30 -0400 | [diff] [blame] | 612 | } |
| 613 | else |
| 614 | { |
Yuly Novikov | bcb3f9b | 2017-01-27 22:45:18 -0500 | [diff] [blame] | 615 | WARN() << "Program link failed unexpectedly with no info log."; |
Geoff Lang | 65a0be9 | 2015-10-02 09:57:30 -0400 | [diff] [blame] | 616 | } |
Geoff Lang | 65a0be9 | 2015-10-02 09:57:30 -0400 | [diff] [blame] | 617 | |
| 618 | // TODO, return GL_OUT_OF_MEMORY or just fail the link? This is an unexpected case |
| 619 | return false; |
| 620 | } |
| 621 | |
| 622 | return true; |
| 623 | } |
| 624 | |
| 625 | void ProgramGL::postLink() |
| 626 | { |
| 627 | // Query the uniform information |
| 628 | ASSERT(mUniformRealLocationMap.empty()); |
Jamie Madill | 48ef11b | 2016-04-27 15:21:52 -0400 | [diff] [blame] | 629 | const auto &uniformLocations = mState.getUniformLocations(); |
| 630 | const auto &uniforms = mState.getUniforms(); |
Geoff Lang | 65a0be9 | 2015-10-02 09:57:30 -0400 | [diff] [blame] | 631 | mUniformRealLocationMap.resize(uniformLocations.size(), GL_INVALID_INDEX); |
| 632 | for (size_t uniformLocation = 0; uniformLocation < uniformLocations.size(); uniformLocation++) |
| 633 | { |
| 634 | const auto &entry = uniformLocations[uniformLocation]; |
| 635 | if (!entry.used) |
| 636 | { |
| 637 | continue; |
| 638 | } |
| 639 | |
| 640 | // From the spec: |
| 641 | // "Locations for sequential array indices are not required to be sequential." |
| 642 | const gl::LinkedUniform &uniform = uniforms[entry.index]; |
| 643 | std::stringstream fullNameStr; |
| 644 | fullNameStr << uniform.name; |
| 645 | if (uniform.isArray()) |
| 646 | { |
| 647 | fullNameStr << "[" << entry.element << "]"; |
| 648 | } |
| 649 | const std::string &fullName = fullNameStr.str(); |
| 650 | |
| 651 | GLint realLocation = mFunctions->getUniformLocation(mProgramID, fullName.c_str()); |
| 652 | mUniformRealLocationMap[uniformLocation] = realLocation; |
| 653 | } |
| 654 | |
Sami Väisänen | 46eaa94 | 2016-06-29 10:26:37 +0300 | [diff] [blame] | 655 | // Discover CHROMIUM_path_rendering fragment inputs if enabled. |
| 656 | if (!mEnablePathRendering) |
| 657 | return; |
| 658 | |
| 659 | GLint numFragmentInputs = 0; |
| 660 | mFunctions->getProgramInterfaceiv(mProgramID, GL_FRAGMENT_INPUT_NV, GL_ACTIVE_RESOURCES, |
| 661 | &numFragmentInputs); |
| 662 | if (numFragmentInputs <= 0) |
| 663 | return; |
| 664 | |
| 665 | GLint maxNameLength = 0; |
| 666 | mFunctions->getProgramInterfaceiv(mProgramID, GL_FRAGMENT_INPUT_NV, GL_MAX_NAME_LENGTH, |
| 667 | &maxNameLength); |
| 668 | ASSERT(maxNameLength); |
| 669 | |
| 670 | for (GLint i = 0; i < numFragmentInputs; ++i) |
| 671 | { |
| 672 | std::string name; |
| 673 | name.resize(maxNameLength); |
| 674 | |
| 675 | GLsizei nameLen = 0; |
| 676 | mFunctions->getProgramResourceName(mProgramID, GL_FRAGMENT_INPUT_NV, i, maxNameLength, |
| 677 | &nameLen, &name[0]); |
| 678 | name.resize(nameLen); |
| 679 | |
| 680 | // Ignore built-ins |
| 681 | if (angle::BeginsWith(name, "gl_")) |
| 682 | continue; |
| 683 | |
| 684 | const GLenum kQueryProperties[] = {GL_LOCATION, GL_ARRAY_SIZE}; |
| 685 | GLint queryResults[ArraySize(kQueryProperties)]; |
| 686 | GLsizei queryLength = 0; |
| 687 | |
Geoff Lang | 3f6a398 | 2016-07-15 15:20:45 -0400 | [diff] [blame] | 688 | mFunctions->getProgramResourceiv( |
| 689 | mProgramID, GL_FRAGMENT_INPUT_NV, i, static_cast<GLsizei>(ArraySize(kQueryProperties)), |
| 690 | kQueryProperties, static_cast<GLsizei>(ArraySize(queryResults)), &queryLength, |
| 691 | queryResults); |
Sami Väisänen | 46eaa94 | 2016-06-29 10:26:37 +0300 | [diff] [blame] | 692 | |
Olli Etuaho | e319171 | 2016-07-18 16:01:10 +0300 | [diff] [blame] | 693 | ASSERT(queryLength == static_cast<GLsizei>(ArraySize(kQueryProperties))); |
Sami Väisänen | 46eaa94 | 2016-06-29 10:26:37 +0300 | [diff] [blame] | 694 | |
Geoff Lang | 3f6a398 | 2016-07-15 15:20:45 -0400 | [diff] [blame] | 695 | PathRenderingFragmentInput baseElementInput; |
| 696 | baseElementInput.name = name; |
| 697 | baseElementInput.location = queryResults[0]; |
| 698 | mPathRenderingFragmentInputs.push_back(std::move(baseElementInput)); |
Sami Väisänen | 46eaa94 | 2016-06-29 10:26:37 +0300 | [diff] [blame] | 699 | |
| 700 | // If the input is an array it's denoted by [0] suffix on the variable |
| 701 | // name. We'll then create an entry per each array index where index > 0 |
| 702 | if (angle::EndsWith(name, "[0]")) |
| 703 | { |
| 704 | // drop the suffix |
| 705 | name.resize(name.size() - 3); |
| 706 | |
| 707 | const auto arraySize = queryResults[1]; |
| 708 | const auto baseLocation = queryResults[0]; |
| 709 | |
Geoff Lang | 3f6a398 | 2016-07-15 15:20:45 -0400 | [diff] [blame] | 710 | for (GLint arrayIndex = 1; arrayIndex < arraySize; ++arrayIndex) |
Sami Väisänen | 46eaa94 | 2016-06-29 10:26:37 +0300 | [diff] [blame] | 711 | { |
Geoff Lang | 3f6a398 | 2016-07-15 15:20:45 -0400 | [diff] [blame] | 712 | PathRenderingFragmentInput arrayElementInput; |
Corentin Wallez | 054f7ed | 2016-09-20 17:15:59 -0400 | [diff] [blame] | 713 | arrayElementInput.name = name + "[" + ToString(arrayIndex) + "]"; |
Geoff Lang | 3f6a398 | 2016-07-15 15:20:45 -0400 | [diff] [blame] | 714 | arrayElementInput.location = baseLocation + arrayIndex; |
| 715 | mPathRenderingFragmentInputs.push_back(std::move(arrayElementInput)); |
Sami Väisänen | 46eaa94 | 2016-06-29 10:26:37 +0300 | [diff] [blame] | 716 | } |
| 717 | } |
| 718 | } |
Geoff Lang | 65a0be9 | 2015-10-02 09:57:30 -0400 | [diff] [blame] | 719 | } |
| 720 | |
Jamie Madill | 4a3c234 | 2015-10-08 12:58:45 -0400 | [diff] [blame] | 721 | } // namespace rx |