[Mesa-dev] [PATCH 01/10] mesa: add infra for ARB_shader_texture_image_samples

Ilia Mirkin imirkin at alum.mit.edu
Tue Sep 8 20:16:25 PDT 2015


On Tue, Sep 8, 2015 at 11:10 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> On Tue, Sep 8, 2015 at 11:05 PM, Ian Romanick <idr at freedesktop.org> wrote:
>> On 08/27/2015 08:48 PM, Ilia Mirkin wrote:
>>> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
>>> ---
>>>  src/mesa/main/extensions.c | 1 +
>>>  src/mesa/main/mtypes.h     | 1 +
>>>  2 files changed, 2 insertions(+)
>>>
>>> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
>>> index a57d5ba..1f7d542 100644
>>> --- a/src/mesa/main/extensions.c
>>> +++ b/src/mesa/main/extensions.c
>>> @@ -159,6 +159,7 @@ static const struct extension extension_table[] = {
>>>     { "GL_ARB_shader_stencil_export",               o(ARB_shader_stencil_export),               GL,             2009 },
>>>     { "GL_ARB_shader_storage_buffer_object",        o(ARB_shader_storage_buffer_object),        GL,             2012 },
>>>     { "GL_ARB_shader_subroutine",                   o(ARB_shader_subroutine),                   GLC,            2010 },
>>> +   { "GL_ARB_shader_texture_image_samples",        o(ARB_shader_texture_image_samples),        GL,             2014 },
>>
>> I'm not sure we can expose this yet.  The spec says:
>>
>>     "Dependencies
>>
>>         OpenGL 4.3 is required.
>>
>>         OpenGL Shading Language 4.30 is required"
>>
>> I wasn't involved with the development of this spec at all, so I don't
>> know why the requirement is so high.  Images were added in 4.2.
>> Certainly every other implementation that has this extension will also
>> have 4.3 or higher.
>>
>> It seems weird since the related extensions only require 4.2
>> (GL_ARB_shader_image_size) or 3.1 (GL_ARB_texture_multisample).
>>
>> Since you have tests... do you know what other implementations do if you
>> only have #version 130?  If nobody enforces the #version 430 requirement
>> from the spec, I'll propose some changes to the spec.
>
> FWIW we ignore these (IMHO silly) version requirements on almost every
> extension that has them. I know I've personally added support for
> EXT_polygon_offset_clamp into compat contexts, whereas the ext
> specifies GL 3.3 minimum.
>
> I'll give it a shot on NVIDIA and see what happens... my tests might
> require GL 3.2 because I didn't want to deal with the various
> differences that happen otherwise.

$ cat tests/spec/arb_shader_texture_image_samples/compiler/fs-texture-samples.frag
// [config]
// expect_result: pass
// glsl_version: 1.50
// require_extensions: GL_ARB_shader_texture_image_samples
// [end config]

#version 130
#extension GL_ARB_texture_multisample: require
#extension GL_ARB_shader_texture_image_samples: require

uniform sampler2DMS s2D;
uniform sampler2DMSArray s2DArray;
uniform isampler2DMS is2D;
uniform isampler2DMSArray is2DArray;
uniform usampler2DMS us2D;
uniform usampler2DMSArray us2DArray;

void main()
{
        int res = 0;

        res += textureSamples(s2D);
        res += textureSamples(s2DArray);
        res += textureSamples(is2D);
        res += textureSamples(is2DArray);
        res += textureSamples(us2D);
        res += textureSamples(us2DArray);

        gl_FragColor = vec4(float(res));
}

$ bin/glslparsertest
tests/spec/arb_shader_texture_image_samples/compiler/fs-texture-samples.frag
pass 1.30
Successfully compiled fragment shader
tests/spec/arb_shader_texture_image_samples/compiler/fs-texture-samples.frag:
0(29) : warning C7533: global variable gl_FragColor is deprecated
after version 120

PIGLIT: {"result": "pass" }

$ bin/textureSamples fs sampler2DMSArray 8 -fbo -auto
PIGLIT: {"result": "pass" }

[the binary is posted on the piglit list]

The image tests failed, but I think for unrelated reasons:

fs-image-samples.frag: 0(24) : error C1115: unable to find compatible
overloaded function "imageSamples(struct iimage2DMS_bindless)"
0(25) : error C1115: unable to find compatible overloaded function
"imageSamples(struct iimage2DMSArray_bindless)"
0(26) : error C1115: unable to find compatible overloaded function
"imageSamples(struct uimage2DMS_bindless)"
0(27) : error C1115: unable to find compatible overloaded function
"imageSamples(struct uimage2DMSArray_bindless)"

I got this error even when I increased the requirement to #version
430. I'm guessing they just forgot to include imageSamples for
iimage*/uimage*, since it was perfectly happy with image*.

  -ilia


More information about the mesa-dev mailing list