[Mesa-dev] [PATCH 04/14] mesa: add ctx->Const.MaxGeometryShaderInvocations
Ian Romanick
idr at freedesktop.org
Sat Aug 11 00:53:19 UTC 2018
This commit is
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
On 08/08/2018 04:55 PM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> radeonsi wants to report a different value
> ---
> src/compiler/glsl/glsl_parser_extras.cpp | 3 ++-
> src/compiler/glsl/glsl_parser_extras.h | 1 +
> src/mesa/main/context.c | 1 +
> src/mesa/main/get_hash_params.py | 2 +-
> src/mesa/main/mtypes.h | 3 ++-
> 5 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
> index 6d92f24ea22..01ca39fb0cc 100644
> --- a/src/compiler/glsl/glsl_parser_extras.cpp
> +++ b/src/compiler/glsl/glsl_parser_extras.cpp
> @@ -111,20 +111,21 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
> this->Const.MaxProgramTexelOffset = ctx->Const.MaxProgramTexelOffset;
>
> this->Const.MaxDrawBuffers = ctx->Const.MaxDrawBuffers;
>
> this->Const.MaxDualSourceDrawBuffers = ctx->Const.MaxDualSourceDrawBuffers;
>
> /* 1.50 constants */
> this->Const.MaxVertexOutputComponents = ctx->Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents;
> this->Const.MaxGeometryInputComponents = ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxInputComponents;
> this->Const.MaxGeometryOutputComponents = ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxOutputComponents;
> + this->Const.MaxGeometryShaderInvocations = ctx->Const.MaxGeometryShaderInvocations;
> this->Const.MaxFragmentInputComponents = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxInputComponents;
> this->Const.MaxGeometryTextureImageUnits = ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits;
> this->Const.MaxGeometryOutputVertices = ctx->Const.MaxGeometryOutputVertices;
> this->Const.MaxGeometryTotalOutputComponents = ctx->Const.MaxGeometryTotalOutputComponents;
> this->Const.MaxGeometryUniformComponents = ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxUniformComponents;
>
> this->Const.MaxVertexAtomicCounters = ctx->Const.Program[MESA_SHADER_VERTEX].MaxAtomicCounters;
> this->Const.MaxTessControlAtomicCounters = ctx->Const.Program[MESA_SHADER_TESS_CTRL].MaxAtomicCounters;
> this->Const.MaxTessEvaluationAtomicCounters = ctx->Const.Program[MESA_SHADER_TESS_EVAL].MaxAtomicCounters;
> this->Const.MaxGeometryAtomicCounters = ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicCounters;
> @@ -1810,21 +1811,21 @@ set_shader_inout_layout(struct gl_shader *shader,
> }
>
> shader->info.Geom.Invocations = 0;
> if (state->in_qualifier->flags.q.invocations) {
> unsigned invocations;
> if (state->in_qualifier->invocations->
> process_qualifier_constant(state, "invocations",
> &invocations, false)) {
>
> YYLTYPE loc = state->in_qualifier->invocations->get_location();
> - if (invocations > MAX_GEOMETRY_SHADER_INVOCATIONS) {
> + if (invocations > state->Const.MaxGeometryShaderInvocations) {
> _mesa_glsl_error(&loc, state,
> "invocations (%d) exceeds "
> "GL_MAX_GEOMETRY_SHADER_INVOCATIONS",
> invocations);
> }
> shader->info.Geom.Invocations = invocations;
> }
> }
> break;
>
> diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h
> index 59a173418b7..b29216f8d32 100644
> --- a/src/compiler/glsl/glsl_parser_extras.h
> +++ b/src/compiler/glsl/glsl_parser_extras.h
> @@ -486,20 +486,21 @@ struct _mesa_glsl_parse_state {
> unsigned MaxDualSourceDrawBuffers;
>
> /* 3.00 ES */
> int MinProgramTexelOffset;
> int MaxProgramTexelOffset;
>
> /* 1.50 */
> unsigned MaxVertexOutputComponents;
> unsigned MaxGeometryInputComponents;
> unsigned MaxGeometryOutputComponents;
> + unsigned MaxGeometryShaderInvocations;
> unsigned MaxFragmentInputComponents;
> unsigned MaxGeometryTextureImageUnits;
> unsigned MaxGeometryOutputVertices;
> unsigned MaxGeometryTotalOutputComponents;
> unsigned MaxGeometryUniformComponents;
>
> /* ARB_shader_atomic_counters */
> unsigned MaxVertexAtomicCounters;
> unsigned MaxTessControlAtomicCounters;
> unsigned MaxTessEvaluationAtomicCounters;
> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
> index 0ef8fe32a63..c46d97983e9 100644
> --- a/src/mesa/main/context.c
> +++ b/src/mesa/main/context.c
> @@ -630,20 +630,21 @@ _mesa_init_constants(struct gl_constants *consts, gl_api api)
>
> consts->MaxColorAttachments = MAX_COLOR_ATTACHMENTS;
> consts->MaxRenderbufferSize = MAX_RENDERBUFFER_SIZE;
>
> consts->Program[MESA_SHADER_VERTEX].MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
> consts->MaxCombinedTextureImageUnits = MAX_COMBINED_TEXTURE_IMAGE_UNITS;
> consts->MaxVarying = 16; /* old limit not to break tnl and swrast */
> consts->Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
> consts->MaxGeometryOutputVertices = MAX_GEOMETRY_OUTPUT_VERTICES;
> consts->MaxGeometryTotalOutputComponents = MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS;
> + consts->MaxGeometryShaderInvocations = MAX_GEOMETRY_SHADER_INVOCATIONS;
>
> #ifdef DEBUG
> consts->GenerateTemporaryNames = true;
> #else
> consts->GenerateTemporaryNames = false;
> #endif
>
> /* GL_ARB_framebuffer_object */
> consts->MaxSamples = 0;
>
> diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
> index 5c672a33123..dcfeac39190 100644
> --- a/src/mesa/main/get_hash_params.py
> +++ b/src/mesa/main/get_hash_params.py
> @@ -635,21 +635,21 @@ descriptor=[
> [ "MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS", "CONTEXT_INT(Const.Program[MESA_SHADER_TESS_EVAL].MaxShaderStorageBlocks), extra_ARB_shader_storage_buffer_object" ],
>
> # GL_ARB_uniform_buffer_object / geometry shader
> [ "MAX_GEOMETRY_UNIFORM_BLOCKS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxUniformBlocks), extra_ARB_uniform_buffer_object_and_geometry_shader" ],
> [ "MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxCombinedUniformComponents), extra_ARB_uniform_buffer_object_and_geometry_shader" ],
>
> # GL_ARB_viewport_array / GL_OES_geometry_shader
> [ "LAYER_PROVOKING_VERTEX", "CONTEXT_ENUM16(Const.LayerAndVPIndexProvokingVertex), extra_ARB_viewport_array_or_oes_geometry_shader" ],
>
> # GL_ARB_gpu_shader5 / GL_OES_geometry_shader
> - [ "MAX_GEOMETRY_SHADER_INVOCATIONS", "CONST(MAX_GEOMETRY_SHADER_INVOCATIONS), extra_ARB_gpu_shader5_or_oes_geometry_shader" ],
> + [ "MAX_GEOMETRY_SHADER_INVOCATIONS", "CONTEXT_INT(Const.MaxGeometryShaderInvocations), extra_ARB_gpu_shader5_or_oes_geometry_shader" ],
>
> # GL_OES_primitive_bounding_box
> [ "PRIMITIVE_BOUNDING_BOX_ARB", "CONTEXT_FLOAT8(PrimitiveBoundingBox), extra_OES_primitive_bounding_box" ],
>
> # GL_ARB_viewport_array / GL_OES_viewport_array
> [ "MAX_VIEWPORTS", "CONTEXT_INT(Const.MaxViewports), extra_ARB_viewport_array_or_oes_viewport_array" ],
> [ "VIEWPORT_SUBPIXEL_BITS", "CONTEXT_INT(Const.ViewportSubpixelBits), extra_ARB_viewport_array_or_oes_viewport_array" ],
> [ "VIEWPORT_BOUNDS_RANGE", "CONTEXT_FLOAT2(Const.ViewportBounds), extra_ARB_viewport_array_or_oes_viewport_array" ],
> [ "VIEWPORT_INDEX_PROVOKING_VERTEX", "CONTEXT_ENUM16(Const.LayerAndVPIndexProvokingVertex), extra_ARB_viewport_array_or_oes_viewport_array" ],
>
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 202268e710b..8ea0f5c2396 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -2441,21 +2441,21 @@ struct gl_shader_info
> 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
> + * 1 .. Const.MaxGeometryShaderInvocations
> */
> 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.
> */
> GLenum16 InputType;
> /**
> * GL_POINTS, GL_LINE_STRIP or GL_TRIANGLE_STRIP, or PRIM_UNKNOWN if
> @@ -3703,20 +3703,21 @@ struct gl_constants
> /** @} */
>
> /**
> * GL_ARB_explicit_uniform_location
> */
> GLuint MaxUserAssignableUniformLocations;
>
> /** geometry shader */
> GLuint MaxGeometryOutputVertices;
> GLuint MaxGeometryTotalOutputComponents;
> + GLuint MaxGeometryShaderInvocations;
>
> GLuint GLSLVersion; /**< Desktop GLSL version supported (ex: 120 = 1.20) */
> GLuint GLSLVersionCompat; /**< Desktop compat GLSL version supported */
>
> /**
> * Changes default GLSL extension behavior from "error" to "warn". It's out
> * of spec, but it can make some apps work that otherwise wouldn't.
> */
> GLboolean ForceGLSLExtensionsWarn;
>
>
More information about the mesa-dev
mailing list