d3d11-Depth_Bias: Added patches to implement support for depth bias clamping.

This commit is contained in:
Sebastian Lackner 2017-10-14 17:54:36 +02:00
parent 5149b192c9
commit 5e03e4422d
6 changed files with 313 additions and 37 deletions

View File

@ -0,0 +1,64 @@
From 2f0910b949940534ca5e2f45773a6be733e8b5b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 7 Oct 2017 00:39:35 +0200
Subject: d3d11/tests: Add basic test for depth bias clamping.
---
dlls/d3d11/tests/d3d11.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 8906b9efa7a..ef6eafd11f1 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -16239,6 +16239,47 @@ static void test_depth_separate(void)
ok(compare_color(color, white_d, 1), "Got unexpected color 0x%08x.\n", color);
release_resource_readback(&rb);
+ ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, red);
+ ID3D11DeviceContext_ClearDepthStencilView(context, ds_view, D3D11_CLEAR_DEPTH, 1.0f, 0);
+ draw_color_quad_z(&test_context, &green, 0.5f);
+ ID3D11RasterizerState_Release(rs);
+
+ rs_desc.DepthClipEnable = TRUE;
+ rs_desc.DepthBias = -100000;
+ ID3D11Device_CreateRasterizerState(device, &rs_desc, &rs);
+ ok(SUCCEEDED(hr), "Failed to create rasterizer state, hr %#x.\n", hr);
+ ID3D11DeviceContext_RSSetState(context, rs);
+ draw_color_quad_z(&test_context, &blue, 0.5f);
+ get_texture_readback(test_context.backbuffer, 0, &rb);
+ color = get_readback_color(&rb, 320, 240);
+ ok(compare_color(color, blue_d, 1), "Got unexpected color 0x%08x.\n", color);
+ release_resource_readback(&rb);
+ ID3D11RasterizerState_Release(rs);
+
+ rs_desc.DepthBias = -100005;
+ rs_desc.DepthBiasClamp = -0.00001f;
+ ID3D11Device_CreateRasterizerState(device, &rs_desc, &rs);
+ ok(SUCCEEDED(hr), "Failed to create rasterizer state, hr %#x.\n", hr);
+ ID3D11DeviceContext_RSSetState(context, rs);
+ draw_color_quad_z(&test_context, &white, 0.5f);
+ get_texture_readback(test_context.backbuffer, 0, &rb);
+ color = get_readback_color(&rb, 320, 240);
+ todo_wine ok(compare_color(color, blue_d, 1), "Got unexpected color 0x%08x.\n", color);
+ release_resource_readback(&rb);
+ ID3D11RasterizerState_Release(rs);
+
+ rs_desc.DepthBias = -100010;
+ rs_desc.DepthBiasClamp = -1.0f;
+ ID3D11Device_CreateRasterizerState(device, &rs_desc, &rs);
+ ok(SUCCEEDED(hr), "Failed to create rasterizer state, hr %#x.\n", hr);
+ ID3D11DeviceContext_RSSetState(context, rs);
+ draw_color_quad_z(&test_context, &green, 0.5f);
+ get_texture_readback(test_context.backbuffer, 0, &rb);
+ color = get_readback_color(&rb, 320, 240);
+ ok(compare_color(color, green_d, 1), "Got unexpected color 0x%08x.\n", color);
+ release_resource_readback(&rb);
+ ID3D11RasterizerState_Release(rs);
+
ID3D11DepthStencilState_Release(ds_state);
ID3D11DepthStencilView_Release(ds_view);
ID3D11RasterizerState_Release(rs);
--
2.14.1

View File

@ -0,0 +1,204 @@
From 0895c4bcdcaaa794619c0a67dcede0b2ab24c1fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 7 Oct 2017 00:52:34 +0200
Subject: wined3d: Add support for depth bias clamping.
---
dlls/d3d11/device.c | 12 +++++++-----
dlls/d3d11/tests/d3d11.c | 2 +-
dlls/wined3d/cs.c | 1 +
dlls/wined3d/directx.c | 3 +++
dlls/wined3d/state.c | 19 ++++++++++++++++---
dlls/wined3d/stateblock.c | 2 ++
dlls/wined3d/utils.c | 1 +
dlls/wined3d/wined3d_gl.h | 1 +
include/wine/wined3d.h | 3 ++-
9 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index a144bccce1e..405a678505f 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -887,7 +887,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon
struct d3d_device *device = device_from_immediate_ID3D11DeviceContext(iface);
struct d3d_rasterizer_state *rasterizer_state_impl;
const D3D11_RASTERIZER_DESC *desc;
- union {DWORD d; float f;} slope;
+ union {DWORD d; float f;} tmpfloat;
TRACE("iface %p, rasterizer_state %p.\n", iface, rasterizer_state);
@@ -901,6 +901,8 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_MULTISAMPLEANTIALIAS, FALSE);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ANTIALIASEDLINEENABLE, FALSE);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, 0);
+ tmpfloat.f = 0.0f;
+ wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIASCLAMP, tmpfloat.d);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SLOPESCALEDEPTHBIAS, 0);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHCLIP, TRUE);
wined3d_mutex_unlock();
@@ -914,12 +916,12 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_CULLMODE, desc->CullMode);
/* OpenGL style depth bias. */
- slope.f = desc->SlopeScaledDepthBias;
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, desc->DepthBias);
- wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SLOPESCALEDEPTHBIAS, slope.d);
+ tmpfloat.f = desc->DepthBiasClamp;
+ wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIASCLAMP, tmpfloat.d);
+ tmpfloat.f = desc->SlopeScaledDepthBias;
+ wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SLOPESCALEDEPTHBIAS, tmpfloat.d);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHCLIP, (desc->DepthClipEnable != FALSE));
- if (desc->DepthBiasClamp)
- FIXME("Ignoring DepthBiasClamp %f.\n", desc->DepthBiasClamp);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SCISSORTESTENABLE, desc->ScissorEnable);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_MULTISAMPLEANTIALIAS, desc->MultisampleEnable);
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index cd5103a8367..923da4b38ce 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -15433,7 +15433,7 @@ static void test_depth_separate(void)
draw_color_quad_z(&test_context, &white, 0.5f);
get_texture_readback(test_context.backbuffer, 0, &rb);
color = get_readback_color(&rb, 320, 240);
- todo_wine ok(compare_color(color, blue_d, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(compare_color(color, blue_d, 1), "Got unexpected color 0x%08x.\n", color);
release_resource_readback(&rb);
ID3D11RasterizerState_Release(rs);
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 04e01da9e0a..599d72889d1 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -986,6 +986,7 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
device_invalidate_state(device, STATE_RENDER(WINED3D_RS_STENCILENABLE));
device_invalidate_state(device, STATE_RENDER(WINED3D_RS_STENCILWRITEMASK));
device_invalidate_state(device, STATE_RENDER(WINED3D_RS_DEPTHBIAS));
+ device_invalidate_state(device, STATE_RENDER(WINED3D_RS_DEPTHBIASCLAMP));
}
else if (prev && (prev->format_flags & WINED3DFMT_FLAG_FLOAT)
!= (op->view->format_flags & WINED3DFMT_FLAG_FLOAT))
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 564078f2905..33eb2d3c0c3 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -225,6 +225,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
{"GL_EXT_packed_depth_stencil", EXT_PACKED_DEPTH_STENCIL },
{"GL_EXT_packed_float", EXT_PACKED_FLOAT },
{"GL_EXT_point_parameters", EXT_POINT_PARAMETERS },
+ {"GL_EXT_polygon_offset_clamp", EXT_POLYGON_OFFSET_CLAMP },
{"GL_EXT_provoking_vertex", EXT_PROVOKING_VERTEX },
{"GL_EXT_secondary_color", EXT_SECONDARY_COLOR },
{"GL_EXT_stencil_two_side", EXT_STENCIL_TWO_SIDE },
@@ -3093,6 +3094,8 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
/* GL_EXT_point_parameters */
USE_GL_FUNC(glPointParameterfEXT)
USE_GL_FUNC(glPointParameterfvEXT)
+ /* GL_EXT_polygon_offset_clamp */
+ USE_GL_FUNC(glPolygonOffsetClampEXT)
/* GL_EXT_provoking_vertex */
USE_GL_FUNC(glProvokingVertexEXT)
/* GL_EXT_secondary_color */
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 8b1729de2a3..df511009833 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -1728,10 +1728,11 @@ static void state_depthbias(struct wined3d_context *context, const struct wined3
DWORD d;
INT i;
float f;
- } scale_bias, const_bias;
+ } scale_bias, const_bias, bias_clamp;
scale_bias.d = state->render_states[WINED3D_RS_SLOPESCALEDEPTHBIAS];
const_bias.d = state->render_states[WINED3D_RS_DEPTHBIAS];
+ bias_clamp.d = state->render_states[WINED3D_RS_DEPTHBIASCLAMP];
gl_info->gl_ops.gl.p_glEnable(GL_POLYGON_OFFSET_FILL);
checkGLcall("glEnable(GL_POLYGON_OFFSET_FILL)");
@@ -1744,8 +1745,19 @@ static void state_depthbias(struct wined3d_context *context, const struct wined3
}
else if (context->d3d_info->wined3d_creation_flags & WINED3D_FORWARD_DEPTH_BIAS)
{
- gl_info->gl_ops.gl.p_glPolygonOffset(scale_bias.f, const_bias.i);
- checkGLcall("glPolygonOffset(...)");
+ if (gl_info->supported[EXT_POLYGON_OFFSET_CLAMP])
+ {
+ GL_EXTCALL(glPolygonOffsetClampEXT(scale_bias.f, const_bias.i, bias_clamp.f));
+ checkGLcall("glPolygonOffsetClampEXT(...)");
+ }
+ else
+ {
+ if (bias_clamp.f)
+ WARN("EXT_polygon_offset_clamp extension missing, no support for depth bias clamping.\n");
+
+ gl_info->gl_ops.gl.p_glPolygonOffset(scale_bias.f, const_bias.i);
+ checkGLcall("glPolygonOffset(...)");
+ }
}
else
{
@@ -5241,6 +5253,7 @@ const struct StateEntryTemplate misc_state_template[] =
{ STATE_RENDER(WINED3D_RS_BLENDFACTOR), { STATE_RENDER(WINED3D_RS_BLENDFACTOR), state_blendfactor }, EXT_BLEND_COLOR },
{ STATE_RENDER(WINED3D_RS_BLENDFACTOR), { STATE_RENDER(WINED3D_RS_BLENDFACTOR), state_blendfactor_w }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_DEPTHBIAS), { STATE_RENDER(WINED3D_RS_DEPTHBIAS), state_depthbias }, WINED3D_GL_EXT_NONE },
+ { STATE_RENDER(WINED3D_RS_DEPTHBIASCLAMP), { STATE_RENDER(WINED3D_RS_DEPTHBIAS), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_ZVISIBLE), { STATE_RENDER(WINED3D_RS_ZVISIBLE), state_zvisible }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_DEPTHCLIP), { STATE_RENDER(WINED3D_RS_DEPTHCLIP), state_depthclip }, ARB_DEPTH_CLAMP },
{ STATE_RENDER(WINED3D_RS_DEPTHCLIP), { STATE_RENDER(WINED3D_RS_DEPTHCLIP), state_depthclip_w }, WINED3D_GL_EXT_NONE },
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index e55e2b8abc3..71571b24fe5 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -1244,6 +1244,8 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d
state->render_states[WINED3D_RS_BLENDFACTOR] = 0xffffffff;
state->render_states[WINED3D_RS_SRGBWRITEENABLE] = 0;
state->render_states[WINED3D_RS_DEPTHBIAS] = 0;
+ tmpfloat.f = 0.0f;
+ state->render_states[WINED3D_RS_DEPTHBIASCLAMP] = tmpfloat.d;
state->render_states[WINED3D_RS_DEPTHCLIP] = TRUE;
state->render_states[WINED3D_RS_WRAP8] = 0;
state->render_states[WINED3D_RS_WRAP9] = 0;
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index b234a2e3b44..472ac9ead0b 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -4299,6 +4299,7 @@ const char *debug_d3drenderstate(enum wined3d_render_state state)
D3DSTATE_TO_STR(WINED3D_RS_BLENDFACTOR);
D3DSTATE_TO_STR(WINED3D_RS_SRGBWRITEENABLE);
D3DSTATE_TO_STR(WINED3D_RS_DEPTHBIAS);
+ D3DSTATE_TO_STR(WINED3D_RS_DEPTHBIASCLAMP);
D3DSTATE_TO_STR(WINED3D_RS_WRAP8);
D3DSTATE_TO_STR(WINED3D_RS_WRAP9);
D3DSTATE_TO_STR(WINED3D_RS_WRAP10);
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h
index 084c2d9dc6e..f044c74584e 100644
--- a/dlls/wined3d/wined3d_gl.h
+++ b/dlls/wined3d/wined3d_gl.h
@@ -156,6 +156,7 @@ enum wined3d_gl_extension
EXT_PACKED_DEPTH_STENCIL,
EXT_PACKED_FLOAT,
EXT_POINT_PARAMETERS,
+ EXT_POLYGON_OFFSET_CLAMP,
EXT_PROVOKING_VERTEX,
EXT_SECONDARY_COLOR,
EXT_STENCIL_TWO_SIDE,
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 946692fc672..5e9e45942be 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -382,8 +382,9 @@ enum wined3d_render_state
WINED3D_RS_DESTBLENDALPHA = 208,
WINED3D_RS_BLENDOPALPHA = 209,
WINED3D_RS_DEPTHCLIP = 210,
+ WINED3D_RS_DEPTHBIASCLAMP = 211,
};
-#define WINEHIGHEST_RENDER_STATE WINED3D_RS_DEPTHCLIP
+#define WINEHIGHEST_RENDER_STATE WINED3D_RS_DEPTHBIASCLAMP
enum wined3d_blend
{
--
2.14.1

View File

@ -1 +1,2 @@
Fixes: Implement support for more d3d11 depth options in RSSetState.
Fixes: [43848] Implement support for depth bias clamping

View File

@ -4017,18 +4017,25 @@ fi
# Patchset d3d11-Depth_Bias
# |
# | This patchset fixes the following Wine bugs:
# | * [#43848] Implement support for depth bias clamping
# |
# | Modified files:
# | * dlls/d3d11/device.c, dlls/d3d11/tests/d3d11.c, dlls/dxgi/factory.c, dlls/wined3d/directx.c, dlls/wined3d/state.c,
# | dlls/wined3d/stateblock.c, dlls/wined3d/utils.c, dlls/wined3d/wined3d_gl.h, include/wine/wined3d.h
# | * dlls/d3d11/device.c, dlls/d3d11/tests/d3d11.c, dlls/dxgi/factory.c, dlls/wined3d/cs.c, dlls/wined3d/directx.c,
# | dlls/wined3d/state.c, dlls/wined3d/stateblock.c, dlls/wined3d/utils.c, dlls/wined3d/wined3d_gl.h, include/wine/wined3d.h
# |
if test "$enable_d3d11_Depth_Bias" -eq 1; then
patch_apply d3d11-Depth_Bias/0002-d3d11-tests-Add-some-basic-depth-tests.patch
patch_apply d3d11-Depth_Bias/0003-d3d11-Implement-depth-bias-and-slope.patch
patch_apply d3d11-Depth_Bias/0004-d3d11-Add-support-for-SlopeScaledDepthBias-in-RSSetS.patch
patch_apply d3d11-Depth_Bias/0005-d3d11-tests-Add-basic-test-for-depth-bias-clamping.patch
patch_apply d3d11-Depth_Bias/0006-wined3d-Add-support-for-depth-bias-clamping.patch
(
printf '%s\n' '+ { "Michael Müller", "d3d11/tests: Add some basic depth tests.", 1 },';
printf '%s\n' '+ { "Michael Müller", "d3d11: Implement depth bias and slope.", 1 },';
printf '%s\n' '+ { "Michael Müller", "d3d11: Add support for SlopeScaledDepthBias in RSSetState.", 1 },';
printf '%s\n' '+ { "Michael Müller", "d3d11/tests: Add basic test for depth bias clamping.", 1 },';
printf '%s\n' '+ { "Michael Müller", "wined3d: Add support for depth bias clamping.", 1 },';
) >> "$patchlist"
fi

View File

@ -47,7 +47,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
};
struct wined3d_cs_add_dirty_texture_region
@@ -2263,6 +2266,53 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
@@ -2264,6 +2267,53 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
unsigned int slice_pitch)
{
struct wined3d_cs_update_sub_resource *op;
@ -101,7 +101,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
op = cs->ops->require_space(cs, sizeof(*op), WINED3D_CS_QUEUE_MAP);
op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE;
@@ -2276,8 +2326,10 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
@@ -2277,8 +2327,10 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
wined3d_resource_acquire(resource);
cs->ops->submit(cs, WINED3D_CS_QUEUE_MAP);
@ -112,7 +112,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
cs->ops->finish(cs, WINED3D_CS_QUEUE_MAP);
}
@@ -2656,6 +2708,13 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -2657,6 +2709,13 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_GENERATE_MIPS */ wined3d_cs_exec_generate_mips,
};
@ -126,7 +126,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id)
{
if (size > (cs->data_size - cs->end))
@@ -2709,6 +2768,9 @@ static void wined3d_cs_st_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
@@ -2710,6 +2769,9 @@ static void wined3d_cs_st_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
static const struct wined3d_cs_ops wined3d_cs_st_ops =
{
@ -136,7 +136,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
wined3d_cs_st_require_space,
wined3d_cs_st_submit,
wined3d_cs_st_finish,
@@ -2742,6 +2804,21 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs, enum wined3d_cs_queue_id
@@ -2743,6 +2805,21 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs, enum wined3d_cs_queue_id
wined3d_cs_queue_submit(&cs->queue[queue_id], cs);
}
@ -158,7 +158,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size_t size, struct wined3d_cs *cs)
{
size_t queue_size = ARRAY_SIZE(queue->data);
@@ -2803,6 +2880,16 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size
@@ -2804,6 +2881,16 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size
return packet->data;
}
@ -175,7 +175,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id)
{
if (cs->thread_id == GetCurrentThreadId())
@@ -2822,6 +2909,9 @@ static void wined3d_cs_mt_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
@@ -2823,6 +2910,9 @@ static void wined3d_cs_mt_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
static const struct wined3d_cs_ops wined3d_cs_mt_ops =
{

View File

@ -1,4 +1,4 @@
From 0b84050faebf1a7d26b9da96c7fbd9176e45fe5f Mon Sep 17 00:00:00 2001
From 97bf1e62501917f0d15a0baf0055478bdaf5367d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 20 Jul 2017 13:50:07 +0200
Subject: wined3d: Implement all 8 d3d11 color write masks.
@ -18,10 +18,10 @@ Subject: wined3d: Implement all 8 d3d11 color write masks.
11 files changed, 72 insertions(+), 70 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 43adb27299a..93938f98f0d 100644
index 405a678505f..fd0afa349f9 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -1633,6 +1633,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11Devi
@@ -687,6 +687,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11Devi
struct d3d_device *device = device_from_immediate_ID3D11DeviceContext(iface);
static const float default_blend_factor[] = {1.0f, 1.0f, 1.0f, 1.0f};
const D3D11_BLEND_DESC *desc;
@ -29,7 +29,7 @@ index 43adb27299a..93938f98f0d 100644
TRACE("iface %p, blend_state %p, blend_factor %s, sample_mask 0x%08x.\n",
iface, blend_state, debug_float4(blend_factor), sample_mask);
@@ -1646,14 +1647,11 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11Devi
@@ -700,14 +701,11 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11Devi
if (!(device->blend_state = unsafe_impl_from_ID3D11BlendState(blend_state)))
{
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ALPHABLENDENABLE, FALSE);
@ -49,7 +49,7 @@ index 43adb27299a..93938f98f0d 100644
wined3d_mutex_unlock();
return;
}
@@ -1680,14 +1678,13 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11Devi
@@ -734,14 +732,13 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11Devi
|| d->DestBlendAlpha == D3D11_BLEND_BLEND_FACTOR || d->DestBlendAlpha == D3D11_BLEND_INV_BLEND_FACTOR))
FIXME("Ignoring blend factor %s.\n", debug_float4(blend_factor));
}
@ -87,10 +87,10 @@ index b7c9264df47..455123f5bb4 100644
/* glSampleCoverage() */
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index ca02850ac33..be7650003cc 100644
index a2c0ba4080c..2a9036cabff 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -2521,10 +2521,8 @@ static void SetupForBlit(const struct wined3d_device *device, struct wined3d_con
@@ -2509,10 +2509,8 @@ static void SetupForBlit(const struct wined3d_device *device, struct wined3d_con
}
gl_info->gl_ops.gl.p_glColorMask(GL_TRUE, GL_TRUE,GL_TRUE,GL_TRUE);
checkGLcall("glColorMask");
@ -104,7 +104,7 @@ index ca02850ac33..be7650003cc 100644
{
gl_info->gl_ops.gl.p_glDisable(GL_COLOR_SUM_EXT);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 42749c7c87a..a9c0a9ccc09 100644
index 31955badb10..848274ce633 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -382,10 +382,8 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
@ -121,10 +121,10 @@ index 42749c7c87a..a9c0a9ccc09 100644
checkGLcall("glClearColor");
clear_mask = clear_mask | GL_COLOR_BUFFER_BIT;
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index ad1e587cca7..353e9aac5f9 100644
index 235f87bfa7d..c09319ef248 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -516,7 +516,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
@@ -502,7 +502,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
if (!(rtv = fb->render_targets[i]) || rtv->format->id == WINED3DFMT_NULL)
continue;
@ -134,7 +134,7 @@ index ad1e587cca7..353e9aac5f9 100644
wined3d_rendertarget_view_load_location(rtv, context, rtv->resource->draw_binding);
wined3d_rendertarget_view_invalidate_location(rtv, ~rtv->resource->draw_binding);
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 8b1729de2a3..a5a1a4bf90c 100644
index df511009833..8820f656976 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -1501,9 +1501,6 @@ static void state_debug_monitor(struct wined3d_context *context, const struct wi
@ -197,7 +197,7 @@ index 8b1729de2a3..a5a1a4bf90c 100644
}
static void state_localviewer(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
@@ -5226,18 +5213,26 @@ const struct StateEntryTemplate misc_state_template[] =
@@ -5238,18 +5225,26 @@ const struct StateEntryTemplate misc_state_template[] =
{ STATE_RENDER(WINED3D_RS_MULTISAMPLEANTIALIAS), { STATE_RENDER(WINED3D_RS_MULTISAMPLEANTIALIAS), state_msaa_w }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_MULTISAMPLEMASK), { STATE_RENDER(WINED3D_RS_MULTISAMPLEMASK), state_multisampmask }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_DEBUGMONITORTOKEN), { STATE_RENDER(WINED3D_RS_DEBUGMONITORTOKEN), state_debug_monitor }, WINED3D_GL_EXT_NONE },
@ -232,7 +232,7 @@ index 8b1729de2a3..a5a1a4bf90c 100644
{ STATE_RENDER(WINED3D_RS_BLENDFACTOR), { STATE_RENDER(WINED3D_RS_BLENDFACTOR), state_blendfactor_w }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_DEPTHBIAS), { STATE_RENDER(WINED3D_RS_DEPTHBIAS), state_depthbias }, WINED3D_GL_EXT_NONE },
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index e55e2b8abc3..5adf2b294c3 100644
index 71571b24fe5..879a98e738e 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -45,6 +45,10 @@ static const DWORD pixel_states_render[] =
@ -264,7 +264,7 @@ index e55e2b8abc3..5adf2b294c3 100644
state->render_states[WINED3D_RS_BLENDFACTOR] = 0xffffffff;
state->render_states[WINED3D_RS_SRGBWRITEENABLE] = 0;
state->render_states[WINED3D_RS_DEPTHBIAS] = 0;
@@ -1257,6 +1257,8 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d
@@ -1259,6 +1259,8 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d
state->render_states[WINED3D_RS_SRCBLENDALPHA] = WINED3D_BLEND_ONE;
state->render_states[WINED3D_RS_DESTBLENDALPHA] = WINED3D_BLEND_ZERO;
state->render_states[WINED3D_RS_BLENDOPALPHA] = WINED3D_BLEND_OP_ADD;
@ -274,7 +274,7 @@ index e55e2b8abc3..5adf2b294c3 100644
/* Texture Stage States - Put directly into state block, we will call function below */
for (i = 0; i < MAX_TEXTURES; ++i)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 1dd229db1ba..e90ef042323 100644
index 134b6d204f9..88a7c877521 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -367,6 +367,7 @@ static void surface_blt_fbo(const struct wined3d_device *device,
@ -299,10 +299,10 @@ index 1dd229db1ba..e90ef042323 100644
gl_info->gl_ops.gl.p_glDisable(GL_SCISSOR_TEST);
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_SCISSORTESTENABLE));
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 09e858a2e28..5e29e7cd7a5 100644
index 472ac9ead0b..38d0ebe171c 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -4254,7 +4254,6 @@ const char *debug_d3drenderstate(enum wined3d_render_state state)
@@ -4273,7 +4273,6 @@ const char *debug_d3drenderstate(enum wined3d_render_state state)
D3DSTATE_TO_STR(WINED3D_RS_DEBUGMONITORTOKEN);
D3DSTATE_TO_STR(WINED3D_RS_POINTSIZE_MAX);
D3DSTATE_TO_STR(WINED3D_RS_INDEXEDVERTEXBLENDENABLE);
@ -310,7 +310,7 @@ index 09e858a2e28..5e29e7cd7a5 100644
D3DSTATE_TO_STR(WINED3D_RS_TWEENFACTOR);
D3DSTATE_TO_STR(WINED3D_RS_BLENDOP);
D3DSTATE_TO_STR(WINED3D_RS_POSITIONDEGREE);
@@ -4274,9 +4273,14 @@ const char *debug_d3drenderstate(enum wined3d_render_state state)
@@ -4293,9 +4292,14 @@ const char *debug_d3drenderstate(enum wined3d_render_state state)
D3DSTATE_TO_STR(WINED3D_RS_BACK_STENCILZFAIL);
D3DSTATE_TO_STR(WINED3D_RS_BACK_STENCILPASS);
D3DSTATE_TO_STR(WINED3D_RS_BACK_STENCILFUNC);
@ -326,7 +326,7 @@ index 09e858a2e28..5e29e7cd7a5 100644
D3DSTATE_TO_STR(WINED3D_RS_SRGBWRITEENABLE);
D3DSTATE_TO_STR(WINED3D_RS_DEPTHBIAS);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index b62aeb26bbd..e95911ed0d5 100644
index 4fca08dbdb7..fd27a37b1a0 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -272,6 +272,7 @@ static inline enum complex_fixup get_complex_fixup(struct color_fixup_desc fixup
@ -338,19 +338,19 @@ index b62aeb26bbd..e95911ed0d5 100644
struct min_lookup
{
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 11a5bc4e933..6c5c5df83ff 100644
index 5e9e45942be..81faf2d4356 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -384,8 +384,20 @@ enum wined3d_render_state
WINED3D_RS_DESTBLENDALPHA = 208,
@@ -383,8 +383,20 @@ enum wined3d_render_state
WINED3D_RS_BLENDOPALPHA = 209,
WINED3D_RS_DEPTHCLIP = 210,
+ WINED3D_RS_COLORWRITEENABLE4 = 211,
+ WINED3D_RS_COLORWRITEENABLE5 = 212,
+ WINED3D_RS_COLORWRITEENABLE6 = 213,
+ WINED3D_RS_COLORWRITEENABLE7 = 214,
WINED3D_RS_DEPTHBIASCLAMP = 211,
+ WINED3D_RS_COLORWRITEENABLE4 = 212,
+ WINED3D_RS_COLORWRITEENABLE5 = 213,
+ WINED3D_RS_COLORWRITEENABLE6 = 214,
+ WINED3D_RS_COLORWRITEENABLE7 = 215,
};
-#define WINEHIGHEST_RENDER_STATE WINED3D_RS_DEPTHCLIP
-#define WINEHIGHEST_RENDER_STATE WINED3D_RS_DEPTHBIASCLAMP
+#define WINEHIGHEST_RENDER_STATE WINED3D_RS_COLORWRITEENABLE7
+
+static inline enum wined3d_render_state WINED3D_RS_COLORWRITE(int index)
@ -364,5 +364,5 @@ index 11a5bc4e933..6c5c5df83ff 100644
enum wined3d_blend
{
--
2.13.1
2.14.1