wined3d: Store the register index in struct wined3d_shader_src_param.
This commit is contained in:
parent
4de1dba2c5
commit
b6668b0296
|
@ -1154,7 +1154,7 @@ static void pshader_hw_tex(const struct wined3d_shader_instruction *ins)
|
||||||
if (shader_version < WINED3DPS_VERSION(2,0))
|
if (shader_version < WINED3DPS_VERSION(2,0))
|
||||||
reg_sampler_code = dst->register_idx;
|
reg_sampler_code = dst->register_idx;
|
||||||
else
|
else
|
||||||
reg_sampler_code = ins->src[1].token & WINED3DSP_REGNUM_MASK;
|
reg_sampler_code = ins->src[1].register_idx;
|
||||||
|
|
||||||
/* projection flag:
|
/* projection flag:
|
||||||
* 1.1, 1.2, 1.3: Use WINED3DTSS_TEXTURETRANSFORMFLAGS
|
* 1.1, 1.2, 1.3: Use WINED3DTSS_TEXTURETRANSFORMFLAGS
|
||||||
|
@ -1260,7 +1260,6 @@ static void pshader_hw_texbem(const struct wined3d_shader_instruction *ins)
|
||||||
BOOL is_color;
|
BOOL is_color;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
DWORD src = ins->src[0].token & WINED3DSP_REGNUM_MASK;
|
|
||||||
SHADER_BUFFER *buffer = ins->ctx->buffer;
|
SHADER_BUFFER *buffer = ins->ctx->buffer;
|
||||||
|
|
||||||
char reg_coord[40];
|
char reg_coord[40];
|
||||||
|
@ -1290,6 +1289,8 @@ static void pshader_hw_texbem(const struct wined3d_shader_instruction *ins)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(has_bumpmat) {
|
if(has_bumpmat) {
|
||||||
|
DWORD src = ins->src[0].register_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 */
|
||||||
|
|
||||||
shader_addline(buffer, "SWZ TMP2, bumpenvmat%d, x, z, 0, 0;\n", reg_dest_code);
|
shader_addline(buffer, "SWZ TMP2, bumpenvmat%d, x, z, 0, 0;\n", reg_dest_code);
|
||||||
|
@ -1433,7 +1434,7 @@ static void pshader_hw_texm3x3spec(const struct wined3d_shader_instruction *ins)
|
||||||
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].register_idx;
|
||||||
DWORD reg3 = ins->src[1].token & WINED3DSP_REGNUM_MASK;
|
DWORD reg3 = ins->src[1].register_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];
|
||||||
|
@ -1632,6 +1633,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].token;
|
++tmp_src[1].token;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,6 +228,7 @@ static void shader_parse_src_param(DWORD param, DWORD addr_param, struct wined3d
|
||||||
{
|
{
|
||||||
src->register_type = ((param & WINED3DSP_REGTYPE_MASK) >> WINED3DSP_REGTYPE_SHIFT)
|
src->register_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->token = param;
|
src->token = param;
|
||||||
src->addr_token = addr_param;
|
src->addr_token = addr_param;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1944,7 +1944,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].token & WINED3DSP_REGNUM_MASK))
|
if (shader_is_scalar(ins->src[0].register_type, ins->src[0].register_idx))
|
||||||
{
|
{
|
||||||
write_mask = shader_glsl_append_dst(ins->ctx->buffer, ins);
|
write_mask = shader_glsl_append_dst(ins->ctx->buffer, ins);
|
||||||
|
|
||||||
|
@ -1955,14 +1955,6 @@ static void shader_glsl_cmp(const struct wined3d_shader_instruction *ins)
|
||||||
shader_addline(ins->ctx->buffer, "%s >= 0.0 ? %s : %s);\n",
|
shader_addline(ins->ctx->buffer, "%s >= 0.0 ? %s : %s);\n",
|
||||||
src0_param.param_str, src1_param.param_str, src2_param.param_str);
|
src0_param.param_str, src1_param.param_str, src2_param.param_str);
|
||||||
} else {
|
} else {
|
||||||
DWORD src0reg = ins->src[0].token & WINED3DSP_REGNUM_MASK;
|
|
||||||
DWORD src1reg = ins->src[1].token & WINED3DSP_REGNUM_MASK;
|
|
||||||
DWORD src2reg = ins->src[2].token & WINED3DSP_REGNUM_MASK;
|
|
||||||
DWORD src0regtype = ins->src[0].register_type;
|
|
||||||
DWORD src1regtype = ins->src[1].register_type;
|
|
||||||
DWORD src2regtype = ins->src[2].register_type;
|
|
||||||
DWORD dstreg = ins->dst[0].register_idx;
|
|
||||||
DWORD dstregtype = ins->dst[0].register_type;
|
|
||||||
DWORD dst_mask = ins->dst[0].write_mask;
|
DWORD dst_mask = ins->dst[0].write_mask;
|
||||||
struct wined3d_shader_dst_param dst = ins->dst[0];
|
struct wined3d_shader_dst_param dst = ins->dst[0];
|
||||||
|
|
||||||
|
@ -1983,9 +1975,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 ((src0reg == dstreg && src0regtype == dstregtype)
|
if ((ins->src[0].register_idx == ins->dst[0].register_idx
|
||||||
|| (src1reg == dstreg && src1regtype == dstregtype)
|
&& ins->src[0].register_type == ins->dst[0].register_type)
|
||||||
|| (src2reg == dstreg && src2regtype == dstregtype))
|
|| (ins->src[1].register_idx == ins->dst[0].register_idx
|
||||||
|
&& ins->src[1].register_type == ins->dst[0].register_type)
|
||||||
|
|| (ins->src[2].register_idx == ins->dst[0].register_idx
|
||||||
|
&& ins->src[2].register_type == ins->dst[0].register_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;
|
||||||
|
@ -2138,6 +2133,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].token;
|
++tmp_src[1].token;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2283,7 +2279,6 @@ static void shader_glsl_loop(const struct wined3d_shader_instruction *ins)
|
||||||
{
|
{
|
||||||
glsl_src_param_t src1_param;
|
glsl_src_param_t src1_param;
|
||||||
IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)ins->ctx->shader;
|
IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)ins->ctx->shader;
|
||||||
DWORD reg = ins->src[1].token & WINED3DSP_REGNUM_MASK;
|
|
||||||
const DWORD *control_values = NULL;
|
const DWORD *control_values = NULL;
|
||||||
const local_constant *constant;
|
const local_constant *constant;
|
||||||
|
|
||||||
|
@ -2297,7 +2292,8 @@ static void shader_glsl_loop(const struct wined3d_shader_instruction *ins)
|
||||||
if (ins->src[1].register_type == WINED3DSPR_CONSTINT)
|
if (ins->src[1].register_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 == reg) {
|
if (constant->idx == ins->src[1].register_idx)
|
||||||
|
{
|
||||||
control_values = constant->value;
|
control_values = constant->value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2408,25 +2404,21 @@ 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)
|
||||||
{
|
{
|
||||||
|
|
||||||
DWORD snum = (ins->src[0].token) & WINED3DSP_REGNUM_MASK;
|
|
||||||
shader_addline(ins->ctx->buffer, "}\n");
|
shader_addline(ins->ctx->buffer, "}\n");
|
||||||
shader_addline(ins->ctx->buffer, "void subroutine%u () {\n", snum);
|
shader_addline(ins->ctx->buffer, "void subroutine%u () {\n", ins->src[0].register_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shader_glsl_call(const struct wined3d_shader_instruction *ins)
|
static void shader_glsl_call(const struct wined3d_shader_instruction *ins)
|
||||||
{
|
{
|
||||||
DWORD snum = (ins->src[0].token) & WINED3DSP_REGNUM_MASK;
|
shader_addline(ins->ctx->buffer, "subroutine%u();\n", ins->src[0].register_idx);
|
||||||
shader_addline(ins->ctx->buffer, "subroutine%u();\n", snum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shader_glsl_callnz(const struct wined3d_shader_instruction *ins)
|
static void shader_glsl_callnz(const struct wined3d_shader_instruction *ins)
|
||||||
{
|
{
|
||||||
glsl_src_param_t src1_param;
|
glsl_src_param_t src1_param;
|
||||||
|
|
||||||
DWORD snum = (ins->src[0].token) & WINED3DSP_REGNUM_MASK;
|
|
||||||
shader_glsl_add_src_param(ins, ins->src[1].token, ins->src[1].addr_token, WINED3DSP_WRITEMASK_0, &src1_param);
|
shader_glsl_add_src_param(ins, ins->src[1].token, ins->src[1].addr_token, WINED3DSP_WRITEMASK_0, &src1_param);
|
||||||
shader_addline(ins->ctx->buffer, "if (%s) subroutine%u();\n", src1_param.param_str, snum);
|
shader_addline(ins->ctx->buffer, "if (%s) subroutine%u();\n", src1_param.param_str, ins->src[0].register_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************
|
/*********************************************
|
||||||
|
@ -2446,7 +2438,7 @@ 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 < WINED3DPS_VERSION(2,0)) sampler_idx = ins->dst[0].register_idx;
|
if (shader_version < WINED3DPS_VERSION(2,0)) sampler_idx = ins->dst[0].register_idx;
|
||||||
else sampler_idx = ins->src[1].token & WINED3DSP_REGNUM_MASK;
|
else sampler_idx = ins->src[1].register_idx;
|
||||||
sampler_type = ins->ctx->reg_maps->samplers[sampler_idx] & WINED3DSP_TEXTURETYPE_MASK;
|
sampler_type = ins->ctx->reg_maps->samplers[sampler_idx] & WINED3DSP_TEXTURETYPE_MASK;
|
||||||
|
|
||||||
if (shader_version < WINED3DPS_VERSION(1,4))
|
if (shader_version < WINED3DPS_VERSION(1,4))
|
||||||
|
@ -2531,7 +2523,7 @@ static void shader_glsl_texldl(const struct wined3d_shader_instruction *ins)
|
||||||
DWORD sampler_idx;
|
DWORD sampler_idx;
|
||||||
DWORD swizzle = ins->src[1].token & WINED3DSP_SWIZZLE_MASK;
|
DWORD swizzle = ins->src[1].token & WINED3DSP_SWIZZLE_MASK;
|
||||||
|
|
||||||
sampler_idx = ins->src[1].token & WINED3DSP_REGNUM_MASK;
|
sampler_idx = ins->src[1].register_idx;
|
||||||
sampler_type = ins->ctx->reg_maps->samplers[sampler_idx] & WINED3DSP_TEXTURETYPE_MASK;
|
sampler_type = ins->ctx->reg_maps->samplers[sampler_idx] & WINED3DSP_TEXTURETYPE_MASK;
|
||||||
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) {
|
||||||
|
@ -2566,7 +2558,7 @@ static void pshader_glsl_texcoord(const struct wined3d_shader_instruction *ins)
|
||||||
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].register_idx, dst_mask);
|
||||||
} else {
|
} else {
|
||||||
DWORD reg = ins->src[0].token & WINED3DSP_REGNUM_MASK;
|
DWORD reg = ins->src[0].register_idx;
|
||||||
DWORD src_mod = ins->src[0].token & WINED3DSP_SRCMOD_MASK;
|
DWORD src_mod = ins->src[0].token & WINED3DSP_SRCMOD_MASK;
|
||||||
char dst_swizzle[6];
|
char dst_swizzle[6];
|
||||||
|
|
||||||
|
|
|
@ -465,6 +465,7 @@ struct wined3d_shader_dst_param
|
||||||
struct wined3d_shader_src_param
|
struct wined3d_shader_src_param
|
||||||
{
|
{
|
||||||
WINED3DSHADER_PARAM_REGISTER_TYPE register_type;
|
WINED3DSHADER_PARAM_REGISTER_TYPE register_type;
|
||||||
|
UINT register_idx;
|
||||||
DWORD token;
|
DWORD token;
|
||||||
DWORD addr_token;
|
DWORD addr_token;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue