[Mesa-dev] [PATCH] mesa: validate the indirect param before the shader in DispatchComputeIndirect
Ilia Mirkin
imirkin at alum.mit.edu
Mon Aug 22 15:22:06 UTC 2016
Both direct and indirect compute match right now - both check the
program, and then check the "other" parameters. If this change is
made, I believe that _mesa_validate_DispatchCompute should be adjusted
as well.
On Mon, Aug 22, 2016 at 10:06 AM, Marek Olšák <maraeo at gmail.com> wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> This is required by and fixes GL45-CTS.compute_shader.api-indirect.
>
> I know it's silly, but it's the path of least resistence.
> ---
> src/mesa/main/api_validate.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
> index 384a8858..27c17fa 100644
> --- a/src/mesa/main/api_validate.c
> +++ b/src/mesa/main/api_validate.c
> @@ -1102,40 +1102,40 @@ _mesa_validate_DispatchCompute(struct gl_context *ctx,
> return GL_TRUE;
> }
>
> static GLboolean
> valid_dispatch_indirect(struct gl_context *ctx,
> GLintptr indirect,
> GLsizei size, const char *name)
> {
> const uint64_t end = (uint64_t) indirect + size;
>
> - if (!check_valid_to_compute(ctx, name))
> - return GL_FALSE;
> -
> /* From the OpenGL 4.3 Core Specification, Chapter 19, Compute Shaders:
> *
> * "An INVALID_VALUE error is generated if indirect is negative or is not a
> * multiple of four."
> */
> if (indirect & (sizeof(GLuint) - 1)) {
> _mesa_error(ctx, GL_INVALID_VALUE,
> "%s(indirect is not aligned)", name);
> return GL_FALSE;
> }
>
> if (indirect < 0) {
> _mesa_error(ctx, GL_INVALID_VALUE,
> "%s(indirect is less than zero)", name);
> return GL_FALSE;
> }
>
> + if (!check_valid_to_compute(ctx, name))
> + return GL_FALSE;
> +
> /* From the OpenGL 4.3 Core Specification, Chapter 19, Compute Shaders:
> *
> * "An INVALID_OPERATION error is generated if no buffer is bound to the
> * DRAW_INDIRECT_BUFFER binding, or if the command would source data
> * beyond the end of the buffer object."
> */
> if (!_mesa_is_bufferobj(ctx->DispatchIndirectBuffer)) {
> _mesa_error(ctx, GL_INVALID_OPERATION,
> "%s: no buffer bound to DISPATCH_INDIRECT_BUFFER", name);
> return GL_FALSE;
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list