[Mesa-dev] [PATCH] [RFC] MESA_shading_language_130: is this it?

Chris Forbes chrisf at ijw.co.nz
Tue Dec 2 11:59:16 PST 2014


Ian, Dave

My ILK is down at the moment, but I don't recall any problem with clip
distances. All that work landed in mesa-10.0, and at the time passed
all the relevant piglits (with 1.30 + EXT_gpu_shader4 hacked in for
entrypoints). The Gen4-5 VS currently lowers all user clipping to clip
distances, and the clip shader works purely in terms of clip
distances.

The old Broadwater and Crestline chips have problems supporting 8 clip
distances due to the negative-W workaround mess. It could be done, but
doesn't seem worth it.

All we were missing was the API side to make 1.30 useful without GL3.

[Note that there's a possible perf tradeoff still to be explored in
not doing real geometry clipping for clip distances, but instead just
discarding the unwanted fragments in the FS. At least Ironlake
provides a mechanism to fixup the fragment counts for this case;
Cantiga may do as well.]

-- Chris

On Wed, Dec 3, 2014 at 7:26 AM, Ian Romanick <idr at freedesktop.org> wrote:
> On 11/26/2014 06:09 PM, Dave Airlie wrote:
>> Glamor is 4x faster on my ILK using glsl 130 at core text using
>> x11perf -ftext.
>>
>> Ian started writing a spec for this extension a while back, which seems like
>> most of the work, this patch seems to do enough, to advertise GLSL 1.30.
>
> Yeah... I started writing the extension when Chris Forbes was working on
> adding GLSL 1.30 for Ironlake.  I seem to recall that gl_ClipDistance
> still does not work for ILK, and difficulties with that caused Chris to
> abandon the project.  This was over a year ago, so the details are a bit
> fuzzy.
>
> The common Mesa parts look good, though.  If we want to pursue this, I
> can finish up the extension spec and get it published.
>
> One other minor nit below...
>
>> TODO:
>> fix extension numbering
>> get piglit to execute tests on this
>>
>> Just-hacked-up-by: Dave Airlie <airlied at redhat.com>
>> ---
>>  src/mapi/glapi/gen/MESA_shading_language_130.xml | 255 +++++++++++++++++++++++
>>  src/mapi/glapi/gen/gl_API.xml                    |   2 +
>>  src/mesa/drivers/dri/i965/intel_extensions.c     |   5 +
>>  src/mesa/main/extensions.c                       |   1 +
>>  src/mesa/main/mtypes.h                           |   1 +
>>  5 files changed, 264 insertions(+)
>>  create mode 100644 src/mapi/glapi/gen/MESA_shading_language_130.xml
>>
>> diff --git a/src/mapi/glapi/gen/MESA_shading_language_130.xml b/src/mapi/glapi/gen/MESA_shading_language_130.xml
>> new file mode 100644
>> index 0000000..9aa553d
>> --- /dev/null
>> +++ b/src/mapi/glapi/gen/MESA_shading_language_130.xml
>> @@ -0,0 +1,255 @@
>> +<?xml version="1.0"?>
>> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
>> +
>> +<OpenGLAPI>
>> +
>> +<category name="GL_MESA_shading_language_130" number="999">
>> +
>> +    <enum name="VERTEX_ATTRIB_ARRAY_INTEGER"        value="0x88FD"/>
>> +    <enum name="SAMPLER_1D_ARRAY"                   value="0x8DC0"/>
>> +    <enum name="SAMPLER_2D_ARRAY"                   value="0x8DC1"/>
>> +    <enum name="SAMPLER_1D_ARRAY_SHADOW"            value="0x8DC3"/>
>> +    <enum name="SAMPLER_2D_ARRAY_SHADOW"            value="0x8DC4"/>
>> +    <enum name="SAMPLER_CUBE_SHADOW"                value="0x8DC5"/>
>> +    <enum name="UNSIGNED_INT_VEC2"                  value="0x8DC6"/>
>> +    <enum name="UNSIGNED_INT_VEC3"                  value="0x8DC7"/>
>> +    <enum name="UNSIGNED_INT_VEC4"                  value="0x8DC8"/>
>> +    <enum name="INT_SAMPLER_1D"                     value="0x8DC9"/>
>> +    <enum name="INT_SAMPLER_2D"                     value="0x8DCA"/>
>> +    <enum name="INT_SAMPLER_3D"                     value="0x8DCB"/>
>> +    <enum name="INT_SAMPLER_CUBE"                   value="0x8DCC"/>
>> +    <enum name="INT_SAMPLER_1D_ARRAY"               value="0x8DCE"/>
>> +    <enum name="INT_SAMPLER_2D_ARRAY"               value="0x8DCF"/>
>> +    <enum name="UNSIGNED_INT_SAMPLER_1D"            value="0x8DD1"/>
>> +    <enum name="UNSIGNED_INT_SAMPLER_2D"            value="0x8DD2"/>
>> +    <enum name="UNSIGNED_INT_SAMPLER_3D"            value="0x8DD3"/>
>> +    <enum name="UNSIGNED_INT_SAMPLER_CUBE"          value="0x8DD4"/>
>> +    <enum name="UNSIGNED_INT_SAMPLER_1D_ARRAY"      value="0x8DD6"/>
>> +    <enum name="UNSIGNED_INT_SAMPLER_2D_ARRAY"      value="0x8DD7"/>
>> +
>> +    <!-- There is no MIN_PROGRAM_TEXEL_OFFSET in glext.h.  There is
>> +         MIN_PROGRAM_TEXEL_OFFSET_NV and MIN_PROGRAM_TEXEL_OFFSET (OpenGL
>> +         3.0).  Same goes for MAX_PROGRAM_TEXEL_OFFSET.
>> +    -->
>> +    <enum name="MIN_PROGRAM_TEXEL_OFFSET"               value="0x8904">
>> +        <size name="Get" mode="get"/>
>> +    </enum>
>> +    <enum name="MAX_PROGRAM_TEXEL_OFFSET"               value="0x8905">
>> +        <size name="Get" mode="get"/>
>> +    </enum>
>> +
>> +    <enum name="CLIP_DISTANCE0"                   value="0x3000"/>
>> +    <enum name="CLIP_DISTANCE1"                   value="0x3001"/>
>> +    <enum name="CLIP_DISTANCE2"                   value="0x3002"/>
>> +    <enum name="CLIP_DISTANCE3"                   value="0x3003"/>
>> +    <enum name="CLIP_DISTANCE4"                   value="0x3004"/>
>> +    <enum name="CLIP_DISTANCE5"                   value="0x3005"/>
>> +    <enum name="CLIP_DISTANCE6"                   value="0x3006"/>
>> +    <enum name="CLIP_DISTANCE7"                   value="0x3007"/>
>> +
>> +    <enum name="MAX_CLIP_DISTANCES"               value="0x0D32"/>
>> +
>> +<!--
>> +    <function name="VertexAttribI1i" offset="assign" exec="dynamic">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="x" type="GLint"/>
>> +    </function>
>> +
>> +    <function name="VertexAttribI2i" offset="assign" exec="dynamic">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="x" type="GLint"/>
>> +        <param name="y" type="GLint"/>
>> +    </function>
>> +
>> +    <function name="VertexAttribI3i" offset="assign" exec="dynamic">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="x" type="GLint"/>
>> +        <param name="y" type="GLint"/>
>> +        <param name="z" type="GLint"/>
>> +    </function>
>> +
>> +    <function name="VertexAttribI4i" offset="assign" exec="dynamic">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="x" type="GLint"/>
>> +        <param name="y" type="GLint"/>
>> +        <param name="z" type="GLint"/>
>> +        <param name="w" type="GLint"/>
>> +    </function>
>> +
>> +    <function name="VertexAttribI1ui" offset="assign" exec="dynamic">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="x" type="GLuint"/>
>> +    </function>
>> +
>> +    <function name="VertexAttribI2ui" offset="assign" exec="dynamic">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="x" type="GLuint"/>
>> +        <param name="y" type="GLuint"/>
>> +    </function>
>> +
>> +    <function name="VertexAttribI3ui" offset="assign" exec="dynamic">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="x" type="GLuint"/>
>> +        <param name="y" type="GLuint"/>
>> +        <param name="z" type="GLuint"/>
>> +    </function>
>> +
>> +    <function name="VertexAttribI4ui" offset="assign" exec="dynamic">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="x" type="GLuint"/>
>> +        <param name="y" type="GLuint"/>
>> +        <param name="z" type="GLuint"/>
>> +        <param name="w" type="GLuint"/>
>> +    </function>
>> +
>> +    <function name="VertexAttribI1iv" alias="VertexAttribI1iv">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="v" type="const GLint *"/>
>> +    </function>
>> +
>> +    <function name="VertexAttribI2iv" offset="assign" exec="dynamic">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="v" type="const GLint *"/>
>> +    </function>
>> +
>> +    <function name="VertexAttribI3iv" offset="assign" exec="dynamic">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="v" type="const GLint *"/>
>> +    </function>
>> +
>> +    <function name="VertexAttribI4iv" offset="assign" exec="dynamic">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="v" type="const GLint *"/>
>> +    </function>
>> +
>> +    <function name="VertexAttribI1uiv" alias="VertexAttribI1uiv">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="v" type="const GLuint *"/>
>> +    </function>
>> +
>> +    <function name="VertexAttribI2uiv" offset="assign" exec="dynamic">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="v" type="const GLuint *"/>
>> +    </function>
>> +
>> +    <function name="VertexAttribI3uiv" offset="assign" exec="dynamic">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="v" type="const GLuint *"/>
>> +    </function>
>> +
>> +    <function name="VertexAttribI4uiv" offset="assign" exec="dynamic">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="v" type="const GLuint *"/>
>> +    </function>
>> +
>> +    <function name="VertexAttribI4bv" alias="VertexAttribI4bv">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="v" type="const GLbyte *"/>
>> +    </function>
>> +
>> +    <function name="VertexAttribI4sv" alias="VertexAttribI4sv">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="v" type="const GLshort *"/>
>> +    </function>
>> +
>> +    <function name="VertexAttribI4ubv" alias="VertexAttribI4ubv">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="v" type="const GLubyte *"/>
>> +    </function>
>> +
>> +    <function name="VertexAttribI4usv" alias="VertexAttribI4usv">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="v" type="const GLushort *"/>
>> +    </function>
>> +
>> +    <function name="VertexAttribIPointer" alias="VertexAttribIPointer">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="size" type="GLint"/>
>> +        <param name="type" type="GLenum"/>
>> +        <param name="stride" type="GLsizei"/>
>> +        <param name="pointer" type="const GLvoid *"/>
>> +    </function>
>> +
>> +    <function name="GetVertexAttribIiv" alias="GetVertexAttribIiv">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="pname" type="GLenum"/>
>> +        <param name="params" type="GLint *"/>
>> +    </function>
>> +
>> +    <function name="GetVertexAttribIuiv" alias="GetVertexAttribIuiv">
>> +        <param name="index" type="GLuint"/>
>> +        <param name="pname" type="GLenum"/>
>> +        <param name="params" type="GLuint *"/>
>> +    </function>
>> +
>> +    <function name="Uniform1ui" alias="Uniform1ui">
>> +        <param name="location" type="GLint"/>
>> +        <param name="x" type="GLuint"/>
>> +    </function>
>> +
>> +    <function name="Uniform2ui" alias="Uniform2ui">
>> +        <param name="location" type="GLint"/>
>> +        <param name="x" type="GLuint"/>
>> +        <param name="y" type="GLuint"/>
>> +    </function>
>> +
>> +    <function name="Uniform3ui" alias="Uniform3ui">
>> +        <param name="location" type="GLint"/>
>> +        <param name="x" type="GLuint"/>
>> +        <param name="y" type="GLuint"/>
>> +        <param name="z" type="GLuint"/>
>> +    </function>
>> +
>> +    <function name="Uniform4ui" alias="Uniform4ui">
>> +        <param name="location" type="GLint"/>
>> +        <param name="x" type="GLuint"/>
>> +        <param name="y" type="GLuint"/>
>> +        <param name="z" type="GLuint"/>
>> +        <param name="w" type="GLuint"/>
>> +    </function>
>> +
>> +    <function name="Uniform1uiv" alias="Uniform1uiv">
>> +        <param name="location" type="GLint"/>
>> +     <param name="count" type="GLsizei"/>
>> +        <param name="value" type="const GLuint *"/>
>> +    </function>
>> +
>> +    <function name="Uniform2uiv" alias="Uniform2uiv">
>> +        <param name="location" type="GLint"/>
>> +     <param name="count" type="GLsizei"/>
>> +        <param name="value" type="const GLuint *"/>
>> +    </function>
>> +
>> +    <function name="Uniform3uiv" alias="Uniform3uiv">
>> +        <param name="location" type="GLint"/>
>> +     <param name="count" type="GLsizei"/>
>> +        <param name="value" type="const GLuint *"/>
>> +    </function>
>> +
>> +    <function name="Uniform4uiv" alias="Uniform4uiv">
>> +        <param name="location" type="GLint"/>
>> +     <param name="count" type="GLsizei"/>
>> +        <param name="value" type="const GLuint *"/>
>> +    </function>
>> +
>> +    <function name="GetUniformuiv" alias="GetUniformuiv">
>> +        <param name="program" type="GLuint"/>
>> +        <param name="location" type="GLint"/>
>> +        <param name="params" type="GLuint *"/>
>> +    </function>
>> +
>> +    <function name="BindFragDataLocation" alias="BindFragDataLocation">
>> +        <param name="program" type="GLuint"/>
>> +        <param name="colorNumber" type="GLuint"/>
>> +        <param name="name" type="const GLchar *"/>
>> +    </function>
>> +
>> +    <function name="GetFragDataLocation" alias="GetFragDataLocation">
>> +     <return type="GLint"/>
>> +        <param name="program" type="GLuint"/>
>> +        <param name="name" type="const GLchar *"/>
>> +    </function>
>> +-->
>> +</category>
>> +
>> +</OpenGLAPI>
>> diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
>> index e1b1246..f346b2f 100644
>> --- a/src/mapi/glapi/gen/gl_API.xml
>> +++ b/src/mapi/glapi/gen/gl_API.xml
>> @@ -12694,6 +12694,8 @@
>>      </function>
>>  </category>
>>
>> +<xi:include href="MESA_shading_language_130.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
>> +
>>  <category name="GL_MESA_pack_invert" number="300">
>>      <enum name="PACK_INVERT_MESA"              count="1"  value="0x8758">
>>          <size name="Get" mode="get"/>
>> diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
>> index bbbb76f..9feec36 100644
>> --- a/src/mesa/drivers/dri/i965/intel_extensions.c
>> +++ b/src/mesa/drivers/dri/i965/intel_extensions.c
>> @@ -245,8 +245,13 @@ intelInitExtensions(struct gl_context *ctx)
>>     ctx->Extensions.OES_standard_derivatives = true;
>>     ctx->Extensions.OES_EGL_image_external = true;
>>
>> +   if (brw->gen >= 5)
>> +      ctx->Extensions.MESA_shading_language_130 = true;
>
> This should go with the existing (brw->gen >= 5) block elsewhere in this
> function.  I should also look like the EXT_shader_integer_mix initializer:
>
>       ctx->Extensions.EXT_shader_integer_mix = ctx->Const.GLSLVersion >=
> 130;
>
> Then this part could land independently of the hunk below.
>
>> +
>>     if (brw->gen >= 6)
>>        ctx->Const.GLSLVersion = 330;
>> +   else if (brw->gen >= 5)
>> +      ctx->Const.GLSLVersion = 130;
>>     else
>>        ctx->Const.GLSLVersion = 120;
>>     _mesa_override_glsl_version(&ctx->Const);
>> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
>> index 0df04c2..bb54d8b 100644
>> --- a/src/mesa/main/extensions.c
>> +++ b/src/mesa/main/extensions.c
>> @@ -350,6 +350,7 @@ static const struct extension extension_table[] = {
>>     { "GL_INGR_blend_func_separate",                o(EXT_blend_func_separate),                 GLL,            1999 },
>>     { "GL_INTEL_performance_query",                 o(INTEL_performance_query),                       GL | ES2, 2013 },
>>     { "GL_MESA_pack_invert",                        o(MESA_pack_invert),                        GL,             2002 },
>> +   { "GL_MESA_shading_language_130",               o(MESA_shading_language_130),               GLL,            2014 },
>>     { "GL_MESA_texture_signed_rgba",                o(EXT_texture_snorm),                       GL,             2009 },
>>     { "GL_MESA_window_pos",                         o(dummy_true),                              GLL,            2000 },
>>     { "GL_MESA_ycbcr_texture",                      o(MESA_ycbcr_texture),                      GL,             2002 },
>> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
>> index 7389baa..020ebef 100644
>> --- a/src/mesa/main/mtypes.h
>> +++ b/src/mesa/main/mtypes.h
>> @@ -3828,6 +3828,7 @@ struct gl_extensions
>>     GLboolean INTEL_performance_query;
>>     GLboolean MESA_pack_invert;
>>     GLboolean MESA_ycbcr_texture;
>> +   GLboolean MESA_shading_language_130;
>>     GLboolean NV_conditional_render;
>>     GLboolean NV_fog_distance;
>>     GLboolean NV_fragment_program_option;
>>
>


More information about the mesa-dev mailing list