wined3d: Implement independent color write masks.
This commit is contained in:
parent
13a57c81f0
commit
4651dd86bf
|
@ -4264,13 +4264,14 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
|
||||||
WINED3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING;
|
WINED3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING;
|
||||||
/* TODO:
|
/* TODO:
|
||||||
WINED3DPMISCCAPS_NULLREFERENCE
|
WINED3DPMISCCAPS_NULLREFERENCE
|
||||||
WINED3DPMISCCAPS_INDEPENDENTWRITEMASKS
|
|
||||||
WINED3DPMISCCAPS_FOGANDSPECULARALPHA
|
WINED3DPMISCCAPS_FOGANDSPECULARALPHA
|
||||||
WINED3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS
|
WINED3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS
|
||||||
WINED3DPMISCCAPS_FOGVERTEXCLAMPED */
|
WINED3DPMISCCAPS_FOGVERTEXCLAMPED */
|
||||||
|
|
||||||
if (gl_info->supported[EXT_BLEND_EQUATION_SEPARATE] && gl_info->supported[EXT_BLEND_FUNC_SEPARATE])
|
if (gl_info->supported[EXT_BLEND_EQUATION_SEPARATE] && gl_info->supported[EXT_BLEND_FUNC_SEPARATE])
|
||||||
pCaps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_SEPARATEALPHABLEND;
|
pCaps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_SEPARATEALPHABLEND;
|
||||||
|
if (gl_info->supported[EXT_DRAW_BUFFERS2])
|
||||||
|
pCaps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_INDEPENDENTWRITEMASKS;
|
||||||
|
|
||||||
pCaps->RasterCaps = WINED3DPRASTERCAPS_DITHER |
|
pCaps->RasterCaps = WINED3DPRASTERCAPS_DITHER |
|
||||||
WINED3DPRASTERCAPS_PAT |
|
WINED3DPRASTERCAPS_PAT |
|
||||||
|
|
|
@ -1549,6 +1549,35 @@ static void state_colorwrite(DWORD state, IWineD3DStateBlockImpl *stateblock, st
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void set_color_mask(struct wined3d_context *context, UINT index, DWORD mask)
|
||||||
|
{
|
||||||
|
GL_EXTCALL(glColorMaskIndexedEXT(index,
|
||||||
|
mask & WINED3DCOLORWRITEENABLE_RED ? GL_TRUE : GL_FALSE,
|
||||||
|
mask & WINED3DCOLORWRITEENABLE_GREEN ? GL_TRUE : GL_FALSE,
|
||||||
|
mask & WINED3DCOLORWRITEENABLE_BLUE ? GL_TRUE : GL_FALSE,
|
||||||
|
mask & WINED3DCOLORWRITEENABLE_ALPHA ? GL_TRUE : GL_FALSE));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void state_colorwrite0(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||||
|
{
|
||||||
|
set_color_mask(context, 0, stateblock->renderState[WINED3DRS_COLORWRITEENABLE]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void state_colorwrite1(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||||
|
{
|
||||||
|
set_color_mask(context, 1, stateblock->renderState[WINED3DRS_COLORWRITEENABLE1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void state_colorwrite2(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||||
|
{
|
||||||
|
set_color_mask(context, 2, stateblock->renderState[WINED3DRS_COLORWRITEENABLE2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void state_colorwrite3(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||||
|
{
|
||||||
|
set_color_mask(context, 3, stateblock->renderState[WINED3DRS_COLORWRITEENABLE3]);
|
||||||
|
}
|
||||||
|
|
||||||
static void state_localviewer(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
static void state_localviewer(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||||
{
|
{
|
||||||
if(stateblock->renderState[WINED3DRS_LOCALVIEWER]) {
|
if(stateblock->renderState[WINED3DRS_LOCALVIEWER]) {
|
||||||
|
@ -4992,13 +5021,17 @@ const struct StateEntryTemplate misc_state_template[] = {
|
||||||
{ STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS), { STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS), state_msaa_w }, WINED3D_GL_EXT_NONE },
|
{ STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS), { STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS), state_msaa_w }, WINED3D_GL_EXT_NONE },
|
||||||
{ STATE_RENDER(WINED3DRS_MULTISAMPLEMASK), { STATE_RENDER(WINED3DRS_MULTISAMPLEMASK), state_multisampmask }, WINED3D_GL_EXT_NONE },
|
{ STATE_RENDER(WINED3DRS_MULTISAMPLEMASK), { STATE_RENDER(WINED3DRS_MULTISAMPLEMASK), state_multisampmask }, WINED3D_GL_EXT_NONE },
|
||||||
{ STATE_RENDER(WINED3DRS_DEBUGMONITORTOKEN), { STATE_RENDER(WINED3DRS_DEBUGMONITORTOKEN), state_debug_monitor }, WINED3D_GL_EXT_NONE },
|
{ STATE_RENDER(WINED3DRS_DEBUGMONITORTOKEN), { STATE_RENDER(WINED3DRS_DEBUGMONITORTOKEN), state_debug_monitor }, WINED3D_GL_EXT_NONE },
|
||||||
|
{ STATE_RENDER(WINED3DRS_COLORWRITEENABLE), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE), state_colorwrite0 }, EXT_DRAW_BUFFERS2 },
|
||||||
{ STATE_RENDER(WINED3DRS_COLORWRITEENABLE), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE), state_colorwrite }, WINED3D_GL_EXT_NONE },
|
{ STATE_RENDER(WINED3DRS_COLORWRITEENABLE), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE), state_colorwrite }, WINED3D_GL_EXT_NONE },
|
||||||
{ STATE_RENDER(WINED3DRS_BLENDOP), { STATE_RENDER(WINED3DRS_BLENDOP), state_blendop }, EXT_BLEND_MINMAX },
|
{ STATE_RENDER(WINED3DRS_BLENDOP), { STATE_RENDER(WINED3DRS_BLENDOP), state_blendop }, EXT_BLEND_MINMAX },
|
||||||
{ STATE_RENDER(WINED3DRS_BLENDOP), { STATE_RENDER(WINED3DRS_BLENDOP), state_blendop_w }, WINED3D_GL_EXT_NONE },
|
{ STATE_RENDER(WINED3DRS_BLENDOP), { STATE_RENDER(WINED3DRS_BLENDOP), state_blendop_w }, WINED3D_GL_EXT_NONE },
|
||||||
{ STATE_RENDER(WINED3DRS_SCISSORTESTENABLE), { STATE_RENDER(WINED3DRS_SCISSORTESTENABLE), state_scissor }, WINED3D_GL_EXT_NONE },
|
{ STATE_RENDER(WINED3DRS_SCISSORTESTENABLE), { STATE_RENDER(WINED3DRS_SCISSORTESTENABLE), state_scissor }, WINED3D_GL_EXT_NONE },
|
||||||
{ STATE_RENDER(WINED3DRS_SLOPESCALEDEPTHBIAS), { STATE_RENDER(WINED3DRS_DEPTHBIAS), state_depthbias }, WINED3D_GL_EXT_NONE },
|
{ STATE_RENDER(WINED3DRS_SLOPESCALEDEPTHBIAS), { STATE_RENDER(WINED3DRS_DEPTHBIAS), state_depthbias }, WINED3D_GL_EXT_NONE },
|
||||||
|
{ STATE_RENDER(WINED3DRS_COLORWRITEENABLE1), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE1), state_colorwrite1 }, EXT_DRAW_BUFFERS2 },
|
||||||
{ STATE_RENDER(WINED3DRS_COLORWRITEENABLE1), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE), state_colorwrite }, WINED3D_GL_EXT_NONE },
|
{ STATE_RENDER(WINED3DRS_COLORWRITEENABLE1), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE), state_colorwrite }, WINED3D_GL_EXT_NONE },
|
||||||
|
{ STATE_RENDER(WINED3DRS_COLORWRITEENABLE2), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE2), state_colorwrite2 }, EXT_DRAW_BUFFERS2 },
|
||||||
{ STATE_RENDER(WINED3DRS_COLORWRITEENABLE2), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE), state_colorwrite }, WINED3D_GL_EXT_NONE },
|
{ STATE_RENDER(WINED3DRS_COLORWRITEENABLE2), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE), state_colorwrite }, WINED3D_GL_EXT_NONE },
|
||||||
|
{ STATE_RENDER(WINED3DRS_COLORWRITEENABLE3), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE3), state_colorwrite3 }, EXT_DRAW_BUFFERS2 },
|
||||||
{ STATE_RENDER(WINED3DRS_COLORWRITEENABLE3), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE), state_colorwrite }, WINED3D_GL_EXT_NONE },
|
{ STATE_RENDER(WINED3DRS_COLORWRITEENABLE3), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE), state_colorwrite }, WINED3D_GL_EXT_NONE },
|
||||||
{ STATE_RENDER(WINED3DRS_BLENDFACTOR), { STATE_RENDER(WINED3DRS_BLENDFACTOR), state_blendfactor }, EXT_BLEND_COLOR },
|
{ STATE_RENDER(WINED3DRS_BLENDFACTOR), { STATE_RENDER(WINED3DRS_BLENDFACTOR), state_blendfactor }, EXT_BLEND_COLOR },
|
||||||
{ STATE_RENDER(WINED3DRS_BLENDFACTOR), { STATE_RENDER(WINED3DRS_BLENDFACTOR), state_blendfactor_w }, WINED3D_GL_EXT_NONE },
|
{ STATE_RENDER(WINED3DRS_BLENDFACTOR), { STATE_RENDER(WINED3DRS_BLENDFACTOR), state_blendfactor_w }, WINED3D_GL_EXT_NONE },
|
||||||
|
|
Loading…
Reference in New Issue