[Mesa-dev] [PATCH 1/3] u_format: implement fetch_rgba_uint and fetch_rgba_sint for integer formats

Marek Olšák maraeo at gmail.com
Mon Jan 2 08:40:59 PST 2012


On Mon, Jan 2, 2012 at 3:31 PM, Dave Airlie <airlied at gmail.com> wrote:
> On Mon, Jan 2, 2012 at 1:07 PM, Marek Olšák <maraeo at gmail.com> wrote:
>> Fetching int as float and vice versa is not allowed.
>> Fetching unsigned int as signed int and vice versa is not allowed either.
>
> The first is true, the second isn't, otherwise I'd have implemented
> this that way.
>
>> Doing conversions like that isn't allowed in OpenGL.
>
> I don't have chapter/verse but EXT_texture_integer doesn't seem to
> disallow this.

EXT_texture_integer doesn't, but that extension doesn't define the new
GLSL samplers, it only requires EXT_gpu_shader4.

See this part from EXT_gpu_shader4 (modifications to section 8.7 of
the GLSL spec):

Table 8.xxx lists the supported combinations of sampler types and
texture internal formats.

      texture
      internal      default (float) integer     unsigned integer
      format        sampler         sampler     sampler
      float         vec4            n/a          n/a
      normalized    vec4            n/a          n/a
      signed int    n/a             ivec4        n/a
      unsigned int  n/a             n/a          uvec4

That is, no conversions are allowed. The pack/unpack stuff is
different, because it doesn't involve shaders. I have no opinion on
whether we should be that strict in u_format or not. Being strict may
later prevent making programming mistakes though.

Marek


More information about the mesa-dev mailing list