blob: a103261ed06c4368100cae28eded4e3e12c4868e [file] [log] [blame]
Geoff Langf9a6f082015-01-22 13:32:49 -05001//
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 Lang5ed74cf2015-04-14 13:57:07 -040012#include "common/utilities.h"
Geoff Langb1f435e2015-02-20 10:01:01 -050013#include "libANGLE/renderer/gl/FunctionsGL.h"
14#include "libANGLE/renderer/gl/ShaderGL.h"
15#include "libANGLE/renderer/gl/StateManagerGL.h"
Geoff Langf9a6f082015-01-22 13:32:49 -050016
17namespace rx
18{
19
Jamie Madill5c6b7bf2015-08-17 12:53:35 -040020ProgramGL::ProgramGL(const gl::Program::Data &data,
21 const FunctionsGL *functions,
22 StateManagerGL *stateManager)
23 : ProgramImpl(data), mFunctions(functions), mStateManager(stateManager), mProgramID(0)
Geoff Langb1f435e2015-02-20 10:01:01 -050024{
25 ASSERT(mFunctions);
26 ASSERT(mStateManager);
Geoff Lang0ca53782015-05-07 13:49:39 -040027
28 mProgramID = mFunctions->createProgram();
Geoff Langb1f435e2015-02-20 10:01:01 -050029}
Geoff Langf9a6f082015-01-22 13:32:49 -050030
31ProgramGL::~ProgramGL()
Geoff Langb1f435e2015-02-20 10:01:01 -050032{
Geoff Lang0ca53782015-05-07 13:49:39 -040033 mFunctions->deleteProgram(mProgramID);
34 mProgramID = 0;
Geoff Langb1f435e2015-02-20 10:01:01 -050035}
Geoff Langf9a6f082015-01-22 13:32:49 -050036
37bool ProgramGL::usesPointSize() const
38{
39 UNIMPLEMENTED();
40 return bool();
41}
42
43int ProgramGL::getShaderVersion() const
44{
45 UNIMPLEMENTED();
46 return int();
47}
48
Geoff Langf9a6f082015-01-22 13:32:49 -050049GLenum ProgramGL::getBinaryFormat()
50{
51 UNIMPLEMENTED();
52 return GLenum();
53}
54
55LinkResult ProgramGL::load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream)
56{
57 UNIMPLEMENTED();
58 return LinkResult(false, gl::Error(GL_INVALID_OPERATION));
59}
60
61gl::Error ProgramGL::save(gl::BinaryOutputStream *stream)
62{
63 UNIMPLEMENTED();
64 return gl::Error(GL_INVALID_OPERATION);
65}
66
Jamie Madillccdf74b2015-08-18 10:46:12 -040067LinkResult ProgramGL::link(const gl::Data &data,
68 gl::InfoLog &infoLog,
69 gl::Shader *fragmentShader,
70 gl::Shader *vertexShader,
71 int *registers,
Geoff Langf9a6f082015-01-22 13:32:49 -050072 std::map<int, gl::VariableLocation> *outputVariables)
73{
Geoff Langb1f435e2015-02-20 10:01:01 -050074 // Reset the program state, delete the current program if one exists
75 reset();
76
Jamie Madillada9ecc2015-08-17 12:53:37 -040077 const ShaderGL *vertexShaderGL = GetImplAs<ShaderGL>(vertexShader);
78 const ShaderGL *fragmentShaderGL = GetImplAs<ShaderGL>(fragmentShader);
Geoff Langb1f435e2015-02-20 10:01:01 -050079
Geoff Langb1f435e2015-02-20 10:01:01 -050080 // Attach the shaders
81 mFunctions->attachShader(mProgramID, vertexShaderGL->getShaderID());
82 mFunctions->attachShader(mProgramID, fragmentShaderGL->getShaderID());
83
Geoff Langb1f435e2015-02-20 10:01:01 -050084 // Link and verify
85 mFunctions->linkProgram(mProgramID);
86
Geoff Lang0ca53782015-05-07 13:49:39 -040087 // Detach the shaders
88 mFunctions->detachShader(mProgramID, vertexShaderGL->getShaderID());
89 mFunctions->detachShader(mProgramID, fragmentShaderGL->getShaderID());
90
91 // Verify the link
Geoff Langb1f435e2015-02-20 10:01:01 -050092 GLint linkStatus = GL_FALSE;
93 mFunctions->getProgramiv(mProgramID, GL_LINK_STATUS, &linkStatus);
94 ASSERT(linkStatus == GL_TRUE);
95 if (linkStatus == GL_FALSE)
96 {
97 // Linking failed, put the error into the info log
98 GLint infoLogLength = 0;
99 mFunctions->getProgramiv(mProgramID, GL_INFO_LOG_LENGTH, &infoLogLength);
100
101 std::vector<char> buf(infoLogLength);
102 mFunctions->getProgramInfoLog(mProgramID, infoLogLength, nullptr, &buf[0]);
103
104 mFunctions->deleteProgram(mProgramID);
105 mProgramID = 0;
106
Jamie Madillf6113162015-05-07 11:49:21 -0400107 infoLog << &buf[0];
Geoff Langb1f435e2015-02-20 10:01:01 -0500108 TRACE("\n%s", &buf[0]);
109
110 // TODO, return GL_OUT_OF_MEMORY or just fail the link? This is an unexpected case
111 return LinkResult(false, gl::Error(GL_NO_ERROR));
112 }
113
114 // Query the uniform information
115 // TODO: A lot of this logic should be done at the gl::Program level
116 GLint activeUniformMaxLength = 0;
117 mFunctions->getProgramiv(mProgramID, GL_ACTIVE_UNIFORM_MAX_LENGTH, &activeUniformMaxLength);
118
119 std::vector<GLchar> uniformNameBuffer(activeUniformMaxLength);
120
121 GLint uniformCount = 0;
122 mFunctions->getProgramiv(mProgramID, GL_ACTIVE_UNIFORMS, &uniformCount);
123 for (GLint i = 0; i < uniformCount; i++)
124 {
125 GLsizei uniformNameLength = 0;
126 GLint uniformSize = 0;
127 GLenum uniformType = GL_NONE;
Cooper Partin4d61f7e2015-08-12 10:56:50 -0700128 mFunctions->getActiveUniform(mProgramID, i, static_cast<GLsizei>(uniformNameBuffer.size()),
129 &uniformNameLength, &uniformSize, &uniformType,
130 &uniformNameBuffer[0]);
Geoff Langb1f435e2015-02-20 10:01:01 -0500131
Geoff Lang79d059f2015-07-28 15:03:28 -0400132 size_t subscript = 0;
133 std::string uniformName = gl::ParseUniformName(std::string(&uniformNameBuffer[0], uniformNameLength), &subscript);
134
135 bool isArray = uniformSize > 1 || subscript != GL_INVALID_INDEX;
Geoff Lang5ed74cf2015-04-14 13:57:07 -0400136
137 for (size_t arrayIndex = 0; arrayIndex < static_cast<size_t>(uniformSize); arrayIndex++)
138 {
139 std::string locationName = uniformName;
Geoff Lang79d059f2015-07-28 15:03:28 -0400140 if (isArray)
Geoff Lang5ed74cf2015-04-14 13:57:07 -0400141 {
Cooper Partin4d61f7e2015-08-12 10:56:50 -0700142 locationName += "[" + Str(static_cast<int>(arrayIndex)) + "]";
Geoff Lang5ed74cf2015-04-14 13:57:07 -0400143 }
144
145 GLint location = mFunctions->getUniformLocation(mProgramID, locationName.c_str());
146 if (location >= 0)
147 {
Cooper Partin4d61f7e2015-08-12 10:56:50 -0700148 mUniformIndex[location] =
149 gl::VariableLocation(uniformName, static_cast<unsigned int>(arrayIndex),
150 static_cast<unsigned int>(mUniforms.size()));
Geoff Langf51bc792015-05-04 14:57:03 -0400151
152 // If the uniform is a sampler, track it in the sampler bindings array
153 if (gl::IsSamplerType(uniformType))
154 {
155 SamplerLocation samplerLoc;
156 samplerLoc.samplerIndex = mSamplerBindings.size();
157 samplerLoc.arrayIndex = arrayIndex;
158 mSamplerUniformMap[location] = samplerLoc;
159 }
Geoff Lang5ed74cf2015-04-14 13:57:07 -0400160 }
161 }
162
163 // ANGLE uses 0 to identify an non-array uniform.
Geoff Lang79d059f2015-07-28 15:03:28 -0400164 unsigned int arraySize = isArray ? static_cast<unsigned int>(uniformSize) : 0;
Geoff Langb1f435e2015-02-20 10:01:01 -0500165
166 // TODO: determine uniform precision
Geoff Lang5ed74cf2015-04-14 13:57:07 -0400167 mUniforms.push_back(new gl::LinkedUniform(uniformType, GL_NONE, uniformName, arraySize, -1, sh::BlockMemberInfo::getDefaultBlockInfo()));
Geoff Langf51bc792015-05-04 14:57:03 -0400168
169 // If uniform is a sampler type, insert it into the mSamplerBindings array
170 if (gl::IsSamplerType(uniformType))
171 {
172 SamplerBindingGL samplerBinding;
173 samplerBinding.textureType = gl::SamplerTypeToTextureType(uniformType);
174 samplerBinding.boundTextureUnits.resize(uniformSize, 0);
175 mSamplerBindings.push_back(samplerBinding);
176 }
Geoff Langb1f435e2015-02-20 10:01:01 -0500177 }
178
179 // Query the attribute information
180 GLint activeAttributeMaxLength = 0;
181 mFunctions->getProgramiv(mProgramID, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &activeAttributeMaxLength);
182
183 std::vector<GLchar> attributeNameBuffer(activeAttributeMaxLength);
184
185 GLint attributeCount = 0;
186 mFunctions->getProgramiv(mProgramID, GL_ACTIVE_ATTRIBUTES, &attributeCount);
187 for (GLint i = 0; i < attributeCount; i++)
188 {
189 GLsizei attributeNameLength = 0;
190 GLint attributeSize = 0;
191 GLenum attributeType = GL_NONE;
Cooper Partin4d61f7e2015-08-12 10:56:50 -0700192 mFunctions->getActiveAttrib(mProgramID, i, static_cast<GLsizei>(attributeNameBuffer.size()),
193 &attributeNameLength, &attributeSize, &attributeType,
194 &attributeNameBuffer[0]);
Geoff Langb1f435e2015-02-20 10:01:01 -0500195
196 std::string attributeName(&attributeNameBuffer[0], attributeNameLength);
197
Geoff Lang0ca53782015-05-07 13:49:39 -0400198 GLint location = mFunctions->getAttribLocation(mProgramID, attributeName.c_str());
199
Geoff Langb1f435e2015-02-20 10:01:01 -0500200 // TODO: determine attribute precision
Geoff Lang0ca53782015-05-07 13:49:39 -0400201 setShaderAttribute(static_cast<size_t>(i), attributeType, GL_NONE, attributeName, attributeSize, location);
Geoff Langb61e1732015-06-05 11:49:55 -0400202
Jamie Madill0b9e9032015-08-17 11:51:52 +0000203 mActiveAttributesMask.set(location);
Geoff Langb1f435e2015-02-20 10:01:01 -0500204 }
205
206 return LinkResult(true, gl::Error(GL_NO_ERROR));
Geoff Langf9a6f082015-01-22 13:32:49 -0500207}
208
Geoff Lang0ca53782015-05-07 13:49:39 -0400209void ProgramGL::bindAttributeLocation(GLuint index, const std::string &name)
210{
211 mFunctions->bindAttribLocation(mProgramID, index, name.c_str());
212}
213
Geoff Langf9a6f082015-01-22 13:32:49 -0500214void ProgramGL::setUniform1fv(GLint location, GLsizei count, const GLfloat *v)
215{
Geoff Lang63cbace2015-02-26 10:03:12 -0500216 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500217 mFunctions->uniform1fv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500218}
219
220void ProgramGL::setUniform2fv(GLint location, GLsizei count, const GLfloat *v)
221{
Geoff Lang63cbace2015-02-26 10:03:12 -0500222 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500223 mFunctions->uniform2fv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500224}
225
226void ProgramGL::setUniform3fv(GLint location, GLsizei count, const GLfloat *v)
227{
Geoff Lang63cbace2015-02-26 10:03:12 -0500228 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500229 mFunctions->uniform3fv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500230}
231
232void ProgramGL::setUniform4fv(GLint location, GLsizei count, const GLfloat *v)
233{
Geoff Lang63cbace2015-02-26 10:03:12 -0500234 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500235 mFunctions->uniform4fv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500236}
237
238void ProgramGL::setUniform1iv(GLint location, GLsizei count, const GLint *v)
239{
Geoff Lang63cbace2015-02-26 10:03:12 -0500240 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500241 mFunctions->uniform1iv(location, count, v);
Geoff Langf51bc792015-05-04 14:57:03 -0400242
243 auto iter = mSamplerUniformMap.find(location);
244 if (iter != mSamplerUniformMap.end())
245 {
246 const SamplerLocation &samplerLoc = iter->second;
247 std::vector<GLuint> &boundTextureUnits = mSamplerBindings[samplerLoc.samplerIndex].boundTextureUnits;
248
249 size_t copyCount = std::max<size_t>(count, boundTextureUnits.size() - samplerLoc.arrayIndex);
250 std::copy(v, v + copyCount, boundTextureUnits.begin() + samplerLoc.arrayIndex);
251 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500252}
253
254void ProgramGL::setUniform2iv(GLint location, GLsizei count, const GLint *v)
255{
Geoff Lang63cbace2015-02-26 10:03:12 -0500256 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500257 mFunctions->uniform2iv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500258}
259
260void ProgramGL::setUniform3iv(GLint location, GLsizei count, const GLint *v)
261{
Geoff Lang63cbace2015-02-26 10:03:12 -0500262 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500263 mFunctions->uniform3iv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500264}
265
266void ProgramGL::setUniform4iv(GLint location, GLsizei count, const GLint *v)
267{
Geoff Lang63cbace2015-02-26 10:03:12 -0500268 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500269 mFunctions->uniform4iv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500270}
271
272void ProgramGL::setUniform1uiv(GLint location, GLsizei count, const GLuint *v)
273{
Geoff Lang63cbace2015-02-26 10:03:12 -0500274 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500275 mFunctions->uniform1uiv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500276}
277
278void ProgramGL::setUniform2uiv(GLint location, GLsizei count, const GLuint *v)
279{
Geoff Lang63cbace2015-02-26 10:03:12 -0500280 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500281 mFunctions->uniform2uiv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500282}
283
284void ProgramGL::setUniform3uiv(GLint location, GLsizei count, const GLuint *v)
285{
Geoff Lang63cbace2015-02-26 10:03:12 -0500286 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500287 mFunctions->uniform3uiv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500288}
289
290void ProgramGL::setUniform4uiv(GLint location, GLsizei count, const GLuint *v)
291{
Geoff Lang63cbace2015-02-26 10:03:12 -0500292 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500293 mFunctions->uniform4uiv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500294}
295
296void ProgramGL::setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
297{
Geoff Lang63cbace2015-02-26 10:03:12 -0500298 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500299 mFunctions->uniformMatrix2fv(location, count, transpose, value);
Geoff Langf9a6f082015-01-22 13:32:49 -0500300}
301
302void ProgramGL::setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
303{
Geoff Lang63cbace2015-02-26 10:03:12 -0500304 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500305 mFunctions->uniformMatrix3fv(location, count, transpose, value);
Geoff Langf9a6f082015-01-22 13:32:49 -0500306}
307
308void ProgramGL::setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
309{
Geoff Lang63cbace2015-02-26 10:03:12 -0500310 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500311 mFunctions->uniformMatrix4fv(location, count, transpose, value);
Geoff Langf9a6f082015-01-22 13:32:49 -0500312}
313
314void ProgramGL::setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
315{
Geoff Lang63cbace2015-02-26 10:03:12 -0500316 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500317 mFunctions->uniformMatrix2x3fv(location, count, transpose, value);
Geoff Langf9a6f082015-01-22 13:32:49 -0500318}
319
320void ProgramGL::setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
321{
Geoff Lang63cbace2015-02-26 10:03:12 -0500322 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500323 mFunctions->uniformMatrix3x2fv(location, count, transpose, value);
Geoff Langf9a6f082015-01-22 13:32:49 -0500324}
325
326void ProgramGL::setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
327{
Geoff Lang63cbace2015-02-26 10:03:12 -0500328 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500329 mFunctions->uniformMatrix2x4fv(location, count, transpose, value);
Geoff Langf9a6f082015-01-22 13:32:49 -0500330}
331
332void ProgramGL::setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
333{
Geoff Lang63cbace2015-02-26 10:03:12 -0500334 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500335 mFunctions->uniformMatrix4x2fv(location, count, transpose, value);
Geoff Langf9a6f082015-01-22 13:32:49 -0500336}
337
338void ProgramGL::setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
339{
Geoff Lang63cbace2015-02-26 10:03:12 -0500340 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500341 mFunctions->uniformMatrix3x4fv(location, count, transpose, value);
Geoff Langf9a6f082015-01-22 13:32:49 -0500342}
343
344void ProgramGL::setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
345{
Geoff Lang63cbace2015-02-26 10:03:12 -0500346 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500347 mFunctions->uniformMatrix4x3fv(location, count, transpose, value);
Geoff Langf9a6f082015-01-22 13:32:49 -0500348}
349
350void ProgramGL::getUniformfv(GLint location, GLfloat *params)
351{
Geoff Langb1f435e2015-02-20 10:01:01 -0500352 mFunctions->getUniformfv(mProgramID, location, params);
Geoff Langf9a6f082015-01-22 13:32:49 -0500353}
354
355void ProgramGL::getUniformiv(GLint location, GLint *params)
356{
Geoff Langb1f435e2015-02-20 10:01:01 -0500357 mFunctions->getUniformiv(mProgramID, location, params);
Geoff Langf9a6f082015-01-22 13:32:49 -0500358}
359
360void ProgramGL::getUniformuiv(GLint location, GLuint *params)
361{
Geoff Langb1f435e2015-02-20 10:01:01 -0500362 mFunctions->getUniformuiv(mProgramID, location, params);
Geoff Langf9a6f082015-01-22 13:32:49 -0500363}
364
365GLint ProgramGL::getSamplerMapping(gl::SamplerType type, unsigned int samplerIndex, const gl::Caps &caps) const
366{
367 UNIMPLEMENTED();
368 return GLint();
369}
370
371GLenum ProgramGL::getSamplerTextureType(gl::SamplerType type, unsigned int samplerIndex) const
372{
373 UNIMPLEMENTED();
374 return GLenum();
375}
376
377GLint ProgramGL::getUsedSamplerRange(gl::SamplerType type) const
378{
379 UNIMPLEMENTED();
380 return GLint();
381}
382
383void ProgramGL::updateSamplerMapping()
384{
385 UNIMPLEMENTED();
386}
387
388bool ProgramGL::validateSamplers(gl::InfoLog *infoLog, const gl::Caps &caps)
389{
Geoff Lang35d315c2015-03-31 12:48:54 -0400390 //UNIMPLEMENTED();
Geoff Langb1f435e2015-02-20 10:01:01 -0500391 return true;
Geoff Langf9a6f082015-01-22 13:32:49 -0500392}
393
Jamie Madill5c6b7bf2015-08-17 12:53:35 -0400394LinkResult ProgramGL::compileProgramExecutables(gl::InfoLog &infoLog, int registers)
Geoff Langf9a6f082015-01-22 13:32:49 -0500395{
Geoff Langb1f435e2015-02-20 10:01:01 -0500396 //UNIMPLEMENTED();
397 return LinkResult(true, gl::Error(GL_NO_ERROR));
Geoff Langf9a6f082015-01-22 13:32:49 -0500398}
399
Geoff Langf9a6f082015-01-22 13:32:49 -0500400gl::Error ProgramGL::applyUniforms()
401{
Geoff Langc3ab9f72015-05-27 14:45:59 -0400402 //UNIMPLEMENTED();
403 // TODO(geofflang)
404 return gl::Error(GL_NO_ERROR);
Geoff Langf9a6f082015-01-22 13:32:49 -0500405}
406
Gregoire Payen de La Garanderie68694e92015-03-24 14:03:37 +0000407gl::Error ProgramGL::applyUniformBuffers(const gl::Data &data, GLuint uniformBlockBindings[])
Geoff Langf9a6f082015-01-22 13:32:49 -0500408{
409 UNIMPLEMENTED();
410 return gl::Error(GL_INVALID_OPERATION);
411}
412
Geoff Langb1f435e2015-02-20 10:01:01 -0500413void ProgramGL::reset()
414{
415 ProgramImpl::reset();
Geoff Langf51bc792015-05-04 14:57:03 -0400416
417 mSamplerUniformMap.clear();
418 mSamplerBindings.clear();
Jamie Madill0b9e9032015-08-17 11:51:52 +0000419 mActiveAttributesMask.reset();
Geoff Langb1f435e2015-02-20 10:01:01 -0500420}
421
422GLuint ProgramGL::getProgramID() const
423{
424 return mProgramID;
425}
426
Geoff Langf51bc792015-05-04 14:57:03 -0400427const std::vector<SamplerBindingGL> &ProgramGL::getAppliedSamplerUniforms() const
428{
429 return mSamplerBindings;
430}
431
Jamie Madill0b9e9032015-08-17 11:51:52 +0000432const gl::AttributesMask &ProgramGL::getActiveAttributesMask() const
Geoff Langb61e1732015-06-05 11:49:55 -0400433{
Jamie Madill0b9e9032015-08-17 11:51:52 +0000434 return mActiveAttributesMask;
Geoff Langb61e1732015-06-05 11:49:55 -0400435}
436
Geoff Langf9a6f082015-01-22 13:32:49 -0500437}