summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/linker.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <timothy.arceri@collabora.com>2016-06-22 12:41:28 +1000
committerTimothy Arceri <t_arceri@yahoo.com.au>2016-06-23 11:01:46 +1000
commitab99196b6bc5b0170db20db6cc3837ce7642d22a (patch)
tree0e37f19fba45438d45cad609ab4b940b0ab6b997 /src/compiler/glsl/linker.cpp
parent24b3be093870a9a77325ac33c8fce97fae143e8e (diff)
downloadexternal_mesa3d-ab99196b6bc5b0170db20db6cc3837ce7642d22a.zip
external_mesa3d-ab99196b6bc5b0170db20db6cc3837ce7642d22a.tar.gz
external_mesa3d-ab99196b6bc5b0170db20db6cc3837ce7642d22a.tar.bz2
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 <itoral@igalia.com>
Diffstat (limited to 'src/compiler/glsl/linker.cpp')
-rw-r--r--src/compiler/glsl/linker.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index bf70f29..c7cf56e 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);