wined3d: Merge pshader_get_register_name() and part of vshader_program_add_param().

This commit is contained in:
Henri Verbeet 2009-04-10 09:15:07 +02:00 committed by Alexandre Julliard
parent 9a28d273bc
commit e6031afdfa
1 changed files with 180 additions and 161 deletions

View File

@ -433,56 +433,95 @@ static void shader_arb_get_swizzle(const DWORD param, BOOL fixup, char *swizzle_
*ptr = '\0';
}
static void pshader_get_register_name(IWineD3DBaseShader *iface,
WINED3DSHADER_PARAM_REGISTER_TYPE register_type, UINT register_idx, char *regstr)
static void shader_arb_get_register_name(IWineD3DBaseShader *iface, WINED3DSHADER_PARAM_REGISTER_TYPE register_type,
UINT register_idx, BOOL rel_addr, char *register_name, BOOL *is_color)
{
IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *) iface;
/* oPos, oFog and oPts in D3D */
static const char * const rastout_reg_names[] = {"TMP_OUT", "result.fogcoord", "result.pointsize"};
IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *)iface;
DWORD shader_version = This->baseShader.reg_maps.shader_version;
BOOL pshader = shader_is_pshader_version(shader_version);
*is_color = FALSE;
switch (register_type)
{
case WINED3DSPR_TEMP:
sprintf(regstr, "R%u", register_idx);
break;
case WINED3DSPR_INPUT:
if (register_idx == 0)
{
strcpy(regstr, "fragment.color.primary");
} else {
strcpy(regstr, "fragment.color.secondary");
}
break;
case WINED3DSPR_CONST:
if(This->baseShader.load_local_constsF || list_empty(&This->baseShader.constantsF)) {
sprintf(regstr, "C[%u]", register_idx);
} else {
sprintf(regstr, "C%u", register_idx);
}
break;
case WINED3DSPR_TEXTURE: /* case WINED3DSPR_ADDR: */
sprintf(regstr, "T%u", register_idx);
break;
case WINED3DSPR_COLOROUT:
if (register_idx == 0)
sprintf(regstr, "TMP_COLOR");
else {
/* TODO: See GL_ARB_draw_buffers */
FIXME("Unsupported write to render target %u\n", register_idx);
sprintf(regstr, "unsupported_register");
}
break;
case WINED3DSPR_DEPTHOUT:
sprintf(regstr, "result.depth");
break;
case WINED3DSPR_ATTROUT:
sprintf(regstr, "oD[%u]", register_idx);
break;
case WINED3DSPR_TEXCRDOUT:
sprintf(regstr, "oT[%u]", register_idx);
break;
default:
FIXME("Unhandled register name Type(%d)\n", register_type);
sprintf(regstr, "unrecognized_register");
break;
case WINED3DSPR_TEMP:
sprintf(register_name, "R%u", register_idx);
break;
case WINED3DSPR_INPUT:
if (pshader)
{
if (register_idx == 0) strcpy(register_name, "fragment.color.primary");
else strcpy(register_name, "fragment.color.secondary");
}
else
{
if (((IWineD3DVertexShaderImpl *)This)->cur_args->swizzle_map & (1 << register_idx)) *is_color = TRUE;
sprintf(register_name, "vertex.attrib[%u]", register_idx);
}
break;
case WINED3DSPR_CONST:
if (!pshader && rel_addr)
{
UINT rel_offset = ((IWineD3DVertexShaderImpl *)This)->rel_offset;
if (register_idx >= rel_offset)
sprintf(register_name, "C[A0.x + %u]", register_idx - rel_offset);
else
sprintf(register_name, "C[A0.x - %u]", -register_idx + rel_offset);
}
else
{
if (This->baseShader.load_local_constsF || list_empty(&This->baseShader.constantsF))
sprintf(register_name, "C[%u]", register_idx);
else
sprintf(register_name, "C%u", register_idx);
}
break;
case WINED3DSPR_TEXTURE: /* case WINED3DSPR_ADDR: */
if (pshader) sprintf(register_name, "T%u", register_idx);
else sprintf(register_name, "A%u", register_idx);
break;
case WINED3DSPR_COLOROUT:
if (register_idx == 0)
{
strcpy(register_name, "TMP_COLOR");
}
else
{
/* TODO: See GL_ARB_draw_buffers */
FIXME("Unsupported write to render target %u\n", register_idx);
sprintf(register_name, "unsupported_register");
}
break;
case WINED3DSPR_RASTOUT:
sprintf(register_name, "%s", rastout_reg_names[register_idx]);
break;
case WINED3DSPR_DEPTHOUT:
strcpy(register_name, "result.depth");
break;
case WINED3DSPR_ATTROUT:
if (pshader) sprintf(register_name, "oD[%u]", register_idx);
else if (register_idx == 0) strcpy(register_name, "result.color.primary");
else strcpy(register_name, "result.color.secondary");
break;
case WINED3DSPR_TEXCRDOUT:
if (pshader) sprintf(register_name, "oT[%u]", register_idx);
else sprintf(register_name, "result.texcoord[%u]", register_idx);
break;
default:
FIXME("Unhandled register type %#x[%u]\n", register_type, register_idx);
sprintf(register_name, "unrecognized_register[%u]", register_idx);
break;
}
}
@ -490,84 +529,28 @@ static void pshader_get_register_name(IWineD3DBaseShader *iface,
static void vshader_program_add_param(const struct wined3d_shader_instruction *ins,
const DWORD param, BOOL is_input, char *hwLine)
{
IWineD3DVertexShaderImpl *This = (IWineD3DVertexShaderImpl *)ins->shader;
char tmpReg[255];
BOOL is_color;
/* oPos, oFog and oPts in D3D */
static const char * const hwrastout_reg_names[] = { "TMP_OUT", "result.fogcoord", "result.pointsize" };
if ((param & WINED3DSP_SRCMOD_MASK) == WINED3DSPSM_NEG) strcat(hwLine, " -");
else strcat(hwLine, " ");
DWORD reg = param & WINED3DSP_REGNUM_MASK;
DWORD regtype = shader_get_regtype(param);
char tmpReg[255];
BOOL is_color = FALSE;
if ((param & WINED3DSP_SRCMOD_MASK) == WINED3DSPSM_NEG) {
strcat(hwLine, " -");
} else {
strcat(hwLine, " ");
}
switch (regtype) {
case WINED3DSPR_TEMP:
sprintf(tmpReg, "R%u", reg);
shader_arb_get_register_name(ins->shader, shader_get_regtype(param), param & WINED3DSP_REGNUM_MASK,
param & WINED3DSHADER_ADDRMODE_RELATIVE, tmpReg, &is_color);
strcat(hwLine, tmpReg);
break;
case WINED3DSPR_INPUT:
if (This->cur_args->swizzle_map & (1 << reg)) is_color = TRUE;
sprintf(tmpReg, "vertex.attrib[%u]", reg);
strcat(hwLine, tmpReg);
break;
case WINED3DSPR_CONST:
if(param & WINED3DSHADER_ADDRMODE_RELATIVE) {
if(reg >= This->rel_offset) {
sprintf(tmpReg, "C[A0.x + %u]", reg - This->rel_offset);
} else {
sprintf(tmpReg, "C[A0.x - %u]", -reg + This->rel_offset);
}
} else {
if(This->baseShader.load_local_constsF || list_empty(&This->baseShader.constantsF)) {
sprintf(tmpReg, "C[%u]", reg);
} else {
sprintf(tmpReg, "C%u", reg);
}
}
strcat(hwLine, tmpReg);
break;
case WINED3DSPR_ADDR: /*case D3DSPR_TEXTURE:*/
sprintf(tmpReg, "A%u", reg);
strcat(hwLine, tmpReg);
break;
case WINED3DSPR_RASTOUT:
sprintf(tmpReg, "%s", hwrastout_reg_names[reg]);
strcat(hwLine, tmpReg);
break;
case WINED3DSPR_ATTROUT:
if (reg==0) {
strcat(hwLine, "result.color.primary");
} else {
strcat(hwLine, "result.color.secondary");
if (!is_input)
{
char write_mask[6];
shader_arb_get_write_mask(ins, param, write_mask);
strcat(hwLine, write_mask);
}
else
{
char swizzle[6];
shader_arb_get_swizzle(param, is_color, swizzle);
strcat(hwLine, swizzle);
}
break;
case WINED3DSPR_TEXCRDOUT:
sprintf(tmpReg, "result.texcoord[%u]", reg);
strcat(hwLine, tmpReg);
break;
default:
FIXME("Unknown reg type %d %d\n", regtype, reg);
strcat(hwLine, "unrecognized_register");
break;
}
if (!is_input) {
char write_mask[6];
shader_arb_get_write_mask(ins, param, write_mask);
strcat(hwLine, write_mask);
} else {
char swizzle[6];
shader_arb_get_swizzle(param, is_color, swizzle);
strcat(hwLine, swizzle);
}
}
static const char *shader_arb_get_fixup_swizzle(enum fixup_channel_source channel_source)
@ -701,6 +684,7 @@ static void pshader_gen_input_modifier_line (
char *outregstr) {
/* Generate a line that does the input modifier computation and return the input register to use */
BOOL is_color = FALSE;
char regstr[256];
char swzstr[20];
int insert_line;
@ -709,8 +693,9 @@ static void pshader_gen_input_modifier_line (
insert_line = 1;
/* Get register name */
pshader_get_register_name(iface, shader_get_regtype(instr), instr & WINED3DSP_REGNUM_MASK, regstr);
shader_arb_get_swizzle(instr, FALSE, swzstr);
shader_arb_get_register_name(iface, shader_get_regtype(instr), instr & WINED3DSP_REGNUM_MASK,
instr & WINED3DSHADER_ADDRMODE_RELATIVE, regstr, &is_color);
shader_arb_get_swizzle(instr, is_color, swzstr);
switch (instr & WINED3DSP_SRCMOD_MASK) {
case WINED3DSPSM_NONE:
@ -771,12 +756,14 @@ static inline void pshader_gen_output_modifier_line(SHADER_BUFFER *buffer, int s
static void pshader_hw_bem(const struct wined3d_shader_instruction *ins)
{
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)ins->shader;
const struct wined3d_shader_dst_param *dst = &ins->dst[0];
SHADER_BUFFER *buffer = ins->buffer;
char dst_name[50];
char src_name[2][50];
char dst_wmask[20];
DWORD sampler_code = ins->dst[0].register_idx;
DWORD sampler_code = dst->register_idx;
BOOL has_bumpmat = FALSE;
BOOL is_color;
int i;
for(i = 0; i < This->numbumpenvmatconsts; i++) {
@ -788,8 +775,9 @@ static void pshader_hw_bem(const struct wined3d_shader_instruction *ins)
}
}
pshader_get_register_name(ins->shader, ins->dst[0].register_type, ins->dst[0].register_idx, dst_name);
shader_arb_get_write_mask(ins, ins->dst[0].token, dst_wmask);
shader_arb_get_register_name(ins->shader, dst->register_type,
dst->register_idx, dst->has_rel_addr, dst_name, &is_color);
shader_arb_get_write_mask(ins, dst->token, dst_wmask);
strcat(dst_name, dst_wmask);
pshader_gen_input_modifier_line(ins->shader, buffer, ins->src[0], 0, src_name[0]);
@ -810,18 +798,21 @@ static void pshader_hw_bem(const struct wined3d_shader_instruction *ins)
static void pshader_hw_cnd(const struct wined3d_shader_instruction *ins)
{
const struct wined3d_shader_dst_param *dst = &ins->dst[0];
SHADER_BUFFER *buffer = ins->buffer;
char dst_wmask[20];
char dst_name[50];
char src_name[3][50];
BOOL sat = ins->dst[0].modifiers & WINED3DSPDM_SATURATE;
DWORD shift = ins->dst[0].shift;
BOOL sat = dst->modifiers & WINED3DSPDM_SATURATE;
DWORD shift = dst->shift;
BOOL is_color;
/* FIXME: support output modifiers */
/* Handle output register */
pshader_get_register_name(ins->shader, ins->dst[0].register_type, ins->dst[0].register_idx, dst_name);
shader_arb_get_write_mask(ins, ins->dst[0].token, dst_wmask);
shader_arb_get_register_name(ins->shader, dst->register_type,
dst->register_idx, dst->has_rel_addr, dst_name, &is_color);
shader_arb_get_write_mask(ins, dst->token, dst_wmask);
/* Generate input register names (with modifiers) */
pshader_gen_input_modifier_line(ins->shader, buffer, ins->src[0], 0, src_name[0]);
@ -843,18 +834,21 @@ static void pshader_hw_cnd(const struct wined3d_shader_instruction *ins)
static void pshader_hw_cmp(const struct wined3d_shader_instruction *ins)
{
const struct wined3d_shader_dst_param *dst = &ins->dst[0];
SHADER_BUFFER *buffer = ins->buffer;
char dst_wmask[20];
char dst_name[50];
char src_name[3][50];
DWORD shift = ins->dst[0].shift;
BOOL sat = ins->dst[0].modifiers & WINED3DSPDM_SATURATE;
DWORD shift = dst->shift;
BOOL sat = dst->modifiers & WINED3DSPDM_SATURATE;
BOOL is_color;
/* FIXME: support output modifiers */
/* Handle output register */
pshader_get_register_name(ins->shader, ins->dst[0].register_type, ins->dst[0].register_idx, dst_name);
shader_arb_get_write_mask(ins, ins->dst[0].token, dst_wmask);
shader_arb_get_register_name(ins->shader, dst->register_type,
dst->register_idx, dst->has_rel_addr, dst_name, &is_color);
shader_arb_get_write_mask(ins, dst->token, dst_wmask);
/* Generate input register names (with modifiers) */
pshader_gen_input_modifier_line(ins->shader, buffer, ins->src[0], 0, src_name[0]);
@ -872,15 +866,18 @@ static void pshader_hw_cmp(const struct wined3d_shader_instruction *ins)
* dst = dot2(src0, src1) + src2 */
static void pshader_hw_dp2add(const struct wined3d_shader_instruction *ins)
{
const struct wined3d_shader_dst_param *dst = &ins->dst[0];
SHADER_BUFFER *buffer = ins->buffer;
char dst_wmask[20];
char dst_name[50];
char src_name[3][50];
DWORD shift = ins->dst[0].shift;
BOOL sat = ins->dst[0].modifiers & WINED3DSPDM_SATURATE;
DWORD shift = dst->shift;
BOOL sat = dst->modifiers & WINED3DSPDM_SATURATE;
BOOL is_color;
pshader_get_register_name(ins->shader, ins->dst[0].register_type, ins->dst[0].register_idx, dst_name);
shader_arb_get_write_mask(ins, ins->dst[0].token, dst_wmask);
shader_arb_get_register_name(ins->shader, dst->register_type,
dst->register_idx, dst->has_rel_addr, dst_name, &is_color);
shader_arb_get_write_mask(ins, dst->token, dst_wmask);
pshader_gen_input_modifier_line(ins->shader, buffer, ins->src[0], 0, src_name[0]);
pshader_gen_input_modifier_line(ins->shader, buffer, ins->src[1], 1, src_name[1]);
@ -946,6 +943,7 @@ static void shader_hw_map2gl(const struct wined3d_shader_instruction *ins)
BOOL centroid = FALSE;
BOOL partialprecision = FALSE;
const char *modifier;
BOOL is_color;
DWORD shift;
if (!(ins->dst_count + ins->src_count))
@ -980,7 +978,8 @@ static void shader_hw_map2gl(const struct wined3d_shader_instruction *ins)
}
/* Handle output register */
pshader_get_register_name(ins->shader, ins->dst[0].register_type, ins->dst[0].register_idx, output_rname);
shader_arb_get_register_name(ins->shader, dst->register_type,
dst->register_idx, dst->has_rel_addr, output_rname, &is_color);
strcpy(operands[0], output_rname);
shader_arb_get_write_mask(ins, dst->token, output_wmask);
strcat(operands[0], output_wmask);
@ -1062,14 +1061,17 @@ static void shader_hw_mov(const struct wined3d_shader_instruction *ins)
static void pshader_hw_texkill(const struct wined3d_shader_instruction *ins)
{
const struct wined3d_shader_dst_param *dst = &ins->dst[0];
DWORD shader_version = ins->reg_maps->shader_version;
SHADER_BUFFER *buffer = ins->buffer;
char reg_dest[40];
BOOL is_color;
/* No swizzles are allowed in d3d's texkill. PS 1.x ignores the 4th component as documented,
* but >= 2.0 honors it(undocumented, but tested by the d3d9 testsuit)
*/
pshader_get_register_name(ins->shader, ins->dst[0].register_type, ins->dst[0].register_idx, reg_dest);
shader_arb_get_register_name(ins->shader, dst->register_type,
dst->register_idx, dst->has_rel_addr, reg_dest, &is_color);
if (shader_version >= WINED3DPS_VERSION(2,0))
{
@ -1089,6 +1091,8 @@ static void pshader_hw_tex(const struct wined3d_shader_instruction *ins)
{
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)ins->shader;
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device;
const struct wined3d_shader_dst_param *dst = &ins->dst[0];
BOOL is_color;
const DWORD *src = ins->src;
SHADER_BUFFER* buffer = ins->buffer;
@ -1097,12 +1101,11 @@ static void pshader_hw_tex(const struct wined3d_shader_instruction *ins)
char reg_dest[40];
char reg_coord[40];
DWORD reg_dest_code;
DWORD reg_sampler_code;
/* All versions have a destination register */
reg_dest_code = ins->dst[0].register_idx;
pshader_get_register_name(ins->shader, ins->dst[0].register_type, ins->dst[0].register_idx, reg_dest);
shader_arb_get_register_name(ins->shader, dst->register_type,
dst->register_idx, dst->has_rel_addr, reg_dest, &is_color);
/* 1.0-1.3: Use destination register as coordinate source.
1.4+: Use provided coordinate source register. */
@ -1114,7 +1117,7 @@ static void pshader_hw_tex(const struct wined3d_shader_instruction *ins)
/* 1.0-1.4: Use destination register number as texture code.
2.0+: Use provided sampler number as texure code. */
if (shader_version < WINED3DPS_VERSION(2,0))
reg_sampler_code = reg_dest_code;
reg_sampler_code = dst->register_idx;
else
reg_sampler_code = src[1] & WINED3DSP_REGNUM_MASK;
@ -1217,8 +1220,10 @@ static void pshader_hw_texreg2rgb(const struct wined3d_shader_instruction *ins)
static void pshader_hw_texbem(const struct wined3d_shader_instruction *ins)
{
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)ins->shader;
const struct wined3d_shader_dst_param *dst = &ins->dst[0];
BOOL has_bumpmat = FALSE;
BOOL has_luminance = FALSE;
BOOL is_color;
int i;
DWORD src = ins->src[0] & WINED3DSP_REGNUM_MASK;
@ -1228,9 +1233,10 @@ static void pshader_hw_texbem(const struct wined3d_shader_instruction *ins)
DWORD reg_dest_code;
/* All versions have a destination register */
reg_dest_code = ins->dst[0].register_idx;
reg_dest_code = dst->register_idx;
/* Can directly use the name because texbem is only valid for <= 1.3 shaders */
pshader_get_register_name(ins->shader, ins->dst[0].register_type, ins->dst[0].register_idx, reg_coord);
shader_arb_get_register_name(ins->shader, dst->register_type,
dst->register_idx, dst->has_rel_addr, reg_coord, &is_color);
for(i = 0; i < This->numbumpenvmatconsts; i++) {
if (This->bumpenvmatconst[i].const_num != WINED3D_CONST_NUM_UNUSED
@ -1426,15 +1432,18 @@ static void pshader_hw_texm3x3spec(const struct wined3d_shader_instruction *ins)
static void pshader_hw_texdepth(const struct wined3d_shader_instruction *ins)
{
const struct wined3d_shader_dst_param *dst = &ins->dst[0];
SHADER_BUFFER *buffer = ins->buffer;
char dst_name[50];
BOOL is_color;
/* texdepth has an implicit destination, the fragment depth value. It's only parameter,
* which is essentially an input, is the destination register because it is the first
* parameter. According to the msdn, this must be register r5, but let's keep it more flexible
* here
*/
pshader_get_register_name(ins->shader, ins->dst[0].register_type, ins->dst[0].register_idx, dst_name);
shader_arb_get_register_name(ins->shader, dst->register_type,
dst->register_idx, dst->has_rel_addr, dst_name, &is_color);
/* According to the msdn, the source register(must be r5) is unusable after
* the texdepth instruction, so we're free to modify it
@ -1473,18 +1482,20 @@ static void pshader_hw_texdp3tex(const struct wined3d_shader_instruction *ins)
* Take a 3-component dot product of the TexCoord[dstreg] and src. */
static void pshader_hw_texdp3(const struct wined3d_shader_instruction *ins)
{
const struct wined3d_shader_dst_param *dst = &ins->dst[0];
char src0[50];
char dst_str[50];
char dst_mask[6];
DWORD dstreg = ins->dst[0].register_idx;
SHADER_BUFFER *buffer = ins->buffer;
BOOL is_color;
/* Handle output register */
pshader_get_register_name(ins->shader, ins->dst[0].register_type, ins->dst[0].register_idx, dst_str);
shader_arb_get_write_mask(ins, ins->dst[0].token, dst_mask);
shader_arb_get_register_name(ins->shader, dst->register_type,
dst->register_idx, dst->has_rel_addr, dst_str, &is_color);
shader_arb_get_write_mask(ins, dst->token, dst_mask);
pshader_gen_input_modifier_line(ins->shader, buffer, ins->src[0], 0, src0);
shader_addline(buffer, "DP3 %s%s, T%u, %s;\n", dst_str, dst_mask, dstreg, src0);
shader_addline(buffer, "DP3 %s%s, T%u, %s;\n", dst_str, dst_mask, dst->register_idx, src0);
/* TODO: Handle output modifiers */
}
@ -1493,17 +1504,19 @@ static void pshader_hw_texdp3(const struct wined3d_shader_instruction *ins)
* Perform the 3rd row of a 3x3 matrix multiply */
static void pshader_hw_texm3x3(const struct wined3d_shader_instruction *ins)
{
const struct wined3d_shader_dst_param *dst = &ins->dst[0];
SHADER_BUFFER *buffer = ins->buffer;
char dst_str[50];
char dst_mask[6];
char src0[50];
DWORD dst_reg = ins->dst[0].register_idx;
BOOL is_color;
pshader_get_register_name(ins->shader, ins->dst[0].register_type, ins->dst[0].register_idx, dst_str);
shader_arb_get_write_mask(ins, ins->dst[0].token, dst_mask);
shader_arb_get_register_name(ins->shader, dst->register_type,
dst->register_idx, dst->has_rel_addr, dst_str, &is_color);
shader_arb_get_write_mask(ins, dst->token, dst_mask);
pshader_gen_input_modifier_line(ins->shader, buffer, ins->src[0], 0, src0);
shader_addline(buffer, "DP3 TMP.z, T%u, %s;\n", dst_reg, src0);
shader_addline(buffer, "DP3 TMP.z, T%u, %s;\n", dst->register_idx, src0);
shader_addline(buffer, "MOV %s%s, TMP;\n", dst_str, dst_mask);
/* TODO: Handle output modifiers */
@ -1626,15 +1639,18 @@ static void vshader_hw_rsq_rcp(const struct wined3d_shader_instruction *ins)
static void shader_hw_nrm(const struct wined3d_shader_instruction *ins)
{
const struct wined3d_shader_dst_param *dst = &ins->dst[0];
SHADER_BUFFER *buffer = ins->buffer;
char dst_name[50];
char src_name[50];
char dst_wmask[20];
DWORD shift = ins->dst[0].shift;
BOOL sat = ins->dst[0].modifiers & WINED3DSPDM_SATURATE;
DWORD shift = dst->shift;
BOOL sat = dst->modifiers & WINED3DSPDM_SATURATE;
BOOL is_color;
pshader_get_register_name(ins->shader, ins->dst[0].register_type, ins->dst[0].register_idx, dst_name);
shader_arb_get_write_mask(ins, ins->dst[0].token, dst_wmask);
shader_arb_get_register_name(ins->shader, dst->register_type,
dst->register_idx, dst->has_rel_addr, dst_name, &is_color);
shader_arb_get_write_mask(ins, dst->token, dst_wmask);
pshader_gen_input_modifier_line(ins->shader, buffer, ins->src[0], 0, src_name);
shader_addline(buffer, "DP3 TMP, %s, %s;\n", src_name, src_name);
@ -1653,15 +1669,18 @@ static void shader_hw_sincos(const struct wined3d_shader_instruction *ins)
* must contain fixed constants. So we need a separate function to filter those constants and
* can't use map2gl
*/
const struct wined3d_shader_dst_param *dst = &ins->dst[0];
SHADER_BUFFER *buffer = ins->buffer;
char dst_name[50];
char src_name[50];
char dst_wmask[20];
DWORD shift = ins->dst[0].shift;
BOOL sat = ins->dst[0].modifiers & WINED3DSPDM_SATURATE;
DWORD shift = dst->shift;
BOOL sat = dst->modifiers & WINED3DSPDM_SATURATE;
BOOL is_color;
pshader_get_register_name(ins->shader, ins->dst[0].register_type, ins->dst[0].register_idx, dst_name);
shader_arb_get_write_mask(ins, ins->dst[0].token, dst_wmask);
shader_arb_get_register_name(ins->shader, dst->register_type,
dst->register_idx, dst->has_rel_addr, dst_name, &is_color);
shader_arb_get_write_mask(ins, dst->token, dst_wmask);
pshader_gen_input_modifier_line(ins->shader, buffer, ins->src[0], 0, src_name);
shader_addline(buffer, "SCS%s %s%s, %s;\n", sat ? "_SAT" : "", dst_name, dst_wmask,