Commit 7c5fd62e authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Get rid of the "onscreen_depth_stencil" field from struct wined3d_device.

parent 41738bae
...@@ -634,11 +634,6 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const ...@@ -634,11 +634,6 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
{ {
wined3d_texture_validate_location(prev_surface->container, wined3d_texture_validate_location(prev_surface->container,
prev->sub_resource_idx, WINED3D_LOCATION_DISCARDED); prev->sub_resource_idx, WINED3D_LOCATION_DISCARDED);
if (prev_surface == device->onscreen_depth_stencil)
{
wined3d_texture_decref(device->onscreen_depth_stencil->container);
device->onscreen_depth_stencil = NULL;
}
} }
} }
......
...@@ -198,20 +198,6 @@ void device_context_remove(struct wined3d_device *device, struct wined3d_context ...@@ -198,20 +198,6 @@ void device_context_remove(struct wined3d_device *device, struct wined3d_context
device->contexts = new_array; device->contexts = new_array;
} }
void device_switch_onscreen_ds(struct wined3d_device *device,
struct wined3d_context *context, struct wined3d_surface *depth_stencil)
{
if (device->onscreen_depth_stencil)
{
surface_load_location(device->onscreen_depth_stencil, context, WINED3D_LOCATION_TEXTURE_RGB);
wined3d_texture_invalidate_location(device->onscreen_depth_stencil->container,
surface_get_sub_resource_idx(device->onscreen_depth_stencil), ~WINED3D_LOCATION_TEXTURE_RGB);
wined3d_texture_decref(device->onscreen_depth_stencil->container);
}
device->onscreen_depth_stencil = depth_stencil;
wined3d_texture_incref(device->onscreen_depth_stencil->container);
}
static BOOL is_full_clear(const struct wined3d_surface *target, const RECT *draw_rect, const RECT *clear_rect) static BOOL is_full_clear(const struct wined3d_surface *target, const RECT *draw_rect, const RECT *clear_rect)
{ {
unsigned int height = wined3d_texture_get_level_height(target->container, target->texture_level); unsigned int height = wined3d_texture_get_level_height(target->container, target->texture_level);
...@@ -300,8 +286,6 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c ...@@ -300,8 +286,6 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
{ {
DWORD location = render_offscreen ? dsv->resource->draw_binding : WINED3D_LOCATION_DRAWABLE; DWORD location = render_offscreen ? dsv->resource->draw_binding : WINED3D_LOCATION_DRAWABLE;
if (!render_offscreen && depth_stencil != device->onscreen_depth_stencil)
device_switch_onscreen_ds(device, context, depth_stencil);
surface_load_location(depth_stencil, context, location); surface_load_location(depth_stencil, context, location);
} }
...@@ -1086,7 +1070,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) ...@@ -1086,7 +1070,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
struct wined3d_resource *resource, *cursor; struct wined3d_resource *resource, *cursor;
const struct wined3d_gl_info *gl_info; const struct wined3d_gl_info *gl_info;
struct wined3d_context *context; struct wined3d_context *context;
struct wined3d_surface *surface;
UINT i; UINT i;
TRACE("device %p.\n", device); TRACE("device %p.\n", device);
...@@ -1133,14 +1116,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) ...@@ -1133,14 +1116,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
context_release(context); context_release(context);
/* Release the buffers (with sanity checks) */
if (device->onscreen_depth_stencil)
{
surface = device->onscreen_depth_stencil;
device->onscreen_depth_stencil = NULL;
wined3d_texture_decref(surface->container);
}
if (device->fb.depth_stencil) if (device->fb.depth_stencil)
{ {
struct wined3d_rendertarget_view *view = device->fb.depth_stencil; struct wined3d_rendertarget_view *view = device->fb.depth_stencil;
...@@ -4636,12 +4611,6 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, ...@@ -4636,12 +4611,6 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
} }
wined3d_device_set_depth_stencil_view(device, NULL); wined3d_device_set_depth_stencil_view(device, NULL);
if (device->onscreen_depth_stencil)
{
wined3d_texture_decref(device->onscreen_depth_stencil->container);
device->onscreen_depth_stencil = NULL;
}
if (reset_state) if (reset_state)
{ {
LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
......
...@@ -466,12 +466,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s ...@@ -466,12 +466,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(dsv); struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(dsv);
if (state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_ZENABLE]) if (state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_ZENABLE])
{
if (!context->render_offscreen && ds != device->onscreen_depth_stencil)
device_switch_onscreen_ds(device, context, ds);
wined3d_texture_load_location(ds->container, dsv->sub_resource_idx, context, location); wined3d_texture_load_location(ds->container, dsv->sub_resource_idx, context, location);
}
else else
wined3d_texture_prepare_location(ds->container, dsv->sub_resource_idx, context, location); wined3d_texture_prepare_location(ds->container, dsv->sub_resource_idx, context, location);
} }
......
...@@ -621,15 +621,8 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, ...@@ -621,15 +621,8 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
if (ds && (swapchain->desc.flags & WINED3D_SWAPCHAIN_DISCARD_DEPTHSTENCIL if (ds && (swapchain->desc.flags & WINED3D_SWAPCHAIN_DISCARD_DEPTHSTENCIL
|| ds->container->flags & WINED3D_TEXTURE_DISCARD)) || ds->container->flags & WINED3D_TEXTURE_DISCARD))
{
wined3d_texture_validate_location(ds->container, wined3d_texture_validate_location(ds->container,
fb->depth_stencil->sub_resource_idx, WINED3D_LOCATION_DISCARDED); fb->depth_stencil->sub_resource_idx, WINED3D_LOCATION_DISCARDED);
if (ds == swapchain->device->onscreen_depth_stencil)
{
wined3d_texture_decref(swapchain->device->onscreen_depth_stencil->container);
swapchain->device->onscreen_depth_stencil = NULL;
}
}
} }
context_release(context); context_release(context);
......
...@@ -2560,7 +2560,6 @@ struct wined3d_device ...@@ -2560,7 +2560,6 @@ struct wined3d_device
/* Render Target Support */ /* Render Target Support */
struct wined3d_fb_state fb; struct wined3d_fb_state fb;
struct wined3d_surface *onscreen_depth_stencil;
struct wined3d_rendertarget_view *auto_depth_stencil_view; struct wined3d_rendertarget_view *auto_depth_stencil_view;
/* For rendering to a texture using glCopyTexImage */ /* For rendering to a texture using glCopyTexImage */
...@@ -2612,8 +2611,6 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL ...@@ -2612,8 +2611,6 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) DECLSPEC_HIDDEN; UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) DECLSPEC_HIDDEN;
void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void device_switch_onscreen_ds(struct wined3d_device *device, struct wined3d_context *context,
struct wined3d_surface *depth_stencil) DECLSPEC_HIDDEN;
void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN; void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN;
static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state) static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment