cmp instruction in GLSL - problems

Ivan Gyurdiev ivg231 at gmail.com
Tue Jul 11 03:10:09 CDT 2006


> -    shader_addline(arg->buffer, "%s.w = (%s.w > 0.0) ? %s.w : %s.w;\n", dst_reg, src0_reg, src1_reg, src2_reg);
> +    shader_glsl_add_dst(arg->dst, dst_reg, dst_mask, tmpLine);
> +    shader_addline(arg->buffer, "%smix(vec4(%s), vec4(%s), vec4(lessThan(vec4(%s), vec4(0.0)))))%s;\n",
> +        tmpLine, src1_str, src2_str, src0_str, dst_mask);
>  }
To give an idea as to what this is doing, see the following translation, 
taken from the Hair demo:

Original Shader:
cmp r1.rg, r0.r, abs(v0).brba, abs(v0).rbba

New code translates to:
R1.xy = vec4(mix(vec4(abs(IN0.zxzw)), vec4(abs(IN0.xzzw)), 
vec4(lessThan(vec4(R0.x), vec4(0.0))))).xy;




More information about the wine-devel mailing list