From 1591e668e162daf4057a0d44df4e70f19b94fc76 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Thu, 30 Jun 2016 14:44:59 +1000 Subject: glsl/mesa: move duplicate shader fields into new struct gl_shader_info Reviewed-by: Iago Toral Quiroga --- src/compiler/glsl/glsl_parser_extras.cpp | 57 +++---- src/compiler/glsl/glsl_to_nir.cpp | 10 +- src/compiler/glsl/link_varyings.cpp | 2 +- src/compiler/glsl/linker.cpp | 249 +++++++++++++++++-------------- 4 files changed, 171 insertions(+), 147 deletions(-) (limited to 'src/compiler/glsl') diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 09f74772659..fab64bbb87b 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -1648,14 +1648,14 @@ set_shader_inout_layout(struct gl_shader *shader, if (state->out_qualifier->out_xfb_stride[i]-> process_qualifier_constant(state, "xfb_stride", &xfb_stride, true)) { - shader->TransformFeedback.BufferStride[i] = xfb_stride; + shader->info.TransformFeedback.BufferStride[i] = xfb_stride; } } } switch (shader->Stage) { case MESA_SHADER_TESS_CTRL: - shader->TessCtrl.VerticesOut = 0; + shader->info.TessCtrl.VerticesOut = 0; if (state->tcs_output_vertices_specified) { unsigned vertices; if (state->out_qualifier->vertices-> @@ -1667,29 +1667,29 @@ set_shader_inout_layout(struct gl_shader *shader, _mesa_glsl_error(&loc, state, "vertices (%d) exceeds " "GL_MAX_PATCH_VERTICES", vertices); } - shader->TessCtrl.VerticesOut = vertices; + shader->info.TessCtrl.VerticesOut = vertices; } } break; case MESA_SHADER_TESS_EVAL: - shader->TessEval.PrimitiveMode = PRIM_UNKNOWN; + shader->info.TessEval.PrimitiveMode = PRIM_UNKNOWN; if (state->in_qualifier->flags.q.prim_type) - shader->TessEval.PrimitiveMode = state->in_qualifier->prim_type; + shader->info.TessEval.PrimitiveMode = state->in_qualifier->prim_type; - shader->TessEval.Spacing = 0; + shader->info.TessEval.Spacing = 0; if (state->in_qualifier->flags.q.vertex_spacing) - shader->TessEval.Spacing = state->in_qualifier->vertex_spacing; + shader->info.TessEval.Spacing = state->in_qualifier->vertex_spacing; - shader->TessEval.VertexOrder = 0; + shader->info.TessEval.VertexOrder = 0; if (state->in_qualifier->flags.q.ordering) - shader->TessEval.VertexOrder = state->in_qualifier->ordering; + shader->info.TessEval.VertexOrder = state->in_qualifier->ordering; - shader->TessEval.PointMode = -1; + shader->info.TessEval.PointMode = -1; if (state->in_qualifier->flags.q.point_mode) - shader->TessEval.PointMode = state->in_qualifier->point_mode; + shader->info.TessEval.PointMode = state->in_qualifier->point_mode; break; case MESA_SHADER_GEOMETRY: - shader->Geom.VerticesOut = -1; + shader->info.Geom.VerticesOut = -1; if (state->out_qualifier->flags.q.max_vertices) { unsigned qual_max_vertices; if (state->out_qualifier->max_vertices-> @@ -1703,23 +1703,23 @@ set_shader_inout_layout(struct gl_shader *shader, "GL_MAX_GEOMETRY_OUTPUT_VERTICES", qual_max_vertices); } - shader->Geom.VerticesOut = qual_max_vertices; + shader->info.Geom.VerticesOut = qual_max_vertices; } } if (state->gs_input_prim_type_specified) { - shader->Geom.InputType = state->in_qualifier->prim_type; + shader->info.Geom.InputType = state->in_qualifier->prim_type; } else { - shader->Geom.InputType = PRIM_UNKNOWN; + shader->info.Geom.InputType = PRIM_UNKNOWN; } if (state->out_qualifier->flags.q.prim_type) { - shader->Geom.OutputType = state->out_qualifier->prim_type; + shader->info.Geom.OutputType = state->out_qualifier->prim_type; } else { - shader->Geom.OutputType = PRIM_UNKNOWN; + shader->info.Geom.OutputType = PRIM_UNKNOWN; } - shader->Geom.Invocations = 0; + shader->info.Geom.Invocations = 0; if (state->in_qualifier->flags.q.invocations) { unsigned invocations; if (state->in_qualifier->invocations-> @@ -1733,7 +1733,7 @@ set_shader_inout_layout(struct gl_shader *shader, "GL_MAX_GEOMETRY_SHADER_INVOCATIONS", invocations); } - shader->Geom.Invocations = invocations; + shader->info.Geom.Invocations = invocations; } } break; @@ -1741,21 +1741,22 @@ set_shader_inout_layout(struct gl_shader *shader, case MESA_SHADER_COMPUTE: if (state->cs_input_local_size_specified) { for (int i = 0; i < 3; i++) - shader->Comp.LocalSize[i] = state->cs_input_local_size[i]; + shader->info.Comp.LocalSize[i] = state->cs_input_local_size[i]; } else { for (int i = 0; i < 3; i++) - shader->Comp.LocalSize[i] = 0; + shader->info.Comp.LocalSize[i] = 0; } break; case MESA_SHADER_FRAGMENT: - shader->redeclares_gl_fragcoord = state->fs_redeclares_gl_fragcoord; - shader->uses_gl_fragcoord = state->fs_uses_gl_fragcoord; - shader->pixel_center_integer = state->fs_pixel_center_integer; - shader->origin_upper_left = state->fs_origin_upper_left; - shader->ARB_fragment_coord_conventions_enable = + shader->info.redeclares_gl_fragcoord = + state->fs_redeclares_gl_fragcoord; + shader->info.uses_gl_fragcoord = state->fs_uses_gl_fragcoord; + shader->info.pixel_center_integer = state->fs_pixel_center_integer; + shader->info.origin_upper_left = state->fs_origin_upper_left; + shader->info.ARB_fragment_coord_conventions_enable = state->ARB_fragment_coord_conventions_enable; - shader->EarlyFragmentTests = state->fs_early_fragment_tests; + shader->info.EarlyFragmentTests = state->fs_early_fragment_tests; break; default: @@ -1877,7 +1878,7 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, shader->InfoLog = state->info_log; shader->Version = state->language_version; shader->IsES = state->es_shader; - shader->uses_builtin_functions = state->uses_builtin_functions; + shader->info.uses_builtin_functions = state->uses_builtin_functions; /* Retain any live IR, but trash the rest. */ reparent_ir(shader->ir, shader->ir); diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 0ad3be10760..20302e399ac 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -166,14 +166,14 @@ glsl_to_nir(const struct gl_shader_program *shader_prog, switch (stage) { case MESA_SHADER_TESS_CTRL: - shader->info.tcs.vertices_out = sh->TessCtrl.VerticesOut; + shader->info.tcs.vertices_out = sh->info.TessCtrl.VerticesOut; break; case MESA_SHADER_GEOMETRY: shader->info.gs.vertices_in = shader_prog->Geom.VerticesIn; - shader->info.gs.output_primitive = sh->Geom.OutputType; - shader->info.gs.vertices_out = sh->Geom.VerticesOut; - shader->info.gs.invocations = sh->Geom.Invocations; + shader->info.gs.output_primitive = sh->info.Geom.OutputType; + shader->info.gs.vertices_out = sh->info.Geom.VerticesOut; + shader->info.gs.invocations = sh->info.Geom.Invocations; shader->info.gs.uses_end_primitive = shader_prog->Geom.UsesEndPrimitive; shader->info.gs.uses_streams = shader_prog->Geom.UsesStreams; break; @@ -184,7 +184,7 @@ glsl_to_nir(const struct gl_shader_program *shader_prog, shader->info.fs.uses_discard = fp->UsesKill; shader->info.fs.uses_sample_qualifier = fp->IsSample != 0; - shader->info.fs.early_fragment_tests = sh->EarlyFragmentTests; + shader->info.fs.early_fragment_tests = sh->info.EarlyFragmentTests; shader->info.fs.depth_layout = fp->FragDepthLayout; break; } diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp index db42bb1b714..473626b7a16 100644 --- a/src/compiler/glsl/link_varyings.cpp +++ b/src/compiler/glsl/link_varyings.cpp @@ -118,7 +118,7 @@ process_xfb_layout_qualifiers(void *mem_ctx, const gl_linked_shader *sh, * xfb_stride to interface block members so this will catch that case also. */ for (unsigned j = 0; j < MAX_FEEDBACK_BUFFERS; j++) { - if (sh->TransformFeedback.BufferStride[j]) { + if (sh->info.TransformFeedback.BufferStride[j]) { has_xfb_qualifiers = true; } } diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 9826368c561..d963f540a52 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(shader->Geom.InputType); + unsigned num_vertices = vertices_per_prim(shader->info.Geom.InputType); prog->Geom.VerticesIn = num_vertices; analyze_clip_cull_usage(prog, shader, ctx, @@ -912,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 && sh->Geom.OutputType != GL_POINTS) { + if (prog->Geom.UsesStreams && sh->info.Geom.OutputType != GL_POINTS) { linker_error(prog, "EmitStreamVertex(n) and EndStreamPrimitive(n) " "with n>0 requires point output\n"); } @@ -1687,37 +1687,38 @@ link_xfb_stride_layout_qualifiers(struct gl_context *ctx, unsigned num_shaders) { for (unsigned i = 0; i < MAX_FEEDBACK_BUFFERS; i++) { - linked_shader->TransformFeedback.BufferStride[i] = 0; + linked_shader->info.TransformFeedback.BufferStride[i] = 0; } for (unsigned i = 0; i < num_shaders; i++) { struct gl_shader *shader = shader_list[i]; for (unsigned j = 0; j < MAX_FEEDBACK_BUFFERS; j++) { - if (shader->TransformFeedback.BufferStride[j]) { - if (linked_shader->TransformFeedback.BufferStride[j] != 0 && - shader->TransformFeedback.BufferStride[j] != 0 && - linked_shader->TransformFeedback.BufferStride[j] != - shader->TransformFeedback.BufferStride[j]) { + if (shader->info.TransformFeedback.BufferStride[j]) { + if (linked_shader->info.TransformFeedback.BufferStride[j] != 0 && + shader->info.TransformFeedback.BufferStride[j] != 0 && + linked_shader->info.TransformFeedback.BufferStride[j] != + shader->info.TransformFeedback.BufferStride[j]) { linker_error(prog, "intrastage shaders defined with conflicting " "xfb_stride for buffer %d (%d and %d)\n", j, - linked_shader->TransformFeedback.BufferStride[j], - shader->TransformFeedback.BufferStride[j]); + linked_shader-> + info.TransformFeedback.BufferStride[j], + shader->info.TransformFeedback.BufferStride[j]); return; } - if (shader->TransformFeedback.BufferStride[j]) - linked_shader->TransformFeedback.BufferStride[j] = - shader->TransformFeedback.BufferStride[j]; + if (shader->info.TransformFeedback.BufferStride[j]) + linked_shader->info.TransformFeedback.BufferStride[j] = + shader->info.TransformFeedback.BufferStride[j]; } } } for (unsigned j = 0; j < MAX_FEEDBACK_BUFFERS; j++) { - if (linked_shader->TransformFeedback.BufferStride[j]) { + if (linked_shader->info.TransformFeedback.BufferStride[j]) { prog->TransformFeedback.BufferStride[j] = - linked_shader->TransformFeedback.BufferStride[j]; + linked_shader->info.TransformFeedback.BufferStride[j]; /* We will validate doubles at a later stage */ if (prog->TransformFeedback.BufferStride[j] % 4) { @@ -1750,7 +1751,7 @@ link_tcs_out_layout_qualifiers(struct gl_shader_program *prog, struct gl_shader **shader_list, unsigned num_shaders) { - linked_shader->TessCtrl.VerticesOut = 0; + linked_shader->info.TessCtrl.VerticesOut = 0; if (linked_shader->Stage != MESA_SHADER_TESS_CTRL) return; @@ -1768,16 +1769,18 @@ link_tcs_out_layout_qualifiers(struct gl_shader_program *prog, for (unsigned i = 0; i < num_shaders; i++) { struct gl_shader *shader = shader_list[i]; - if (shader->TessCtrl.VerticesOut != 0) { - if (linked_shader->TessCtrl.VerticesOut != 0 && - linked_shader->TessCtrl.VerticesOut != shader->TessCtrl.VerticesOut) { + if (shader->info.TessCtrl.VerticesOut != 0) { + if (linked_shader->info.TessCtrl.VerticesOut != 0 && + linked_shader->info.TessCtrl.VerticesOut != + shader->info.TessCtrl.VerticesOut) { linker_error(prog, "tessellation control shader defined with " "conflicting output vertex count (%d and %d)\n", - linked_shader->TessCtrl.VerticesOut, - shader->TessCtrl.VerticesOut); + linked_shader->info.TessCtrl.VerticesOut, + shader->info.TessCtrl.VerticesOut); return; } - linked_shader->TessCtrl.VerticesOut = shader->TessCtrl.VerticesOut; + linked_shader->info.TessCtrl.VerticesOut = + shader->info.TessCtrl.VerticesOut; } } @@ -1785,7 +1788,7 @@ link_tcs_out_layout_qualifiers(struct gl_shader_program *prog, * since we already know we're in the right type of shader program * for doing it. */ - if (linked_shader->TessCtrl.VerticesOut == 0) { + if (linked_shader->info.TessCtrl.VerticesOut == 0) { linker_error(prog, "tessellation control shader didn't declare " "vertices out layout qualifier\n"); return; @@ -1805,10 +1808,10 @@ link_tes_in_layout_qualifiers(struct gl_shader_program *prog, struct gl_shader **shader_list, unsigned num_shaders) { - linked_shader->TessEval.PrimitiveMode = PRIM_UNKNOWN; - linked_shader->TessEval.Spacing = 0; - linked_shader->TessEval.VertexOrder = 0; - linked_shader->TessEval.PointMode = -1; + linked_shader->info.TessEval.PrimitiveMode = PRIM_UNKNOWN; + linked_shader->info.TessEval.Spacing = 0; + linked_shader->info.TessEval.VertexOrder = 0; + linked_shader->info.TessEval.PointMode = -1; if (linked_shader->Stage != MESA_SHADER_TESS_EVAL) return; @@ -1830,44 +1833,50 @@ link_tes_in_layout_qualifiers(struct gl_shader_program *prog, for (unsigned i = 0; i < num_shaders; i++) { struct gl_shader *shader = shader_list[i]; - if (shader->TessEval.PrimitiveMode != PRIM_UNKNOWN) { - if (linked_shader->TessEval.PrimitiveMode != PRIM_UNKNOWN && - linked_shader->TessEval.PrimitiveMode != shader->TessEval.PrimitiveMode) { + if (shader->info.TessEval.PrimitiveMode != PRIM_UNKNOWN) { + if (linked_shader->info.TessEval.PrimitiveMode != PRIM_UNKNOWN && + linked_shader->info.TessEval.PrimitiveMode != + shader->info.TessEval.PrimitiveMode) { linker_error(prog, "tessellation evaluation shader defined with " "conflicting input primitive modes.\n"); return; } - linked_shader->TessEval.PrimitiveMode = shader->TessEval.PrimitiveMode; + linked_shader->info.TessEval.PrimitiveMode = shader->info.TessEval.PrimitiveMode; } - if (shader->TessEval.Spacing != 0) { - if (linked_shader->TessEval.Spacing != 0 && - linked_shader->TessEval.Spacing != shader->TessEval.Spacing) { + if (shader->info.TessEval.Spacing != 0) { + if (linked_shader->info.TessEval.Spacing != 0 && + linked_shader->info.TessEval.Spacing != + shader->info.TessEval.Spacing) { linker_error(prog, "tessellation evaluation shader defined with " "conflicting vertex spacing.\n"); return; } - linked_shader->TessEval.Spacing = shader->TessEval.Spacing; + linked_shader->info.TessEval.Spacing = shader->info.TessEval.Spacing; } - if (shader->TessEval.VertexOrder != 0) { - if (linked_shader->TessEval.VertexOrder != 0 && - linked_shader->TessEval.VertexOrder != shader->TessEval.VertexOrder) { + if (shader->info.TessEval.VertexOrder != 0) { + if (linked_shader->info.TessEval.VertexOrder != 0 && + linked_shader->info.TessEval.VertexOrder != + shader->info.TessEval.VertexOrder) { linker_error(prog, "tessellation evaluation shader defined with " "conflicting ordering.\n"); return; } - linked_shader->TessEval.VertexOrder = shader->TessEval.VertexOrder; + linked_shader->info.TessEval.VertexOrder = + shader->info.TessEval.VertexOrder; } - if (shader->TessEval.PointMode != -1) { - if (linked_shader->TessEval.PointMode != -1 && - linked_shader->TessEval.PointMode != shader->TessEval.PointMode) { + if (shader->info.TessEval.PointMode != -1) { + if (linked_shader->info.TessEval.PointMode != -1 && + linked_shader->info.TessEval.PointMode != + shader->info.TessEval.PointMode) { linker_error(prog, "tessellation evaluation shader defined with " "conflicting point modes.\n"); return; } - linked_shader->TessEval.PointMode = shader->TessEval.PointMode; + linked_shader->info.TessEval.PointMode = + shader->info.TessEval.PointMode; } } @@ -1876,21 +1885,21 @@ link_tes_in_layout_qualifiers(struct gl_shader_program *prog, * since we already know we're in the right type of shader program * for doing it. */ - if (linked_shader->TessEval.PrimitiveMode == PRIM_UNKNOWN) { + if (linked_shader->info.TessEval.PrimitiveMode == PRIM_UNKNOWN) { linker_error(prog, "tessellation evaluation shader didn't declare input " "primitive modes.\n"); return; } - if (linked_shader->TessEval.Spacing == 0) - linked_shader->TessEval.Spacing = GL_EQUAL; + if (linked_shader->info.TessEval.Spacing == 0) + linked_shader->info.TessEval.Spacing = GL_EQUAL; - if (linked_shader->TessEval.VertexOrder == 0) - linked_shader->TessEval.VertexOrder = GL_CCW; + if (linked_shader->info.TessEval.VertexOrder == 0) + linked_shader->info.TessEval.VertexOrder = GL_CCW; - if (linked_shader->TessEval.PointMode == -1) - linked_shader->TessEval.PointMode = GL_FALSE; + if (linked_shader->info.TessEval.PointMode == -1) + linked_shader->info.TessEval.PointMode = GL_FALSE; } @@ -1905,10 +1914,10 @@ link_fs_input_layout_qualifiers(struct gl_shader_program *prog, struct gl_shader **shader_list, unsigned num_shaders) { - linked_shader->redeclares_gl_fragcoord = false; - linked_shader->uses_gl_fragcoord = false; - linked_shader->origin_upper_left = false; - linked_shader->pixel_center_integer = false; + linked_shader->info.redeclares_gl_fragcoord = false; + linked_shader->info.uses_gl_fragcoord = false; + linked_shader->info.origin_upper_left = false; + linked_shader->info.pixel_center_integer = false; if (linked_shader->Stage != MESA_SHADER_FRAGMENT || (prog->Version < 150 && !prog->ARB_fragment_coord_conventions_enable)) @@ -1922,12 +1931,12 @@ link_fs_input_layout_qualifiers(struct gl_shader_program *prog, * it must be redeclared in all the fragment shaders in that program * that have a static use gl_FragCoord." */ - if ((linked_shader->redeclares_gl_fragcoord - && !shader->redeclares_gl_fragcoord - && shader->uses_gl_fragcoord) - || (shader->redeclares_gl_fragcoord - && !linked_shader->redeclares_gl_fragcoord - && linked_shader->uses_gl_fragcoord)) { + if ((linked_shader->info.redeclares_gl_fragcoord + && !shader->info.redeclares_gl_fragcoord + && shader->info.uses_gl_fragcoord) + || (shader->info.redeclares_gl_fragcoord + && !linked_shader->info.redeclares_gl_fragcoord + && linked_shader->info.uses_gl_fragcoord)) { linker_error(prog, "fragment shader defined with conflicting " "layout qualifiers for gl_FragCoord\n"); } @@ -1937,9 +1946,12 @@ link_fs_input_layout_qualifiers(struct gl_shader_program *prog, * "All redeclarations of gl_FragCoord in all fragment shaders in a * single program must have the same set of qualifiers." */ - if (linked_shader->redeclares_gl_fragcoord && shader->redeclares_gl_fragcoord - && (shader->origin_upper_left != linked_shader->origin_upper_left - || shader->pixel_center_integer != linked_shader->pixel_center_integer)) { + if (linked_shader->info.redeclares_gl_fragcoord && + shader->info.redeclares_gl_fragcoord && + (shader->info.origin_upper_left != + linked_shader->info.origin_upper_left || + shader->info.pixel_center_integer != + linked_shader->info.pixel_center_integer)) { linker_error(prog, "fragment shader defined with conflicting " "layout qualifiers for gl_FragCoord\n"); } @@ -1949,16 +1961,21 @@ link_fs_input_layout_qualifiers(struct gl_shader_program *prog, * are multiple redeclarations, all the fields except uses_gl_fragcoord * are already known to be the same. */ - if (shader->redeclares_gl_fragcoord || shader->uses_gl_fragcoord) { - linked_shader->redeclares_gl_fragcoord = - shader->redeclares_gl_fragcoord; - linked_shader->uses_gl_fragcoord = linked_shader->uses_gl_fragcoord - || shader->uses_gl_fragcoord; - linked_shader->origin_upper_left = shader->origin_upper_left; - linked_shader->pixel_center_integer = shader->pixel_center_integer; + if (shader->info.redeclares_gl_fragcoord || + shader->info.uses_gl_fragcoord) { + linked_shader->info.redeclares_gl_fragcoord = + shader->info.redeclares_gl_fragcoord; + linked_shader->info.uses_gl_fragcoord = + linked_shader->info.uses_gl_fragcoord || + shader->info.uses_gl_fragcoord; + linked_shader->info.origin_upper_left = + shader->info.origin_upper_left; + linked_shader->info.pixel_center_integer = + shader->info.pixel_center_integer; } - linked_shader->EarlyFragmentTests |= shader->EarlyFragmentTests; + linked_shader->info.EarlyFragmentTests |= + shader->info.EarlyFragmentTests; } } @@ -1973,10 +1990,10 @@ link_gs_inout_layout_qualifiers(struct gl_shader_program *prog, struct gl_shader **shader_list, unsigned num_shaders) { - linked_shader->Geom.VerticesOut = -1; - linked_shader->Geom.Invocations = 0; - linked_shader->Geom.InputType = PRIM_UNKNOWN; - linked_shader->Geom.OutputType = PRIM_UNKNOWN; + linked_shader->info.Geom.VerticesOut = -1; + linked_shader->info.Geom.Invocations = 0; + linked_shader->info.Geom.InputType = PRIM_UNKNOWN; + linked_shader->info.Geom.OutputType = PRIM_UNKNOWN; /* No in/out qualifiers defined for anything but GLSL 1.50+ * geometry shaders so far. @@ -1997,48 +2014,52 @@ link_gs_inout_layout_qualifiers(struct gl_shader_program *prog, for (unsigned i = 0; i < num_shaders; i++) { struct gl_shader *shader = shader_list[i]; - if (shader->Geom.InputType != PRIM_UNKNOWN) { - if (linked_shader->Geom.InputType != PRIM_UNKNOWN && - linked_shader->Geom.InputType != shader->Geom.InputType) { + if (shader->info.Geom.InputType != PRIM_UNKNOWN) { + if (linked_shader->info.Geom.InputType != PRIM_UNKNOWN && + linked_shader->info.Geom.InputType != + shader->info.Geom.InputType) { linker_error(prog, "geometry shader defined with conflicting " "input types\n"); return; } - linked_shader->Geom.InputType = shader->Geom.InputType; + linked_shader->info.Geom.InputType = shader->info.Geom.InputType; } - if (shader->Geom.OutputType != PRIM_UNKNOWN) { - if (linked_shader->Geom.OutputType != PRIM_UNKNOWN && - linked_shader->Geom.OutputType != shader->Geom.OutputType) { + if (shader->info.Geom.OutputType != PRIM_UNKNOWN) { + if (linked_shader->info.Geom.OutputType != PRIM_UNKNOWN && + linked_shader->info.Geom.OutputType != + shader->info.Geom.OutputType) { linker_error(prog, "geometry shader defined with conflicting " "output types\n"); return; } - linked_shader->Geom.OutputType = shader->Geom.OutputType; + linked_shader->info.Geom.OutputType = shader->info.Geom.OutputType; } - if (shader->Geom.VerticesOut != -1) { - if (linked_shader->Geom.VerticesOut != -1 && - linked_shader->Geom.VerticesOut != shader->Geom.VerticesOut) { + if (shader->info.Geom.VerticesOut != -1) { + if (linked_shader->info.Geom.VerticesOut != -1 && + linked_shader->info.Geom.VerticesOut != + shader->info.Geom.VerticesOut) { linker_error(prog, "geometry shader defined with conflicting " "output vertex count (%d and %d)\n", - linked_shader->Geom.VerticesOut, - shader->Geom.VerticesOut); + linked_shader->info.Geom.VerticesOut, + shader->info.Geom.VerticesOut); return; } - linked_shader->Geom.VerticesOut = shader->Geom.VerticesOut; + linked_shader->info.Geom.VerticesOut = shader->info.Geom.VerticesOut; } - if (shader->Geom.Invocations != 0) { - if (linked_shader->Geom.Invocations != 0 && - linked_shader->Geom.Invocations != shader->Geom.Invocations) { + if (shader->info.Geom.Invocations != 0) { + if (linked_shader->info.Geom.Invocations != 0 && + linked_shader->info.Geom.Invocations != + shader->info.Geom.Invocations) { linker_error(prog, "geometry shader defined with conflicting " "invocation count (%d and %d)\n", - linked_shader->Geom.Invocations, - shader->Geom.Invocations); + linked_shader->info.Geom.Invocations, + shader->info.Geom.Invocations); return; } - linked_shader->Geom.Invocations = shader->Geom.Invocations; + linked_shader->info.Geom.Invocations = shader->info.Geom.Invocations; } } @@ -2046,26 +2067,26 @@ link_gs_inout_layout_qualifiers(struct gl_shader_program *prog, * since we already know we're in the right type of shader program * for doing it. */ - if (linked_shader->Geom.InputType == PRIM_UNKNOWN) { + if (linked_shader->info.Geom.InputType == PRIM_UNKNOWN) { linker_error(prog, "geometry shader didn't declare primitive input type\n"); return; } - if (linked_shader->Geom.OutputType == PRIM_UNKNOWN) { + if (linked_shader->info.Geom.OutputType == PRIM_UNKNOWN) { linker_error(prog, "geometry shader didn't declare primitive output type\n"); return; } - if (linked_shader->Geom.VerticesOut == -1) { + if (linked_shader->info.Geom.VerticesOut == -1) { linker_error(prog, "geometry shader didn't declare max_vertices\n"); return; } - if (linked_shader->Geom.Invocations == 0) - linked_shader->Geom.Invocations = 1; + if (linked_shader->info.Geom.Invocations == 0) + linked_shader->info.Geom.Invocations = 1; } @@ -2081,7 +2102,7 @@ link_cs_input_layout_qualifiers(struct gl_shader_program *prog, unsigned num_shaders) { for (int i = 0; i < 3; i++) - linked_shader->Comp.LocalSize[i] = 0; + linked_shader->info.Comp.LocalSize[i] = 0; /* This function is called for all shader stages, but it only has an effect * for compute shaders. @@ -2102,19 +2123,21 @@ link_cs_input_layout_qualifiers(struct gl_shader_program *prog, for (unsigned sh = 0; sh < num_shaders; sh++) { struct gl_shader *shader = shader_list[sh]; - if (shader->Comp.LocalSize[0] != 0) { - if (linked_shader->Comp.LocalSize[0] != 0) { + if (shader->info.Comp.LocalSize[0] != 0) { + if (linked_shader->info.Comp.LocalSize[0] != 0) { for (int i = 0; i < 3; i++) { - if (linked_shader->Comp.LocalSize[i] != - shader->Comp.LocalSize[i]) { + if (linked_shader->info.Comp.LocalSize[i] != + shader->info.Comp.LocalSize[i]) { linker_error(prog, "compute shader defined with conflicting " "local sizes\n"); return; } } } - for (int i = 0; i < 3; i++) - linked_shader->Comp.LocalSize[i] = shader->Comp.LocalSize[i]; + for (int i = 0; i < 3; i++) { + linked_shader->info.Comp.LocalSize[i] = + shader->info.Comp.LocalSize[i]; + } } } @@ -2122,12 +2145,12 @@ link_cs_input_layout_qualifiers(struct gl_shader_program *prog, * since we already know we're in the right type of shader program * for doing it. */ - if (linked_shader->Comp.LocalSize[0] == 0) { + if (linked_shader->info.Comp.LocalSize[0] == 0) { linker_error(prog, "compute shader didn't declare local size\n"); return; } for (int i = 0; i < 3; i++) - prog->Comp.LocalSize[i] = linked_shader->Comp.LocalSize[i]; + prog->Comp.LocalSize[i] = linked_shader->info.Comp.LocalSize[i]; } @@ -2266,7 +2289,7 @@ link_intrastage_shaders(void *mem_ctx, /* Check if any shader needs built-in functions. */ bool need_builtins = false; for (unsigned i = 0; i < num_shaders; i++) { - if (shader_list[i]->uses_builtin_functions) { + if (shader_list[i]->info.uses_builtin_functions) { need_builtins = true; break; } @@ -2345,7 +2368,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(linked->Geom.InputType); + unsigned num_vertices = vertices_per_prim(linked->info.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); @@ -2470,7 +2493,7 @@ resize_tes_inputs(struct gl_context *ctx, * known until draw time. */ const int num_vertices = tcs - ? tcs->TessCtrl.VerticesOut + ? tcs->info.TessCtrl.VerticesOut : ctx->Const.MaxPatchVertices; tess_eval_array_resize_visitor input_resize_visitor(num_vertices, prog); @@ -4511,7 +4534,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) goto done; } - if (prog->Shaders[i]->ARB_fragment_coord_conventions_enable) { + if (prog->Shaders[i]->info.ARB_fragment_coord_conventions_enable) { prog->ARB_fragment_coord_conventions_enable = true; } -- cgit v1.2.3