On 3 September 2015 at 12:52, Stefan Dösinger stefan@codeweavers.com wrote:
@@ -3034,32 +3034,29 @@ static HRESULT CDECL device_parent_volume_created(struct wined3d_device_parent * return D3D_OK; }
-static HRESULT CDECL device_parent_create_swapchain_surface(struct wined3d_device_parent *device_parent,
void *container_parent, const struct wined3d_resource_desc *desc, struct wined3d_surface **surface)
+static HRESULT CDECL device_parent_create_swapchain_texture(struct wined3d_device_parent *device_parent,
void *container_parent, const struct wined3d_resource_desc *desc, struct wined3d_texture **texture)
{ struct d3d8_device *device = device_from_device_parent(device_parent); struct wined3d_resource_desc texture_desc;
- struct wined3d_surface *surface; struct d3d8_surface *d3d_surface;
struct wined3d_texture *texture; HRESULT hr;
TRACE("device_parent %p, container_parent %p, desc %p, surface %p.\n",
device_parent, container_parent, desc, surface);
TRACE("device_parent %p, container_parent %p, desc %p, texture %p.\n",
device_parent, container_parent, desc, texture);
texture_desc = *desc; texture_desc.resource_type = WINED3D_RTYPE_TEXTURE;
Now that you're creating a texture, you don't need to change the resource type anymore. You should just be able to pass "desc" to wined3d_texture_create().
- *surface = wined3d_surface_from_resource(wined3d_texture_get_sub_resource(texture, 0));
- wined3d_surface_incref(*surface);
- wined3d_texture_decref(texture);
- d3d_surface = wined3d_surface_get_parent(*surface);
- surface = wined3d_surface_from_resource(wined3d_texture_get_sub_resource(*texture, 0));
- d3d_surface = wined3d_surface_get_parent(surface);
wined3d_resource_get_parent().
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 765af0d..d50cd84 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4685,32 +4685,37 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, } if (swapchain->desc.enable_auto_depth_stencil) {
struct wined3d_resource_desc surface_desc;
struct wined3d_surface *surface;
struct wined3d_resource_desc texture_desc;
struct wined3d_texture *texture;
struct wined3d_rendertarget_view_desc view_desc; TRACE("Creating the depth stencil buffer\n");
surface_desc.resource_type = WINED3D_RTYPE_SURFACE;
surface_desc.format = swapchain->desc.auto_depth_stencil_format;
surface_desc.multisample_type = swapchain->desc.multisample_type;
surface_desc.multisample_quality = swapchain->desc.multisample_quality;
surface_desc.usage = WINED3DUSAGE_DEPTHSTENCIL;
surface_desc.pool = WINED3D_POOL_DEFAULT;
surface_desc.width = swapchain->desc.backbuffer_width;
surface_desc.height = swapchain->desc.backbuffer_height;
surface_desc.depth = 1;
surface_desc.size = 0;
if (FAILED(hr = device->device_parent->ops->create_swapchain_surface(device->device_parent,
device->device_parent, &surface_desc, &surface)))
texture_desc.resource_type = WINED3D_RTYPE_SURFACE;
This looks wrong. It probably works anyway because you overwrite the resource type in the create_swapchain_texture() implementations.