diff options
author | Timothy Arceri <[email protected]> | 2016-06-22 12:41:28 +1000 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2016-06-23 11:01:46 +1000 |
commit | ab99196b6bc5b0170db20db6cc3837ce7642d22a (patch) | |
tree | 0e37f19fba45438d45cad609ab4b940b0ab6b997 /src/compiler/glsl | |
parent | 24b3be093870a9a77325ac33c8fce97fae143e8e (diff) |
glsl/mesa: stop duplicating geom and tcs layout values
We already store these in gl_shader and gl_program here we
remove it from gl_shader_program and just use the values
from gl_shader.
This will allow us to keep the shader cache restore code as
simple as it can be while making it somewhat clearer where these
values originate from.
Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r-- | src/compiler/glsl/glsl_to_nir.cpp | 2 | ||||
-rw-r--r-- | src/compiler/glsl/linker.cpp | 18 |
2 files changed, 8 insertions, 12 deletions
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index daf237eee6b..16d0c1d54d2 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -166,7 +166,7 @@ glsl_to_nir(const struct gl_shader_program *shader_prog, switch (stage) { case MESA_SHADER_TESS_CTRL: - shader->info.tcs.vertices_out = shader_prog->TessCtrl.VerticesOut; + shader->info.tcs.vertices_out = sh->TessCtrl.VerticesOut; break; case MESA_SHADER_GEOMETRY: diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index bf70f29039f..c7cf56eaa0b 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -857,7 +857,7 @@ validate_geometry_shader_executable(struct gl_shader_program *prog, if (shader == NULL) return; - unsigned num_vertices = vertices_per_prim(prog->Geom.InputType); + unsigned num_vertices = vertices_per_prim(shader->Geom.InputType); prog->Geom.VerticesIn = num_vertices; analyze_clip_cull_usage(prog, shader, ctx, @@ -873,9 +873,11 @@ static void validate_geometry_shader_emissions(struct gl_context *ctx, struct gl_shader_program *prog) { - if (prog->_LinkedShaders[MESA_SHADER_GEOMETRY] != NULL) { + struct gl_shader *sh = prog->_LinkedShaders[MESA_SHADER_GEOMETRY]; + + if (sh != NULL) { find_emit_vertex_visitor emit_vertex(ctx->Const.MaxVertexStreams - 1); - emit_vertex.run(prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->ir); + emit_vertex.run(sh->ir); if (emit_vertex.error()) { linker_error(prog, "Invalid call %s(%d). Accepted values for the " "stream parameter are in the range [0, %d].\n", @@ -910,7 +912,7 @@ validate_geometry_shader_emissions(struct gl_context *ctx, * EmitStreamVertex() or EmitEndPrimitive() are called with a non-zero * stream. */ - if (prog->Geom.UsesStreams && prog->Geom.OutputType != GL_POINTS) { + if (prog->Geom.UsesStreams && sh->Geom.OutputType != GL_POINTS) { linker_error(prog, "EmitStreamVertex(n) and EndStreamPrimitive(n) " "with n>0 requires point output\n"); } @@ -1793,7 +1795,6 @@ link_tcs_out_layout_qualifiers(struct gl_shader_program *prog, "vertices out layout qualifier\n"); return; } - prog->TessCtrl.VerticesOut = linked_shader->TessCtrl.VerticesOut; } @@ -2055,26 +2056,21 @@ link_gs_inout_layout_qualifiers(struct gl_shader_program *prog, "geometry shader didn't declare primitive input type\n"); return; } - prog->Geom.InputType = linked_shader->Geom.InputType; if (linked_shader->Geom.OutputType == PRIM_UNKNOWN) { linker_error(prog, "geometry shader didn't declare primitive output type\n"); return; } - prog->Geom.OutputType = linked_shader->Geom.OutputType; if (linked_shader->Geom.VerticesOut == -1) { linker_error(prog, "geometry shader didn't declare max_vertices\n"); return; } - prog->Geom.VerticesOut = linked_shader->Geom.VerticesOut; if (linked_shader->Geom.Invocations == 0) linked_shader->Geom.Invocations = 1; - - prog->Geom.Invocations = linked_shader->Geom.Invocations; } @@ -2349,7 +2345,7 @@ link_intrastage_shaders(void *mem_ctx, /* Set the size of geometry shader input arrays */ if (linked->Stage == MESA_SHADER_GEOMETRY) { - unsigned num_vertices = vertices_per_prim(prog->Geom.InputType); + unsigned num_vertices = vertices_per_prim(linked->Geom.InputType); geom_array_resize_visitor input_resize_visitor(num_vertices, prog); foreach_in_list(ir_instruction, ir, linked->ir) { ir->accept(&input_resize_visitor); |