[Mesa-dev] [PATCH 2/2] main/get: support ARB_gpu_shader5

Jordan Justen jljusten at gmail.com
Sun Jan 26 00:17:16 PST 2014


On Sat, Jan 25, 2014 at 2:05 PM, Matt Turner <mattst88 at gmail.com> wrote:
> On Sat, Jan 25, 2014 at 10:55 AM, Jordan Justen
> <jordan.l.justen at intel.com> wrote:
>> If a driver enables ARB_gpu_shader5 and sets
>> Const.MaxVertexSteams >= 4, then piglit's
>> arb_gpu_shader5-minmax test should now pass.
>>
>> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
>> ---
>>  src/mesa/main/config.h           | 9 +++++++++
>>  src/mesa/main/context.c          | 4 ++++
>>  src/mesa/main/get.c              | 2 ++
>>  src/mesa/main/get_hash_params.py | 8 +++++++-
>>  src/mesa/main/mtypes.h           | 4 ++++
>>  5 files changed, 26 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
>> index 0c1782a..30da5d4 100644
>> --- a/src/mesa/main/config.h
>> +++ b/src/mesa/main/config.h
>> @@ -272,6 +272,15 @@
>>  #define MAX_DEBUG_GROUP_STACK_DEPTH 64
>>  /*@}*/
>>
>> +/** For GL_ARB_gpu_shader5 */
>> +/*@{*/
>> +#define MAX_GEOMETRY_SHADER_INVOCATIONS     32
>> +#define MIN_FRAGMENT_INTERPOLATION_OFFSET   -0.5
>> +#define MAX_FRAGMENT_INTERPOLATION_OFFSET   0.5
>> +#define FRAGMENT_INTERPOLATION_OFFSET_BITS  4
>> +#define MAX_VERTEX_STREAMS                  4
>> +/*@}*/
>> +
>>  /*
>>   * Color channel component order
>>   *
>> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
>> index b7cd568..c284079 100644
>> --- a/src/mesa/main/context.c
>> +++ b/src/mesa/main/context.c
>> @@ -692,6 +692,10 @@ _mesa_init_constants(struct gl_context *ctx)
>>     /* GL_ARB_vertex_attrib_binding */
>>     ctx->Const.MaxVertexAttribRelativeOffset = 2047;
>>     ctx->Const.MaxVertexAttribBindings = MAX_VERTEX_GENERIC_ATTRIBS;
>> +
>> +   /** GL_ARB_gpu_shader5 */
>> +   ctx->Const.MinFragmentInterpolationOffset = MIN_FRAGMENT_INTERPOLATION_OFFSET;
>> +   ctx->Const.MaxFragmentInterpolationOffset = MAX_FRAGMENT_INTERPOLATION_OFFSET;
>>  }
>>
>>
>> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
>> index 16dce5b..4192151 100644
>> --- a/src/mesa/main/get.c
>> +++ b/src/mesa/main/get.c
>> @@ -392,6 +392,8 @@ EXTRA_EXT(ARB_shader_atomic_counters);
>>  EXTRA_EXT(ARB_draw_indirect);
>>  EXTRA_EXT(ARB_shader_image_load_store);
>>  EXTRA_EXT(ARB_viewport_array);
>> +EXTRA_EXT(ARB_gpu_shader5);
>> +EXTRA_EXT2(ARB_transform_feedback3, ARB_gpu_shader5);
>>
>>  static const int
>>  extra_ARB_color_buffer_float_or_glcore[] = {
>> diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
>> index b45e143..818d9a0 100644
>> --- a/src/mesa/main/get_hash_params.py
>> +++ b/src/mesa/main/get_hash_params.py
>> @@ -643,7 +643,7 @@ descriptor=[
>>
>>  # GL_ARB_transform_feedback3
>>    [ "MAX_TRANSFORM_FEEDBACK_BUFFERS", "CONTEXT_INT(Const.MaxTransformFeedbackBuffers), extra_ARB_transform_feedback3" ],
>> -  [ "MAX_VERTEX_STREAMS", "CONTEXT_INT(Const.MaxVertexStreams), extra_ARB_transform_feedback3" ],
>> +  [ "MAX_VERTEX_STREAMS", "CONTEXT_INT(Const.MaxVertexStreams), extra_ARB_transform_feedback3_ARB_gpu_shader5" ],
>>
>>  # GL_ARB_geometry_shader4
>>    [ "MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits), extra_gl32_ARB_geometry_shader4" ],
>> @@ -751,6 +751,12 @@ descriptor=[
>>    [ "MAX_GEOMETRY_IMAGE_UNIFORMS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxImageUniforms), extra_ARB_shader_image_load_store_and_geometry_shader"],
>>    [ "MAX_FRAGMENT_IMAGE_UNIFORMS", "CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxImageUniforms), extra_ARB_shader_image_load_store"],
>>    [ "MAX_COMBINED_IMAGE_UNIFORMS", "CONTEXT_INT(Const.MaxCombinedImageUniforms), extra_ARB_shader_image_load_store"],
>> +
>> +# GL_ARB_gpu_shader5
>> +  [ "MAX_GEOMETRY_SHADER_INVOCATIONS", "CONST(MAX_GEOMETRY_SHADER_INVOCATIONS), extra_ARB_gpu_shader5" ],
>> +  [ "MIN_FRAGMENT_INTERPOLATION_OFFSET", "CONTEXT_FLOAT(Const.MinFragmentInterpolationOffset), extra_ARB_gpu_shader5" ],
>> +  [ "MAX_FRAGMENT_INTERPOLATION_OFFSET", "CONTEXT_FLOAT(Const.MaxFragmentInterpolationOffset), extra_ARB_gpu_shader5" ],
>> +  [ "FRAGMENT_INTERPOLATION_OFFSET_BITS", "CONST(FRAGMENT_INTERPOLATION_OFFSET_BITS), extra_ARB_gpu_shader5" ],
>>  ]},
>>
>>  # Enums restricted to OpenGL Core profile
>> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
>> index 9ab2de0..875b57a 100644
>> --- a/src/mesa/main/mtypes.h
>> +++ b/src/mesa/main/mtypes.h
>> @@ -3366,6 +3366,10 @@ struct gl_constants
>>     GLuint MaxCombinedImageUnitsAndFragmentOutputs;
>>     GLuint MaxImageSamples;
>>     GLuint MaxCombinedImageUniforms;
>> +
>> +   /** GL_ARB_gpu_shader5 */
>> +   GLfloat MinFragmentInterpolationOffset;
>> +   GLfloat MaxFragmentInterpolationOffset;
>>  };
>
> Both are
>
> Reviewed-by: Matt Turner <mattst88 at gmail.com>
>
> but I'm wondering why only two of the four get new fields in
> gl_constants? Are we going to want to override just those two?

I wanted to make these constant floats, because I don't have enough
information to anticipate needing to change them from the spec
requirement. The issue was that get_hash_params.py only supports
constant ints right now.

I took another look, and it seems that storing const norm floats would
be an easy change, so I'll send out a v2 with that change.

-Jordan


More information about the mesa-dev mailing list