From: Samuel Pitoiset Date: Wed, 14 Jun 2017 09:27:44 +0000 (+0200) Subject: mesa: add KHR_no_error support for gl*UniformHandleui64*ARB X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=10d104207acdf78e76e329041852c2eae9765cec;p=mesa.git 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 Reviewed-by: Timothy Arceri --- 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;