[Mesa-dev] [PATCH 5/5] mesa: add KHR_no_error support for gl*UniformHandleui64*ARB

Samuel Pitoiset samuel.pitoiset at gmail.com
Wed Jun 14 09:27:44 UTC 2017


Similar to _mesa_uniform() except that we have to call
validate_uniform_parameters() instead of validate_uniform().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/mesa/main/uniform_query.cpp | 58 +++++++++++++++++++++++++++--------------
 1 file changed, 39 insertions(+), 19 deletions(-)

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index fed33df6fb0..37c130ac310 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -1359,28 +1359,48 @@ _mesa_uniform_handle(GLint location, GLsizei count, const GLvoid *values,
                      struct gl_context *ctx, struct gl_shader_program *shProg)
 {
    unsigned offset;
-   struct gl_uniform_storage *const uni =
-      validate_uniform_parameters(location, count, &offset,
-                                  ctx, shProg, "glUniformHandleui64*ARB");
-   if (uni == NULL)
-      return;
+   struct gl_uniform_storage *uni;
 
-   if (!uni->is_bindless) {
-      /* From section "Errors" of the ARB_bindless_texture spec:
-       *
-       * "The error INVALID_OPERATION is generated by
-       *  UniformHandleui64{v}ARB if the sampler or image uniform being
-       *  updated has the "bound_sampler" or "bound_image" layout qualifier."
-       *
-       * From section 4.4.6 of the ARB_bindless_texture spec:
+   if (_mesa_is_no_error_enabled(ctx)) {
+      /* From Section 7.6 (UNIFORM VARIABLES) of the OpenGL 4.5 spec:
        *
-       * "In the absence of these qualifiers, sampler and image uniforms are
-       *  considered "bound". Additionally, if GL_ARB_bindless_texture is not
-       *  enabled, these uniforms are considered "bound"."
+       *   "If the value of location is -1, the Uniform* commands will
+       *   silently ignore the data passed in, and the current uniform values
+       *   will not be changed.
        */
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glUniformHandleui64*ARB(non-bindless sampler/image uniform)");
-      return;
+      if (location == -1)
+         return;
+
+      uni = shProg->UniformRemapTable[location];
+
+      /* The array index specified by the uniform location is just the
+       * uniform location minus the base location of of the uniform.
+       */
+      assert(uni->array_elements > 0 || location == (int)uni->remap_location);
+      offset = location - uni->remap_location;
+   } else {
+      uni = validate_uniform_parameters(location, count, &offset,
+                                        ctx, shProg, "glUniformHandleui64*ARB");
+      if (!uni)
+         return;
+
+      if (!uni->is_bindless) {
+         /* From section "Errors" of the ARB_bindless_texture spec:
+          *
+          * "The error INVALID_OPERATION is generated by
+          *  UniformHandleui64{v}ARB if the sampler or image uniform being
+          *  updated has the "bound_sampler" or "bound_image" layout qualifier."
+          *
+          * From section 4.4.6 of the ARB_bindless_texture spec:
+          *
+          * "In the absence of these qualifiers, sampler and image uniforms are
+          *  considered "bound". Additionally, if GL_ARB_bindless_texture is
+          *  not enabled, these uniforms are considered "bound"."
+          */
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glUniformHandleui64*ARB(non-bindless sampler/image uniform)");
+         return;
+      }
    }
 
    const unsigned components = uni->type->vector_elements;
-- 
2.13.1



More information about the mesa-dev mailing list