Hi All,
can someone help me understand some code from dlls/wined3d/vertexshader.c please?
Im new to shader code, but to me the following looks a bit strange:
shader_addline(&buffer, "ADD result.position.x, TMP_OUT.x, PROJECTIONX.w;\n"); shader_addline(&buffer, "ADD result.position.y, TMP_OUT.y, PROJECTIONY.w;\n"); /* Account for any inverted textures (render to texture case) by reversing the y coordinate * (this is handled in drawPrim() when it sets the MODELVIEW and PROJECTION matrices) */ shader_addline(&buffer, "MUL result.position.y, TMP_OUT.y, PROJECTIONY.y;\n");
Am I correct that the last line makes the second line redundant? Wont result.position.y be equal to TMP_OUT.y * PROJECTIONY.y no matter what?
Thanks in advance.
Kapila.
That does look wrong. The proper code should probably look like this:
shader_addline(&buffer, "ADD result.position.x, TMP_OUT.x, PROJECTIONX.w;\n"); shader_addline(&buffer, "MAD result.position.y, TMP_OUT.y, PROJECTIONY.y, PROJECTIONY.w;\n");
On 12/09/06, H. Verbeet hverbeet@gmail.com wrote:
That does look wrong. The proper code should probably look like this:
shader_addline(&buffer, "ADD result.position.x, TMP_OUT.x, PROJECTIONX.w;\n"); shader_addline(&buffer, "MAD result.position.y, TMP_OUT.y, PROJECTIONY.y, PROJECTIONY.w;\n");
Actually, that's not completely true... that would do the add after the multiplication instead of before. It might still be worth it to do it that way and invert the offset instead though.