OK, I see what you're talking about.  Can you try the attached patch?

-Brian

Shachar Kaufman wrote:
> Yes: I'm working on 7.3 sources, and looking at prog_execute.c
> mesa_execute_program() under OPCODE_TEX/TXB/TXD.
> 
> My claim was too broad though, I am wondering very specifically about
> the use of the inst->TexSrcUnit field. In OPCODE_TXB it is used directly
> as an index into the ctx->Texture.Unit array (for the purpose of fetchig
> the LOD bias), but in fetch_texel() we have "unit =
> machine->Samplers[inst->TexSrcUnit]" that is, there is an indirect
> mapping between the instruciton field and the actual texture unit index.
> 
> On Mon, Mar 30, 2009 at 5:32 PM, Brian Paul <[email protected]
> <mailto:[email protected]>> wrote:
> 
>     Shachar Kaufman wrote:
>     > Hi all,
>     >
>     > I noticed shader texture access, when done from TEX instructions,
>     takes
>     > the TexSrcUnit instruction field into the program's Samplers map
>     to find
>     > the intended texture unit. When done through TXB or TXD instructions
>     > this mapping with Samplers does not take place.
>     >
>     > Is this on purpose?
> 
>     Can you be more specific about where you're seeing this in the code?
> 
>     Thanks.
> 
>     -Brian
> 
> 

diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c
index a60cda6..0bc8d5f 100644
--- a/src/mesa/shader/prog_execute.c
+++ b/src/mesa/shader/prog_execute.c
@@ -1540,8 +1540,8 @@ _mesa_execute_program(GLcontext * ctx,
       case OPCODE_TXB:         /* GL_ARB_fragment_program only */
          /* Texel lookup with LOD bias */
          {
-            const struct gl_texture_unit *texUnit
-               = &ctx->Texture.Unit[inst->TexSrcUnit];
+            const GLuint unit = machine->Samplers[inst->TexSrcUnit];
+            const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
             GLfloat texcoord[4], color[4], lodBias;
 
             fetch_vector4(&inst->SrcReg[0], machine, texcoord);
------------------------------------------------------------------------------
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to