blob: 16455de18e36d573fd7e26d85a7b0b8b6b46d420 [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
Sami Väisänen46eaa942016-06-29 10:26:37 +030011#include "common/angleutils.h"
Jamie Madillc564c072017-06-01 12:45:42 -040012#include "common/bitset_utils.h"
Geoff Langf9a6f082015-01-22 13:32:49 -050013#include "common/debug.h"
Sami Väisänen46eaa942016-06-29 10:26:37 +030014#include "common/string_utils.h"
Geoff Lang5ed74cf2015-04-14 13:57:07 -040015#include "common/utilities.h"
Jamie Madillc564c072017-06-01 12:45:42 -040016#include "libANGLE/Context.h"
Jamie Madill6db1c2e2017-11-08 09:17:40 -050017#include "libANGLE/ProgramLinkedResources.h"
Jamie Madillc564c072017-06-01 12:45:42 -040018#include "libANGLE/Uniform.h"
Geoff Lang92019432017-11-20 13:09:34 -050019#include "libANGLE/queryconversions.h"
Jamie Madilla7d12dc2016-12-13 15:08:19 -050020#include "libANGLE/renderer/gl/ContextGL.h"
Geoff Langb1f435e2015-02-20 10:01:01 -050021#include "libANGLE/renderer/gl/FunctionsGL.h"
22#include "libANGLE/renderer/gl/ShaderGL.h"
23#include "libANGLE/renderer/gl/StateManagerGL.h"
Philippe Hamel40911192016-04-07 16:45:50 -040024#include "libANGLE/renderer/gl/WorkaroundsGL.h"
unknownb4a3af22015-11-25 15:02:51 -050025#include "platform/Platform.h"
Geoff Langf9a6f082015-01-22 13:32:49 -050026
27namespace rx
28{
29
Jamie Madill48ef11b2016-04-27 15:21:52 -040030ProgramGL::ProgramGL(const gl::ProgramState &data,
Jamie Madill5c6b7bf2015-08-17 12:53:35 -040031 const FunctionsGL *functions,
Philippe Hamel40911192016-04-07 16:45:50 -040032 const WorkaroundsGL &workarounds,
Sami Väisänen46eaa942016-06-29 10:26:37 +030033 StateManagerGL *stateManager,
34 bool enablePathRendering)
Philippe Hamel40911192016-04-07 16:45:50 -040035 : ProgramImpl(data),
36 mFunctions(functions),
37 mWorkarounds(workarounds),
38 mStateManager(stateManager),
Sami Väisänen46eaa942016-06-29 10:26:37 +030039 mEnablePathRendering(enablePathRendering),
Martin Radev4e619f52017-08-09 11:50:06 +030040 mMultiviewBaseViewLayerIndexUniformLocation(-1),
Philippe Hamel40911192016-04-07 16:45:50 -040041 mProgramID(0)
Geoff Langb1f435e2015-02-20 10:01:01 -050042{
43 ASSERT(mFunctions);
44 ASSERT(mStateManager);
Geoff Lang0ca53782015-05-07 13:49:39 -040045
46 mProgramID = mFunctions->createProgram();
Geoff Langb1f435e2015-02-20 10:01:01 -050047}
Geoff Langf9a6f082015-01-22 13:32:49 -050048
49ProgramGL::~ProgramGL()
Geoff Langb1f435e2015-02-20 10:01:01 -050050{
Geoff Lang0ca53782015-05-07 13:49:39 -040051 mFunctions->deleteProgram(mProgramID);
52 mProgramID = 0;
Geoff Langb1f435e2015-02-20 10:01:01 -050053}
Geoff Langf9a6f082015-01-22 13:32:49 -050054
Jamie Madill9cf9e872017-06-05 12:59:25 -040055gl::LinkResult ProgramGL::load(const gl::Context *context,
56 gl::InfoLog &infoLog,
57 gl::BinaryInputStream *stream)
Geoff Langf9a6f082015-01-22 13:32:49 -050058{
Geoff Lang65a0be92015-10-02 09:57:30 -040059 preLink();
60
61 // Read the binary format, size and blob
62 GLenum binaryFormat = stream->readInt<GLenum>();
63 GLint binaryLength = stream->readInt<GLint>();
64 const uint8_t *binary = stream->data() + stream->offset();
65 stream->skip(binaryLength);
66
67 // Load the binary
68 mFunctions->programBinary(mProgramID, binaryFormat, binary, binaryLength);
69
70 // Verify that the program linked
71 if (!checkLinkStatus(infoLog))
72 {
Jamie Madillb0a838b2016-11-13 20:02:12 -050073 return false;
Geoff Lang65a0be92015-10-02 09:57:30 -040074 }
75
76 postLink();
Jamie Madill27a60632017-06-30 15:12:01 -040077 reapplyUBOBindingsIfNeeded(context);
Jamie Madilla7d12dc2016-12-13 15:08:19 -050078
Jamie Madillb0a838b2016-11-13 20:02:12 -050079 return true;
Geoff Langf9a6f082015-01-22 13:32:49 -050080}
81
Jamie Madill27a60632017-06-30 15:12:01 -040082void ProgramGL::save(const gl::Context *context, gl::BinaryOutputStream *stream)
Geoff Langf9a6f082015-01-22 13:32:49 -050083{
Geoff Lang65a0be92015-10-02 09:57:30 -040084 GLint binaryLength = 0;
85 mFunctions->getProgramiv(mProgramID, GL_PROGRAM_BINARY_LENGTH, &binaryLength);
86
Geoff Lang416a23e2017-11-20 12:34:20 -050087 std::vector<uint8_t> binary(std::max(binaryLength, 1));
Geoff Lang65a0be92015-10-02 09:57:30 -040088 GLenum binaryFormat = GL_NONE;
89 mFunctions->getProgramBinary(mProgramID, binaryLength, &binaryLength, &binaryFormat,
Geoff Lang416a23e2017-11-20 12:34:20 -050090 binary.data());
Geoff Lang65a0be92015-10-02 09:57:30 -040091
92 stream->writeInt(binaryFormat);
93 stream->writeInt(binaryLength);
Geoff Lang416a23e2017-11-20 12:34:20 -050094 stream->writeBytes(binary.data(), binaryLength);
Jamie Madill27a60632017-06-30 15:12:01 -040095
96 reapplyUBOBindingsIfNeeded(context);
97}
98
99void ProgramGL::reapplyUBOBindingsIfNeeded(const gl::Context *context)
100{
101 // Re-apply UBO bindings to work around driver bugs.
102 const WorkaroundsGL &workaroundsGL = GetImplAs<ContextGL>(context)->getWorkaroundsGL();
103 if (workaroundsGL.reapplyUBOBindingsAfterUsingBinaryProgram)
104 {
105 const auto &blocks = mState.getUniformBlocks();
106 for (size_t blockIndex : mState.getActiveUniformBlockBindingsMask())
107 {
108 setUniformBlockBinding(static_cast<GLuint>(blockIndex), blocks[blockIndex].binding);
109 }
110 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500111}
112
Geoff Langc5629752015-12-07 16:29:04 -0500113void ProgramGL::setBinaryRetrievableHint(bool retrievable)
114{
Geoff Lang65a0be92015-10-02 09:57:30 -0400115 // glProgramParameteri isn't always available on ES backends.
116 if (mFunctions->programParameteri)
117 {
118 mFunctions->programParameteri(mProgramID, GL_PROGRAM_BINARY_RETRIEVABLE_HINT,
119 retrievable ? GL_TRUE : GL_FALSE);
120 }
Geoff Langc5629752015-12-07 16:29:04 -0500121}
122
Yunchao He61afff12017-03-14 15:34:03 +0800123void ProgramGL::setSeparable(bool separable)
124{
125 mFunctions->programParameteri(mProgramID, GL_PROGRAM_SEPARABLE, separable ? GL_TRUE : GL_FALSE);
126}
127
Jamie Madill9cf9e872017-06-05 12:59:25 -0400128gl::LinkResult ProgramGL::link(const gl::Context *context,
Jamie Madillc9727f32017-11-07 12:37:07 -0500129 const gl::ProgramLinkedResources &resources,
Jamie Madill9cf9e872017-06-05 12:59:25 -0400130 gl::InfoLog &infoLog)
Geoff Langf9a6f082015-01-22 13:32:49 -0500131{
Geoff Lang65a0be92015-10-02 09:57:30 -0400132 preLink();
Geoff Langb1f435e2015-02-20 10:01:01 -0500133
Martin Radev4c4c8e72016-08-04 12:25:34 +0300134 if (mState.getAttachedComputeShader())
Geoff Lang1a683462015-09-29 15:09:59 -0400135 {
Martin Radev4c4c8e72016-08-04 12:25:34 +0300136 const ShaderGL *computeShaderGL = GetImplAs<ShaderGL>(mState.getAttachedComputeShader());
Geoff Lang1a683462015-09-29 15:09:59 -0400137
Martin Radev4c4c8e72016-08-04 12:25:34 +0300138 mFunctions->attachShader(mProgramID, computeShaderGL->getShaderID());
139
140 // Link and verify
141 mFunctions->linkProgram(mProgramID);
142
143 // Detach the shaders
144 mFunctions->detachShader(mProgramID, computeShaderGL->getShaderID());
Geoff Lang1a683462015-09-29 15:09:59 -0400145 }
146 else
147 {
Martin Radev4c4c8e72016-08-04 12:25:34 +0300148 // Set the transform feedback state
Olli Etuaho855d9642017-05-17 14:05:06 +0300149 std::vector<std::string> transformFeedbackVaryingMappedNames;
Martin Radev4c4c8e72016-08-04 12:25:34 +0300150 for (const auto &tfVarying : mState.getTransformFeedbackVaryingNames())
Geoff Lang1528e562015-08-24 15:10:58 -0400151 {
Olli Etuaho855d9642017-05-17 14:05:06 +0300152 std::string tfVaryingMappedName =
153 mState.getAttachedVertexShader()->getTransformFeedbackVaryingMappedName(tfVarying,
154 context);
155 transformFeedbackVaryingMappedNames.push_back(tfVaryingMappedName);
Geoff Lang1528e562015-08-24 15:10:58 -0400156 }
157
Olli Etuaho855d9642017-05-17 14:05:06 +0300158 if (transformFeedbackVaryingMappedNames.empty())
Martin Radev4c4c8e72016-08-04 12:25:34 +0300159 {
160 if (mFunctions->transformFeedbackVaryings)
161 {
162 mFunctions->transformFeedbackVaryings(mProgramID, 0, nullptr,
163 mState.getTransformFeedbackBufferMode());
164 }
165 }
166 else
167 {
168 ASSERT(mFunctions->transformFeedbackVaryings);
Olli Etuaho855d9642017-05-17 14:05:06 +0300169 std::vector<const GLchar *> transformFeedbackVaryings;
170 for (const auto &varying : transformFeedbackVaryingMappedNames)
171 {
172 transformFeedbackVaryings.push_back(varying.c_str());
173 }
Martin Radev4c4c8e72016-08-04 12:25:34 +0300174 mFunctions->transformFeedbackVaryings(
Olli Etuaho855d9642017-05-17 14:05:06 +0300175 mProgramID, static_cast<GLsizei>(transformFeedbackVaryingMappedNames.size()),
Martin Radev4c4c8e72016-08-04 12:25:34 +0300176 &transformFeedbackVaryings[0], mState.getTransformFeedbackBufferMode());
177 }
178
179 const ShaderGL *vertexShaderGL = GetImplAs<ShaderGL>(mState.getAttachedVertexShader());
180 const ShaderGL *fragmentShaderGL = GetImplAs<ShaderGL>(mState.getAttachedFragmentShader());
181
182 // Attach the shaders
183 mFunctions->attachShader(mProgramID, vertexShaderGL->getShaderID());
184 mFunctions->attachShader(mProgramID, fragmentShaderGL->getShaderID());
185
186 // Bind attribute locations to match the GL layer.
187 for (const sh::Attribute &attribute : mState.getAttributes())
188 {
Corentin Wallez6c1cbf52016-11-23 12:44:35 -0500189 if (!attribute.staticUse || attribute.isBuiltIn())
Martin Radev4c4c8e72016-08-04 12:25:34 +0300190 {
191 continue;
192 }
193
Olli Etuaho855d9642017-05-17 14:05:06 +0300194 mFunctions->bindAttribLocation(mProgramID, attribute.location,
195 attribute.mappedName.c_str());
Martin Radev4c4c8e72016-08-04 12:25:34 +0300196 }
197
198 // Link and verify
199 mFunctions->linkProgram(mProgramID);
200
201 // Detach the shaders
202 mFunctions->detachShader(mProgramID, vertexShaderGL->getShaderID());
203 mFunctions->detachShader(mProgramID, fragmentShaderGL->getShaderID());
Geoff Lang1528e562015-08-24 15:10:58 -0400204 }
205
Geoff Lang0ca53782015-05-07 13:49:39 -0400206 // Verify the link
Geoff Lang65a0be92015-10-02 09:57:30 -0400207 if (!checkLinkStatus(infoLog))
Geoff Langb1f435e2015-02-20 10:01:01 -0500208 {
Jamie Madillb0a838b2016-11-13 20:02:12 -0500209 return false;
Geoff Langb1f435e2015-02-20 10:01:01 -0500210 }
211
Philippe Hamel40911192016-04-07 16:45:50 -0400212 if (mWorkarounds.alwaysCallUseProgramAfterLink)
213 {
214 mStateManager->forceUseProgram(mProgramID);
215 }
216
Jamie Madill6db1c2e2017-11-08 09:17:40 -0500217 linkResources(resources);
Geoff Lang65a0be92015-10-02 09:57:30 -0400218 postLink();
Geoff Langb1f435e2015-02-20 10:01:01 -0500219
Jamie Madillb0a838b2016-11-13 20:02:12 -0500220 return true;
Geoff Langf9a6f082015-01-22 13:32:49 -0500221}
222
Jamie Madill36cfd6a2015-08-18 10:46:20 -0400223GLboolean ProgramGL::validate(const gl::Caps & /*caps*/, gl::InfoLog * /*infoLog*/)
224{
225 // TODO(jmadill): implement validate
226 return true;
227}
228
Geoff Langf9a6f082015-01-22 13:32:49 -0500229void ProgramGL::setUniform1fv(GLint location, GLsizei count, const GLfloat *v)
230{
Jiajia Qinee9f08c2016-11-16 10:06:10 +0800231 if (mFunctions->programUniform1fv != nullptr)
232 {
233 mFunctions->programUniform1fv(mProgramID, uniLoc(location), count, v);
234 }
235 else
236 {
237 mStateManager->useProgram(mProgramID);
238 mFunctions->uniform1fv(uniLoc(location), count, v);
239 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500240}
241
242void ProgramGL::setUniform2fv(GLint location, GLsizei count, const GLfloat *v)
243{
Jiajia Qinee9f08c2016-11-16 10:06:10 +0800244 if (mFunctions->programUniform2fv != nullptr)
245 {
246 mFunctions->programUniform2fv(mProgramID, uniLoc(location), count, v);
247 }
248 else
249 {
250 mStateManager->useProgram(mProgramID);
251 mFunctions->uniform2fv(uniLoc(location), count, v);
252 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500253}
254
255void ProgramGL::setUniform3fv(GLint location, GLsizei count, const GLfloat *v)
256{
Jiajia Qinee9f08c2016-11-16 10:06:10 +0800257 if (mFunctions->programUniform3fv != nullptr)
258 {
259 mFunctions->programUniform3fv(mProgramID, uniLoc(location), count, v);
260 }
261 else
262 {
263 mStateManager->useProgram(mProgramID);
264 mFunctions->uniform3fv(uniLoc(location), count, v);
265 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500266}
267
268void ProgramGL::setUniform4fv(GLint location, GLsizei count, const GLfloat *v)
269{
Jiajia Qinee9f08c2016-11-16 10:06:10 +0800270 if (mFunctions->programUniform4fv != nullptr)
271 {
272 mFunctions->programUniform4fv(mProgramID, uniLoc(location), count, v);
273 }
274 else
275 {
276 mStateManager->useProgram(mProgramID);
277 mFunctions->uniform4fv(uniLoc(location), count, v);
278 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500279}
280
281void ProgramGL::setUniform1iv(GLint location, GLsizei count, const GLint *v)
282{
Jiajia Qinee9f08c2016-11-16 10:06:10 +0800283 if (mFunctions->programUniform1iv != nullptr)
284 {
285 mFunctions->programUniform1iv(mProgramID, uniLoc(location), count, v);
286 }
287 else
288 {
289 mStateManager->useProgram(mProgramID);
290 mFunctions->uniform1iv(uniLoc(location), count, v);
291 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500292}
293
294void ProgramGL::setUniform2iv(GLint location, GLsizei count, const GLint *v)
295{
Jiajia Qinee9f08c2016-11-16 10:06:10 +0800296 if (mFunctions->programUniform2iv != nullptr)
297 {
298 mFunctions->programUniform2iv(mProgramID, uniLoc(location), count, v);
299 }
300 else
301 {
302 mStateManager->useProgram(mProgramID);
303 mFunctions->uniform2iv(uniLoc(location), count, v);
304 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500305}
306
307void ProgramGL::setUniform3iv(GLint location, GLsizei count, const GLint *v)
308{
Jiajia Qinee9f08c2016-11-16 10:06:10 +0800309 if (mFunctions->programUniform3iv != nullptr)
310 {
311 mFunctions->programUniform3iv(mProgramID, uniLoc(location), count, v);
312 }
313 else
314 {
315 mStateManager->useProgram(mProgramID);
316 mFunctions->uniform3iv(uniLoc(location), count, v);
317 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500318}
319
320void ProgramGL::setUniform4iv(GLint location, GLsizei count, const GLint *v)
321{
Jiajia Qinee9f08c2016-11-16 10:06:10 +0800322 if (mFunctions->programUniform4iv != nullptr)
323 {
324 mFunctions->programUniform4iv(mProgramID, uniLoc(location), count, v);
325 }
326 else
327 {
328 mStateManager->useProgram(mProgramID);
329 mFunctions->uniform4iv(uniLoc(location), count, v);
330 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500331}
332
333void ProgramGL::setUniform1uiv(GLint location, GLsizei count, const GLuint *v)
334{
Jiajia Qinee9f08c2016-11-16 10:06:10 +0800335 if (mFunctions->programUniform1uiv != nullptr)
336 {
337 mFunctions->programUniform1uiv(mProgramID, uniLoc(location), count, v);
338 }
339 else
340 {
341 mStateManager->useProgram(mProgramID);
342 mFunctions->uniform1uiv(uniLoc(location), count, v);
343 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500344}
345
346void ProgramGL::setUniform2uiv(GLint location, GLsizei count, const GLuint *v)
347{
Jiajia Qinee9f08c2016-11-16 10:06:10 +0800348 if (mFunctions->programUniform2uiv != nullptr)
349 {
350 mFunctions->programUniform2uiv(mProgramID, uniLoc(location), count, v);
351 }
352 else
353 {
354 mStateManager->useProgram(mProgramID);
355 mFunctions->uniform2uiv(uniLoc(location), count, v);
356 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500357}
358
359void ProgramGL::setUniform3uiv(GLint location, GLsizei count, const GLuint *v)
360{
Jiajia Qinee9f08c2016-11-16 10:06:10 +0800361 if (mFunctions->programUniform3uiv != nullptr)
362 {
363 mFunctions->programUniform3uiv(mProgramID, uniLoc(location), count, v);
364 }
365 else
366 {
367 mStateManager->useProgram(mProgramID);
368 mFunctions->uniform3uiv(uniLoc(location), count, v);
369 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500370}
371
372void ProgramGL::setUniform4uiv(GLint location, GLsizei count, const GLuint *v)
373{
Jiajia Qinee9f08c2016-11-16 10:06:10 +0800374 if (mFunctions->programUniform4uiv != nullptr)
375 {
376 mFunctions->programUniform4uiv(mProgramID, uniLoc(location), count, v);
377 }
378 else
379 {
380 mStateManager->useProgram(mProgramID);
381 mFunctions->uniform4uiv(uniLoc(location), count, v);
382 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500383}
384
385void ProgramGL::setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
386{
Jiajia Qinee9f08c2016-11-16 10:06:10 +0800387 if (mFunctions->programUniformMatrix2fv != nullptr)
388 {
389 mFunctions->programUniformMatrix2fv(mProgramID, uniLoc(location), count, transpose, value);
390 }
391 else
392 {
393 mStateManager->useProgram(mProgramID);
394 mFunctions->uniformMatrix2fv(uniLoc(location), count, transpose, value);
395 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500396}
397
398void ProgramGL::setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
399{
Jiajia Qinee9f08c2016-11-16 10:06:10 +0800400 if (mFunctions->programUniformMatrix3fv != nullptr)
401 {
402 mFunctions->programUniformMatrix3fv(mProgramID, uniLoc(location), count, transpose, value);
403 }
404 else
405 {
406 mStateManager->useProgram(mProgramID);
407 mFunctions->uniformMatrix3fv(uniLoc(location), count, transpose, value);
408 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500409}
410
411void ProgramGL::setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
412{
Jiajia Qinee9f08c2016-11-16 10:06:10 +0800413 if (mFunctions->programUniformMatrix4fv != nullptr)
414 {
415 mFunctions->programUniformMatrix4fv(mProgramID, uniLoc(location), count, transpose, value);
416 }
417 else
418 {
419 mStateManager->useProgram(mProgramID);
420 mFunctions->uniformMatrix4fv(uniLoc(location), count, transpose, value);
421 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500422}
423
424void ProgramGL::setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
425{
Jiajia Qinee9f08c2016-11-16 10:06:10 +0800426 if (mFunctions->programUniformMatrix2x3fv != nullptr)
427 {
428 mFunctions->programUniformMatrix2x3fv(mProgramID, uniLoc(location), count, transpose,
429 value);
430 }
431 else
432 {
433 mStateManager->useProgram(mProgramID);
434 mFunctions->uniformMatrix2x3fv(uniLoc(location), count, transpose, value);
435 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500436}
437
438void ProgramGL::setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
439{
Jiajia Qinee9f08c2016-11-16 10:06:10 +0800440 if (mFunctions->programUniformMatrix3x2fv != nullptr)
441 {
442 mFunctions->programUniformMatrix3x2fv(mProgramID, uniLoc(location), count, transpose,
443 value);
444 }
445 else
446 {
447 mStateManager->useProgram(mProgramID);
448 mFunctions->uniformMatrix3x2fv(uniLoc(location), count, transpose, value);
449 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500450}
451
452void ProgramGL::setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
453{
Jiajia Qinee9f08c2016-11-16 10:06:10 +0800454 if (mFunctions->programUniformMatrix2x4fv != nullptr)
455 {
456 mFunctions->programUniformMatrix2x4fv(mProgramID, uniLoc(location), count, transpose,
457 value);
458 }
459 else
460 {
461 mStateManager->useProgram(mProgramID);
462 mFunctions->uniformMatrix2x4fv(uniLoc(location), count, transpose, value);
463 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500464}
465
466void ProgramGL::setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
467{
Jiajia Qinee9f08c2016-11-16 10:06:10 +0800468 if (mFunctions->programUniformMatrix4x2fv != nullptr)
469 {
470 mFunctions->programUniformMatrix4x2fv(mProgramID, uniLoc(location), count, transpose,
471 value);
472 }
473 else
474 {
475 mStateManager->useProgram(mProgramID);
476 mFunctions->uniformMatrix4x2fv(uniLoc(location), count, transpose, value);
477 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500478}
479
480void ProgramGL::setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
481{
Jiajia Qinee9f08c2016-11-16 10:06:10 +0800482 if (mFunctions->programUniformMatrix3x4fv != nullptr)
483 {
484 mFunctions->programUniformMatrix3x4fv(mProgramID, uniLoc(location), count, transpose,
485 value);
486 }
487 else
488 {
489 mStateManager->useProgram(mProgramID);
490 mFunctions->uniformMatrix3x4fv(uniLoc(location), count, transpose, value);
491 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500492}
493
494void ProgramGL::setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
495{
Jiajia Qinee9f08c2016-11-16 10:06:10 +0800496 if (mFunctions->programUniformMatrix4x3fv != nullptr)
497 {
498 mFunctions->programUniformMatrix4x3fv(mProgramID, uniLoc(location), count, transpose,
499 value);
500 }
501 else
502 {
503 mStateManager->useProgram(mProgramID);
504 mFunctions->uniformMatrix4x3fv(uniLoc(location), count, transpose, value);
505 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500506}
507
Geoff Lang5d124a62015-09-15 13:03:27 -0400508void ProgramGL::setUniformBlockBinding(GLuint uniformBlockIndex, GLuint uniformBlockBinding)
509{
Jamie Madill4a3c2342015-10-08 12:58:45 -0400510 // Lazy init
511 if (mUniformBlockRealLocationMap.empty())
512 {
Jamie Madill48ef11b2016-04-27 15:21:52 -0400513 mUniformBlockRealLocationMap.reserve(mState.getUniformBlocks().size());
Jiajia Qin729b2c62017-08-14 09:36:11 +0800514 for (const gl::InterfaceBlock &uniformBlock : mState.getUniformBlocks())
Jamie Madill4a3c2342015-10-08 12:58:45 -0400515 {
Olli Etuaho855d9642017-05-17 14:05:06 +0300516 const std::string &mappedNameWithIndex = uniformBlock.mappedNameWithArrayIndex();
517 GLuint blockIndex =
518 mFunctions->getUniformBlockIndex(mProgramID, mappedNameWithIndex.c_str());
Jamie Madill4a3c2342015-10-08 12:58:45 -0400519 mUniformBlockRealLocationMap.push_back(blockIndex);
520 }
521 }
522
523 GLuint realBlockIndex = mUniformBlockRealLocationMap[uniformBlockIndex];
524 if (realBlockIndex != GL_INVALID_INDEX)
525 {
526 mFunctions->uniformBlockBinding(mProgramID, realBlockIndex, uniformBlockBinding);
527 }
Geoff Lang5d124a62015-09-15 13:03:27 -0400528}
529
Geoff Langb1f435e2015-02-20 10:01:01 -0500530GLuint ProgramGL::getProgramID() const
531{
532 return mProgramID;
533}
534
Olli Etuaho855d9642017-05-17 14:05:06 +0300535bool ProgramGL::getUniformBlockSize(const std::string & /* blockName */,
536 const std::string &blockMappedName,
537 size_t *sizeOut) const
Jamie Madill62d31cb2015-09-11 13:25:51 -0400538{
Jamie Madill4a3c2342015-10-08 12:58:45 -0400539 ASSERT(mProgramID != 0u);
Geoff Lang5d124a62015-09-15 13:03:27 -0400540
Olli Etuaho855d9642017-05-17 14:05:06 +0300541 GLuint blockIndex = mFunctions->getUniformBlockIndex(mProgramID, blockMappedName.c_str());
Jamie Madill4a3c2342015-10-08 12:58:45 -0400542 if (blockIndex == GL_INVALID_INDEX)
Geoff Lang5d124a62015-09-15 13:03:27 -0400543 {
Jamie Madill4a3c2342015-10-08 12:58:45 -0400544 *sizeOut = 0;
545 return false;
Geoff Lang5d124a62015-09-15 13:03:27 -0400546 }
547
Jamie Madill4a3c2342015-10-08 12:58:45 -0400548 GLint dataSize = 0;
549 mFunctions->getActiveUniformBlockiv(mProgramID, blockIndex, GL_UNIFORM_BLOCK_DATA_SIZE,
550 &dataSize);
551 *sizeOut = static_cast<size_t>(dataSize);
552 return true;
553}
554
Olli Etuaho855d9642017-05-17 14:05:06 +0300555bool ProgramGL::getUniformBlockMemberInfo(const std::string & /* memberUniformName */,
556 const std::string &memberUniformMappedName,
Jamie Madill4a3c2342015-10-08 12:58:45 -0400557 sh::BlockMemberInfo *memberInfoOut) const
558{
559 GLuint uniformIndex;
Olli Etuaho855d9642017-05-17 14:05:06 +0300560 const GLchar *memberNameGLStr = memberUniformMappedName.c_str();
Jamie Madill4a3c2342015-10-08 12:58:45 -0400561 mFunctions->getUniformIndices(mProgramID, 1, &memberNameGLStr, &uniformIndex);
562
563 if (uniformIndex == GL_INVALID_INDEX)
Geoff Lang5d124a62015-09-15 13:03:27 -0400564 {
Jamie Madill4a3c2342015-10-08 12:58:45 -0400565 *memberInfoOut = sh::BlockMemberInfo::getDefaultBlockInfo();
566 return false;
Geoff Lang5d124a62015-09-15 13:03:27 -0400567 }
Jamie Madill4a3c2342015-10-08 12:58:45 -0400568
569 mFunctions->getActiveUniformsiv(mProgramID, 1, &uniformIndex, GL_UNIFORM_OFFSET,
570 &memberInfoOut->offset);
571 mFunctions->getActiveUniformsiv(mProgramID, 1, &uniformIndex, GL_UNIFORM_ARRAY_STRIDE,
572 &memberInfoOut->arrayStride);
573 mFunctions->getActiveUniformsiv(mProgramID, 1, &uniformIndex, GL_UNIFORM_MATRIX_STRIDE,
574 &memberInfoOut->matrixStride);
575
576 // TODO(jmadill): possibly determine this at the gl::Program level.
577 GLint isRowMajorMatrix = 0;
578 mFunctions->getActiveUniformsiv(mProgramID, 1, &uniformIndex, GL_UNIFORM_IS_ROW_MAJOR,
579 &isRowMajorMatrix);
Geoff Lang92019432017-11-20 13:09:34 -0500580 memberInfoOut->isRowMajorMatrix = gl::ConvertToBool(isRowMajorMatrix);
Jamie Madill4a3c2342015-10-08 12:58:45 -0400581 return true;
Jamie Madill62d31cb2015-09-11 13:25:51 -0400582}
Jamie Madill4a3c2342015-10-08 12:58:45 -0400583
Jiajia Qin3a9090f2017-09-27 14:37:04 +0800584bool ProgramGL::getShaderStorageBlockMemberInfo(const std::string & /* memberName */,
585 const std::string &memberUniformMappedName,
586 sh::BlockMemberInfo *memberInfoOut) const
587{
588 const GLchar *memberNameGLStr = memberUniformMappedName.c_str();
589 GLuint index =
590 mFunctions->getProgramResourceIndex(mProgramID, GL_BUFFER_VARIABLE, memberNameGLStr);
591
592 if (index == GL_INVALID_INDEX)
593 {
594 *memberInfoOut = sh::BlockMemberInfo::getDefaultBlockInfo();
595 return false;
596 }
597
598 constexpr int kPropCount = 5;
599 std::array<GLenum, kPropCount> props = {
600 {GL_ARRAY_STRIDE, GL_IS_ROW_MAJOR, GL_MATRIX_STRIDE, GL_OFFSET, GL_TOP_LEVEL_ARRAY_STRIDE}};
601 std::array<GLint, kPropCount> params;
602 GLsizei length;
603 mFunctions->getProgramResourceiv(mProgramID, GL_BUFFER_VARIABLE, index, kPropCount,
604 props.data(), kPropCount, &length, params.data());
605 ASSERT(kPropCount == length);
606 memberInfoOut->arrayStride = params[0];
Olli Etuahoc4eca922017-11-13 12:27:23 +0200607 memberInfoOut->isRowMajorMatrix = params[1] != 0;
Jiajia Qin3a9090f2017-09-27 14:37:04 +0800608 memberInfoOut->matrixStride = params[2];
609 memberInfoOut->offset = params[3];
610 memberInfoOut->topLevelArrayStride = params[4];
611
612 return true;
613}
614
615bool ProgramGL::getShaderStorageBlockSize(const std::string &name,
616 const std::string &mappedName,
617 size_t *sizeOut) const
618{
619 const GLchar *nameGLStr = mappedName.c_str();
620 GLuint index =
621 mFunctions->getProgramResourceIndex(mProgramID, GL_SHADER_STORAGE_BLOCK, nameGLStr);
622
623 if (index == GL_INVALID_INDEX)
624 {
625 *sizeOut = 0;
626 return false;
627 }
628
629 GLenum prop = GL_BUFFER_DATA_SIZE;
630 GLsizei length = 0;
631 GLint dataSize = 0;
632 mFunctions->getProgramResourceiv(mProgramID, GL_SHADER_STORAGE_BLOCK, index, 1, &prop, 1,
633 &length, &dataSize);
634 *sizeOut = static_cast<size_t>(dataSize);
635 return true;
636}
637
Sami Väisänen46eaa942016-06-29 10:26:37 +0300638void ProgramGL::setPathFragmentInputGen(const std::string &inputName,
639 GLenum genMode,
640 GLint components,
641 const GLfloat *coeffs)
642{
643 ASSERT(mEnablePathRendering);
644
645 for (const auto &input : mPathRenderingFragmentInputs)
646 {
Olli Etuaho855d9642017-05-17 14:05:06 +0300647 if (input.mappedName == inputName)
Sami Väisänen46eaa942016-06-29 10:26:37 +0300648 {
649 mFunctions->programPathFragmentInputGenNV(mProgramID, input.location, genMode,
650 components, coeffs);
651 ASSERT(mFunctions->getError() == GL_NO_ERROR);
652 return;
653 }
654 }
655
656}
657
Geoff Lang65a0be92015-10-02 09:57:30 -0400658void ProgramGL::preLink()
659{
660 // Reset the program state
661 mUniformRealLocationMap.clear();
662 mUniformBlockRealLocationMap.clear();
Sami Väisänen46eaa942016-06-29 10:26:37 +0300663 mPathRenderingFragmentInputs.clear();
Martin Radev4e619f52017-08-09 11:50:06 +0300664
665 mMultiviewBaseViewLayerIndexUniformLocation = -1;
Geoff Lang65a0be92015-10-02 09:57:30 -0400666}
667
668bool ProgramGL::checkLinkStatus(gl::InfoLog &infoLog)
669{
670 GLint linkStatus = GL_FALSE;
671 mFunctions->getProgramiv(mProgramID, GL_LINK_STATUS, &linkStatus);
672 if (linkStatus == GL_FALSE)
673 {
674 // Linking failed, put the error into the info log
675 GLint infoLogLength = 0;
676 mFunctions->getProgramiv(mProgramID, GL_INFO_LOG_LENGTH, &infoLogLength);
677
Geoff Lang65a0be92015-10-02 09:57:30 -0400678 // Info log length includes the null terminator, so 1 means that the info log is an empty
679 // string.
680 if (infoLogLength > 1)
681 {
682 std::vector<char> buf(infoLogLength);
683 mFunctions->getProgramInfoLog(mProgramID, infoLogLength, nullptr, &buf[0]);
684
685 mFunctions->deleteProgram(mProgramID);
686 mProgramID = 0;
687
688 infoLog << buf.data();
689
Yuly Novikovbcb3f9b2017-01-27 22:45:18 -0500690 WARN() << "Program link failed unexpectedly: " << buf.data();
Geoff Lang65a0be92015-10-02 09:57:30 -0400691 }
692 else
693 {
Yuly Novikovbcb3f9b2017-01-27 22:45:18 -0500694 WARN() << "Program link failed unexpectedly with no info log.";
Geoff Lang65a0be92015-10-02 09:57:30 -0400695 }
Geoff Lang65a0be92015-10-02 09:57:30 -0400696
697 // TODO, return GL_OUT_OF_MEMORY or just fail the link? This is an unexpected case
698 return false;
699 }
700
701 return true;
702}
703
704void ProgramGL::postLink()
705{
706 // Query the uniform information
707 ASSERT(mUniformRealLocationMap.empty());
Jamie Madill48ef11b2016-04-27 15:21:52 -0400708 const auto &uniformLocations = mState.getUniformLocations();
709 const auto &uniforms = mState.getUniforms();
Geoff Lang65a0be92015-10-02 09:57:30 -0400710 mUniformRealLocationMap.resize(uniformLocations.size(), GL_INVALID_INDEX);
711 for (size_t uniformLocation = 0; uniformLocation < uniformLocations.size(); uniformLocation++)
712 {
713 const auto &entry = uniformLocations[uniformLocation];
Jamie Madillfb997ec2017-09-20 15:44:27 -0400714 if (!entry.used())
Geoff Lang65a0be92015-10-02 09:57:30 -0400715 {
716 continue;
717 }
718
Olli Etuahoc8538042017-09-27 11:20:15 +0300719 // From the GLES 3.0.5 spec:
Geoff Lang65a0be92015-10-02 09:57:30 -0400720 // "Locations for sequential array indices are not required to be sequential."
721 const gl::LinkedUniform &uniform = uniforms[entry.index];
722 std::stringstream fullNameStr;
Geoff Lang65a0be92015-10-02 09:57:30 -0400723 if (uniform.isArray())
724 {
Olli Etuahod2551232017-10-26 20:03:33 +0300725 ASSERT(angle::EndsWith(uniform.mappedName, "[0]"));
726 fullNameStr << uniform.mappedName.substr(0, uniform.mappedName.length() - 3);
Olli Etuaho1734e172017-10-27 15:30:27 +0300727 fullNameStr << "[" << entry.arrayIndex << "]";
Olli Etuahod2551232017-10-26 20:03:33 +0300728 }
729 else
730 {
731 fullNameStr << uniform.mappedName;
Geoff Lang65a0be92015-10-02 09:57:30 -0400732 }
733 const std::string &fullName = fullNameStr.str();
734
735 GLint realLocation = mFunctions->getUniformLocation(mProgramID, fullName.c_str());
736 mUniformRealLocationMap[uniformLocation] = realLocation;
737 }
738
Martin Radev4e619f52017-08-09 11:50:06 +0300739 if (mState.usesMultiview())
740 {
741 mMultiviewBaseViewLayerIndexUniformLocation =
Olli Etuaho855d9642017-05-17 14:05:06 +0300742 mFunctions->getUniformLocation(mProgramID, "multiviewBaseViewLayerIndex");
Martin Radev4e619f52017-08-09 11:50:06 +0300743 ASSERT(mMultiviewBaseViewLayerIndexUniformLocation != -1);
744 }
745
Sami Väisänen46eaa942016-06-29 10:26:37 +0300746 // Discover CHROMIUM_path_rendering fragment inputs if enabled.
747 if (!mEnablePathRendering)
748 return;
749
750 GLint numFragmentInputs = 0;
751 mFunctions->getProgramInterfaceiv(mProgramID, GL_FRAGMENT_INPUT_NV, GL_ACTIVE_RESOURCES,
752 &numFragmentInputs);
753 if (numFragmentInputs <= 0)
754 return;
755
756 GLint maxNameLength = 0;
757 mFunctions->getProgramInterfaceiv(mProgramID, GL_FRAGMENT_INPUT_NV, GL_MAX_NAME_LENGTH,
758 &maxNameLength);
759 ASSERT(maxNameLength);
760
761 for (GLint i = 0; i < numFragmentInputs; ++i)
762 {
Olli Etuaho855d9642017-05-17 14:05:06 +0300763 std::string mappedName;
764 mappedName.resize(maxNameLength);
Sami Väisänen46eaa942016-06-29 10:26:37 +0300765
766 GLsizei nameLen = 0;
767 mFunctions->getProgramResourceName(mProgramID, GL_FRAGMENT_INPUT_NV, i, maxNameLength,
Olli Etuaho855d9642017-05-17 14:05:06 +0300768 &nameLen, &mappedName[0]);
769 mappedName.resize(nameLen);
Sami Väisänen46eaa942016-06-29 10:26:37 +0300770
771 // Ignore built-ins
Olli Etuaho855d9642017-05-17 14:05:06 +0300772 if (angle::BeginsWith(mappedName, "gl_"))
Sami Väisänen46eaa942016-06-29 10:26:37 +0300773 continue;
774
775 const GLenum kQueryProperties[] = {GL_LOCATION, GL_ARRAY_SIZE};
776 GLint queryResults[ArraySize(kQueryProperties)];
777 GLsizei queryLength = 0;
778
Geoff Lang3f6a3982016-07-15 15:20:45 -0400779 mFunctions->getProgramResourceiv(
780 mProgramID, GL_FRAGMENT_INPUT_NV, i, static_cast<GLsizei>(ArraySize(kQueryProperties)),
781 kQueryProperties, static_cast<GLsizei>(ArraySize(queryResults)), &queryLength,
782 queryResults);
Sami Väisänen46eaa942016-06-29 10:26:37 +0300783
Olli Etuahoe3191712016-07-18 16:01:10 +0300784 ASSERT(queryLength == static_cast<GLsizei>(ArraySize(kQueryProperties)));
Sami Väisänen46eaa942016-06-29 10:26:37 +0300785
Geoff Lang3f6a3982016-07-15 15:20:45 -0400786 PathRenderingFragmentInput baseElementInput;
Olli Etuaho855d9642017-05-17 14:05:06 +0300787 baseElementInput.mappedName = mappedName;
Geoff Lang3f6a3982016-07-15 15:20:45 -0400788 baseElementInput.location = queryResults[0];
789 mPathRenderingFragmentInputs.push_back(std::move(baseElementInput));
Sami Väisänen46eaa942016-06-29 10:26:37 +0300790
791 // If the input is an array it's denoted by [0] suffix on the variable
792 // name. We'll then create an entry per each array index where index > 0
Olli Etuaho855d9642017-05-17 14:05:06 +0300793 if (angle::EndsWith(mappedName, "[0]"))
Sami Väisänen46eaa942016-06-29 10:26:37 +0300794 {
795 // drop the suffix
Olli Etuaho855d9642017-05-17 14:05:06 +0300796 mappedName.resize(mappedName.size() - 3);
Sami Väisänen46eaa942016-06-29 10:26:37 +0300797
798 const auto arraySize = queryResults[1];
799 const auto baseLocation = queryResults[0];
800
Geoff Lang3f6a3982016-07-15 15:20:45 -0400801 for (GLint arrayIndex = 1; arrayIndex < arraySize; ++arrayIndex)
Sami Väisänen46eaa942016-06-29 10:26:37 +0300802 {
Geoff Lang3f6a3982016-07-15 15:20:45 -0400803 PathRenderingFragmentInput arrayElementInput;
Olli Etuaho855d9642017-05-17 14:05:06 +0300804 arrayElementInput.mappedName = mappedName + "[" + ToString(arrayIndex) + "]";
Geoff Lang3f6a3982016-07-15 15:20:45 -0400805 arrayElementInput.location = baseLocation + arrayIndex;
806 mPathRenderingFragmentInputs.push_back(std::move(arrayElementInput));
Sami Väisänen46eaa942016-06-29 10:26:37 +0300807 }
808 }
809 }
Geoff Lang65a0be92015-10-02 09:57:30 -0400810}
811
Martin Radev4e619f52017-08-09 11:50:06 +0300812void ProgramGL::enableSideBySideRenderingPath() const
813{
814 ASSERT(mState.usesMultiview());
815 ASSERT(mMultiviewBaseViewLayerIndexUniformLocation != -1);
816
817 ASSERT(mFunctions->programUniform1i != nullptr);
818 mFunctions->programUniform1i(mProgramID, mMultiviewBaseViewLayerIndexUniformLocation, -1);
819}
820
821void ProgramGL::enableLayeredRenderingPath(int baseViewIndex) const
822{
823 ASSERT(mState.usesMultiview());
824 ASSERT(mMultiviewBaseViewLayerIndexUniformLocation != -1);
825
826 ASSERT(mFunctions->programUniform1i != nullptr);
827 mFunctions->programUniform1i(mProgramID, mMultiviewBaseViewLayerIndexUniformLocation,
828 baseViewIndex);
829}
830
Jamie Madill54164b02017-08-28 15:17:37 -0400831void ProgramGL::getUniformfv(const gl::Context *context, GLint location, GLfloat *params) const
832{
833 mFunctions->getUniformfv(mProgramID, uniLoc(location), params);
834}
835
836void ProgramGL::getUniformiv(const gl::Context *context, GLint location, GLint *params) const
837{
838 mFunctions->getUniformiv(mProgramID, uniLoc(location), params);
839}
840
841void ProgramGL::getUniformuiv(const gl::Context *context, GLint location, GLuint *params) const
842{
843 mFunctions->getUniformuiv(mProgramID, uniLoc(location), params);
844}
845
Jamie Madillfb997ec2017-09-20 15:44:27 -0400846void ProgramGL::markUnusedUniformLocations(std::vector<gl::VariableLocation> *uniformLocations,
847 std::vector<gl::SamplerBinding> *samplerBindings)
Jamie Madill54164b02017-08-28 15:17:37 -0400848{
849 GLint maxLocation = static_cast<GLint>(uniformLocations->size());
850 for (GLint location = 0; location < maxLocation; ++location)
851 {
852 if (uniLoc(location) == -1)
853 {
Jamie Madillfb997ec2017-09-20 15:44:27 -0400854 auto &locationRef = (*uniformLocations)[location];
855 if (mState.isSamplerUniformIndex(locationRef.index))
856 {
857 GLuint samplerIndex = mState.getSamplerIndexFromUniformIndex(locationRef.index);
858 (*samplerBindings)[samplerIndex].unreferenced = true;
859 }
860 locationRef.markUnused();
Jamie Madill54164b02017-08-28 15:17:37 -0400861 }
862 }
863}
864
Jamie Madill6db1c2e2017-11-08 09:17:40 -0500865void ProgramGL::linkResources(const gl::ProgramLinkedResources &resources)
866{
867 // Gather interface block info.
868 auto getUniformBlockSize = [this](const std::string &name, const std::string &mappedName,
869 size_t *sizeOut) {
870 return this->getUniformBlockSize(name, mappedName, sizeOut);
871 };
872
873 auto getUniformBlockMemberInfo = [this](const std::string &name, const std::string &mappedName,
874 sh::BlockMemberInfo *infoOut) {
875 return this->getUniformBlockMemberInfo(name, mappedName, infoOut);
876 };
877
878 resources.uniformBlockLinker.linkBlocks(getUniformBlockSize, getUniformBlockMemberInfo);
879
Jiajia Qin3a9090f2017-09-27 14:37:04 +0800880 auto getShaderStorageBlockSize = [this](const std::string &name, const std::string &mappedName,
881 size_t *sizeOut) {
882 return this->getShaderStorageBlockSize(name, mappedName, sizeOut);
Jamie Madill6db1c2e2017-11-08 09:17:40 -0500883 };
884
Jiajia Qin3a9090f2017-09-27 14:37:04 +0800885 auto getShaderStorageBlockMemberInfo = [this](const std::string &name,
886 const std::string &mappedName,
887 sh::BlockMemberInfo *infoOut) {
888 return this->getShaderStorageBlockMemberInfo(name, mappedName, infoOut);
889 };
Jamie Madill6db1c2e2017-11-08 09:17:40 -0500890 resources.shaderStorageBlockLinker.linkBlocks(getShaderStorageBlockSize,
891 getShaderStorageBlockMemberInfo);
892}
893
Jamie Madill4a3c2342015-10-08 12:58:45 -0400894} // namespace rx