glsl/linker: pass shader_info to analyze_clip_cull_usage directly

This will be needed by the next commit.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
This commit is contained in:
Marek Olšák
2019-11-05 19:20:35 -05:00
parent 3ef50b023e
commit 9950523368

View File

@@ -587,11 +587,10 @@ static void
analyze_clip_cull_usage(struct gl_shader_program *prog, analyze_clip_cull_usage(struct gl_shader_program *prog,
struct gl_linked_shader *shader, struct gl_linked_shader *shader,
struct gl_context *ctx, struct gl_context *ctx,
GLuint *clip_distance_array_size, struct shader_info *info)
GLuint *cull_distance_array_size)
{ {
*clip_distance_array_size = 0; info->clip_distance_array_size = 0;
*cull_distance_array_size = 0; info->cull_distance_array_size = 0;
if (prog->data->Version >= (prog->IsES ? 300 : 130)) { if (prog->data->Version >= (prog->IsES ? 300 : 130)) {
/* From section 7.1 (Vertex Shader Special Variables) of the /* From section 7.1 (Vertex Shader Special Variables) of the
@@ -643,13 +642,13 @@ analyze_clip_cull_usage(struct gl_shader_program *prog,
ir_variable *clip_distance_var = ir_variable *clip_distance_var =
shader->symbols->get_variable("gl_ClipDistance"); shader->symbols->get_variable("gl_ClipDistance");
assert(clip_distance_var); assert(clip_distance_var);
*clip_distance_array_size = clip_distance_var->type->length; info->clip_distance_array_size = clip_distance_var->type->length;
} }
if (gl_CullDistance.found) { if (gl_CullDistance.found) {
ir_variable *cull_distance_var = ir_variable *cull_distance_var =
shader->symbols->get_variable("gl_CullDistance"); shader->symbols->get_variable("gl_CullDistance");
assert(cull_distance_var); assert(cull_distance_var);
*cull_distance_array_size = cull_distance_var->type->length; info->cull_distance_array_size = cull_distance_var->type->length;
} }
/* From the ARB_cull_distance spec: /* From the ARB_cull_distance spec:
* *
@@ -658,7 +657,7 @@ analyze_clip_cull_usage(struct gl_shader_program *prog,
* gl_CullDistance arrays to be larger than * gl_CullDistance arrays to be larger than
* gl_MaxCombinedClipAndCullDistances. * gl_MaxCombinedClipAndCullDistances.
*/ */
if ((*clip_distance_array_size + *cull_distance_array_size) > if ((uint32_t)(info->clip_distance_array_size + info->cull_distance_array_size) >
ctx->Const.MaxClipPlanes) { ctx->Const.MaxClipPlanes) {
linker_error(prog, "%s shader: the combined size of " linker_error(prog, "%s shader: the combined size of "
"'gl_ClipDistance' and 'gl_CullDistance' size cannot " "'gl_ClipDistance' and 'gl_CullDistance' size cannot "
@@ -729,9 +728,7 @@ validate_vertex_shader_executable(struct gl_shader_program *prog,
} }
} }
analyze_clip_cull_usage(prog, shader, ctx, analyze_clip_cull_usage(prog, shader, ctx, &shader->Program->info);
&shader->Program->info.clip_distance_array_size,
&shader->Program->info.cull_distance_array_size);
} }
static void static void
@@ -742,9 +739,7 @@ validate_tess_eval_shader_executable(struct gl_shader_program *prog,
if (shader == NULL) if (shader == NULL)
return; return;
analyze_clip_cull_usage(prog, shader, ctx, analyze_clip_cull_usage(prog, shader, ctx, &shader->Program->info);
&shader->Program->info.clip_distance_array_size,
&shader->Program->info.cull_distance_array_size);
} }
@@ -791,9 +786,7 @@ validate_geometry_shader_executable(struct gl_shader_program *prog,
vertices_per_prim(shader->Program->info.gs.input_primitive); vertices_per_prim(shader->Program->info.gs.input_primitive);
prog->Geom.VerticesIn = num_vertices; prog->Geom.VerticesIn = num_vertices;
analyze_clip_cull_usage(prog, shader, ctx, analyze_clip_cull_usage(prog, shader, ctx, &shader->Program->info);
&shader->Program->info.clip_distance_array_size,
&shader->Program->info.cull_distance_array_size);
} }
/** /**