[Mesa-dev] [PATCH] glsl/mesa: move duplicate shader fields into new struct gl_shader_info
Iago Toral
itoral at igalia.com
Thu Jun 30 06:28:12 UTC 2016
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
On Thu, 2016-06-30 at 14:49 +1000, Timothy Arceri wrote:
> ---
>
> This applys on top of https://patchwork.freedesktop.org/series/9217/
> with hasn't landed just yet.
>
> 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 ++++++++++++++++-------------
> src/mesa/drivers/dri/i965/brw_tcs.c | 2 +-
> src/mesa/main/api_validate.c | 13 +-
> src/mesa/main/ff_fragment_shader.cpp | 2 +-
> src/mesa/main/mtypes.h | 241 +++++++++-------------------
> src/mesa/main/shaderapi.c | 38 ++---
> src/mesa/main/shaderobj.c | 6 +-
> src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 +-
> 11 files changed, 283 insertions(+), 339 deletions(-)
>
> diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
> index 09f7477..fab64bb 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 0ad3be1..20302e3 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 db42bb1..473626b 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 9826368..d963f54 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;
> }
>
> diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c
> index 3ba9f2c..28e2f36 100644
> --- a/src/mesa/drivers/dri/i965/brw_tcs.c
> +++ b/src/mesa/drivers/dri/i965/brw_tcs.c
> @@ -392,7 +392,7 @@ brw_tcs_precompile(struct gl_context *ctx,
> /* Guess that the input and output patches have the same dimensionality. */
> if (brw->gen < 8) {
> key.input_vertices = shader_prog->
> - _LinkedShaders[MESA_SHADER_TESS_CTRL]->TessCtrl.VerticesOut;
> + _LinkedShaders[MESA_SHADER_TESS_CTRL]->info.TessCtrl.VerticesOut;
> }
>
> key.tes_primitive_mode = brw->tess_eval_program ?
> diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
> index c096224..038b5a9 100644
> --- a/src/mesa/main/api_validate.c
> +++ b/src/mesa/main/api_validate.c
> @@ -201,7 +201,7 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
> if (ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]) {
> const GLenum geom_mode =
> ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]->
> - _LinkedShaders[MESA_SHADER_GEOMETRY]->Geom.InputType;
> + _LinkedShaders[MESA_SHADER_GEOMETRY]->info.Geom.InputType;
> struct gl_shader_program *tes =
> ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
> GLenum mode_before_gs = mode;
> @@ -209,9 +209,9 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
> if (tes) {
> struct gl_linked_shader *tes_sh =
> tes->_LinkedShaders[MESA_SHADER_TESS_EVAL];
> - if (tes_sh->TessEval.PointMode)
> + if (tes_sh->info.TessEval.PointMode)
> mode_before_gs = GL_POINTS;
> - else if (tes_sh->TessEval.PrimitiveMode == GL_ISOLINES)
> + else if (tes_sh->info.TessEval.PrimitiveMode == GL_ISOLINES)
> mode_before_gs = GL_LINES;
> else
> /* the GL_QUADS mode generates triangles too */
> @@ -308,7 +308,8 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
>
> if(ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]) {
> switch (ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]->
> - _LinkedShaders[MESA_SHADER_GEOMETRY]->Geom.OutputType) {
> + _LinkedShaders[MESA_SHADER_GEOMETRY]->
> + info.Geom.OutputType) {
> case GL_POINTS:
> pass = ctx->TransformFeedback.Mode == GL_POINTS;
> break;
> @@ -327,9 +328,9 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
> ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
> struct gl_linked_shader *tes_sh =
> tes->_LinkedShaders[MESA_SHADER_TESS_EVAL];
> - if (tes_sh->TessEval.PointMode)
> + if (tes_sh->info.TessEval.PointMode)
> pass = ctx->TransformFeedback.Mode == GL_POINTS;
> - else if (tes_sh->TessEval.PrimitiveMode == GL_ISOLINES)
> + else if (tes_sh->info.TessEval.PrimitiveMode == GL_ISOLINES)
> pass = ctx->TransformFeedback.Mode == GL_LINES;
> else
> pass = ctx->TransformFeedback.Mode == GL_TRIANGLES;
> diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
> index 83881e9..1f9a7cf 100644
> --- a/src/mesa/main/ff_fragment_shader.cpp
> +++ b/src/mesa/main/ff_fragment_shader.cpp
> @@ -1260,7 +1260,7 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
>
> p.shader->CompileStatus = true;
> p.shader->Version = state->language_version;
> - p.shader->uses_builtin_functions = state->uses_builtin_functions;
> + p.shader->info.uses_builtin_functions = state->uses_builtin_functions;
> p.shader_program->Shaders =
> (gl_shader **)malloc(sizeof(*p.shader_program->Shaders));
> p.shader_program->Shaders[0] = p.shader;
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index fdd445f..cab315d 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -2235,62 +2235,10 @@ struct gl_subroutine_function
> };
>
> /**
> - * A linked GLSL shader object.
> + * Shader information needed by both gl_shader and gl_linked shader.
> */
> -struct gl_linked_shader
> +struct gl_shader_info
> {
> - gl_shader_stage Stage;
> -
> - struct gl_program *Program; /**< Post-compile assembly code */
> -
> - /**
> - * \name Sampler tracking
> - *
> - * \note Each of these fields is only set post-linking.
> - */
> - /*@{*/
> - unsigned num_samplers; /**< Number of samplers used by this shader. */
> - GLbitfield active_samplers; /**< Bitfield of which samplers are used */
> - GLbitfield shadow_samplers; /**< Samplers used for shadow sampling. */
> - /*@}*/
> -
> - /**
> - * Map from sampler unit to texture unit (set by glUniform1i())
> - *
> - * A sampler unit is associated with each sampler uniform by the linker.
> - * The sampler unit associated with each uniform is stored in the
> - * \c gl_uniform_storage::sampler field.
> - */
> - GLubyte SamplerUnits[MAX_SAMPLERS];
> - /** Which texture target is being sampled (TEXTURE_1D/2D/3D/etc_INDEX) */
> - gl_texture_index SamplerTargets[MAX_SAMPLERS];
> -
> - /**
> - * Number of default uniform block components used by this shader.
> - *
> - * This field is only set post-linking.
> - */
> - unsigned num_uniform_components;
> -
> - /**
> - * Number of combined uniform components used by this shader.
> - *
> - * This field is only set post-linking. It is the sum of the uniform block
> - * sizes divided by sizeof(float), and num_uniform_compoennts.
> - */
> - unsigned num_combined_uniform_components;
> -
> - unsigned NumUniformBlocks;
> - struct gl_uniform_block **UniformBlocks;
> -
> - unsigned NumShaderStorageBlocks;
> - struct gl_uniform_block **ShaderStorageBlocks;
> -
> - struct exec_list *ir;
> - struct exec_list *packed_varyings;
> - struct exec_list *fragdata_arrays;
> - struct glsl_symbol_table *symbols;
> -
> bool uses_builtin_functions;
> bool uses_gl_fragcoord;
> bool redeclares_gl_fragcoord;
> @@ -2366,6 +2314,81 @@ struct gl_linked_shader
> } Geom;
>
> /**
> + * Whether early fragment tests are enabled as defined by
> + * ARB_shader_image_load_store.
> + */
> + bool EarlyFragmentTests;
> +
> + /**
> + * Compute shader state from ARB_compute_shader layout qualifiers.
> + */
> + struct {
> + /**
> + * Size specified using local_size_{x,y,z}, or all 0's to indicate that
> + * it's not set in this shader.
> + */
> + unsigned LocalSize[3];
> + } Comp;
> +};
> +
> +/**
> + * A linked GLSL shader object.
> + */
> +struct gl_linked_shader
> +{
> + gl_shader_stage Stage;
> +
> + struct gl_program *Program; /**< Post-compile assembly code */
> +
> + /**
> + * \name Sampler tracking
> + *
> + * \note Each of these fields is only set post-linking.
> + */
> + /*@{*/
> + unsigned num_samplers; /**< Number of samplers used by this shader. */
> + GLbitfield active_samplers; /**< Bitfield of which samplers are used */
> + GLbitfield shadow_samplers; /**< Samplers used for shadow sampling. */
> + /*@}*/
> +
> + /**
> + * Map from sampler unit to texture unit (set by glUniform1i())
> + *
> + * A sampler unit is associated with each sampler uniform by the linker.
> + * The sampler unit associated with each uniform is stored in the
> + * \c gl_uniform_storage::sampler field.
> + */
> + GLubyte SamplerUnits[MAX_SAMPLERS];
> + /** Which texture target is being sampled (TEXTURE_1D/2D/3D/etc_INDEX) */
> + gl_texture_index SamplerTargets[MAX_SAMPLERS];
> +
> + /**
> + * Number of default uniform block components used by this shader.
> + *
> + * This field is only set post-linking.
> + */
> + unsigned num_uniform_components;
> +
> + /**
> + * Number of combined uniform components used by this shader.
> + *
> + * This field is only set post-linking. It is the sum of the uniform block
> + * sizes divided by sizeof(float), and num_uniform_compoennts.
> + */
> + unsigned num_combined_uniform_components;
> +
> + unsigned NumUniformBlocks;
> + struct gl_uniform_block **UniformBlocks;
> +
> + unsigned NumShaderStorageBlocks;
> + struct gl_uniform_block **ShaderStorageBlocks;
> +
> + struct exec_list *ir;
> + struct exec_list *packed_varyings;
> + struct exec_list *fragdata_arrays;
> + struct glsl_symbol_table *symbols;
> +
> + /**
> * Map from image uniform index to image unit (set by glUniform1i())
> *
> * An image uniform index is associated with each image uniform by
> @@ -2395,23 +2418,6 @@ struct gl_linked_shader
> unsigned NumAtomicBuffers;
>
> /**
> - * Whether early fragment tests are enabled as defined by
> - * ARB_shader_image_load_store.
> - */
> - bool EarlyFragmentTests;
> -
> - /**
> - * Compute shader state from ARB_compute_shader layout qualifiers.
> - */
> - struct {
> - /**
> - * Size specified using local_size_{x,y,z}, or all 0's to indicate that
> - * it's not set in this shader.
> - */
> - unsigned LocalSize[3];
> - } Comp;
> -
> - /**
> * Number of types for subroutine uniforms.
> */
> GLuint NumSubroutineUniformTypes;
> @@ -2431,6 +2437,8 @@ struct gl_linked_shader
> GLuint NumSubroutineFunctions;
> GLuint MaxSubroutineFunctionIndex;
> struct gl_subroutine_function *SubroutineFunctions;
> +
> + struct gl_shader_info info;
> };
>
> /**
> @@ -2461,96 +2469,7 @@ struct gl_shader
> struct exec_list *ir;
> struct glsl_symbol_table *symbols;
>
> - bool uses_builtin_functions;
> - bool uses_gl_fragcoord;
> - bool redeclares_gl_fragcoord;
> - bool ARB_fragment_coord_conventions_enable;
> -
> - /**
> - * Fragment shader state from GLSL 1.50 layout qualifiers.
> - */
> - bool origin_upper_left;
> - bool pixel_center_integer;
> -
> - struct {
> - /** Global xfb_stride out qualifier if any */
> - GLuint BufferStride[MAX_FEEDBACK_BUFFERS];
> - } TransformFeedback;
> -
> - /**
> - * Tessellation Control shader state from layout qualifiers.
> - */
> - struct {
> - /**
> - * 0 - vertices not declared in shader, or
> - * 1 .. GL_MAX_PATCH_VERTICES
> - */
> - GLint VerticesOut;
> - } TessCtrl;
> -
> - /**
> - * Tessellation Evaluation shader state from layout qualifiers.
> - */
> - struct {
> - /**
> - * GL_TRIANGLES, GL_QUADS, GL_ISOLINES or PRIM_UNKNOWN if it's not set
> - * in this shader.
> - */
> - GLenum PrimitiveMode;
> - /**
> - * GL_EQUAL, GL_FRACTIONAL_ODD, GL_FRACTIONAL_EVEN, or 0 if it's not set
> - * in this shader.
> - */
> - GLenum Spacing;
> - /**
> - * GL_CW, GL_CCW, or 0 if it's not set in this shader.
> - */
> - GLenum VertexOrder;
> - /**
> - * 1, 0, or -1 if it's not set in this shader.
> - */
> - int PointMode;
> - } TessEval;
> -
> - /**
> - * Geometry shader state from GLSL 1.50 layout qualifiers.
> - */
> - struct {
> - GLint VerticesOut;
> - /**
> - * 0 - Invocations count not declared in shader, or
> - * 1 .. MAX_GEOMETRY_SHADER_INVOCATIONS
> - */
> - GLint Invocations;
> - /**
> - * GL_POINTS, GL_LINES, GL_LINES_ADJACENCY, GL_TRIANGLES, or
> - * GL_TRIANGLES_ADJACENCY, or PRIM_UNKNOWN if it's not set in this
> - * shader.
> - */
> - GLenum InputType;
> - /**
> - * GL_POINTS, GL_LINE_STRIP or GL_TRIANGLE_STRIP, or PRIM_UNKNOWN if
> - * it's not set in this shader.
> - */
> - GLenum OutputType;
> - } Geom;
> -
> - /**
> - * Whether early fragment tests are enabled as defined by
> - * ARB_shader_image_load_store.
> - */
> - bool EarlyFragmentTests;
> -
> - /**
> - * Compute shader state from ARB_compute_shader layout qualifiers.
> - */
> - struct {
> - /**
> - * Size specified using local_size_{x,y,z}, or all 0's to indicate that
> - * it's not set in this shader.
> - */
> - unsigned LocalSize[3];
> - } Comp;
> + struct gl_shader_info info;
> };
>
>
> diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
> index fdfe1e7..c5c5024 100644
> --- a/src/mesa/main/shaderapi.c
> +++ b/src/mesa/main/shaderapi.c
> @@ -732,7 +732,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
> break;
> if (check_gs_query(ctx, shProg)) {
> *params = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->
> - Geom.VerticesOut;
> + info.Geom.VerticesOut;
> }
> return;
> case GL_GEOMETRY_SHADER_INVOCATIONS:
> @@ -740,7 +740,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
> break;
> if (check_gs_query(ctx, shProg)) {
> *params = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->
> - Geom.Invocations;
> + info.Geom.Invocations;
> }
> return;
> case GL_GEOMETRY_INPUT_TYPE:
> @@ -748,7 +748,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
> break;
> if (check_gs_query(ctx, shProg)) {
> *params = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->
> - Geom.InputType;
> + info.Geom.InputType;
> }
> return;
> case GL_GEOMETRY_OUTPUT_TYPE:
> @@ -756,7 +756,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
> break;
> if (check_gs_query(ctx, shProg)) {
> *params = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->
> - Geom.OutputType;
> + info.Geom.OutputType;
> }
> return;
> case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH: {
> @@ -834,7 +834,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
> break;
> if (check_tcs_query(ctx, shProg)) {
> *params = shProg->_LinkedShaders[MESA_SHADER_TESS_CTRL]->
> - TessCtrl.VerticesOut;
> + info.TessCtrl.VerticesOut;
> }
> return;
> case GL_TESS_GEN_MODE:
> @@ -842,7 +842,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
> break;
> if (check_tes_query(ctx, shProg)) {
> *params = shProg->_LinkedShaders[MESA_SHADER_TESS_EVAL]->
> - TessEval.PrimitiveMode;
> + info.TessEval.PrimitiveMode;
> }
> return;
> case GL_TESS_GEN_SPACING:
> @@ -850,7 +850,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
> break;
> if (check_tes_query(ctx, shProg)) {
> *params = shProg->_LinkedShaders[MESA_SHADER_TESS_EVAL]->
> - TessEval.Spacing;
> + info.TessEval.Spacing;
> }
> return;
> case GL_TESS_GEN_VERTEX_ORDER:
> @@ -858,7 +858,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
> break;
> if (check_tes_query(ctx, shProg)) {
> *params = shProg->_LinkedShaders[MESA_SHADER_TESS_EVAL]->
> - TessEval.VertexOrder;
> + info.TessEval.VertexOrder;
> }
> return;
> case GL_TESS_GEN_POINT_MODE:
> @@ -866,7 +866,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
> break;
> if (check_tes_query(ctx, shProg)) {
> *params = shProg->_LinkedShaders[MESA_SHADER_TESS_EVAL]->
> - TessEval.PointMode;
> + info.TessEval.PointMode;
> }
> return;
> default:
> @@ -2168,8 +2168,8 @@ _mesa_copy_linked_program_data(gl_shader_stage type,
> case MESA_SHADER_TESS_CTRL: {
> struct gl_tess_ctrl_program *dst_tcp =
> (struct gl_tess_ctrl_program *) dst;
> - dst_tcp->VerticesOut =
> - src->_LinkedShaders[MESA_SHADER_TESS_CTRL]->TessCtrl.VerticesOut;
> + dst_tcp->VerticesOut = src->_LinkedShaders[MESA_SHADER_TESS_CTRL]->
> + info.TessCtrl.VerticesOut;
> break;
> }
> case MESA_SHADER_TESS_EVAL: {
> @@ -2178,10 +2178,10 @@ _mesa_copy_linked_program_data(gl_shader_stage type,
> struct gl_linked_shader *tes_sh =
> src->_LinkedShaders[MESA_SHADER_TESS_EVAL];
>
> - dst_tep->PrimitiveMode = tes_sh->TessEval.PrimitiveMode;
> - dst_tep->Spacing = tes_sh->TessEval.Spacing;
> - dst_tep->VertexOrder = tes_sh->TessEval.VertexOrder;
> - dst_tep->PointMode = tes_sh->TessEval.PointMode;
> + dst_tep->PrimitiveMode = tes_sh->info.TessEval.PrimitiveMode;
> + dst_tep->Spacing = tes_sh->info.TessEval.Spacing;
> + dst_tep->VertexOrder = tes_sh->info.TessEval.VertexOrder;
> + dst_tep->PointMode = tes_sh->info.TessEval.PointMode;
> dst->ClipDistanceArraySize = src->TessEval.ClipDistanceArraySize;
> dst->CullDistanceArraySize = src->TessEval.CullDistanceArraySize;
> break;
> @@ -2192,10 +2192,10 @@ _mesa_copy_linked_program_data(gl_shader_stage type,
> src->_LinkedShaders[MESA_SHADER_GEOMETRY];
>
> dst_gp->VerticesIn = src->Geom.VerticesIn;
> - dst_gp->VerticesOut = geom_sh->Geom.VerticesOut;
> - dst_gp->Invocations = geom_sh->Geom.Invocations;
> - dst_gp->InputType = geom_sh->Geom.InputType;
> - dst_gp->OutputType = geom_sh->Geom.OutputType;
> + dst_gp->VerticesOut = geom_sh->info.Geom.VerticesOut;
> + dst_gp->Invocations = geom_sh->info.Geom.Invocations;
> + dst_gp->InputType = geom_sh->info.Geom.InputType;
> + dst_gp->OutputType = geom_sh->info.Geom.OutputType;
> dst->ClipDistanceArraySize = src->Geom.ClipDistanceArraySize;
> dst->CullDistanceArraySize = src->Geom.CullDistanceArraySize;
> dst_gp->UsesEndPrimitive = src->Geom.UsesEndPrimitive;
> diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
> index 131d682..0075a6d 100644
> --- a/src/mesa/main/shaderobj.c
> +++ b/src/mesa/main/shaderobj.c
> @@ -92,9 +92,9 @@ static void
> _mesa_init_shader(struct gl_shader *shader)
> {
> shader->RefCount = 1;
> - shader->Geom.VerticesOut = -1;
> - shader->Geom.InputType = GL_TRIANGLES;
> - shader->Geom.OutputType = GL_TRIANGLE_STRIP;
> + shader->info.Geom.VerticesOut = -1;
> + shader->info.Geom.InputType = GL_TRIANGLES;
> + shader->info.Geom.OutputType = GL_TRIANGLE_STRIP;
> }
>
> /**
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index 9315153..197b3af 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -6133,7 +6133,7 @@ st_translate_program(
> }
>
> if (procType == PIPE_SHADER_FRAGMENT) {
> - if (program->shader->EarlyFragmentTests)
> + if (program->shader->info.EarlyFragmentTests)
> ureg_property(ureg, TGSI_PROPERTY_FS_EARLY_DEPTH_STENCIL, 1);
>
> if (proginfo->InputsRead & VARYING_BIT_POS) {
More information about the mesa-dev
mailing list