From 5cfbfbc8b3e59994e745e40c0de8b0d095b5765a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sun, 3 May 2009 21:48:34 +0200 Subject: [PATCH] wined3d: Tidy up shader_hw_rsq_rcp. --- dlls/wined3d/arb_program_shader.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index ec4bea7f720..c77c66468c3 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -1553,12 +1553,11 @@ static void shader_hw_mnxn(const struct wined3d_shader_instruction *ins) } } -static void vshader_hw_rsq_rcp(const struct wined3d_shader_instruction *ins) +static void shader_hw_rsq_rcp(const struct wined3d_shader_instruction *ins) { SHADER_BUFFER *buffer = ins->ctx->buffer; - const char *instruction; + const char *instruction, *sat; - char tmpLine[256]; char dst[50]; char src[50]; @@ -1571,22 +1570,20 @@ static void vshader_hw_rsq_rcp(const struct wined3d_shader_instruction *ins) break; } - strcpy(tmpLine, instruction); + if(ins->dst[0].modifiers & WINED3DSPDM_SATURATE) sat = "_SAT"; + else sat = ""; + shader_arb_get_dst_param(ins, &ins->dst[0], dst); /* Destination */ - strcat(tmpLine, " "); - strcat(tmpLine, dst); - strcat(tmpLine, ", "); shader_arb_get_src_param(ins, &ins->src[0], 0, src); - strcat(tmpLine, src); if (ins->src[0].swizzle == WINED3DSP_NOSWIZZLE) { /* Dx sdk says .x is used if no swizzle is given, but our test shows that * .w is used */ - strcat(tmpLine, ".w"); + strcat(src, ".w"); } - shader_addline(buffer, "%s;\n", tmpLine); + shader_addline(buffer, "%s%s %s, %s;\n", instruction, sat, dst, src); } static void shader_hw_nrm(const struct wined3d_shader_instruction *ins) @@ -2224,10 +2221,10 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL /* WINED3DSIH_NRM */ shader_hw_nrm, /* WINED3DSIH_PHASE */ NULL, /* WINED3DSIH_POW */ shader_hw_map2gl, - /* WINED3DSIH_RCP */ vshader_hw_rsq_rcp, + /* WINED3DSIH_RCP */ shader_hw_rsq_rcp, /* WINED3DSIH_REP */ NULL, /* WINED3DSIH_RET */ NULL, - /* WINED3DSIH_RSQ */ vshader_hw_rsq_rcp, + /* WINED3DSIH_RSQ */ shader_hw_rsq_rcp, /* WINED3DSIH_SETP */ NULL, /* WINED3DSIH_SGE */ shader_hw_map2gl, /* WINED3DSIH_SGN */ NULL,