On 12/18/2013 01:04 AM, Chris Forbes wrote:
> The hardware is broken with nonzero texel offsets and unnormalized
> coordinates; instead of doing correct offsetting, we get garbage.
> 
> This just extends the existing workaround for ir_txf and
> ir_tg4+gsampler2DRect to also consider ir_tex+gsampler2DRect.
> 
> Fixes broken rendering in 'tesseract' when 'mesa_texrectoffset_bug' is
> not enabled; also fixes the new piglit test
> 'tests/spec/glsl-1.30/execution/fs-textureOffset-Rect'.
> to 0.
> 
> Has been broken ~forever; suggesting including this in only 10.0 because
> the lowering pass doesn't exist in 9.2 or earlier so would require quite
> a different patch.
> 
> Signed-off-by: Chris Forbes <chr...@ijw.co.nz>
> Cc: Lee Salzman <lsalz...@gmail.com>
> Cc: "10.0" <mesa-sta...@lists.freedesktop.org>
> ---
>  src/mesa/drivers/dri/i965/brw_lower_unnormalized_offset.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_lower_unnormalized_offset.cpp 
> b/src/mesa/drivers/dri/i965/brw_lower_unnormalized_offset.cpp
> index df4fe4b..c95d7f3 100644
> --- a/src/mesa/drivers/dri/i965/brw_lower_unnormalized_offset.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_lower_unnormalized_offset.cpp
> @@ -55,7 +55,7 @@ 
> brw_lower_unnormalized_offset_visitor::visit_leave(ir_texture *ir)
>     if (!ir->offset)
>        return visit_continue;
>  
> -   if (ir->op == ir_tg4) {
> +   if (ir->op == ir_tg4 || ir->op == ir_tex) {
>        if (ir->sampler->type->sampler_dimensionality != GLSL_SAMPLER_DIM_RECT)
>           return visit_continue;
>     }
> 

This looks good, and is:
Reviewed-by: Kenneth Graunke <kenn...@whitecape.org>
along with an ack for cherry-picking to 10.0.

That said, I think we may be missing a case.  I checked the spec, and
concluded that we won't ever see TXB/TXL with a sampler2DRect.  (This
wasn't obvious at first glance.)

However, it looks like textureGradOffset and textureProjGradOffset have
sampler2DRect variants.  This seems utterly bizarre to me, since
gradients are used to determine the LOD, and rectangle textures only
have miplevel 0.  So what's the point?  (Ian?)

But I wonder if we should handle txd...or for that matter, just handle
(TXF || rectangle textures regardless of opcode), just to be safe.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to