wined3d: Avoid NOP additions.
This commit is contained in:
parent
c7c785861a
commit
0183f3e305
|
@ -802,8 +802,15 @@ static void shader_glsl_get_register_name(
|
||||||
glsl_src_param_t rel_param;
|
glsl_src_param_t rel_param;
|
||||||
shader_glsl_add_src_param(arg, addr_token, 0, WINED3DSP_WRITEMASK_0, &rel_param);
|
shader_glsl_add_src_param(arg, addr_token, 0, WINED3DSP_WRITEMASK_0, &rel_param);
|
||||||
|
|
||||||
sprintf(tmpStr, "IN[%s + %u]", rel_param.param_str,
|
/* Removing a + 0 would be an obvious optimization, but macos doesn't see the NOP
|
||||||
((IWineD3DPixelShaderImpl *) This)->input_reg_map[reg]);
|
* operation there
|
||||||
|
*/
|
||||||
|
if(((IWineD3DPixelShaderImpl *) This)->input_reg_map[reg]) {
|
||||||
|
sprintf(tmpStr, "IN[%s + %u]", rel_param.param_str,
|
||||||
|
((IWineD3DPixelShaderImpl *) This)->input_reg_map[reg]);
|
||||||
|
} else {
|
||||||
|
sprintf(tmpStr, "IN[%s]", rel_param.param_str);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
sprintf(tmpStr, "IN[%u]",
|
sprintf(tmpStr, "IN[%u]",
|
||||||
((IWineD3DPixelShaderImpl *) This)->input_reg_map[reg]);
|
((IWineD3DPixelShaderImpl *) This)->input_reg_map[reg]);
|
||||||
|
@ -832,9 +839,18 @@ static void shader_glsl_get_register_name(
|
||||||
if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 2) {
|
if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 2) {
|
||||||
glsl_src_param_t rel_param;
|
glsl_src_param_t rel_param;
|
||||||
shader_glsl_add_src_param(arg, addr_token, 0, WINED3DSP_WRITEMASK_0, &rel_param);
|
shader_glsl_add_src_param(arg, addr_token, 0, WINED3DSP_WRITEMASK_0, &rel_param);
|
||||||
sprintf(tmpStr, "%s[%s + %u]", prefix, rel_param.param_str, reg);
|
if(reg) {
|
||||||
} else
|
sprintf(tmpStr, "%s[%s + %u]", prefix, rel_param.param_str, reg);
|
||||||
sprintf(tmpStr, "%s[A0.x + %u]", prefix, reg);
|
} else {
|
||||||
|
sprintf(tmpStr, "%s[%s]", prefix, rel_param.param_str);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(reg) {
|
||||||
|
sprintf(tmpStr, "%s[A0.x + %u]", prefix, reg);
|
||||||
|
} else {
|
||||||
|
sprintf(tmpStr, "%s[A0.x]", prefix);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} else
|
} else
|
||||||
sprintf(tmpStr, "%s[%u]", prefix, reg);
|
sprintf(tmpStr, "%s[%u]", prefix, reg);
|
||||||
|
@ -1299,18 +1315,8 @@ void shader_glsl_mov(SHADER_OPCODE_ARG* arg) {
|
||||||
* shader versions WINED3DSIO_MOVA is used for this. */
|
* shader versions WINED3DSIO_MOVA is used for this. */
|
||||||
if ((WINED3DSHADER_VERSION_MAJOR(shader->baseShader.hex_version) == 1 &&
|
if ((WINED3DSHADER_VERSION_MAJOR(shader->baseShader.hex_version) == 1 &&
|
||||||
!shader_is_pshader_version(shader->baseShader.hex_version) &&
|
!shader_is_pshader_version(shader->baseShader.hex_version) &&
|
||||||
shader_get_regtype(arg->dst) == WINED3DSPR_ADDR)) {
|
shader_get_regtype(arg->dst) == WINED3DSPR_ADDR) ||
|
||||||
/* This is a simple floor(). Msdn claims it is a round to nearest, but our test shows
|
arg->opcode->opcode == WINED3DSIO_MOVA) {
|
||||||
* that it is just a floor(). ATI docs confirm that, and the test succeeds on the
|
|
||||||
* reference rasterizer too
|
|
||||||
*/
|
|
||||||
size_t mask_size = shader_glsl_get_write_mask_size(write_mask);
|
|
||||||
if (mask_size > 1) {
|
|
||||||
shader_addline(buffer, "ivec%d(floor(%s)));\n", mask_size, src0_param.param_str);
|
|
||||||
} else {
|
|
||||||
shader_addline(buffer, "int(floor(%s)));\n", src0_param.param_str);
|
|
||||||
}
|
|
||||||
} else if(arg->opcode->opcode == WINED3DSIO_MOVA) {
|
|
||||||
/* We need to *round* to the nearest int here. */
|
/* We need to *round* to the nearest int here. */
|
||||||
size_t mask_size = shader_glsl_get_write_mask_size(write_mask);
|
size_t mask_size = shader_glsl_get_write_mask_size(write_mask);
|
||||||
if (mask_size > 1) {
|
if (mask_size > 1) {
|
||||||
|
|
Loading…
Reference in New Issue