[Mesa-dev] [PATCH 06/11] glsl: Add remaining *sampler2DRect* texture functions.
Kenneth Graunke
kenneth at whitecape.org
Fri Apr 13 23:40:16 PDT 2012
On 04/13/2012 04:38 PM, Eric Anholt wrote:
> Fixes the new piglit texelFetch() tests on these. Note that the rest
> of the new functions are not tested (same as the non-2DRect versions
> of most of them).
> ---
> src/glsl/builtins/profiles/140.frag | 68 +++++++++++++++++++++++++++
> src/glsl/builtins/profiles/140.vert | 68 +++++++++++++++++++++++++++
> src/glsl/builtins/tools/texture_builtins.py | 22 +++++++++
> 3 files changed, 158 insertions(+)
>
> diff --git a/src/glsl/builtins/profiles/140.frag b/src/glsl/builtins/profiles/140.frag
> index ba616a1..36fa822 100644
> --- a/src/glsl/builtins/profiles/140.frag
> +++ b/src/glsl/builtins/profiles/140.frag
[snip]
> @@ -953,6 +1012,15 @@ uvec4 textureProjGradOffset(usampler2D s, vec3 P, vec2 dx, vec2 dy, ivec2 off);
> ivec4 textureProjGradOffset(isampler2D s, vec4 P, vec2 dx, vec2 dy, ivec2 off);
> uvec4 textureProjGradOffset(usampler2D s, vec4 P, vec2 dx, vec2 dy, ivec2 off);
>
> + vec4 textureProjGradOffset( sampler2DRect s, vec3 P, vec2 dx, vec2 dy, ivec2 off);
> +ivec4 textureProjGradOffset(isampler2DRect s, vec3 P, vec2 dx, vec2 dy, ivec2 off);
> +uvec4 textureProjGradOffset(usampler2DRect s, vec3 P, vec2 dx, vec2 dy, ivec2 off);
> + vec4 textureProjGradOffset( sampler2DRect s, vec4 P, vec2 dx, vec2 dy, ivec2 off);
> +ivec4 textureProjGradOffset(isampler2DRect s, vec4 P, vec2 dx, vec2 dy, ivec2 off);
> +uvec4 textureProjGradOffset(usampler2DRect s, vec4 P, vec2 dx, vec2 dy, ivec2 off);
> +
> +float textureProjGradOffset(sampler2DRectShadow s, vec4 P, vec2 dx, vec2 dy, vec2 o);
This is supposed to be "ivec2 offset", not a vec2.
Which brings up another issue: GLSL 1.30 -> 4.10 all state that
textureProjGradOffset's sampler2D, sampler3D, and sampler2DShadow
variants use vec2/vec3 offset rather than ivecs.
That's rubbish for several reasons:
- The offset is an integer number of texels; hardware uses integers too.
- /Every/ other texture function uses ivecs.
GLSL 4.20 corrects all of these to be ivec types. Neither the 4.20 spec
nor ARB_shading_language_420pack mention this as a concious change
though, so I'm inclined to treat it as a long running typo.
Regardless, texture_builtins.py implements the functions using ivec for
all variants, so these functions -are- broken in our current implementation.
[snip]
Assuming you change the 2DRectShadow to ivec2 in both profiles:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
More information about the mesa-dev
mailing list