Stefan Dösinger : wined3d: Get rid of Tx hardcoding in texbem.
Alexandre Julliard
julliard at winehq.org
Wed May 27 09:26:53 CDT 2009
Module: wine
Branch: master
Commit: f484cbbf916ed80a4f79fbe61d8a7902c900343b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f484cbbf916ed80a4f79fbe61d8a7902c900343b
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Sat May 9 01:05:46 2009 +0200
wined3d: Get rid of Tx hardcoding in texbem.
---
dlls/wined3d/arb_program_shader.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index e2d6793..d0382bb 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -1311,9 +1311,8 @@ static void pshader_hw_texbem(const struct wined3d_shader_instruction *ins)
{
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)ins->ctx->shader;
const struct wined3d_shader_dst_param *dst = &ins->dst[0];
- DWORD src = ins->src[0].reg.idx;
SHADER_BUFFER *buffer = ins->ctx->buffer;
- char reg_coord[40], dst_reg[50];
+ char reg_coord[40], dst_reg[50], src_reg[50];
DWORD reg_dest_code;
/* All versions have a destination register. The Tx where the texture coordinates come
@@ -1321,15 +1320,16 @@ static void pshader_hw_texbem(const struct wined3d_shader_instruction *ins)
*/
reg_dest_code = dst->reg.idx;
shader_arb_get_dst_param(ins, &ins->dst[0], dst_reg);
+ shader_arb_get_src_param(ins, &ins->src[0], 0, src_reg);
sprintf(reg_coord, "fragment.texcoord[%u]", reg_dest_code);
/* Sampling the perturbation map in Tsrc was done already, including the signedness correction if needed
* The Tx in which the perturbation map is stored is the tempreg incarnation of the texture register
*/
shader_addline(buffer, "SWZ TB, bumpenvmat%d, x, z, 0, 0;\n", reg_dest_code);
- shader_addline(buffer, "DP3 TA.x, TB, T%u;\n", src);
+ shader_addline(buffer, "DP3 TA.x, TB, %s;\n", src_reg);
shader_addline(buffer, "SWZ TB, bumpenvmat%d, y, w, 0, 0;\n", reg_dest_code);
- shader_addline(buffer, "DP3 TA.y, TB, T%u;\n", src);
+ shader_addline(buffer, "DP3 TA.y, TB, %s;\n", src_reg);
/* with projective textures, texbem only divides the static texture coord, not the displacement,
* so we can't let the GL handle this.
@@ -1347,8 +1347,9 @@ static void pshader_hw_texbem(const struct wined3d_shader_instruction *ins)
if (ins->handler_idx == WINED3DSIH_TEXBEML)
{
- shader_addline(buffer, "MAD TA, T%u.z, luminance%d.x, luminance%d.y;\n",
- src, reg_dest_code, reg_dest_code);
+ /* No src swizzles are allowed, so this is ok */
+ shader_addline(buffer, "MAD TA, %s.z, luminance%d.x, luminance%d.y;\n",
+ src_reg, reg_dest_code, reg_dest_code);
shader_addline(buffer, "MUL %s, %s, TA;\n", dst_reg, dst_reg);
}
}
More information about the wine-cvs
mailing list