Michał Król wrote:
> The LOOP/ENDLOOP opcodes have been loosely defined in gallium and the 
> de-facto definition had redundant semantics to BGNLOOP2/ENDLOOP2.
> 
> This patch documents this pair to closely match GL_NV_fragment_program2 
> LOOP/ENDLOOP behaviour.
> 
> Fixes into the code will follow after this has been accepted.
> 
> 
> diff --git a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt 
> b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt
> index a3f4947..7b3e419 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt
> +++ b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt
> @@ -667,7 +667,15 @@ TGSI Instruction Specification
>  
>  1.9.8  LOOP - Loop
>  
> -  TBD
> +  dst.x = floor(src.x)
> +  dst.y = floor(src.y)
> +  dst.z = floor(src.z)
> +
> +  if (dst.y <= 0)
> +    pc = [matching ENDLOOP] + 1
> +  endif
> +
> +  Note: The destination must be a loop register.
>  
>  
>  1.9.9  REP - Repeat
> @@ -687,7 +695,14 @@ TGSI Instruction Specification
>  
>  1.9.12  ENDLOOP - End Loop
>  
> -  TBD
> +  dst.x = dst.x + dst.z
> +  dst.y = dst.y - 1.0
> +
> +  if (dst.y > 0)
> +    pc = [matching LOOP instruction]

Fix:   pc = [matching LOOP instruction] + 1


> +  endif
> +
> +  Note: The destination must be a loop register.

I think you have dst.x and dst.y mixed up in a few places there.  The 
NV spec says .x is the loop count.

In GL_NV_fragment_program2.txt the loop count/index/incr are hidden 
values which can't be accessed by other instructions inside the loop.
Also, the loop count must be a constant, etc.  Are we imposing those 
policies here too?  If so, that should be documented.


I think I'd prefer to rename the "simple" LOOP2/ENDLOOP2 instructions 
as LOOP/ENDLOOP and call the above functions LOOP_COUNT/ENDLOOP_COUNT.

-Brian

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to