Add getUniform impl methods.
This will let us remove some of the uniform data management code in
the GL front-end, and simplify the GL back-end. It will also enable
us to implement uniform data more efficiently in the D3D11 back-end,
and probably Vulkan back-end later.
This also implements a new impl method for the ProgramGL class to
flag optimized-out uniforms as no longer used, post-link. This is
important because otherwise the optimized uniforms get assigned
valid locations, and then the getUniform calls are expected to
succeed.
We also use a workaround for uniform value queries for the GL
back-end. It seems as though some drivers (seen on NVIDIA and AMD)
may not properly clamp to the maximum representable integer value
when querying out-of-range floating point values. Work around this by
always calling the driver with the proper type and then casting the
value in ANGLE.
BUG=angleproject:1390
Change-Id: I03dc2382e7af52455c356a2bf3971a4d1bd46ec6
Reviewed-on: https://chromium-review.googlesource.com/616785
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/Program.h b/src/libANGLE/Program.h
index 3690fb7..fb97643 100644
--- a/src/libANGLE/Program.h
+++ b/src/libANGLE/Program.h
@@ -171,8 +171,8 @@
// This small structure encapsulates binding sampler uniforms to active GL textures.
struct SamplerBinding
{
- SamplerBinding(GLenum textureTypeIn, size_t elementCount)
- : textureType(textureTypeIn), boundTextureUnits(elementCount, 0)
+ SamplerBinding(GLenum textureTypeIn, size_t elementCount, bool unreferenced)
+ : textureType(textureTypeIn), boundTextureUnits(elementCount, 0), unreferenced(unreferenced)
{
}
@@ -181,6 +181,9 @@
// List of all textures bound to this sampler, of type textureType.
std::vector<GLuint> boundTextureUnits;
+
+ // A note if this sampler is an unreferenced uniform.
+ bool unreferenced;
};
// A varying with tranform feedback enabled. If it's an array, either the whole array or one of its
@@ -457,9 +460,9 @@
void setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
void setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void getUniformfv(GLint location, GLfloat *params) const;
- void getUniformiv(GLint location, GLint *params) const;
- void getUniformuiv(GLint location, GLuint *params) const;
+ void getUniformfv(const Context *context, GLint location, GLfloat *params) const;
+ void getUniformiv(const Context *context, GLint location, GLint *params) const;
+ void getUniformuiv(const Context *context, GLint location, GLuint *params) const;
void getActiveUniformBlockName(GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName) const;
GLuint getActiveUniformBlockCount() const;
@@ -627,7 +630,11 @@
const T *v);
template <typename DestT>
- void getUniformInternal(GLint location, DestT *dataOut) const;
+ void getUniformInternal(const Context *context,
+ DestT *dataOut,
+ GLint location,
+ GLenum nativeType,
+ int components) const;
ProgramState mState;
rx::ProgramImpl *mProgram;