wined3d: Only perform sRGB write correction on formats that advertise it.
This commit is contained in:
parent
d3a5242c97
commit
6b794cbd64
|
@ -2192,6 +2192,11 @@ static void context_setup_target(IWineD3DDeviceImpl *device,
|
|||
{
|
||||
Context_MarkStateDirty(context, STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), StateTable);
|
||||
}
|
||||
/* Update sRGB writing when switching between formats that do/do not support sRGB writing */
|
||||
if ((old->Flags & WINED3DFMT_FLAG_SRGB_WRITE) != (new->Flags & WINED3DFMT_FLAG_SRGB_WRITE))
|
||||
{
|
||||
Context_MarkStateDirty(context, STATE_RENDER(WINED3DRS_SRGBWRITEENABLE), StateTable);
|
||||
}
|
||||
}
|
||||
|
||||
/* When switching away from an offscreen render target, and we're not
|
||||
|
|
|
@ -2008,10 +2008,16 @@ void find_ps_compile_args(IWineD3DPixelShaderImpl *shader,
|
|||
IWineD3DStateBlockImpl *stateblock, struct ps_compile_args *args)
|
||||
{
|
||||
IWineD3DBaseTextureImpl *texture;
|
||||
IWineD3DDeviceImpl *device = stateblock->device;
|
||||
UINT i;
|
||||
|
||||
memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */
|
||||
args->srgb_correction = stateblock->renderState[WINED3DRS_SRGBWRITEENABLE] ? 1 : 0;
|
||||
if (stateblock->renderState[WINED3DRS_SRGBWRITEENABLE])
|
||||
{
|
||||
IWineD3DSurfaceImpl *rt = device->render_targets[0];
|
||||
if(rt->resource.format_desc->Flags & WINED3DFMT_FLAG_SRGB_WRITE) args->srgb_correction = 1;
|
||||
}
|
||||
|
||||
args->np2_fixup = 0;
|
||||
|
||||
for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i)
|
||||
|
@ -2036,7 +2042,7 @@ void find_ps_compile_args(IWineD3DPixelShaderImpl *shader,
|
|||
}
|
||||
if (shader->baseShader.reg_maps.shader_version.major >= 3)
|
||||
{
|
||||
if (((IWineD3DDeviceImpl *)shader->baseShader.device)->strided_streams.position_transformed)
|
||||
if (device->strided_streams.position_transformed)
|
||||
{
|
||||
args->vp_mode = pretransformed;
|
||||
}
|
||||
|
@ -2058,8 +2064,7 @@ void find_ps_compile_args(IWineD3DPixelShaderImpl *shader,
|
|||
switch (stateblock->renderState[WINED3DRS_FOGTABLEMODE])
|
||||
{
|
||||
case WINED3DFOG_NONE:
|
||||
if (((IWineD3DDeviceImpl *)shader->baseShader.device)->strided_streams.position_transformed
|
||||
|| use_vs(stateblock))
|
||||
if (device->strided_streams.position_transformed || use_vs(stateblock))
|
||||
{
|
||||
args->fog = FOG_LINEAR;
|
||||
break;
|
||||
|
|
|
@ -2698,6 +2698,7 @@ void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_setting
|
|||
DWORD ttff;
|
||||
DWORD cop, aop, carg0, carg1, carg2, aarg0, aarg1, aarg2;
|
||||
IWineD3DDeviceImpl *device = stateblock->device;
|
||||
IWineD3DSurfaceImpl *rt = device->render_targets[0];
|
||||
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
||||
|
||||
for (i = 0; i < gl_info->limits.texture_stages; ++i)
|
||||
|
@ -2886,7 +2887,8 @@ void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_setting
|
|||
break;
|
||||
}
|
||||
}
|
||||
if(stateblock->renderState[WINED3DRS_SRGBWRITEENABLE]) {
|
||||
if(stateblock->renderState[WINED3DRS_SRGBWRITEENABLE] &&
|
||||
rt->resource.format_desc->Flags & WINED3DFMT_FLAG_SRGB_WRITE) {
|
||||
settings->sRGB_write = 1;
|
||||
} else {
|
||||
settings->sRGB_write = 0;
|
||||
|
|
Loading…
Reference in New Issue