wined3d: Drop the color0 mov optimization if the src is overwritten.

This commit is contained in:
Stefan Dösinger 2009-07-09 22:24:27 +02:00 committed by Alexandre Julliard
parent 8a6553da14
commit 17769497eb
1 changed files with 17 additions and 7 deletions

View File

@ -632,8 +632,11 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
reg_maps->texcoord_mask[dst_param.reg.idx] |= dst_param.write_mask;
}
if (shader_version.type == WINED3D_SHADER_TYPE_PIXEL
&& dst_param.reg.type == WINED3DSPR_COLOROUT && dst_param.reg.idx == 0)
if (shader_version.type == WINED3D_SHADER_TYPE_PIXEL)
{
IWineD3DPixelShaderImpl *ps = (IWineD3DPixelShaderImpl *)This;
if(dst_param.reg.type == WINED3DSPR_COLOROUT && dst_param.reg.idx == 0)
{
/* Many 2.0 and 3.0 pixel shaders end with a MOV from a temp register to
* COLOROUT 0. If we know this in advance, the ARB shader backend can skip
@ -642,7 +645,6 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
* However, if the mov is only partial, we can't do this, and if the write
* comes from an instruction other than MOV it is hard to do as well. If
* COLOROUT 0 is overwritten partially later, the marker is dropped again. */
IWineD3DPixelShaderImpl *ps = (IWineD3DPixelShaderImpl *)This;
ps->color0_mov = FALSE;
if (ins.handler_idx == WINED3DSIH_MOV)
@ -651,6 +653,14 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
color0_mov = TRUE;
}
}
/* Also drop the MOV marker if the source register is overwritten prior to the shader
* end
*/
else if(dst_param.reg.type == WINED3DSPR_TEMP && dst_param.reg.idx == ps->color0_reg)
{
ps->color0_mov = FALSE;
}
}
/* Declare 1.X samplers implicitly, based on the destination reg. number */
if (shader_version.major == 1