diff options
author | Samuel Pitoiset <[email protected]> | 2017-06-14 11:27:44 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-06-18 14:21:05 +0200 |
commit | 10d104207acdf78e76e329041852c2eae9765cec (patch) | |
tree | a2b0b44cbe0a9b1e8417e32ef6f8ceee20c94185 /src/mesa/main | |
parent | 304de4edb941e42aa37002b1ca598647f5cd248f (diff) |
mesa: add KHR_no_error support for gl*UniformHandleui64*ARB
Similar to _mesa_uniform() except that we have to call
validate_uniform_parameters() instead of validate_uniform().
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/uniform_query.cpp | 58 |
1 files 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; |