[Mesa-stable] [Mesa-dev] [PATCH 5/5] glsl: Use Geom.VerticesOut == -1 to specify unset
Ilia Mirkin
imirkin at alum.mit.edu
Tue May 31 18:57:05 UTC 2016
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
On Tue, May 31, 2016 at 2:52 PM, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Because apparently layout(max_vertices=0) is a thing.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Cc: "12.0" <mesa-stable at lists.freedesktop.org>
> ---
> src/compiler/glsl/glsl_parser_extras.cpp | 2 +-
> src/compiler/glsl/linker.cpp | 8 ++++----
> src/mesa/main/shaderobj.c | 2 +-
> 3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
> index 843998d..2e3395e 100644
> --- a/src/compiler/glsl/glsl_parser_extras.cpp
> +++ b/src/compiler/glsl/glsl_parser_extras.cpp
> @@ -1687,7 +1687,7 @@ set_shader_inout_layout(struct gl_shader *shader,
> shader->TessEval.PointMode = state->in_qualifier->point_mode;
> break;
> case MESA_SHADER_GEOMETRY:
> - shader->Geom.VerticesOut = 0;
> + shader->Geom.VerticesOut = -1;
> if (state->out_qualifier->flags.q.max_vertices) {
> unsigned qual_max_vertices;
> if (state->out_qualifier->max_vertices->
> diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
> index 010dbd7..0f01a97 100644
> --- a/src/compiler/glsl/linker.cpp
> +++ b/src/compiler/glsl/linker.cpp
> @@ -1980,7 +1980,7 @@ link_gs_inout_layout_qualifiers(struct gl_shader_program *prog,
> struct gl_shader **shader_list,
> unsigned num_shaders)
> {
> - linked_shader->Geom.VerticesOut = 0;
> + linked_shader->Geom.VerticesOut = -1;
> linked_shader->Geom.Invocations = 0;
> linked_shader->Geom.InputType = PRIM_UNKNOWN;
> linked_shader->Geom.OutputType = PRIM_UNKNOWN;
> @@ -2024,8 +2024,8 @@ link_gs_inout_layout_qualifiers(struct gl_shader_program *prog,
> linked_shader->Geom.OutputType = shader->Geom.OutputType;
> }
>
> - if (shader->Geom.VerticesOut != 0) {
> - if (linked_shader->Geom.VerticesOut != 0 &&
> + if (shader->Geom.VerticesOut != -1) {
> + if (linked_shader->Geom.VerticesOut != -1 &&
> linked_shader->Geom.VerticesOut != shader->Geom.VerticesOut) {
> linker_error(prog, "geometry shader defined with conflicting "
> "output vertex count (%d and %d)\n",
> @@ -2067,7 +2067,7 @@ link_gs_inout_layout_qualifiers(struct gl_shader_program *prog,
> }
> prog->Geom.OutputType = linked_shader->Geom.OutputType;
>
> - if (linked_shader->Geom.VerticesOut == 0) {
> + if (linked_shader->Geom.VerticesOut == -1) {
> linker_error(prog,
> "geometry shader didn't declare max_vertices\n");
> return;
> diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
> index 274cb12..189317c 100644
> --- a/src/mesa/main/shaderobj.c
> +++ b/src/mesa/main/shaderobj.c
> @@ -232,7 +232,7 @@ init_shader_program(struct gl_shader_program *prog)
> prog->FragDataBindings = string_to_uint_map_ctor();
> prog->FragDataIndexBindings = string_to_uint_map_ctor();
>
> - prog->Geom.VerticesOut = 0;
> + prog->Geom.VerticesOut = -1;
> prog->Geom.InputType = GL_TRIANGLES;
> prog->Geom.OutputType = GL_TRIANGLE_STRIP;
> prog->Geom.UsesEndPrimitive = false;
> --
> 2.5.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-stable
mailing list