blob: 5c22a4652b10e742dfc7f24e35121efa4b4a7802 [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
Corentin Wallez1661fde2015-08-18 11:29:46 -0400203 int attributeRegisterCount = gl::VariableRegisterCount(attributeType);
204 for (int offset = 0; offset < attributeRegisterCount; offset++)
205 {
206 mActiveAttributesMask.set(location + offset);
207 }
Geoff Langb1f435e2015-02-20 10:01:01 -0500208 }
209
210 return LinkResult(true, gl::Error(GL_NO_ERROR));
Geoff Langf9a6f082015-01-22 13:32:49 -0500211}
212
Geoff Lang0ca53782015-05-07 13:49:39 -0400213void ProgramGL::bindAttributeLocation(GLuint index, const std::string &name)
214{
215 mFunctions->bindAttribLocation(mProgramID, index, name.c_str());
216}
217
Geoff Langf9a6f082015-01-22 13:32:49 -0500218void ProgramGL::setUniform1fv(GLint location, GLsizei count, const GLfloat *v)
219{
Geoff Lang63cbace2015-02-26 10:03:12 -0500220 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500221 mFunctions->uniform1fv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500222}
223
224void ProgramGL::setUniform2fv(GLint location, GLsizei count, const GLfloat *v)
225{
Geoff Lang63cbace2015-02-26 10:03:12 -0500226 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500227 mFunctions->uniform2fv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500228}
229
230void ProgramGL::setUniform3fv(GLint location, GLsizei count, const GLfloat *v)
231{
Geoff Lang63cbace2015-02-26 10:03:12 -0500232 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500233 mFunctions->uniform3fv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500234}
235
236void ProgramGL::setUniform4fv(GLint location, GLsizei count, const GLfloat *v)
237{
Geoff Lang63cbace2015-02-26 10:03:12 -0500238 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500239 mFunctions->uniform4fv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500240}
241
242void ProgramGL::setUniform1iv(GLint location, GLsizei count, const GLint *v)
243{
Geoff Lang63cbace2015-02-26 10:03:12 -0500244 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500245 mFunctions->uniform1iv(location, count, v);
Geoff Langf51bc792015-05-04 14:57:03 -0400246
247 auto iter = mSamplerUniformMap.find(location);
248 if (iter != mSamplerUniformMap.end())
249 {
250 const SamplerLocation &samplerLoc = iter->second;
251 std::vector<GLuint> &boundTextureUnits = mSamplerBindings[samplerLoc.samplerIndex].boundTextureUnits;
252
253 size_t copyCount = std::max<size_t>(count, boundTextureUnits.size() - samplerLoc.arrayIndex);
254 std::copy(v, v + copyCount, boundTextureUnits.begin() + samplerLoc.arrayIndex);
255 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500256}
257
258void ProgramGL::setUniform2iv(GLint location, GLsizei count, const GLint *v)
259{
Geoff Lang63cbace2015-02-26 10:03:12 -0500260 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500261 mFunctions->uniform2iv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500262}
263
264void ProgramGL::setUniform3iv(GLint location, GLsizei count, const GLint *v)
265{
Geoff Lang63cbace2015-02-26 10:03:12 -0500266 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500267 mFunctions->uniform3iv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500268}
269
270void ProgramGL::setUniform4iv(GLint location, GLsizei count, const GLint *v)
271{
Geoff Lang63cbace2015-02-26 10:03:12 -0500272 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500273 mFunctions->uniform4iv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500274}
275
276void ProgramGL::setUniform1uiv(GLint location, GLsizei count, const GLuint *v)
277{
Geoff Lang63cbace2015-02-26 10:03:12 -0500278 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500279 mFunctions->uniform1uiv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500280}
281
282void ProgramGL::setUniform2uiv(GLint location, GLsizei count, const GLuint *v)
283{
Geoff Lang63cbace2015-02-26 10:03:12 -0500284 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500285 mFunctions->uniform2uiv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500286}
287
288void ProgramGL::setUniform3uiv(GLint location, GLsizei count, const GLuint *v)
289{
Geoff Lang63cbace2015-02-26 10:03:12 -0500290 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500291 mFunctions->uniform3uiv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500292}
293
294void ProgramGL::setUniform4uiv(GLint location, GLsizei count, const GLuint *v)
295{
Geoff Lang63cbace2015-02-26 10:03:12 -0500296 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500297 mFunctions->uniform4uiv(location, count, v);
Geoff Langf9a6f082015-01-22 13:32:49 -0500298}
299
300void ProgramGL::setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
301{
Geoff Lang63cbace2015-02-26 10:03:12 -0500302 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500303 mFunctions->uniformMatrix2fv(location, count, transpose, value);
Geoff Langf9a6f082015-01-22 13:32:49 -0500304}
305
306void ProgramGL::setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
307{
Geoff Lang63cbace2015-02-26 10:03:12 -0500308 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500309 mFunctions->uniformMatrix3fv(location, count, transpose, value);
Geoff Langf9a6f082015-01-22 13:32:49 -0500310}
311
312void ProgramGL::setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
313{
Geoff Lang63cbace2015-02-26 10:03:12 -0500314 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500315 mFunctions->uniformMatrix4fv(location, count, transpose, value);
Geoff Langf9a6f082015-01-22 13:32:49 -0500316}
317
318void ProgramGL::setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
319{
Geoff Lang63cbace2015-02-26 10:03:12 -0500320 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500321 mFunctions->uniformMatrix2x3fv(location, count, transpose, value);
Geoff Langf9a6f082015-01-22 13:32:49 -0500322}
323
324void ProgramGL::setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
325{
Geoff Lang63cbace2015-02-26 10:03:12 -0500326 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500327 mFunctions->uniformMatrix3x2fv(location, count, transpose, value);
Geoff Langf9a6f082015-01-22 13:32:49 -0500328}
329
330void ProgramGL::setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
331{
Geoff Lang63cbace2015-02-26 10:03:12 -0500332 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500333 mFunctions->uniformMatrix2x4fv(location, count, transpose, value);
Geoff Langf9a6f082015-01-22 13:32:49 -0500334}
335
336void ProgramGL::setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
337{
Geoff Lang63cbace2015-02-26 10:03:12 -0500338 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500339 mFunctions->uniformMatrix4x2fv(location, count, transpose, value);
Geoff Langf9a6f082015-01-22 13:32:49 -0500340}
341
342void ProgramGL::setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
343{
Geoff Lang63cbace2015-02-26 10:03:12 -0500344 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500345 mFunctions->uniformMatrix3x4fv(location, count, transpose, value);
Geoff Langf9a6f082015-01-22 13:32:49 -0500346}
347
348void ProgramGL::setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
349{
Geoff Lang63cbace2015-02-26 10:03:12 -0500350 mStateManager->useProgram(mProgramID);
Geoff Langb1f435e2015-02-20 10:01:01 -0500351 mFunctions->uniformMatrix4x3fv(location, count, transpose, value);
Geoff Langf9a6f082015-01-22 13:32:49 -0500352}
353
354void ProgramGL::getUniformfv(GLint location, GLfloat *params)
355{
Geoff Langb1f435e2015-02-20 10:01:01 -0500356 mFunctions->getUniformfv(mProgramID, location, params);
Geoff Langf9a6f082015-01-22 13:32:49 -0500357}
358
359void ProgramGL::getUniformiv(GLint location, GLint *params)
360{
Geoff Langb1f435e2015-02-20 10:01:01 -0500361 mFunctions->getUniformiv(mProgramID, location, params);
Geoff Langf9a6f082015-01-22 13:32:49 -0500362}
363
364void ProgramGL::getUniformuiv(GLint location, GLuint *params)
365{
Geoff Langb1f435e2015-02-20 10:01:01 -0500366 mFunctions->getUniformuiv(mProgramID, location, params);
Geoff Langf9a6f082015-01-22 13:32:49 -0500367}
368
369GLint ProgramGL::getSamplerMapping(gl::SamplerType type, unsigned int samplerIndex, const gl::Caps &caps) const
370{
371 UNIMPLEMENTED();
372 return GLint();
373}
374
375GLenum ProgramGL::getSamplerTextureType(gl::SamplerType type, unsigned int samplerIndex) const
376{
377 UNIMPLEMENTED();
378 return GLenum();
379}
380
381GLint ProgramGL::getUsedSamplerRange(gl::SamplerType type) const
382{
383 UNIMPLEMENTED();
384 return GLint();
385}
386
387void ProgramGL::updateSamplerMapping()
388{
389 UNIMPLEMENTED();
390}
391
392bool ProgramGL::validateSamplers(gl::InfoLog *infoLog, const gl::Caps &caps)
393{
Geoff Lang35d315c2015-03-31 12:48:54 -0400394 //UNIMPLEMENTED();
Geoff Langb1f435e2015-02-20 10:01:01 -0500395 return true;
Geoff Langf9a6f082015-01-22 13:32:49 -0500396}
397
Jamie Madill5c6b7bf2015-08-17 12:53:35 -0400398LinkResult ProgramGL::compileProgramExecutables(gl::InfoLog &infoLog, int registers)
Geoff Langf9a6f082015-01-22 13:32:49 -0500399{
Geoff Langb1f435e2015-02-20 10:01:01 -0500400 //UNIMPLEMENTED();
401 return LinkResult(true, gl::Error(GL_NO_ERROR));
Geoff Langf9a6f082015-01-22 13:32:49 -0500402}
403
Geoff Langf9a6f082015-01-22 13:32:49 -0500404gl::Error ProgramGL::applyUniforms()
405{
Geoff Langc3ab9f72015-05-27 14:45:59 -0400406 //UNIMPLEMENTED();
407 // TODO(geofflang)
408 return gl::Error(GL_NO_ERROR);
Geoff Langf9a6f082015-01-22 13:32:49 -0500409}
410
Gregoire Payen de La Garanderie68694e92015-03-24 14:03:37 +0000411gl::Error ProgramGL::applyUniformBuffers(const gl::Data &data, GLuint uniformBlockBindings[])
Geoff Langf9a6f082015-01-22 13:32:49 -0500412{
413 UNIMPLEMENTED();
414 return gl::Error(GL_INVALID_OPERATION);
415}
416
Geoff Langb1f435e2015-02-20 10:01:01 -0500417void ProgramGL::reset()
418{
419 ProgramImpl::reset();
Geoff Langf51bc792015-05-04 14:57:03 -0400420
421 mSamplerUniformMap.clear();
422 mSamplerBindings.clear();
Jamie Madill0b9e9032015-08-17 11:51:52 +0000423 mActiveAttributesMask.reset();
Geoff Langb1f435e2015-02-20 10:01:01 -0500424}
425
426GLuint ProgramGL::getProgramID() const
427{
428 return mProgramID;
429}
430
Geoff Langf51bc792015-05-04 14:57:03 -0400431const std::vector<SamplerBindingGL> &ProgramGL::getAppliedSamplerUniforms() const
432{
433 return mSamplerBindings;
434}
435
Jamie Madill0b9e9032015-08-17 11:51:52 +0000436const gl::AttributesMask &ProgramGL::getActiveAttributesMask() const
Geoff Langb61e1732015-06-05 11:49:55 -0400437{
Jamie Madill0b9e9032015-08-17 11:51:52 +0000438 return mActiveAttributesMask;
Geoff Langb61e1732015-06-05 11:49:55 -0400439}
440
Geoff Langf9a6f082015-01-22 13:32:49 -0500441}