[PATCH 1/3] wined3d: Prepare the destination location in surface_load_location.
Stefan Dösinger
stefan at codeweavers.com
Tue Nov 3 16:55:12 CST 2015
Instead of its sub-functions. See comments in patch 3 for details about
surface_blt_fbo.
This fixes bug 39536. surface_load_location didn't prepare the
multisample renderbuffer.
The next patches will consistently move the responsibility to the caller
of surface_load_location. This is already the case for everything but
textures. For this reason I don't have to handle WINED3D_LOCATION_BUFFER
yet.
Please note that none of these changes intend to address the problem
that we don't initialize the renderbuffer from system memory.
---
dlls/wined3d/surface.c | 35 ++++++++++++++++++++++++++++++-----
1 file changed, 30 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index e1633fc..89fefbb 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -914,9 +914,6 @@ static void surface_blt_fbo(const struct wined3d_device *device,
surface_load_location(src_surface, old_ctx, src_location);
if (!surface_is_full_rect(dst_surface, &dst_rect))
surface_load_location(dst_surface, old_ctx, dst_location);
- else
- wined3d_surface_prepare(dst_surface, old_ctx, dst_location);
-
if (src_location == WINED3D_LOCATION_DRAWABLE) required_rt = src_surface;
else if (dst_location == WINED3D_LOCATION_DRAWABLE) required_rt = dst_surface;
@@ -2851,7 +2848,6 @@ void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb, struct
gl_info = context->gl_info;
device_invalidate_state(device, STATE_FRAMEBUFFER);
- wined3d_texture_prepare_texture(surface->container, context, srgb);
wined3d_texture_bind_and_dirtify(surface->container, context, srgb);
TRACE("Reading back offscreen render target %p.\n", surface);
@@ -3990,7 +3986,6 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
surface_load_location(surface, context, WINED3D_LOCATION_SYSMEM);
}
- wined3d_texture_prepare_texture(texture, context, srgb);
wined3d_texture_bind_and_dirtify(texture, context, srgb);
width = surface->resource.width;
@@ -4131,6 +4126,8 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co
return WINED3DERR_DEVICELOST;
}
+ wined3d_surface_prepare(surface, context, location);
+
switch (location)
{
case WINED3D_LOCATION_DIB:
@@ -5311,6 +5308,9 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
TRACE("Using FBO blit.\n");
context = context_acquire(device, NULL);
+
+ wined3d_surface_prepare(dst_surface, context, dst_surface->container->resource.draw_binding);
+
surface_blt_fbo(device, context, filter,
src_surface, src_surface->container->resource.draw_binding, &src_rect,
dst_surface, dst_surface->container->resource.draw_binding, &dst_rect);
@@ -5492,6 +5492,24 @@ void wined3d_surface_prepare(struct wined3d_surface *surface, struct wined3d_con
{
switch (location)
{
+ case WINED3D_LOCATION_SYSMEM:
+ surface_prepare_system_memory(surface);
+ break;
+
+ case WINED3D_LOCATION_USER_MEMORY:
+ if (!surface->user_memory)
+ ERR("Map binding is set to WINED3D_LOCATION_USER_MEMORY but surface->user_memory is NULL.\n");
+ break;
+
+ case WINED3D_LOCATION_DIB:
+ if (!surface->dib.bitmap_data)
+ ERR("Map binding is set to WINED3D_LOCATION_DIB but surface->dib.bitmap_data is NULL.\n");
+ break;
+
+ case WINED3D_LOCATION_BUFFER:
+ /* Intentionally not yet handled in this patch. */
+ break;
+
case WINED3D_LOCATION_TEXTURE_RGB:
wined3d_texture_prepare_texture(surface->container, context, FALSE);
break;
@@ -5500,6 +5518,10 @@ void wined3d_surface_prepare(struct wined3d_surface *surface, struct wined3d_con
wined3d_texture_prepare_texture(surface->container, context, TRUE);
break;
+ case WINED3D_LOCATION_DRAWABLE:
+ /* Nothing to do. */
+ break;
+
case WINED3D_LOCATION_RB_MULTISAMPLE:
surface_prepare_rb(surface, context->gl_info, TRUE);
break;
@@ -5507,5 +5529,8 @@ void wined3d_surface_prepare(struct wined3d_surface *surface, struct wined3d_con
case WINED3D_LOCATION_RB_RESOLVED:
surface_prepare_rb(surface, context->gl_info, FALSE);
break;
+
+ default:
+ ERR("Trying to prepare unknown location %#x\n", location);
}
}
--
2.4.10
More information about the wine-patches
mailing list