wined3d: Group register information into struct wined3d_shader_register.

This commit is contained in:
Henri Verbeet 2009-05-07 16:36:07 +02:00 committed by Alexandre Julliard
parent 0bc112cfe4
commit 5e473cb17f
7 changed files with 168 additions and 162 deletions

View File

@ -423,7 +423,7 @@ static void shader_arb_get_write_mask(const struct wined3d_shader_instruction *i
char *ptr = write_mask; char *ptr = write_mask;
char vshader = shader_is_vshader_version(ins->ctx->reg_maps->shader_version.type); char vshader = shader_is_vshader_version(ins->ctx->reg_maps->shader_version.type);
if (vshader && dst->register_type == WINED3DSPR_ADDR) if (vshader && dst->reg.type == WINED3DSPR_ADDR)
{ {
*ptr++ = '.'; *ptr++ = '.';
*ptr++ = 'x'; *ptr++ = 'x';
@ -574,8 +574,8 @@ static void shader_arb_add_src_param(const struct wined3d_shader_instruction *in
if (wined3d_src->modifiers == WINED3DSPSM_NEG) strcat(str, " -"); if (wined3d_src->modifiers == WINED3DSPSM_NEG) strcat(str, " -");
else strcat(str, " "); else strcat(str, " ");
shader_arb_get_register_name(ins->ctx->shader, wined3d_src->register_type, shader_arb_get_register_name(ins->ctx->shader, wined3d_src->reg.type,
wined3d_src->register_idx, !!wined3d_src->rel_addr, register_name, &is_color); wined3d_src->reg.idx, !!wined3d_src->reg.rel_addr, register_name, &is_color);
strcat(str, register_name); strcat(str, register_name);
shader_arb_get_swizzle(wined3d_src, is_color, swizzle); shader_arb_get_swizzle(wined3d_src, is_color, swizzle);
@ -591,8 +591,8 @@ static void shader_arb_add_dst_param(const struct wined3d_shader_instruction *in
strcat(str, " "); strcat(str, " ");
shader_arb_get_register_name(ins->ctx->shader, wined3d_dst->register_type, shader_arb_get_register_name(ins->ctx->shader, wined3d_dst->reg.type,
wined3d_dst->register_idx, !!wined3d_dst->rel_addr, register_name, &is_color); wined3d_dst->reg.idx, !!wined3d_dst->reg.rel_addr, register_name, &is_color);
strcat(str, register_name); strcat(str, register_name);
shader_arb_get_write_mask(ins, wined3d_dst, write_mask); shader_arb_get_write_mask(ins, wined3d_dst, write_mask);
@ -742,8 +742,8 @@ static void pshader_gen_input_modifier_line(IWineD3DBaseShader *iface, SHADER_BU
insert_line = 1; insert_line = 1;
/* Get register name */ /* Get register name */
shader_arb_get_register_name(iface, src->register_type, shader_arb_get_register_name(iface, src->reg.type,
src->register_idx, !!src->rel_addr, regstr, &is_color); src->reg.idx, !!src->reg.rel_addr, regstr, &is_color);
shader_arb_get_swizzle(src, is_color, swzstr); shader_arb_get_swizzle(src, is_color, swzstr);
switch (src->modifiers) switch (src->modifiers)
@ -811,7 +811,7 @@ static void pshader_hw_bem(const struct wined3d_shader_instruction *ins)
char dst_name[50]; char dst_name[50];
char src_name[2][50]; char src_name[2][50];
char dst_wmask[20]; char dst_wmask[20];
DWORD sampler_code = dst->register_idx; DWORD sampler_code = dst->reg.idx;
BOOL has_bumpmat = FALSE; BOOL has_bumpmat = FALSE;
BOOL is_color; BOOL is_color;
int i; int i;
@ -825,8 +825,8 @@ static void pshader_hw_bem(const struct wined3d_shader_instruction *ins)
} }
} }
shader_arb_get_register_name(ins->ctx->shader, dst->register_type, shader_arb_get_register_name(ins->ctx->shader, dst->reg.type,
dst->register_idx, !!dst->rel_addr, dst_name, &is_color); dst->reg.idx, !!dst->reg.rel_addr, dst_name, &is_color);
shader_arb_get_write_mask(ins, dst, dst_wmask); shader_arb_get_write_mask(ins, dst, dst_wmask);
strcat(dst_name, dst_wmask); strcat(dst_name, dst_wmask);
@ -862,8 +862,8 @@ static void pshader_hw_cnd(const struct wined3d_shader_instruction *ins)
/* FIXME: support output modifiers */ /* FIXME: support output modifiers */
/* Handle output register */ /* Handle output register */
shader_arb_get_register_name(ins->ctx->shader, dst->register_type, shader_arb_get_register_name(ins->ctx->shader, dst->reg.type,
dst->register_idx, !!dst->rel_addr, dst_name, &is_color); dst->reg.idx, !!dst->reg.rel_addr, dst_name, &is_color);
shader_arb_get_write_mask(ins, dst, dst_wmask); shader_arb_get_write_mask(ins, dst, dst_wmask);
/* Generate input register names (with modifiers) */ /* Generate input register names (with modifiers) */
@ -898,8 +898,8 @@ static void pshader_hw_cmp(const struct wined3d_shader_instruction *ins)
/* FIXME: support output modifiers */ /* FIXME: support output modifiers */
/* Handle output register */ /* Handle output register */
shader_arb_get_register_name(ins->ctx->shader, dst->register_type, shader_arb_get_register_name(ins->ctx->shader, dst->reg.type,
dst->register_idx, !!dst->rel_addr, dst_name, &is_color); dst->reg.idx, !!dst->reg.rel_addr, dst_name, &is_color);
shader_arb_get_write_mask(ins, dst, dst_wmask); shader_arb_get_write_mask(ins, dst, dst_wmask);
/* Generate input register names (with modifiers) */ /* Generate input register names (with modifiers) */
@ -927,8 +927,8 @@ static void pshader_hw_dp2add(const struct wined3d_shader_instruction *ins)
BOOL sat = dst->modifiers & WINED3DSPDM_SATURATE; BOOL sat = dst->modifiers & WINED3DSPDM_SATURATE;
BOOL is_color; BOOL is_color;
shader_arb_get_register_name(ins->ctx->shader, dst->register_type, shader_arb_get_register_name(ins->ctx->shader, dst->reg.type,
dst->register_idx, !!dst->rel_addr, dst_name, &is_color); dst->reg.idx, !!dst->reg.rel_addr, dst_name, &is_color);
shader_arb_get_write_mask(ins, dst, dst_wmask); shader_arb_get_write_mask(ins, dst, dst_wmask);
pshader_gen_input_modifier_line(ins->ctx->shader, buffer, &ins->src[0], 0, src_name[0]); pshader_gen_input_modifier_line(ins->ctx->shader, buffer, &ins->src[0], 0, src_name[0]);
@ -1029,8 +1029,8 @@ static void shader_hw_map2gl(const struct wined3d_shader_instruction *ins)
} }
/* Handle output register */ /* Handle output register */
shader_arb_get_register_name(ins->ctx->shader, dst->register_type, shader_arb_get_register_name(ins->ctx->shader, dst->reg.type,
dst->register_idx, !!dst->rel_addr, output_rname, &is_color); dst->reg.idx, !!dst->reg.rel_addr, output_rname, &is_color);
strcpy(operands[0], output_rname); strcpy(operands[0], output_rname);
shader_arb_get_write_mask(ins, dst, output_wmask); shader_arb_get_write_mask(ins, dst, output_wmask);
strcat(operands[0], output_wmask); strcat(operands[0], output_wmask);
@ -1069,7 +1069,7 @@ static void shader_hw_mov(const struct wined3d_shader_instruction *ins)
if ((ins->ctx->reg_maps->shader_version.major == 1 if ((ins->ctx->reg_maps->shader_version.major == 1
&& !shader_is_pshader_version(ins->ctx->reg_maps->shader_version.type) && !shader_is_pshader_version(ins->ctx->reg_maps->shader_version.type)
&& ins->dst[0].register_type == WINED3DSPR_ADDR) && ins->dst[0].reg.type == WINED3DSPR_ADDR)
|| ins->handler_idx == WINED3DSIH_MOVA) || ins->handler_idx == WINED3DSIH_MOVA)
{ {
SHADER_BUFFER *buffer = ins->ctx->buffer; SHADER_BUFFER *buffer = ins->ctx->buffer;
@ -1112,8 +1112,8 @@ static void pshader_hw_texkill(const struct wined3d_shader_instruction *ins)
/* No swizzles are allowed in d3d's texkill. PS 1.x ignores the 4th component as documented, /* 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) * but >= 2.0 honors it(undocumented, but tested by the d3d9 testsuit)
*/ */
shader_arb_get_register_name(ins->ctx->shader, dst->register_type, shader_arb_get_register_name(ins->ctx->shader, dst->reg.type,
dst->register_idx, !!dst->rel_addr, reg_dest, &is_color); dst->reg.idx, !!dst->reg.rel_addr, reg_dest, &is_color);
if (ins->ctx->reg_maps->shader_version.major >= 2) if (ins->ctx->reg_maps->shader_version.major >= 2)
{ {
@ -1145,8 +1145,8 @@ static void pshader_hw_tex(const struct wined3d_shader_instruction *ins)
DWORD reg_sampler_code; DWORD reg_sampler_code;
/* All versions have a destination register */ /* All versions have a destination register */
shader_arb_get_register_name(ins->ctx->shader, dst->register_type, shader_arb_get_register_name(ins->ctx->shader, dst->reg.type,
dst->register_idx, !!dst->rel_addr, reg_dest, &is_color); dst->reg.idx, !!dst->reg.rel_addr, reg_dest, &is_color);
/* 1.0-1.3: Use destination register as coordinate source. /* 1.0-1.3: Use destination register as coordinate source.
1.4+: Use provided coordinate source register. */ 1.4+: Use provided coordinate source register. */
@ -1158,9 +1158,9 @@ static void pshader_hw_tex(const struct wined3d_shader_instruction *ins)
/* 1.0-1.4: Use destination register number as texture code. /* 1.0-1.4: Use destination register number as texture code.
2.0+: Use provided sampler number as texure code. */ 2.0+: Use provided sampler number as texure code. */
if (shader_version < WINED3D_SHADER_VERSION(2,0)) if (shader_version < WINED3D_SHADER_VERSION(2,0))
reg_sampler_code = dst->register_idx; reg_sampler_code = dst->reg.idx;
else else
reg_sampler_code = ins->src[1].register_idx; reg_sampler_code = ins->src[1].reg.idx;
/* projection flag: /* projection flag:
* 1.1, 1.2, 1.3: Use WINED3DTSS_TEXTURETRANSFORMFLAGS * 1.1, 1.2, 1.3: Use WINED3DTSS_TEXTURETRANSFORMFLAGS
@ -1203,13 +1203,13 @@ static void pshader_hw_texcoord(const struct wined3d_shader_instruction *ins)
shader_arb_get_write_mask(ins, dst, tmp); shader_arb_get_write_mask(ins, dst, tmp);
if (shader_version != WINED3D_SHADER_VERSION(1,4)) if (shader_version != WINED3D_SHADER_VERSION(1,4))
{ {
DWORD reg = dst->register_idx; DWORD reg = dst->reg.idx;
shader_addline(buffer, "MOV_SAT T%u%s, fragment.texcoord[%u];\n", reg, tmp, reg); shader_addline(buffer, "MOV_SAT T%u%s, fragment.texcoord[%u];\n", reg, tmp, reg);
} else { } else {
char reg_src[40]; char reg_src[40];
pshader_gen_input_modifier_line(ins->ctx->shader, buffer, &ins->src[0], 0, reg_src); pshader_gen_input_modifier_line(ins->ctx->shader, buffer, &ins->src[0], 0, reg_src);
shader_addline(buffer, "MOV R%u%s, %s;\n", dst->register_idx, tmp, reg_src); shader_addline(buffer, "MOV R%u%s, %s;\n", dst->reg.idx, tmp, reg_src);
} }
} }
@ -1220,7 +1220,7 @@ static void pshader_hw_texreg2ar(const struct wined3d_shader_instruction *ins)
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device; IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device;
DWORD flags; DWORD flags;
DWORD reg1 = ins->dst[0].register_idx; DWORD reg1 = ins->dst[0].reg.idx;
char dst_str[8]; char dst_str[8];
char src_str[50]; char src_str[50];
@ -1236,7 +1236,7 @@ static void pshader_hw_texreg2gb(const struct wined3d_shader_instruction *ins)
{ {
SHADER_BUFFER *buffer = ins->ctx->buffer; SHADER_BUFFER *buffer = ins->ctx->buffer;
DWORD reg1 = ins->dst[0].register_idx; DWORD reg1 = ins->dst[0].reg.idx;
char dst_str[8]; char dst_str[8];
char src_str[50]; char src_str[50];
@ -1250,7 +1250,7 @@ static void pshader_hw_texreg2gb(const struct wined3d_shader_instruction *ins)
static void pshader_hw_texreg2rgb(const struct wined3d_shader_instruction *ins) static void pshader_hw_texreg2rgb(const struct wined3d_shader_instruction *ins)
{ {
SHADER_BUFFER *buffer = ins->ctx->buffer; SHADER_BUFFER *buffer = ins->ctx->buffer;
DWORD reg1 = ins->dst[0].register_idx; DWORD reg1 = ins->dst[0].reg.idx;
char dst_str[8]; char dst_str[8];
char src_str[50]; char src_str[50];
@ -1274,10 +1274,10 @@ static void pshader_hw_texbem(const struct wined3d_shader_instruction *ins)
DWORD reg_dest_code; DWORD reg_dest_code;
/* All versions have a destination register */ /* All versions have a destination register */
reg_dest_code = dst->register_idx; reg_dest_code = dst->reg.idx;
/* Can directly use the name because texbem is only valid for <= 1.3 shaders */ /* Can directly use the name because texbem is only valid for <= 1.3 shaders */
shader_arb_get_register_name(ins->ctx->shader, dst->register_type, shader_arb_get_register_name(ins->ctx->shader, dst->reg.type,
dst->register_idx, !!dst->rel_addr, reg_coord, &is_color); dst->reg.idx, !!dst->reg.rel_addr, reg_coord, &is_color);
for(i = 0; i < This->numbumpenvmatconsts; i++) { for(i = 0; i < This->numbumpenvmatconsts; i++) {
if (This->bumpenvmatconst[i].const_num != WINED3D_CONST_NUM_UNUSED if (This->bumpenvmatconst[i].const_num != WINED3D_CONST_NUM_UNUSED
@ -1297,7 +1297,7 @@ static void pshader_hw_texbem(const struct wined3d_shader_instruction *ins)
} }
if(has_bumpmat) { if(has_bumpmat) {
DWORD src = ins->src[0].register_idx; DWORD src = ins->src[0].reg.idx;
/* Sampling the perturbation map in Tsrc was done already, including the signedness correction if needed */ /* Sampling the perturbation map in Tsrc was done already, including the signedness correction if needed */
@ -1341,7 +1341,7 @@ static void pshader_hw_texbem(const struct wined3d_shader_instruction *ins)
static void pshader_hw_texm3x2pad(const struct wined3d_shader_instruction *ins) static void pshader_hw_texm3x2pad(const struct wined3d_shader_instruction *ins)
{ {
DWORD reg = ins->dst[0].register_idx; DWORD reg = ins->dst[0].reg.idx;
SHADER_BUFFER *buffer = ins->ctx->buffer; SHADER_BUFFER *buffer = ins->ctx->buffer;
char src0_name[50]; char src0_name[50];
@ -1354,7 +1354,7 @@ static void pshader_hw_texm3x2tex(const struct wined3d_shader_instruction *ins)
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)ins->ctx->shader; IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)ins->ctx->shader;
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device; IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device;
DWORD flags; DWORD flags;
DWORD reg = ins->dst[0].register_idx; DWORD reg = ins->dst[0].reg.idx;
SHADER_BUFFER *buffer = ins->ctx->buffer; SHADER_BUFFER *buffer = ins->ctx->buffer;
char dst_str[8]; char dst_str[8];
char src0_name[50]; char src0_name[50];
@ -1369,7 +1369,7 @@ static void pshader_hw_texm3x2tex(const struct wined3d_shader_instruction *ins)
static void pshader_hw_texm3x3pad(const struct wined3d_shader_instruction *ins) static void pshader_hw_texm3x3pad(const struct wined3d_shader_instruction *ins)
{ {
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)ins->ctx->shader; IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)ins->ctx->shader;
DWORD reg = ins->dst[0].register_idx; DWORD reg = ins->dst[0].reg.idx;
SHADER_BUFFER *buffer = ins->ctx->buffer; SHADER_BUFFER *buffer = ins->ctx->buffer;
SHADER_PARSE_STATE* current_state = &This->baseShader.parse_state; SHADER_PARSE_STATE* current_state = &This->baseShader.parse_state;
char src0_name[50]; char src0_name[50];
@ -1384,7 +1384,7 @@ static void pshader_hw_texm3x3tex(const struct wined3d_shader_instruction *ins)
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)ins->ctx->shader; IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)ins->ctx->shader;
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device; IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device;
DWORD flags; DWORD flags;
DWORD reg = ins->dst[0].register_idx; DWORD reg = ins->dst[0].reg.idx;
SHADER_BUFFER *buffer = ins->ctx->buffer; SHADER_BUFFER *buffer = ins->ctx->buffer;
SHADER_PARSE_STATE* current_state = &This->baseShader.parse_state; SHADER_PARSE_STATE* current_state = &This->baseShader.parse_state;
char dst_str[8]; char dst_str[8];
@ -1405,7 +1405,7 @@ static void pshader_hw_texm3x3vspec(const struct wined3d_shader_instruction *ins
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)ins->ctx->shader; IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)ins->ctx->shader;
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device; IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device;
DWORD flags; DWORD flags;
DWORD reg = ins->dst[0].register_idx; DWORD reg = ins->dst[0].reg.idx;
SHADER_BUFFER *buffer = ins->ctx->buffer; SHADER_BUFFER *buffer = ins->ctx->buffer;
SHADER_PARSE_STATE* current_state = &This->baseShader.parse_state; SHADER_PARSE_STATE* current_state = &This->baseShader.parse_state;
char dst_str[8]; char dst_str[8];
@ -1441,8 +1441,8 @@ static void pshader_hw_texm3x3spec(const struct wined3d_shader_instruction *ins)
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)ins->ctx->shader; IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)ins->ctx->shader;
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device; IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device;
DWORD flags; DWORD flags;
DWORD reg = ins->dst[0].register_idx; DWORD reg = ins->dst[0].reg.idx;
DWORD reg3 = ins->src[1].register_idx; DWORD reg3 = ins->src[1].reg.idx;
SHADER_PARSE_STATE* current_state = &This->baseShader.parse_state; SHADER_PARSE_STATE* current_state = &This->baseShader.parse_state;
SHADER_BUFFER *buffer = ins->ctx->buffer; SHADER_BUFFER *buffer = ins->ctx->buffer;
char dst_str[8]; char dst_str[8];
@ -1485,8 +1485,8 @@ static void pshader_hw_texdepth(const struct wined3d_shader_instruction *ins)
* parameter. According to the msdn, this must be register r5, but let's keep it more flexible * parameter. According to the msdn, this must be register r5, but let's keep it more flexible
* here * here
*/ */
shader_arb_get_register_name(ins->ctx->shader, dst->register_type, shader_arb_get_register_name(ins->ctx->shader, dst->reg.type,
dst->register_idx, !!dst->rel_addr, dst_name, &is_color); dst->reg.idx, !!dst->reg.rel_addr, dst_name, &is_color);
/* According to the msdn, the source register(must be r5) is unusable after /* According to the msdn, the source register(must be r5) is unusable after
* the texdepth instruction, so we're free to modify it * the texdepth instruction, so we're free to modify it
@ -1509,7 +1509,7 @@ static void pshader_hw_texdepth(const struct wined3d_shader_instruction *ins)
static void pshader_hw_texdp3tex(const struct wined3d_shader_instruction *ins) static void pshader_hw_texdp3tex(const struct wined3d_shader_instruction *ins)
{ {
SHADER_BUFFER *buffer = ins->ctx->buffer; SHADER_BUFFER *buffer = ins->ctx->buffer;
DWORD sampler_idx = ins->dst[0].register_idx; DWORD sampler_idx = ins->dst[0].reg.idx;
char src0[50]; char src0[50];
char dst_str[8]; char dst_str[8];
@ -1533,12 +1533,12 @@ static void pshader_hw_texdp3(const struct wined3d_shader_instruction *ins)
BOOL is_color; BOOL is_color;
/* Handle output register */ /* Handle output register */
shader_arb_get_register_name(ins->ctx->shader, dst->register_type, shader_arb_get_register_name(ins->ctx->shader, dst->reg.type,
dst->register_idx, !!dst->rel_addr, dst_str, &is_color); dst->reg.idx, !!dst->reg.rel_addr, dst_str, &is_color);
shader_arb_get_write_mask(ins, dst, dst_mask); shader_arb_get_write_mask(ins, dst, dst_mask);
pshader_gen_input_modifier_line(ins->ctx->shader, buffer, &ins->src[0], 0, src0); pshader_gen_input_modifier_line(ins->ctx->shader, buffer, &ins->src[0], 0, src0);
shader_addline(buffer, "DP3 %s%s, T%u, %s;\n", dst_str, dst_mask, dst->register_idx, src0); shader_addline(buffer, "DP3 %s%s, T%u, %s;\n", dst_str, dst_mask, dst->reg.idx, src0);
/* TODO: Handle output modifiers */ /* TODO: Handle output modifiers */
} }
@ -1554,12 +1554,12 @@ static void pshader_hw_texm3x3(const struct wined3d_shader_instruction *ins)
char src0[50]; char src0[50];
BOOL is_color; BOOL is_color;
shader_arb_get_register_name(ins->ctx->shader, dst->register_type, shader_arb_get_register_name(ins->ctx->shader, dst->reg.type,
dst->register_idx, !!dst->rel_addr, dst_str, &is_color); dst->reg.idx, !!dst->reg.rel_addr, dst_str, &is_color);
shader_arb_get_write_mask(ins, dst, dst_mask); shader_arb_get_write_mask(ins, dst, dst_mask);
pshader_gen_input_modifier_line(ins->ctx->shader, buffer, &ins->src[0], 0, src0); pshader_gen_input_modifier_line(ins->ctx->shader, buffer, &ins->src[0], 0, src0);
shader_addline(buffer, "DP3 TMP.z, T%u, %s;\n", dst->register_idx, src0); shader_addline(buffer, "DP3 TMP.z, T%u, %s;\n", dst->reg.idx, src0);
shader_addline(buffer, "MOV %s%s, TMP;\n", dst_str, dst_mask); shader_addline(buffer, "MOV %s%s, TMP;\n", dst_str, dst_mask);
/* TODO: Handle output modifiers */ /* TODO: Handle output modifiers */
@ -1573,7 +1573,7 @@ static void pshader_hw_texm3x3(const struct wined3d_shader_instruction *ins)
static void pshader_hw_texm3x2depth(const struct wined3d_shader_instruction *ins) static void pshader_hw_texm3x2depth(const struct wined3d_shader_instruction *ins)
{ {
SHADER_BUFFER *buffer = ins->ctx->buffer; SHADER_BUFFER *buffer = ins->ctx->buffer;
DWORD dst_reg = ins->dst[0].register_idx; DWORD dst_reg = ins->dst[0].reg.idx;
char src0[50]; char src0[50];
pshader_gen_input_modifier_line(ins->ctx->shader, buffer, &ins->src[0], 0, src0); pshader_gen_input_modifier_line(ins->ctx->shader, buffer, &ins->src[0], 0, src0);
@ -1595,8 +1595,8 @@ static void shader_hw_mnxn(const struct wined3d_shader_instruction *ins)
{ {
int i; int i;
int nComponents = 0; int nComponents = 0;
struct wined3d_shader_dst_param tmp_dst = {0}; struct wined3d_shader_dst_param tmp_dst = {{0}};
struct wined3d_shader_src_param tmp_src[2] = {{0}}; struct wined3d_shader_src_param tmp_src[2] = {{{0}}};
struct wined3d_shader_instruction tmp_ins; struct wined3d_shader_instruction tmp_ins;
memset(&tmp_ins, 0, sizeof(tmp_ins)); memset(&tmp_ins, 0, sizeof(tmp_ins));
@ -1641,7 +1641,7 @@ static void shader_hw_mnxn(const struct wined3d_shader_instruction *ins)
for (i = 0; i < nComponents; i++) { for (i = 0; i < nComponents; i++) {
tmp_dst.write_mask = WINED3DSP_WRITEMASK_0 << i; tmp_dst.write_mask = WINED3DSP_WRITEMASK_0 << i;
shader_hw_map2gl(&tmp_ins); shader_hw_map2gl(&tmp_ins);
++tmp_src[1].register_idx; ++tmp_src[1].reg.idx;
} }
} }
@ -1687,8 +1687,8 @@ static void shader_hw_nrm(const struct wined3d_shader_instruction *ins)
BOOL sat = dst->modifiers & WINED3DSPDM_SATURATE; BOOL sat = dst->modifiers & WINED3DSPDM_SATURATE;
BOOL is_color; BOOL is_color;
shader_arb_get_register_name(ins->ctx->shader, dst->register_type, shader_arb_get_register_name(ins->ctx->shader, dst->reg.type,
dst->register_idx, !!dst->rel_addr, dst_name, &is_color); dst->reg.idx, !!dst->reg.rel_addr, dst_name, &is_color);
shader_arb_get_write_mask(ins, dst, dst_wmask); shader_arb_get_write_mask(ins, dst, dst_wmask);
pshader_gen_input_modifier_line(ins->ctx->shader, buffer, &ins->src[0], 0, src_name); pshader_gen_input_modifier_line(ins->ctx->shader, buffer, &ins->src[0], 0, src_name);
@ -1717,8 +1717,8 @@ static void shader_hw_sincos(const struct wined3d_shader_instruction *ins)
BOOL sat = dst->modifiers & WINED3DSPDM_SATURATE; BOOL sat = dst->modifiers & WINED3DSPDM_SATURATE;
BOOL is_color; BOOL is_color;
shader_arb_get_register_name(ins->ctx->shader, dst->register_type, shader_arb_get_register_name(ins->ctx->shader, dst->reg.type,
dst->register_idx, !!dst->rel_addr, dst_name, &is_color); dst->reg.idx, !!dst->reg.rel_addr, dst_name, &is_color);
shader_arb_get_write_mask(ins, dst, dst_wmask); shader_arb_get_write_mask(ins, dst, dst_wmask);
pshader_gen_input_modifier_line(ins->ctx->shader, buffer, &ins->src[0], 0, src_name); pshader_gen_input_modifier_line(ins->ctx->shader, buffer, &ins->src[0], 0, src_name);

View File

@ -366,30 +366,30 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
fe->shader_read_semantic(&pToken, &semantic); fe->shader_read_semantic(&pToken, &semantic);
switch (semantic.reg.register_type) switch (semantic.reg.reg.type)
{ {
/* Vshader: mark attributes used /* Vshader: mark attributes used
* Pshader: mark 3.0 input registers used, save token */ * Pshader: mark 3.0 input registers used, save token */
case WINED3DSPR_INPUT: case WINED3DSPR_INPUT:
if (!pshader) reg_maps->attributes[semantic.reg.register_idx] = 1; if (!pshader) reg_maps->attributes[semantic.reg.reg.idx] = 1;
else reg_maps->packed_input[semantic.reg.register_idx] = 1; else reg_maps->packed_input[semantic.reg.reg.idx] = 1;
semantics_in[semantic.reg.register_idx] = semantic; semantics_in[semantic.reg.reg.idx] = semantic;
break; break;
/* Vshader: mark 3.0 output registers used, save token */ /* Vshader: mark 3.0 output registers used, save token */
case WINED3DSPR_OUTPUT: case WINED3DSPR_OUTPUT:
reg_maps->packed_output[semantic.reg.register_idx] = 1; reg_maps->packed_output[semantic.reg.reg.idx] = 1;
semantics_out[semantic.reg.register_idx] = semantic; semantics_out[semantic.reg.reg.idx] = semantic;
if (semantic.usage == WINED3DDECLUSAGE_FOG) reg_maps->fog = 1; if (semantic.usage == WINED3DDECLUSAGE_FOG) reg_maps->fog = 1;
break; break;
/* Save sampler usage token */ /* Save sampler usage token */
case WINED3DSPR_SAMPLER: case WINED3DSPR_SAMPLER:
reg_maps->sampler_type[semantic.reg.register_idx] = semantic.sampler_type; reg_maps->sampler_type[semantic.reg.reg.idx] = semantic.sampler_type;
break; break;
default: default:
TRACE("Not recording DCL register type %#x.\n", semantic.reg.register_type); TRACE("Not recording DCL register type %#x.\n", semantic.reg.reg.type);
break; break;
} }
} }
@ -402,7 +402,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
if (!lconst) return E_OUTOFMEMORY; if (!lconst) return E_OUTOFMEMORY;
fe->shader_read_dst_param(fe_data, &pToken, &dst, &rel_addr); fe->shader_read_dst_param(fe_data, &pToken, &dst, &rel_addr);
lconst->idx = dst.register_idx; lconst->idx = dst.reg.idx;
memcpy(lconst->value, pToken, 4 * sizeof(DWORD)); memcpy(lconst->value, pToken, 4 * sizeof(DWORD));
pToken += 4; pToken += 4;
@ -432,7 +432,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
if (!lconst) return E_OUTOFMEMORY; if (!lconst) return E_OUTOFMEMORY;
fe->shader_read_dst_param(fe_data, &pToken, &dst, &rel_addr); fe->shader_read_dst_param(fe_data, &pToken, &dst, &rel_addr);
lconst->idx = dst.register_idx; lconst->idx = dst.reg.idx;
memcpy(lconst->value, pToken, 4 * sizeof(DWORD)); memcpy(lconst->value, pToken, 4 * sizeof(DWORD));
pToken += 4; pToken += 4;
@ -448,7 +448,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
if (!lconst) return E_OUTOFMEMORY; if (!lconst) return E_OUTOFMEMORY;
fe->shader_read_dst_param(fe_data, &pToken, &dst, &rel_addr); fe->shader_read_dst_param(fe_data, &pToken, &dst, &rel_addr);
lconst->idx = dst.register_idx; lconst->idx = dst.reg.idx;
memcpy(lconst->value, pToken, sizeof(DWORD)); memcpy(lconst->value, pToken, sizeof(DWORD));
++pToken; ++pToken;
@ -466,12 +466,12 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
/* Rep and Loop always use an integer constant for the control parameters */ /* Rep and Loop always use an integer constant for the control parameters */
if (ins.handler_idx == WINED3DSIH_REP) if (ins.handler_idx == WINED3DSIH_REP)
{ {
reg_maps->integer_constants |= 1 << src.register_idx; reg_maps->integer_constants |= 1 << src.reg.idx;
} }
else else
{ {
fe->shader_read_src_param(fe_data, &pToken, &src, &rel_addr); fe->shader_read_src_param(fe_data, &pToken, &src, &rel_addr);
reg_maps->integer_constants |= 1 << src.register_idx; reg_maps->integer_constants |= 1 << src.reg.idx;
} }
cur_loop_depth++; cur_loop_depth++;
@ -489,7 +489,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
struct wined3d_shader_src_param src, rel_addr; struct wined3d_shader_src_param src, rel_addr;
fe->shader_read_src_param(fe_data, &pToken, &src, &rel_addr); fe->shader_read_src_param(fe_data, &pToken, &src, &rel_addr);
reg_maps->labels[src.register_idx] = 1; reg_maps->labels[src.reg.idx] = 1;
} }
/* Set texture, address, temporary registers */ /* Set texture, address, temporary registers */
else else
@ -513,14 +513,14 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
/* WINED3DSPR_TEXCRDOUT is the same as WINED3DSPR_OUTPUT. _OUTPUT can be > MAX_REG_TEXCRD and /* WINED3DSPR_TEXCRDOUT is the same as WINED3DSPR_OUTPUT. _OUTPUT can be > MAX_REG_TEXCRD and
* is used in >= 3.0 shaders. Filter 3.0 shaders to prevent overflows, and also filter pixel * is used in >= 3.0 shaders. Filter 3.0 shaders to prevent overflows, and also filter pixel
* shaders because TECRDOUT isn't used in them, but future register types might cause issues */ * shaders because TECRDOUT isn't used in them, but future register types might cause issues */
if (!pshader && shader_version.major < 3 && dst_param.register_type == WINED3DSPR_TEXCRDOUT) if (!pshader && shader_version.major < 3 && dst_param.reg.type == WINED3DSPR_TEXCRDOUT)
{ {
reg_maps->texcoord_mask[dst_param.register_type] |= dst_param.write_mask; reg_maps->texcoord_mask[dst_param.reg.type] |= dst_param.write_mask;
} }
else else
{ {
shader_record_register_usage(This, reg_maps, dst_param.register_type, shader_record_register_usage(This, reg_maps, dst_param.reg.type,
dst_param.register_idx, !!dst_param.rel_addr, pshader); dst_param.reg.idx, !!dst_param.reg.rel_addr, pshader);
} }
/* Declare 1.X samplers implicitly, based on the destination reg. number */ /* Declare 1.X samplers implicitly, based on the destination reg. number */
@ -539,7 +539,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
|| ins.handler_idx == WINED3DSIH_TEXREG2RGB)) || ins.handler_idx == WINED3DSIH_TEXREG2RGB))
{ {
/* Fake sampler usage, only set reserved bit and ttype */ /* Fake sampler usage, only set reserved bit and ttype */
DWORD sampler_code = dst_param.register_idx; DWORD sampler_code = dst_param.reg.idx;
TRACE("Setting fake 2D sampler for 1.x pixelshader\n"); TRACE("Setting fake 2D sampler for 1.x pixelshader\n");
reg_maps->sampler_type[sampler_code] = WINED3DSTT_2D; reg_maps->sampler_type[sampler_code] = WINED3DSTT_2D;
@ -557,7 +557,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
} }
else if (pshader && ins.handler_idx == WINED3DSIH_BEM) else if (pshader && ins.handler_idx == WINED3DSIH_BEM)
{ {
reg_maps->bumpmat[dst_param.register_idx] = TRUE; reg_maps->bumpmat[dst_param.reg.idx] = TRUE;
} }
} }
@ -580,8 +580,8 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
struct wined3d_shader_src_param src_param, src_rel_addr; struct wined3d_shader_src_param src_param, src_rel_addr;
fe->shader_read_src_param(fe_data, &pToken, &src_param, &src_rel_addr); fe->shader_read_src_param(fe_data, &pToken, &src_param, &src_rel_addr);
shader_record_register_usage(This, reg_maps, src_param.register_type, shader_record_register_usage(This, reg_maps, src_param.reg.type,
src_param.register_idx, !!src_param.rel_addr, pshader); src_param.reg.idx, !!src_param.reg.rel_addr, pshader);
} }
} }
} }
@ -597,7 +597,7 @@ static void shader_dump_decl_usage(const struct wined3d_shader_semantic *semanti
{ {
TRACE("dcl"); TRACE("dcl");
if (semantic->reg.register_type == WINED3DSPR_SAMPLER) if (semantic->reg.reg.type == WINED3DSPR_SAMPLER)
{ {
switch (semantic->sampler_type) switch (semantic->sampler_type)
{ {
@ -796,7 +796,7 @@ void shader_dump_dst_param(const struct wined3d_shader_dst_param *param,
{ {
DWORD write_mask = param->write_mask; DWORD write_mask = param->write_mask;
shader_dump_register(param->register_type, param->register_idx, 0, NULL, param->rel_addr, shader_version); shader_dump_register(param->reg.type, param->reg.idx, 0, NULL, param->reg.rel_addr, shader_version);
if (write_mask != WINED3DSP_WRITEMASK_ALL) if (write_mask != WINED3DSP_WRITEMASK_ALL)
{ {
@ -830,8 +830,8 @@ void shader_dump_src_param(const struct wined3d_shader_src_param *param,
if (src_modifier == WINED3DSPSM_ABS || src_modifier == WINED3DSPSM_ABSNEG) if (src_modifier == WINED3DSPSM_ABS || src_modifier == WINED3DSPSM_ABSNEG)
TRACE("abs("); TRACE("abs(");
shader_dump_register(param->register_type, param->register_idx, shader_dump_register(param->reg.type, param->reg.idx, param->reg.immconst_type,
param->immconst_type, param->immconst_data, param->rel_addr, shader_version); param->reg.immconst_data, param->reg.rel_addr, shader_version);
if (src_modifier) if (src_modifier)
{ {
@ -1055,7 +1055,7 @@ void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data,
fe->shader_read_dst_param(fe_data, &pToken, &dst, &rel_addr); fe->shader_read_dst_param(fe_data, &pToken, &dst, &rel_addr);
TRACE("def c%u = %f, %f, %f, %f", shader_get_float_offset(dst.register_type, dst.register_idx), TRACE("def c%u = %f, %f, %f, %f", shader_get_float_offset(dst.reg.type, dst.reg.idx),
*(const float *)(pToken), *(const float *)(pToken),
*(const float *)(pToken + 1), *(const float *)(pToken + 1),
*(const float *)(pToken + 2), *(const float *)(pToken + 2),
@ -1069,7 +1069,7 @@ void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data,
fe->shader_read_dst_param(fe_data, &pToken, &dst, &rel_addr); fe->shader_read_dst_param(fe_data, &pToken, &dst, &rel_addr);
TRACE("defi i%u = %d, %d, %d, %d", dst.register_idx, TRACE("defi i%u = %d, %d, %d, %d", dst.reg.idx,
*(pToken), *(pToken),
*(pToken + 1), *(pToken + 1),
*(pToken + 2), *(pToken + 2),
@ -1083,7 +1083,7 @@ void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data,
fe->shader_read_dst_param(fe_data, &pToken, &dst, &rel_addr); fe->shader_read_dst_param(fe_data, &pToken, &dst, &rel_addr);
TRACE("defb b%u = %s", dst.register_idx, *pToken ? "true" : "false"); TRACE("defb b%u = %s", dst.reg.idx, *pToken ? "true" : "false");
++pToken; ++pToken;
} }
else else

View File

@ -1238,7 +1238,7 @@ static DWORD shader_glsl_get_write_mask(const struct wined3d_shader_dst_param *p
{ {
DWORD mask = param->write_mask; DWORD mask = param->write_mask;
if (shader_is_scalar(param->register_type, param->register_idx)) if (shader_is_scalar(param->reg.type, param->reg.idx))
{ {
mask = WINED3DSP_WRITEMASK_0; mask = WINED3DSP_WRITEMASK_0;
*write_mask = '\0'; *write_mask = '\0';
@ -1281,7 +1281,7 @@ static void shader_glsl_swizzle_to_str(const DWORD swizzle, BOOL fixup, DWORD ma
static void shader_glsl_get_swizzle(const struct wined3d_shader_src_param *param, static void shader_glsl_get_swizzle(const struct wined3d_shader_src_param *param,
BOOL fixup, DWORD mask, char *swizzle_str) BOOL fixup, DWORD mask, char *swizzle_str)
{ {
if (shader_is_scalar(param->register_type, param->register_idx)) if (shader_is_scalar(param->reg.type, param->reg.idx))
*swizzle_str = '\0'; *swizzle_str = '\0';
else else
shader_glsl_swizzle_to_str(param->swizzle, fixup, mask, swizzle_str); shader_glsl_swizzle_to_str(param->swizzle, fixup, mask, swizzle_str);
@ -1300,8 +1300,8 @@ static void shader_glsl_add_src_param(const struct wined3d_shader_instruction *i
glsl_src->param_str[0] = '\0'; glsl_src->param_str[0] = '\0';
swizzle_str[0] = '\0'; swizzle_str[0] = '\0';
shader_glsl_get_register_name(wined3d_src->register_type, wined3d_src->register_idx, shader_glsl_get_register_name(wined3d_src->reg.type, wined3d_src->reg.idx,
wined3d_src->rel_addr, glsl_src->reg_name, &is_color, ins); wined3d_src->reg.rel_addr, glsl_src->reg_name, &is_color, ins);
shader_glsl_get_swizzle(wined3d_src, is_color, mask, swizzle_str); shader_glsl_get_swizzle(wined3d_src, is_color, mask, swizzle_str);
shader_glsl_gen_modifier(wined3d_src->modifiers, glsl_src->reg_name, swizzle_str, glsl_src->param_str); shader_glsl_gen_modifier(wined3d_src->modifiers, glsl_src->reg_name, swizzle_str, glsl_src->param_str);
@ -1318,8 +1318,8 @@ static DWORD shader_glsl_add_dst_param(const struct wined3d_shader_instruction *
glsl_dst->mask_str[0] = '\0'; glsl_dst->mask_str[0] = '\0';
glsl_dst->reg_name[0] = '\0'; glsl_dst->reg_name[0] = '\0';
shader_glsl_get_register_name(wined3d_dst->register_type, wined3d_dst->register_idx, shader_glsl_get_register_name(wined3d_dst->reg.type, wined3d_dst->reg.idx,
wined3d_dst->rel_addr, glsl_dst->reg_name, &is_color, ins); wined3d_dst->reg.rel_addr, glsl_dst->reg_name, &is_color, ins);
return shader_glsl_get_write_mask(wined3d_dst, glsl_dst->mask_str); return shader_glsl_get_write_mask(wined3d_dst, glsl_dst->mask_str);
} }
@ -1667,7 +1667,7 @@ static void shader_glsl_mov(const struct wined3d_shader_instruction *ins)
* shader versions WINED3DSIO_MOVA is used for this. */ * shader versions WINED3DSIO_MOVA is used for this. */
if (ins->ctx->reg_maps->shader_version.major == 1 if (ins->ctx->reg_maps->shader_version.major == 1
&& !shader_is_pshader_version(ins->ctx->reg_maps->shader_version.type) && !shader_is_pshader_version(ins->ctx->reg_maps->shader_version.type)
&& ins->dst[0].register_type == WINED3DSPR_ADDR) && ins->dst[0].reg.type == WINED3DSPR_ADDR)
{ {
/* This is a simple floor() */ /* This is a simple floor() */
unsigned int mask_size = shader_glsl_get_write_mask_size(write_mask); unsigned int mask_size = shader_glsl_get_write_mask_size(write_mask);
@ -1969,7 +1969,7 @@ static void shader_glsl_cmp(const struct wined3d_shader_instruction *ins)
char mask_char[6]; char mask_char[6];
BOOL temp_destination = FALSE; BOOL temp_destination = FALSE;
if (shader_is_scalar(ins->src[0].register_type, ins->src[0].register_idx)) if (shader_is_scalar(ins->src[0].reg.type, ins->src[0].reg.idx))
{ {
write_mask = shader_glsl_append_dst(ins->ctx->buffer, ins); write_mask = shader_glsl_append_dst(ins->ctx->buffer, ins);
@ -2000,12 +2000,12 @@ static void shader_glsl_cmp(const struct wined3d_shader_instruction *ins)
* The first lines may overwrite source parameters of the following lines. * The first lines may overwrite source parameters of the following lines.
* Deal with that by using a temporary destination register if needed * Deal with that by using a temporary destination register if needed
*/ */
if ((ins->src[0].register_idx == ins->dst[0].register_idx if ((ins->src[0].reg.idx == ins->dst[0].reg.idx
&& ins->src[0].register_type == ins->dst[0].register_type) && ins->src[0].reg.type == ins->dst[0].reg.type)
|| (ins->src[1].register_idx == ins->dst[0].register_idx || (ins->src[1].reg.idx == ins->dst[0].reg.idx
&& ins->src[1].register_type == ins->dst[0].register_type) && ins->src[1].reg.type == ins->dst[0].reg.type)
|| (ins->src[2].register_idx == ins->dst[0].register_idx || (ins->src[2].reg.idx == ins->dst[0].reg.idx
&& ins->src[2].register_type == ins->dst[0].register_type)) && ins->src[2].reg.type == ins->dst[0].reg.type))
{ {
write_mask = shader_glsl_get_write_mask(&dst, mask_char); write_mask = shader_glsl_get_write_mask(&dst, mask_char);
if (!write_mask) continue; if (!write_mask) continue;
@ -2114,8 +2114,8 @@ static void shader_glsl_mnxn(const struct wined3d_shader_instruction *ins)
{ {
int i; int i;
int nComponents = 0; int nComponents = 0;
struct wined3d_shader_dst_param tmp_dst = {0}; struct wined3d_shader_dst_param tmp_dst = {{0}};
struct wined3d_shader_src_param tmp_src[2] = {{0}}; struct wined3d_shader_src_param tmp_src[2] = {{{0}}};
struct wined3d_shader_instruction tmp_ins; struct wined3d_shader_instruction tmp_ins;
memset(&tmp_ins, 0, sizeof(tmp_ins)); memset(&tmp_ins, 0, sizeof(tmp_ins));
@ -2160,7 +2160,7 @@ static void shader_glsl_mnxn(const struct wined3d_shader_instruction *ins)
{ {
tmp_dst.write_mask = WINED3DSP_WRITEMASK_0 << i; tmp_dst.write_mask = WINED3DSP_WRITEMASK_0 << i;
shader_glsl_dot(&tmp_ins); shader_glsl_dot(&tmp_ins);
++tmp_src[1].register_idx; ++tmp_src[1].reg.idx;
} }
} }
@ -2315,10 +2315,10 @@ static void shader_glsl_loop(const struct wined3d_shader_instruction *ins)
* known at compile time, the GLSL compiler can unroll the loop, and replace indirect addressing with direct * known at compile time, the GLSL compiler can unroll the loop, and replace indirect addressing with direct
* addressing. * addressing.
*/ */
if (ins->src[1].register_type == WINED3DSPR_CONSTINT) if (ins->src[1].reg.type == WINED3DSPR_CONSTINT)
{ {
LIST_FOR_EACH_ENTRY(constant, &shader->baseShader.constantsI, local_constant, entry) { LIST_FOR_EACH_ENTRY(constant, &shader->baseShader.constantsI, local_constant, entry) {
if (constant->idx == ins->src[1].register_idx) if (constant->idx == ins->src[1].reg.idx)
{ {
control_values = constant->value; control_values = constant->value;
break; break;
@ -2381,9 +2381,12 @@ static void shader_glsl_rep(const struct wined3d_shader_instruction *ins)
const local_constant *constant; const local_constant *constant;
/* Try to hardcode local values to help the GLSL compiler to unroll and optimize the loop */ /* Try to hardcode local values to help the GLSL compiler to unroll and optimize the loop */
if(ins->src[0].register_type == WINED3DSPR_CONSTINT) { if (ins->src[0].reg.type == WINED3DSPR_CONSTINT)
LIST_FOR_EACH_ENTRY(constant, &shader->baseShader.constantsI, local_constant, entry) { {
if(constant->idx == ins->src[0].register_idx) { LIST_FOR_EACH_ENTRY(constant, &shader->baseShader.constantsI, local_constant, entry)
{
if (constant->idx == ins->src[0].reg.idx)
{
control_values = constant->value; control_values = constant->value;
break; break;
} }
@ -2449,12 +2452,12 @@ static void shader_glsl_breakc(const struct wined3d_shader_instruction *ins)
static void shader_glsl_label(const struct wined3d_shader_instruction *ins) static void shader_glsl_label(const struct wined3d_shader_instruction *ins)
{ {
shader_addline(ins->ctx->buffer, "}\n"); shader_addline(ins->ctx->buffer, "}\n");
shader_addline(ins->ctx->buffer, "void subroutine%u () {\n", ins->src[0].register_idx); shader_addline(ins->ctx->buffer, "void subroutine%u () {\n", ins->src[0].reg.idx);
} }
static void shader_glsl_call(const struct wined3d_shader_instruction *ins) static void shader_glsl_call(const struct wined3d_shader_instruction *ins)
{ {
shader_addline(ins->ctx->buffer, "subroutine%u();\n", ins->src[0].register_idx); shader_addline(ins->ctx->buffer, "subroutine%u();\n", ins->src[0].reg.idx);
} }
static void shader_glsl_callnz(const struct wined3d_shader_instruction *ins) static void shader_glsl_callnz(const struct wined3d_shader_instruction *ins)
@ -2462,7 +2465,7 @@ static void shader_glsl_callnz(const struct wined3d_shader_instruction *ins)
glsl_src_param_t src1_param; glsl_src_param_t src1_param;
shader_glsl_add_src_param(ins, &ins->src[1], WINED3DSP_WRITEMASK_0, &src1_param); shader_glsl_add_src_param(ins, &ins->src[1], WINED3DSP_WRITEMASK_0, &src1_param);
shader_addline(ins->ctx->buffer, "if (%s) subroutine%u();\n", src1_param.param_str, ins->src[0].register_idx); shader_addline(ins->ctx->buffer, "if (%s) subroutine%u();\n", src1_param.param_str, ins->src[0].reg.idx);
} }
/********************************************* /*********************************************
@ -2482,8 +2485,8 @@ static void pshader_glsl_tex(const struct wined3d_shader_instruction *ins)
/* 1.0-1.4: Use destination register as sampler source. /* 1.0-1.4: Use destination register as sampler source.
* 2.0+: Use provided sampler source. */ * 2.0+: Use provided sampler source. */
if (shader_version < WINED3D_SHADER_VERSION(2,0)) sampler_idx = ins->dst[0].register_idx; if (shader_version < WINED3D_SHADER_VERSION(2,0)) sampler_idx = ins->dst[0].reg.idx;
else sampler_idx = ins->src[1].register_idx; else sampler_idx = ins->src[1].reg.idx;
sampler_type = ins->ctx->reg_maps->sampler_type[sampler_idx]; sampler_type = ins->ctx->reg_maps->sampler_type[sampler_idx];
if (shader_version < WINED3D_SHADER_VERSION(1,4)) if (shader_version < WINED3D_SHADER_VERSION(1,4))
@ -2574,7 +2577,7 @@ static void shader_glsl_texldd(const struct wined3d_shader_instruction *ins)
return pshader_glsl_tex(ins); return pshader_glsl_tex(ins);
} }
sampler_idx = ins->src[1].register_idx; sampler_idx = ins->src[1].reg.idx;
sampler_type = ins->ctx->reg_maps->sampler_type[sampler_idx]; sampler_type = ins->ctx->reg_maps->sampler_type[sampler_idx];
if(deviceImpl->stateBlock->textures[sampler_idx] && if(deviceImpl->stateBlock->textures[sampler_idx] &&
IWineD3DBaseTexture_GetTextureDimensions(deviceImpl->stateBlock->textures[sampler_idx]) == GL_TEXTURE_RECTANGLE_ARB) { IWineD3DBaseTexture_GetTextureDimensions(deviceImpl->stateBlock->textures[sampler_idx]) == GL_TEXTURE_RECTANGLE_ARB) {
@ -2601,7 +2604,7 @@ static void shader_glsl_texldl(const struct wined3d_shader_instruction *ins)
DWORD sampler_idx; DWORD sampler_idx;
DWORD swizzle = ins->src[1].swizzle; DWORD swizzle = ins->src[1].swizzle;
sampler_idx = ins->src[1].register_idx; sampler_idx = ins->src[1].reg.idx;
sampler_type = ins->ctx->reg_maps->sampler_type[sampler_idx]; sampler_type = ins->ctx->reg_maps->sampler_type[sampler_idx];
if(deviceImpl->stateBlock->textures[sampler_idx] && if(deviceImpl->stateBlock->textures[sampler_idx] &&
IWineD3DBaseTexture_GetTextureDimensions(deviceImpl->stateBlock->textures[sampler_idx]) == GL_TEXTURE_RECTANGLE_ARB) { IWineD3DBaseTexture_GetTextureDimensions(deviceImpl->stateBlock->textures[sampler_idx]) == GL_TEXTURE_RECTANGLE_ARB) {
@ -2634,9 +2637,9 @@ static void pshader_glsl_texcoord(const struct wined3d_shader_instruction *ins)
shader_glsl_get_write_mask(&ins->dst[0], dst_mask); shader_glsl_get_write_mask(&ins->dst[0], dst_mask);
shader_addline(buffer, "clamp(gl_TexCoord[%u], 0.0, 1.0)%s);\n", shader_addline(buffer, "clamp(gl_TexCoord[%u], 0.0, 1.0)%s);\n",
ins->dst[0].register_idx, dst_mask); ins->dst[0].reg.idx, dst_mask);
} else { } else {
DWORD reg = ins->src[0].register_idx; DWORD reg = ins->src[0].reg.idx;
DWORD src_mod = ins->src[0].modifiers; DWORD src_mod = ins->src[0].modifiers;
char dst_swizzle[6]; char dst_swizzle[6];
@ -2675,7 +2678,7 @@ static void pshader_glsl_texdp3tex(const struct wined3d_shader_instruction *ins)
{ {
glsl_src_param_t src0_param; glsl_src_param_t src0_param;
glsl_sample_function_t sample_function; glsl_sample_function_t sample_function;
DWORD sampler_idx = ins->dst[0].register_idx; DWORD sampler_idx = ins->dst[0].reg.idx;
DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2;
WINED3DSAMPLER_TEXTURE_TYPE sampler_type = ins->ctx->reg_maps->sampler_type[sampler_idx]; WINED3DSAMPLER_TEXTURE_TYPE sampler_type = ins->ctx->reg_maps->sampler_type[sampler_idx];
UINT mask_size; UINT mask_size;
@ -2718,7 +2721,7 @@ static void pshader_glsl_texdp3tex(const struct wined3d_shader_instruction *ins)
static void pshader_glsl_texdp3(const struct wined3d_shader_instruction *ins) static void pshader_glsl_texdp3(const struct wined3d_shader_instruction *ins)
{ {
glsl_src_param_t src0_param; glsl_src_param_t src0_param;
DWORD dstreg = ins->dst[0].register_idx; DWORD dstreg = ins->dst[0].reg.idx;
DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2;
DWORD dst_mask; DWORD dst_mask;
unsigned int mask_size; unsigned int mask_size;
@ -2760,7 +2763,7 @@ static void pshader_glsl_texdepth(const struct wined3d_shader_instruction *ins)
static void pshader_glsl_texm3x2depth(const struct wined3d_shader_instruction *ins) static void pshader_glsl_texm3x2depth(const struct wined3d_shader_instruction *ins)
{ {
DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2;
DWORD dstreg = ins->dst[0].register_idx; DWORD dstreg = ins->dst[0].reg.idx;
glsl_src_param_t src0_param; glsl_src_param_t src0_param;
shader_glsl_add_src_param(ins, &ins->src[0], src_mask, &src0_param); shader_glsl_add_src_param(ins, &ins->src[0], src_mask, &src0_param);
@ -2774,7 +2777,7 @@ static void pshader_glsl_texm3x2depth(const struct wined3d_shader_instruction *i
static void pshader_glsl_texm3x2pad(const struct wined3d_shader_instruction *ins) static void pshader_glsl_texm3x2pad(const struct wined3d_shader_instruction *ins)
{ {
DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2;
DWORD reg = ins->dst[0].register_idx; DWORD reg = ins->dst[0].reg.idx;
SHADER_BUFFER *buffer = ins->ctx->buffer; SHADER_BUFFER *buffer = ins->ctx->buffer;
glsl_src_param_t src0_param; glsl_src_param_t src0_param;
@ -2788,7 +2791,7 @@ static void pshader_glsl_texm3x3pad(const struct wined3d_shader_instruction *ins
{ {
IWineD3DPixelShaderImpl *shader = (IWineD3DPixelShaderImpl *)ins->ctx->shader; IWineD3DPixelShaderImpl *shader = (IWineD3DPixelShaderImpl *)ins->ctx->shader;
DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2;
DWORD reg = ins->dst[0].register_idx; DWORD reg = ins->dst[0].reg.idx;
SHADER_BUFFER *buffer = ins->ctx->buffer; SHADER_BUFFER *buffer = ins->ctx->buffer;
SHADER_PARSE_STATE* current_state = &shader->baseShader.parse_state; SHADER_PARSE_STATE* current_state = &shader->baseShader.parse_state;
glsl_src_param_t src0_param; glsl_src_param_t src0_param;
@ -2801,7 +2804,7 @@ static void pshader_glsl_texm3x3pad(const struct wined3d_shader_instruction *ins
static void pshader_glsl_texm3x2tex(const struct wined3d_shader_instruction *ins) static void pshader_glsl_texm3x2tex(const struct wined3d_shader_instruction *ins)
{ {
DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2;
DWORD reg = ins->dst[0].register_idx; DWORD reg = ins->dst[0].reg.idx;
SHADER_BUFFER *buffer = ins->ctx->buffer; SHADER_BUFFER *buffer = ins->ctx->buffer;
glsl_src_param_t src0_param; glsl_src_param_t src0_param;
WINED3DSAMPLER_TEXTURE_TYPE sampler_type = ins->ctx->reg_maps->sampler_type[reg]; WINED3DSAMPLER_TEXTURE_TYPE sampler_type = ins->ctx->reg_maps->sampler_type[reg];
@ -2822,7 +2825,7 @@ static void pshader_glsl_texm3x3tex(const struct wined3d_shader_instruction *ins
{ {
DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2;
glsl_src_param_t src0_param; glsl_src_param_t src0_param;
DWORD reg = ins->dst[0].register_idx; DWORD reg = ins->dst[0].reg.idx;
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)ins->ctx->shader; IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)ins->ctx->shader;
SHADER_PARSE_STATE* current_state = &This->baseShader.parse_state; SHADER_PARSE_STATE* current_state = &This->baseShader.parse_state;
WINED3DSAMPLER_TEXTURE_TYPE sampler_type = ins->ctx->reg_maps->sampler_type[reg]; WINED3DSAMPLER_TEXTURE_TYPE sampler_type = ins->ctx->reg_maps->sampler_type[reg];
@ -2847,7 +2850,7 @@ static void pshader_glsl_texm3x3(const struct wined3d_shader_instruction *ins)
DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2;
glsl_src_param_t src0_param; glsl_src_param_t src0_param;
char dst_mask[6]; char dst_mask[6];
DWORD reg = ins->dst[0].register_idx; DWORD reg = ins->dst[0].reg.idx;
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)ins->ctx->shader; IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)ins->ctx->shader;
SHADER_PARSE_STATE* current_state = &This->baseShader.parse_state; SHADER_PARSE_STATE* current_state = &This->baseShader.parse_state;
@ -2865,7 +2868,7 @@ static void pshader_glsl_texm3x3(const struct wined3d_shader_instruction *ins)
static void pshader_glsl_texm3x3spec(const struct wined3d_shader_instruction *ins) static void pshader_glsl_texm3x3spec(const struct wined3d_shader_instruction *ins)
{ {
IWineD3DPixelShaderImpl *shader = (IWineD3DPixelShaderImpl *)ins->ctx->shader; IWineD3DPixelShaderImpl *shader = (IWineD3DPixelShaderImpl *)ins->ctx->shader;
DWORD reg = ins->dst[0].register_idx; DWORD reg = ins->dst[0].reg.idx;
glsl_src_param_t src0_param; glsl_src_param_t src0_param;
glsl_src_param_t src1_param; glsl_src_param_t src1_param;
SHADER_BUFFER *buffer = ins->ctx->buffer; SHADER_BUFFER *buffer = ins->ctx->buffer;
@ -2896,7 +2899,7 @@ static void pshader_glsl_texm3x3spec(const struct wined3d_shader_instruction *in
static void pshader_glsl_texm3x3vspec(const struct wined3d_shader_instruction *ins) static void pshader_glsl_texm3x3vspec(const struct wined3d_shader_instruction *ins)
{ {
IWineD3DPixelShaderImpl *shader = (IWineD3DPixelShaderImpl *)ins->ctx->shader; IWineD3DPixelShaderImpl *shader = (IWineD3DPixelShaderImpl *)ins->ctx->shader;
DWORD reg = ins->dst[0].register_idx; DWORD reg = ins->dst[0].reg.idx;
SHADER_BUFFER *buffer = ins->ctx->buffer; SHADER_BUFFER *buffer = ins->ctx->buffer;
SHADER_PARSE_STATE* current_state = &shader->baseShader.parse_state; SHADER_PARSE_STATE* current_state = &shader->baseShader.parse_state;
glsl_src_param_t src0_param; glsl_src_param_t src0_param;
@ -2939,7 +2942,7 @@ static void pshader_glsl_texbem(const struct wined3d_shader_instruction *ins)
DWORD flags; DWORD flags;
char coord_mask[6]; char coord_mask[6];
sampler_idx = ins->dst[0].register_idx; sampler_idx = ins->dst[0].reg.idx;
flags = deviceImpl->stateBlock->textureState[sampler_idx][WINED3DTSS_TEXTURETRANSFORMFLAGS]; flags = deviceImpl->stateBlock->textureState[sampler_idx][WINED3DTSS_TEXTURETRANSFORMFLAGS];
sampler_type = ins->ctx->reg_maps->sampler_type[sampler_idx]; sampler_type = ins->ctx->reg_maps->sampler_type[sampler_idx];
@ -2989,7 +2992,7 @@ static void pshader_glsl_texbem(const struct wined3d_shader_instruction *ins)
static void pshader_glsl_bem(const struct wined3d_shader_instruction *ins) static void pshader_glsl_bem(const struct wined3d_shader_instruction *ins)
{ {
glsl_src_param_t src0_param, src1_param; glsl_src_param_t src0_param, src1_param;
DWORD sampler_idx = ins->dst[0].register_idx; DWORD sampler_idx = ins->dst[0].reg.idx;
shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1, &src0_param); shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1, &src0_param);
shader_glsl_add_src_param(ins, &ins->src[1], WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1, &src1_param); shader_glsl_add_src_param(ins, &ins->src[1], WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1, &src1_param);
@ -3004,7 +3007,7 @@ static void pshader_glsl_bem(const struct wined3d_shader_instruction *ins)
static void pshader_glsl_texreg2ar(const struct wined3d_shader_instruction *ins) static void pshader_glsl_texreg2ar(const struct wined3d_shader_instruction *ins)
{ {
glsl_src_param_t src0_param; glsl_src_param_t src0_param;
DWORD sampler_idx = ins->dst[0].register_idx; DWORD sampler_idx = ins->dst[0].reg.idx;
WINED3DSAMPLER_TEXTURE_TYPE sampler_type = ins->ctx->reg_maps->sampler_type[sampler_idx]; WINED3DSAMPLER_TEXTURE_TYPE sampler_type = ins->ctx->reg_maps->sampler_type[sampler_idx];
glsl_sample_function_t sample_function; glsl_sample_function_t sample_function;
@ -3020,7 +3023,7 @@ static void pshader_glsl_texreg2ar(const struct wined3d_shader_instruction *ins)
static void pshader_glsl_texreg2gb(const struct wined3d_shader_instruction *ins) static void pshader_glsl_texreg2gb(const struct wined3d_shader_instruction *ins)
{ {
glsl_src_param_t src0_param; glsl_src_param_t src0_param;
DWORD sampler_idx = ins->dst[0].register_idx; DWORD sampler_idx = ins->dst[0].reg.idx;
WINED3DSAMPLER_TEXTURE_TYPE sampler_type = ins->ctx->reg_maps->sampler_type[sampler_idx]; WINED3DSAMPLER_TEXTURE_TYPE sampler_type = ins->ctx->reg_maps->sampler_type[sampler_idx];
glsl_sample_function_t sample_function; glsl_sample_function_t sample_function;
@ -3036,7 +3039,7 @@ static void pshader_glsl_texreg2gb(const struct wined3d_shader_instruction *ins)
static void pshader_glsl_texreg2rgb(const struct wined3d_shader_instruction *ins) static void pshader_glsl_texreg2rgb(const struct wined3d_shader_instruction *ins)
{ {
glsl_src_param_t src0_param; glsl_src_param_t src0_param;
DWORD sampler_idx = ins->dst[0].register_idx; DWORD sampler_idx = ins->dst[0].reg.idx;
WINED3DSAMPLER_TEXTURE_TYPE sampler_type = ins->ctx->reg_maps->sampler_type[sampler_idx]; WINED3DSAMPLER_TEXTURE_TYPE sampler_type = ins->ctx->reg_maps->sampler_type[sampler_idx];
glsl_sample_function_t sample_function; glsl_sample_function_t sample_function;

View File

@ -346,24 +346,24 @@ static int shader_skip_opcode(const struct wined3d_sm1_data *priv,
static void shader_parse_src_param(DWORD param, const struct wined3d_shader_src_param *rel_addr, static void shader_parse_src_param(DWORD param, const struct wined3d_shader_src_param *rel_addr,
struct wined3d_shader_src_param *src) struct wined3d_shader_src_param *src)
{ {
src->register_type = ((param & WINED3DSP_REGTYPE_MASK) >> WINED3DSP_REGTYPE_SHIFT) src->reg.type = ((param & WINED3DSP_REGTYPE_MASK) >> WINED3DSP_REGTYPE_SHIFT)
| ((param & WINED3DSP_REGTYPE_MASK2) >> WINED3DSP_REGTYPE_SHIFT2); | ((param & WINED3DSP_REGTYPE_MASK2) >> WINED3DSP_REGTYPE_SHIFT2);
src->register_idx = param & WINED3DSP_REGNUM_MASK; src->reg.idx = param & WINED3DSP_REGNUM_MASK;
src->swizzle = (param & WINED3DSP_SWIZZLE_MASK) >> WINED3DSP_SWIZZLE_SHIFT; src->swizzle = (param & WINED3DSP_SWIZZLE_MASK) >> WINED3DSP_SWIZZLE_SHIFT;
src->modifiers = (param & WINED3DSP_SRCMOD_MASK) >> WINED3DSP_SRCMOD_SHIFT; src->modifiers = (param & WINED3DSP_SRCMOD_MASK) >> WINED3DSP_SRCMOD_SHIFT;
src->rel_addr = rel_addr; src->reg.rel_addr = rel_addr;
} }
static void shader_parse_dst_param(DWORD param, const struct wined3d_shader_src_param *rel_addr, static void shader_parse_dst_param(DWORD param, const struct wined3d_shader_src_param *rel_addr,
struct wined3d_shader_dst_param *dst) struct wined3d_shader_dst_param *dst)
{ {
dst->register_type = ((param & WINED3DSP_REGTYPE_MASK) >> WINED3DSP_REGTYPE_SHIFT) dst->reg.type = ((param & WINED3DSP_REGTYPE_MASK) >> WINED3DSP_REGTYPE_SHIFT)
| ((param & WINED3DSP_REGTYPE_MASK2) >> WINED3DSP_REGTYPE_SHIFT2); | ((param & WINED3DSP_REGTYPE_MASK2) >> WINED3DSP_REGTYPE_SHIFT2);
dst->register_idx = param & WINED3DSP_REGNUM_MASK; dst->reg.idx = param & WINED3DSP_REGNUM_MASK;
dst->write_mask = (param & WINED3D_SM1_WRITEMASK_MASK) >> WINED3D_SM1_WRITEMASK_SHIFT; dst->write_mask = (param & WINED3D_SM1_WRITEMASK_MASK) >> WINED3D_SM1_WRITEMASK_SHIFT;
dst->modifiers = (param & WINED3DSP_DSTMOD_MASK) >> WINED3DSP_DSTMOD_SHIFT; dst->modifiers = (param & WINED3DSP_DSTMOD_MASK) >> WINED3DSP_DSTMOD_SHIFT;
dst->shift = (param & WINED3DSP_DSTSHIFT_MASK) >> WINED3DSP_DSTSHIFT_SHIFT; dst->shift = (param & WINED3DSP_DSTSHIFT_MASK) >> WINED3DSP_DSTSHIFT_SHIFT;
dst->rel_addr = rel_addr; dst->reg.rel_addr = rel_addr;
} }
/* Read the parameters of an unrecognized opcode from the input stream /* Read the parameters of an unrecognized opcode from the input stream

View File

@ -200,11 +200,11 @@ static void shader_sm4_read_src_param(void *data, const DWORD **ptr, struct wine
if (register_type >= sizeof(register_type_table) / sizeof(*register_type_table)) if (register_type >= sizeof(register_type_table) / sizeof(*register_type_table))
{ {
FIXME("Unhandled register type %#x\n", register_type); FIXME("Unhandled register type %#x\n", register_type);
src_param->register_type = WINED3DSPR_TEMP; src_param->reg.type = WINED3DSPR_TEMP;
} }
else else
{ {
src_param->register_type = register_type_table[register_type]; src_param->reg.type = register_type_table[register_type];
} }
if (register_type == WINED3D_SM4_RT_IMMCONST) if (register_type == WINED3D_SM4_RT_IMMCONST)
@ -216,14 +216,14 @@ static void shader_sm4_read_src_param(void *data, const DWORD **ptr, struct wine
switch(immconst_type) switch(immconst_type)
{ {
case WINED3D_SM4_IMMCONST_FLOAT: case WINED3D_SM4_IMMCONST_FLOAT:
src_param->immconst_type = WINED3D_IMMCONST_FLOAT; src_param->reg.immconst_type = WINED3D_IMMCONST_FLOAT;
memcpy(src_param->immconst_data, *ptr, 1 * sizeof(DWORD)); memcpy(src_param->reg.immconst_data, *ptr, 1 * sizeof(DWORD));
*ptr += 1; *ptr += 1;
break; break;
case WINED3D_SM4_IMMCONST_FLOAT4: case WINED3D_SM4_IMMCONST_FLOAT4:
src_param->immconst_type = WINED3D_IMMCONST_FLOAT4; src_param->reg.immconst_type = WINED3D_IMMCONST_FLOAT4;
memcpy(src_param->immconst_data, *ptr, 4 * sizeof(DWORD)); memcpy(src_param->reg.immconst_data, *ptr, 4 * sizeof(DWORD));
*ptr += 4; *ptr += 4;
break; break;
@ -234,12 +234,12 @@ static void shader_sm4_read_src_param(void *data, const DWORD **ptr, struct wine
} }
else else
{ {
src_param->register_idx = *(*ptr)++; src_param->reg.idx = *(*ptr)++;
src_param->swizzle = (token & WINED3D_SM4_SWIZZLE_MASK) >> WINED3D_SM4_SWIZZLE_SHIFT; src_param->swizzle = (token & WINED3D_SM4_SWIZZLE_MASK) >> WINED3D_SM4_SWIZZLE_SHIFT;
} }
src_param->modifiers = 0; src_param->modifiers = 0;
src_param->rel_addr = NULL; src_param->reg.rel_addr = NULL;
} }
static void shader_sm4_read_dst_param(void *data, const DWORD **ptr, struct wined3d_shader_dst_param *dst_param, static void shader_sm4_read_dst_param(void *data, const DWORD **ptr, struct wined3d_shader_dst_param *dst_param,
@ -253,18 +253,18 @@ static void shader_sm4_read_dst_param(void *data, const DWORD **ptr, struct wine
if (register_type >= sizeof(register_type_table) / sizeof(*register_type_table)) if (register_type >= sizeof(register_type_table) / sizeof(*register_type_table))
{ {
FIXME("Unhandled register type %#x\n", register_type); FIXME("Unhandled register type %#x\n", register_type);
dst_param->register_type = WINED3DSPR_TEMP; dst_param->reg.type = WINED3DSPR_TEMP;
} }
else else
{ {
dst_param->register_type = register_type_table[register_type]; dst_param->reg.type = register_type_table[register_type];
} }
dst_param->register_idx = register_idx; dst_param->reg.idx = register_idx;
dst_param->write_mask = (token & WINED3D_SM4_WRITEMASK_MASK) >> WINED3D_SM4_WRITEMASK_SHIFT; dst_param->write_mask = (token & WINED3D_SM4_WRITEMASK_MASK) >> WINED3D_SM4_WRITEMASK_SHIFT;
dst_param->modifiers = 0; dst_param->modifiers = 0;
dst_param->shift = 0; dst_param->shift = 0;
dst_param->rel_addr = NULL; dst_param->reg.rel_addr = NULL;
} }
static void shader_sm4_read_semantic(const DWORD **ptr, struct wined3d_shader_semantic *semantic) static void shader_sm4_read_semantic(const DWORD **ptr, struct wined3d_shader_semantic *semantic)

View File

@ -113,12 +113,12 @@ static void vshader_set_input(
This->semantics_in[regnum].usage = usage; This->semantics_in[regnum].usage = usage;
This->semantics_in[regnum].usage_idx = usage_idx; This->semantics_in[regnum].usage_idx = usage_idx;
This->semantics_in[regnum].reg.register_type = WINED3DSPR_INPUT; This->semantics_in[regnum].reg.reg.type = WINED3DSPR_INPUT;
This->semantics_in[regnum].reg.register_idx = regnum; This->semantics_in[regnum].reg.reg.idx = regnum;
This->semantics_in[regnum].reg.write_mask = WINED3DSP_WRITEMASK_ALL; This->semantics_in[regnum].reg.write_mask = WINED3DSP_WRITEMASK_ALL;
This->semantics_in[regnum].reg.modifiers = 0; This->semantics_in[regnum].reg.modifiers = 0;
This->semantics_in[regnum].reg.shift = 0; This->semantics_in[regnum].reg.shift = 0;
This->semantics_in[regnum].reg.rel_addr = NULL; This->semantics_in[regnum].reg.reg.rel_addr = NULL;
} }
static BOOL match_usage(BYTE usage1, BYTE usage_idx1, BYTE usage2, BYTE usage_idx2) { static BOOL match_usage(BYTE usage1, BYTE usage_idx1, BYTE usage2, BYTE usage_idx2) {

View File

@ -649,25 +649,28 @@ struct wined3d_shader_context
SHADER_BUFFER *buffer; SHADER_BUFFER *buffer;
}; };
struct wined3d_shader_register
{
WINED3DSHADER_PARAM_REGISTER_TYPE type;
UINT idx;
const struct wined3d_shader_src_param *rel_addr;
enum wined3d_immconst_type immconst_type;
DWORD immconst_data[4];
};
struct wined3d_shader_dst_param struct wined3d_shader_dst_param
{ {
WINED3DSHADER_PARAM_REGISTER_TYPE register_type; struct wined3d_shader_register reg;
UINT register_idx;
DWORD write_mask; DWORD write_mask;
DWORD modifiers; DWORD modifiers;
DWORD shift; DWORD shift;
const struct wined3d_shader_src_param *rel_addr;
}; };
struct wined3d_shader_src_param struct wined3d_shader_src_param
{ {
WINED3DSHADER_PARAM_REGISTER_TYPE register_type; struct wined3d_shader_register reg;
UINT register_idx;
DWORD swizzle; DWORD swizzle;
DWORD modifiers; DWORD modifiers;
const struct wined3d_shader_src_param *rel_addr;
enum wined3d_immconst_type immconst_type;
DWORD immconst_data[4];
}; };
struct wined3d_shader_instruction struct wined3d_shader_instruction