Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d8/device.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index bcd25e9245..0721d2a501 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -1606,6 +1606,7 @@ static HRESULT WINAPI d3d8_device_Clear(IDirect3DDevice8 *iface, DWORD rect_coun }
wined3d_mutex_lock(); + wined3d_device_apply_stateblock(device->wined3d_device, device->state); hr = wined3d_device_clear(device->wined3d_device, rect_count, (const RECT *)rects, flags, &c, z, stencil); wined3d_mutex_unlock();
@@ -2287,6 +2288,7 @@ static HRESULT WINAPI d3d8_device_ValidateDevice(IDirect3DDevice8 *iface, DWORD TRACE("iface %p, pass_count %p.\n", iface, pass_count);
wined3d_mutex_lock(); + wined3d_device_apply_stateblock(device->wined3d_device, device->state); hr = wined3d_device_validate_device(device->wined3d_device, pass_count); wined3d_mutex_unlock();
@@ -2417,6 +2419,7 @@ static HRESULT WINAPI d3d8_device_DrawPrimitive(IDirect3DDevice8 *iface,
vertex_count = vertex_count_from_primitive_count(primitive_type, primitive_count); wined3d_mutex_lock(); + wined3d_device_apply_stateblock(device->wined3d_device, device->state); d3d8_device_upload_sysmem_vertex_buffers(device, start_vertex, vertex_count); wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0); hr = wined3d_device_draw_primitive(device->wined3d_device, start_vertex, vertex_count); @@ -2439,6 +2442,7 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitive(IDirect3DDevice8 *iface,
index_count = vertex_count_from_primitive_count(primitive_type, primitive_count); wined3d_mutex_lock(); + wined3d_device_apply_stateblock(device->wined3d_device, device->state); base_vertex_index = wined3d_device_get_base_vertex_index(device->wined3d_device); d3d8_device_upload_sysmem_vertex_buffers(device, base_vertex_index + min_vertex_idx, vertex_count); d3d8_device_upload_sysmem_index_buffer(device, start_idx, index_count); @@ -2509,6 +2513,7 @@ static HRESULT WINAPI d3d8_device_DrawPrimitiveUP(IDirect3DDevice8 *iface, }
wined3d_mutex_lock(); + wined3d_device_apply_stateblock(device->wined3d_device, device->state); hr = d3d8_device_prepare_vertex_buffer(device, size); if (FAILED(hr)) goto done; @@ -2610,6 +2615,7 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface
wined3d_mutex_lock();
+ wined3d_device_apply_stateblock(device->wined3d_device, device->state); hr = d3d8_device_prepare_vertex_buffer(device, vtx_size); if (FAILED(hr)) goto done; @@ -2689,6 +2695,8 @@ static HRESULT WINAPI d3d8_device_ProcessVertices(IDirect3DDevice8 *iface, UINT
wined3d_mutex_lock();
+ wined3d_device_apply_stateblock(device->wined3d_device, device->state); + /* Note that an alternative approach would be to simply create these * buffers with WINED3D_RESOURCE_ACCESS_MAP_R and update them here like we * do for draws. In some regards that would be easier, but it seems less
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d8/d3d8_private.h | 3 +++ dlls/d3d8/device.c | 30 ++++++++++++++++++++++++++++++ dlls/d3d8/directx.c | 13 +++++++++++-- 3 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index f262d12fc7..26451255c0 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -42,6 +42,9 @@ #define D3D8_MAX_VERTEX_SHADER_CONSTANTF 256 #define D3D8_MAX_STREAMS 16
+#define D3DFMT_RESZ MAKEFOURCC('R','E','S','Z') +#define D3D8_RESZ_CODE 0x7fa05000 + /* CreateVertexShader can return > 0xFFFF */ #define VS_HIGHESTFIXEDFXF 0xF0000000
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 0721d2a501..4c2c350ec2 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -1846,6 +1846,34 @@ static HRESULT WINAPI d3d8_device_GetClipPlane(IDirect3DDevice8 *iface, DWORD in return hr; }
+static void resolve_depth_buffer(struct d3d8_device *device) +{ + const struct wined3d_stateblock_state *state = wined3d_stateblock_get_state(device->state); + struct wined3d_rendertarget_view *wined3d_dsv; + struct wined3d_resource *dst_resource; + struct wined3d_texture *dst_texture; + struct wined3d_resource_desc desc; + struct d3d8_surface *d3d8_dsv; + + if (!(dst_texture = state->textures[0])) + return; + dst_resource = wined3d_texture_get_resource(dst_texture); + wined3d_resource_get_desc(dst_resource, &desc); + if (desc.format != WINED3DFMT_D24_UNORM_S8_UINT + && desc.format != WINED3DFMT_X8D24_UNORM + && desc.format != WINED3DFMT_DF16 + && desc.format != WINED3DFMT_DF24 + && desc.format != WINED3DFMT_INTZ) + return; + + if (!(wined3d_dsv = wined3d_device_get_depth_stencil_view(device->wined3d_device))) + return; + d3d8_dsv = wined3d_rendertarget_view_get_sub_resource_parent(wined3d_dsv); + + wined3d_device_resolve_sub_resource(device->wined3d_device, dst_resource, 0, + wined3d_rendertarget_view_get_resource(wined3d_dsv), d3d8_dsv->sub_resource_idx, desc.format); +} + static HRESULT WINAPI d3d8_device_SetRenderState(IDirect3DDevice8 *iface, D3DRENDERSTATETYPE state, DWORD value) { @@ -1859,6 +1887,8 @@ static HRESULT WINAPI d3d8_device_SetRenderState(IDirect3DDevice8 *iface, wined3d_stateblock_set_render_state(device->update_state, state, value); if (!device->recording) wined3d_device_set_render_state(device->wined3d_device, state, value); + if (state == D3DRS_POINTSIZE && value == D3D8_RESZ_CODE) + resolve_depth_buffer(device); wined3d_mutex_unlock();
return D3D_OK; diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c index 9a9abeccca..d1f8872d12 100644 --- a/dlls/d3d8/directx.c +++ b/dlls/d3d8/directx.c @@ -266,8 +266,17 @@ static HRESULT WINAPI d3d8_CheckDeviceFormat(IDirect3D8 *iface, UINT adapter, D3 }
wined3d_mutex_lock(); - hr = wined3d_check_device_format(d3d8->wined3d, adapter, device_type, wined3dformat_from_d3dformat(adapter_format), - usage, bind_flags, wined3d_rtype, wined3dformat_from_d3dformat(format)); + if (format == D3DFMT_RESZ && resource_type == D3DRTYPE_SURFACE && usage == D3DUSAGE_RENDERTARGET) + { + DWORD levels; + hr = wined3d_check_device_multisample_type(d3d8->wined3d, adapter, device_type, + WINED3DFMT_D24_UNORM_S8_UINT, FALSE, WINED3D_MULTISAMPLE_NON_MASKABLE, &levels); + if (SUCCEEDED(hr) && !levels) + hr = D3DERR_NOTAVAILABLE; + } + else + hr = wined3d_check_device_format(d3d8->wined3d, adapter, device_type, wined3dformat_from_d3dformat(adapter_format), + usage, bind_flags, wined3d_rtype, wined3dformat_from_d3dformat(format)); wined3d_mutex_unlock();
return hr;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d8/device.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 4c2c350ec2..b0a0491890 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -1885,8 +1885,6 @@ static HRESULT WINAPI d3d8_device_SetRenderState(IDirect3DDevice8 *iface, if (state == D3DRS_ZBIAS) state = WINED3D_RS_DEPTHBIAS; wined3d_stateblock_set_render_state(device->update_state, state, value); - if (!device->recording) - wined3d_device_set_render_state(device->wined3d_device, state, value); if (state == D3DRS_POINTSIZE && value == D3D8_RESZ_CODE) resolve_depth_buffer(device); wined3d_mutex_unlock();
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d8/device.c | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index b0a0491890..71717852bb 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -927,9 +927,6 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface, wined3d_stateblock_set_render_state(device->state, WINED3D_RS_POINTSIZE_MIN, 0); wined3d_stateblock_set_render_state(device->state, WINED3D_RS_ZENABLE, !!swapchain_desc.enable_auto_depth_stencil); - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_POINTSIZE_MIN, 0); - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ZENABLE, - !!swapchain_desc.enable_auto_depth_stencil); device_reset_viewport_state(device); device->device_state = D3D8_DEVICE_STATE_OK; } @@ -3769,9 +3766,6 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine wined3d_stateblock_set_render_state(device->state, WINED3D_RS_ZENABLE, !!swapchain_desc.enable_auto_depth_stencil); wined3d_stateblock_set_render_state(device->state, WINED3D_RS_POINTSIZE_MIN, 0); - wined3d_device_set_render_state(device->wined3d_device, - WINED3D_RS_ZENABLE, !!swapchain_desc.enable_auto_depth_stencil); - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_POINTSIZE_MIN, 0); device_reset_viewport_state(device); wined3d_mutex_unlock();
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com