Module: wine Branch: refs/heads/master Commit: c13f097de3ce04b98dad8a5a3f504055a276946b URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=c13f097de3ce04b98dad8a5a...
Author: Jason Green jave27@gmail.com Date: Fri Jun 16 23:01:20 2006 -0400
wined3d: Correct implementation of D3DSIO_LOOP.
I initially misread the specification. src0.x is the iteration count, not the max amount for the loop register. This fixes that.
---
dlls/wined3d/glsl_shader.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index a9b5820..91961eb 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -333,8 +333,10 @@ void shader_generate_glsl_declarations( }
/* Declare loop register aL */ - if (reg_maps->loop) + if (reg_maps->loop) { shader_addline(buffer, "int aL;\n"); + shader_addline(buffer, "int tmpInt;\n"); + }
/* Temporary variables for matrix operations */ shader_addline(buffer, "vec4 tmp0;\n"); @@ -1157,7 +1159,8 @@ void shader_glsl_sincos(SHADER_OPCODE_AR
/** Process the D3DSIO_LOOP instruction in GLSL: * Start a for() loop where src0.y is the initial value of aL, - * increment aL by src0.z while (aL < src0.x). + * increment aL by src0.z for a total of src0.x iterations. + * Need to use a temporary variable for this operation. */ void shader_glsl_loop(SHADER_OPCODE_ARG* arg) {
@@ -1166,9 +1169,9 @@ void shader_glsl_loop(SHADER_OPCODE_ARG* char src0_mask[6];
shader_glsl_add_param(arg, arg->src[0], arg->src_addr[0], TRUE, src0_reg, src0_mask, src0_str); - - shader_addline(arg->buffer, "for (aL = %s.y; aL < %s.x; aL += %s.z) {\n", - src0_reg, src0_reg, src0_reg); + + shader_addline(arg->buffer, "for (tmpInt = 0, aL = %s.y; tmpInt < %s.x; tmpInt++, aL += %s.z) {\n", + src0_reg, src0_reg, src0_reg); }
/** Process the D3DSIO_ENDLOOP instruction in GLSL: