[Mesa-dev] [PATCH 14/17] mesa: compute.c C99 tidy up
Timothy Arceri
tarceri at itsqueeze.com
Mon May 15 06:19:23 UTC 2017
---
src/mesa/main/compute.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/mesa/main/compute.c b/src/mesa/main/compute.c
index 5c84516..e881d4f 100644
--- a/src/mesa/main/compute.c
+++ b/src/mesa/main/compute.c
@@ -47,27 +47,26 @@ check_valid_to_compute(struct gl_context *ctx, const char *function)
function);
return false;
}
return true;
}
static bool
validate_DispatchCompute(struct gl_context *ctx, const GLuint *num_groups)
{
- int i;
FLUSH_CURRENT(ctx, 0);
if (!check_valid_to_compute(ctx, "glDispatchCompute"))
return GL_FALSE;
- for (i = 0; i < 3; i++) {
+ for (int i = 0; i < 3; i++) {
/* From the OpenGL 4.3 Core Specification, Chapter 19, Compute Shaders:
*
* "An INVALID_VALUE error is generated if any of num_groups_x,
* num_groups_y and num_groups_z are greater than or equal to the
* maximum work group count for the corresponding dimension."
*
* However, the "or equal to" portions appears to be a specification
* bug. In all other areas, the specification appears to indicate that
* the number of workgroups can match the MAX_COMPUTE_WORK_GROUP_COUNT
* value. For example, under DispatchComputeIndirect:
@@ -100,42 +99,41 @@ validate_DispatchCompute(struct gl_context *ctx, const GLuint *num_groups)
return GL_TRUE;
}
static bool
validate_DispatchComputeGroupSizeARB(struct gl_context *ctx,
const GLuint *num_groups,
const GLuint *group_size)
{
GLuint total_invocations = 1;
- int i;
FLUSH_CURRENT(ctx, 0);
if (!check_valid_to_compute(ctx, "glDispatchComputeGroupSizeARB"))
return GL_FALSE;
/* The ARB_compute_variable_group_size spec says:
*
* "An INVALID_OPERATION error is generated by
* DispatchComputeGroupSizeARB if the active program for the compute
* shader stage has a fixed work group size."
*/
struct gl_program *prog = ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
if (!prog->info.cs.local_size_variable) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glDispatchComputeGroupSizeARB(fixed work group size "
"forbidden)");
return GL_FALSE;
}
- for (i = 0; i < 3; i++) {
+ for (int i = 0; i < 3; i++) {
/* The ARB_compute_variable_group_size spec says:
*
* "An INVALID_VALUE error is generated if any of num_groups_x,
* num_groups_y and num_groups_z are greater than or equal to the
* maximum work group count for the corresponding dimension."
*/
if (num_groups[i] > ctx->Const.MaxComputeWorkGroupCount[i]) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glDispatchComputeGroupSizeARB(num_groups_%c)", 'x' + i);
return GL_FALSE;
--
2.9.3
More information about the mesa-dev
mailing list