diff options
Diffstat (limited to 'mesalib/src/glsl/glsl_parser_extras.cpp')
-rw-r--r-- | mesalib/src/glsl/glsl_parser_extras.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp index a5bc20c23..88f048365 100644 --- a/mesalib/src/glsl/glsl_parser_extras.cpp +++ b/mesalib/src/glsl/glsl_parser_extras.cpp @@ -159,6 +159,10 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, this->default_uniform_qualifier = new(this) ast_type_qualifier(); this->default_uniform_qualifier->flags.q.shared = 1; this->default_uniform_qualifier->flags.q.column_major = 1; + + this->gs_input_prim_type_specified = false; + this->gs_input_prim_type = GL_POINTS; + this->out_qualifier = new(this) ast_type_qualifier(); } /** @@ -1410,6 +1414,34 @@ ast_struct_specifier::ast_struct_specifier(const char *identifier, is_declaration = true; } +static void +set_shader_inout_layout(struct gl_shader *shader, + struct _mesa_glsl_parse_state *state) +{ + if (shader->Type != GL_GEOMETRY_SHADER) { + /* Should have been prevented by the parser. */ + assert(!state->gs_input_prim_type_specified); + assert(!state->out_qualifier->flags.i); + return; + } + + shader->Geom.VerticesOut = 0; + if (state->out_qualifier->flags.q.max_vertices) + shader->Geom.VerticesOut = state->out_qualifier->max_vertices; + + if (state->gs_input_prim_type_specified) { + shader->Geom.InputType = state->gs_input_prim_type; + } else { + shader->Geom.InputType = PRIM_UNKNOWN; + } + + if (state->out_qualifier->flags.q.prim_type) { + shader->Geom.OutputType = state->out_qualifier->prim_type; + } else { + shader->Geom.OutputType = PRIM_UNKNOWN; + } +} + extern "C" { void @@ -1485,6 +1517,9 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, shader->UniformBlocks = state->uniform_blocks; ralloc_steal(shader, shader->UniformBlocks); + if (!state->error) + set_shader_inout_layout(shader, state); + /* Retain any live IR, but trash the rest. */ reparent_ir(shader->ir, shader->ir); |