You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
wined3d-CSMT_Main: Reenable CSMT patchset.
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
From f4f3123974b03c4c7d671ce36f41bef336b1a8a6 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 6 Mar 2016 22:08:15 +0100
|
||||
Subject: Revert "wined3d: Call wined3d_texture_set_dirty() in
|
||||
wined3d_volume_invalidate_location()."
|
||||
|
||||
This reverts commit b23f21a9fb6e09afad6ac3327233130f8be979b2.
|
||||
---
|
||||
dlls/wined3d/volume.c | 7 +++----
|
||||
1 file changed, 3 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
|
||||
index 457067d..2d88af6 100644
|
||||
--- a/dlls/wined3d/volume.c
|
||||
+++ b/dlls/wined3d/volume.c
|
||||
@@ -109,11 +109,7 @@ void wined3d_volume_validate_location(struct wined3d_volume *volume, DWORD locat
|
||||
void wined3d_volume_invalidate_location(struct wined3d_volume *volume, DWORD location)
|
||||
{
|
||||
TRACE("Volume %p, clearing %s.\n", volume, wined3d_debug_location(location));
|
||||
-
|
||||
- if (location & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
|
||||
- wined3d_texture_set_dirty(volume->container);
|
||||
volume->locations &= ~location;
|
||||
-
|
||||
TRACE("new location flags are %s.\n", wined3d_debug_location(volume->locations));
|
||||
}
|
||||
|
||||
@@ -556,7 +552,10 @@ HRESULT wined3d_volume_map(struct wined3d_volume *volume,
|
||||
}
|
||||
|
||||
if (!(flags & (WINED3D_MAP_NO_DIRTY_UPDATE | WINED3D_MAP_READONLY)))
|
||||
+ {
|
||||
+ wined3d_texture_set_dirty(texture);
|
||||
wined3d_volume_invalidate_location(volume, ~volume->resource.map_binding);
|
||||
+ }
|
||||
|
||||
volume->resource.map_count++;
|
||||
|
||||
--
|
||||
2.7.1
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
From 5d3739d94ccb7e4a7bfaebf33cdb399a0707f9e7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
|
||||
Date: Thu, 29 Oct 2015 15:41:59 +0100
|
||||
Subject: wined3d: Make surface_load_location return nothing.
|
||||
|
||||
FIXME: I guess Henri disagrees.
|
||||
---
|
||||
dlls/wined3d/surface.c | 12 ++++++------
|
||||
dlls/wined3d/texture.c | 3 ++-
|
||||
dlls/wined3d/wined3d_private.h | 2 +-
|
||||
3 files changed, 9 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
|
||||
index e0d7c80..3435d17 100644
|
||||
--- a/dlls/wined3d/surface.c
|
||||
+++ b/dlls/wined3d/surface.c
|
||||
@@ -3035,7 +3035,7 @@ static void surface_load_renderbuffer(struct wined3d_surface *surface, struct wi
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. Context may be NULL in ddraw-only mode. */
|
||||
-HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location)
|
||||
+void surface_load_location(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location)
|
||||
{
|
||||
unsigned int sub_resource_idx = surface_get_sub_resource_idx(surface);
|
||||
struct wined3d_texture *texture = surface->container;
|
||||
@@ -3053,7 +3053,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co
|
||||
|| (surface->ds_current_size.cx == surface_w && surface->ds_current_size.cy == surface_h)))
|
||||
{
|
||||
TRACE("Location (%#x) is already up to date.\n", location);
|
||||
- return WINED3D_OK;
|
||||
+ return;
|
||||
}
|
||||
|
||||
if (WARN_ON(d3d))
|
||||
@@ -3091,7 +3091,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co
|
||||
|
||||
FIXME("Unimplemented copy from %s to %s for depth/stencil buffers.\n",
|
||||
wined3d_debug_location(sub_resource->locations), wined3d_debug_location(location));
|
||||
- return WINED3DERR_INVALIDCALL;
|
||||
+ return;
|
||||
}
|
||||
|
||||
switch (location)
|
||||
@@ -3104,7 +3104,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co
|
||||
|
||||
case WINED3D_LOCATION_DRAWABLE:
|
||||
if (FAILED(hr = surface_load_drawable(surface, context)))
|
||||
- return hr;
|
||||
+ return;
|
||||
break;
|
||||
|
||||
case WINED3D_LOCATION_RB_RESOLVED:
|
||||
@@ -3116,7 +3116,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co
|
||||
case WINED3D_LOCATION_TEXTURE_SRGB:
|
||||
if (FAILED(hr = surface_load_texture(surface, context,
|
||||
location == WINED3D_LOCATION_TEXTURE_SRGB)))
|
||||
- return hr;
|
||||
+ return;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -3133,7 +3133,7 @@ done:
|
||||
surface->ds_current_size.cy = surface_h;
|
||||
}
|
||||
|
||||
- return WINED3D_OK;
|
||||
+ return;
|
||||
}
|
||||
|
||||
static HRESULT ffp_blit_alloc(struct wined3d_device *device) { return WINED3D_OK; }
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index 3a03bb6..fcea428 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -1353,7 +1353,8 @@ static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int
|
||||
static BOOL texture2d_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
struct wined3d_context *context, DWORD location)
|
||||
{
|
||||
- return SUCCEEDED(surface_load_location(texture->sub_resources[sub_resource_idx].u.surface, context, location));
|
||||
+ surface_load_location(texture->sub_resources[sub_resource_idx].u.surface, context, location);
|
||||
+ return TRUE;
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 274f620..d5fa2f0 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -2708,7 +2708,7 @@ void surface_get_drawable_size(const struct wined3d_surface *surface, const stru
|
||||
unsigned int *width, unsigned int *height) DECLSPEC_HIDDEN;
|
||||
void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb,
|
||||
struct wined3d_context *context) DECLSPEC_HIDDEN;
|
||||
-HRESULT surface_load_location(struct wined3d_surface *surface,
|
||||
+void surface_load_location(struct wined3d_surface *surface,
|
||||
struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
|
||||
void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN;
|
||||
void wined3d_surface_prepare(struct wined3d_surface *surface, struct wined3d_context *context,
|
||||
--
|
||||
2.8.0
|
||||
|
||||
@@ -1,167 +0,0 @@
|
||||
From 50e69e1a480a8910aa50b5e6201213ef9d35fea5 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 6 Mar 2016 22:08:35 +0100
|
||||
Subject: Revert "wined3d: Merge surface_remove_pbo() and
|
||||
wined3d_volume_free_pbo()."
|
||||
|
||||
This reverts commit 5141c082caabd0f18698fe611b57e885adf25fe7.
|
||||
---
|
||||
dlls/wined3d/surface.c | 19 ++++++++++++++++++-
|
||||
dlls/wined3d/texture.c | 27 ---------------------------
|
||||
dlls/wined3d/volume.c | 22 ++++++++++++++++++++++
|
||||
dlls/wined3d/wined3d_private.h | 2 --
|
||||
4 files changed, 40 insertions(+), 30 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
|
||||
index 469a493..3cd3782 100644
|
||||
--- a/dlls/wined3d/surface.c
|
||||
+++ b/dlls/wined3d/surface.c
|
||||
@@ -996,6 +996,19 @@ static HRESULT wined3d_surface_depth_blt(struct wined3d_surface *src_surface, DW
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
+/* Context activation is done by the caller. */
|
||||
+static void surface_remove_pbo(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info)
|
||||
+{
|
||||
+ GLuint *buffer_object;
|
||||
+
|
||||
+ buffer_object = &surface->container->sub_resources[surface_get_sub_resource_idx(surface)].buffer_object;
|
||||
+ GL_EXTCALL(glDeleteBuffers(1, buffer_object));
|
||||
+ checkGLcall("glDeleteBuffers(1, buffer_object)");
|
||||
+
|
||||
+ *buffer_object = 0;
|
||||
+ surface_invalidate_location(surface, WINED3D_LOCATION_BUFFER);
|
||||
+}
|
||||
+
|
||||
static ULONG surface_resource_incref(struct wined3d_resource *resource)
|
||||
{
|
||||
struct wined3d_surface *surface = surface_from_resource(resource);
|
||||
@@ -1058,6 +1071,10 @@ static void surface_unload(struct wined3d_resource *resource)
|
||||
surface_invalidate_location(surface, ~surface->resource.map_binding);
|
||||
}
|
||||
|
||||
+ /* Destroy PBOs, but load them into real sysmem before */
|
||||
+ if (surface->container->sub_resources[surface_get_sub_resource_idx(surface)].buffer_object)
|
||||
+ surface_remove_pbo(surface, gl_info);
|
||||
+
|
||||
/* Destroy fbo render buffers. This is needed for implicit render targets, for
|
||||
* all application-created targets the application has to release the surface
|
||||
* before calling _Reset
|
||||
@@ -3664,7 +3681,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
|
||||
|
||||
surface_prepare_map_memory(surface);
|
||||
surface_load_location(surface, context, surface->resource.map_binding);
|
||||
- wined3d_texture_remove_buffer_object(texture, surface_get_sub_resource_idx(surface), gl_info);
|
||||
+ surface_remove_pbo(surface, gl_info);
|
||||
}
|
||||
|
||||
surface_get_memory(surface, &data, surface->locations);
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index 90a3978..9846f07 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -74,23 +74,6 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
-/* Context activation is done by the caller. */
|
||||
-void wined3d_texture_remove_buffer_object(struct wined3d_texture *texture,
|
||||
- unsigned int sub_resource_idx, const struct wined3d_gl_info *gl_info)
|
||||
-{
|
||||
- GLuint *buffer_object;
|
||||
-
|
||||
- buffer_object = &texture->sub_resources[sub_resource_idx].buffer_object;
|
||||
- GL_EXTCALL(glDeleteBuffers(1, buffer_object));
|
||||
- checkGLcall("glDeleteBuffers");
|
||||
- texture->texture_ops->texture_sub_resource_invalidate_location(
|
||||
- texture->sub_resources[sub_resource_idx].resource, WINED3D_LOCATION_BUFFER);
|
||||
- *buffer_object = 0;
|
||||
-
|
||||
- TRACE("Deleted buffer object %u for texture %p, sub-resource %u.\n",
|
||||
- *buffer_object, texture, sub_resource_idx);
|
||||
-}
|
||||
-
|
||||
/* A GL context is provided by the caller */
|
||||
static void gltexture_delete(struct wined3d_device *device, const struct wined3d_gl_info *gl_info,
|
||||
struct gl_texture *tex)
|
||||
@@ -996,7 +979,6 @@ static void wined3d_texture_unload(struct wined3d_resource *resource)
|
||||
{
|
||||
struct wined3d_texture *texture = wined3d_texture_from_resource(resource);
|
||||
UINT sub_count = texture->level_count * texture->layer_count;
|
||||
- struct wined3d_context *context = NULL;
|
||||
UINT i;
|
||||
|
||||
TRACE("texture %p.\n", texture);
|
||||
@@ -1006,16 +988,7 @@ static void wined3d_texture_unload(struct wined3d_resource *resource)
|
||||
struct wined3d_resource *sub_resource = texture->sub_resources[i].resource;
|
||||
|
||||
sub_resource->resource_ops->resource_unload(sub_resource);
|
||||
-
|
||||
- if (texture->sub_resources[i].buffer_object)
|
||||
- {
|
||||
- if (!context)
|
||||
- context = context_acquire(texture->resource.device, NULL);
|
||||
- wined3d_texture_remove_buffer_object(texture, i, context->gl_info);
|
||||
- }
|
||||
}
|
||||
- if (context)
|
||||
- context_release(context);
|
||||
|
||||
wined3d_texture_force_reload(texture);
|
||||
wined3d_texture_unload_gl_texture(texture);
|
||||
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
|
||||
index 2d88af6..fcadd39 100644
|
||||
--- a/dlls/wined3d/volume.c
|
||||
+++ b/dlls/wined3d/volume.c
|
||||
@@ -362,6 +362,19 @@ void wined3d_volume_load(struct wined3d_volume *volume, struct wined3d_context *
|
||||
srgb_mode ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB);
|
||||
}
|
||||
|
||||
+static void wined3d_volume_free_pbo(struct wined3d_volume *volume)
|
||||
+{
|
||||
+ GLuint *buffer_object = &volume->container->sub_resources[volume->texture_level].buffer_object;
|
||||
+ struct wined3d_context *context = context_acquire(volume->resource.device, NULL);
|
||||
+ const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
+
|
||||
+ TRACE("Deleting PBO %u belonging to volume %p.\n", *buffer_object, volume);
|
||||
+ GL_EXTCALL(glDeleteBuffers(1, buffer_object));
|
||||
+ checkGLcall("glDeleteBuffers");
|
||||
+ *buffer_object = 0;
|
||||
+ context_release(context);
|
||||
+}
|
||||
+
|
||||
void wined3d_volume_cleanup(struct wined3d_volume *volume)
|
||||
{
|
||||
TRACE("volume %p.\n", volume);
|
||||
@@ -394,6 +407,15 @@ static void volume_unload(struct wined3d_resource *resource)
|
||||
wined3d_volume_invalidate_location(volume, ~WINED3D_LOCATION_DISCARDED);
|
||||
}
|
||||
|
||||
+ if (volume->container->sub_resources[volume->texture_level].buffer_object)
|
||||
+ {
|
||||
+ /* Should not happen because only dynamic default pool volumes
|
||||
+ * have a buffer, and those are not evicted by device_evit_managed_resources
|
||||
+ * and must be freed before a non-ex device reset. */
|
||||
+ ERR("Unloading a volume with a buffer\n");
|
||||
+ wined3d_volume_free_pbo(volume);
|
||||
+ }
|
||||
+
|
||||
/* The texture name is managed by the container. */
|
||||
|
||||
resource_unload(resource);
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index da36985..28121b7 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -2424,8 +2424,6 @@ void wined3d_texture_prepare_buffer_object(struct wined3d_texture *texture,
|
||||
unsigned int sub_resource_idx, const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
|
||||
void wined3d_texture_prepare_texture(struct wined3d_texture *texture,
|
||||
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
|
||||
-void wined3d_texture_remove_buffer_object(struct wined3d_texture *texture,
|
||||
- unsigned int sub_resource_idx, const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
|
||||
void wined3d_texture_set_dirty(struct wined3d_texture *texture) DECLSPEC_HIDDEN;
|
||||
void wined3d_texture_set_swapchain(struct wined3d_texture *texture,
|
||||
struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
|
||||
--
|
||||
2.7.1
|
||||
|
||||
@@ -0,0 +1,236 @@
|
||||
From e9556c0ee5a1e3ca28cfe317b63affa2ec99141d Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
|
||||
Date: Thu, 29 Oct 2015 17:33:23 +0100
|
||||
Subject: wined3d: Start to move surface/volume_load_location into the texture.
|
||||
|
||||
FIXME 1: This can be split up into a case by case replace.
|
||||
FIXME 2: This breaks some rtv->resource != buffer checks.
|
||||
|
||||
wined3d_surface_prepare will be moved into the texture a lot later, after
|
||||
moving allocation of all locations (including sysmem) there.
|
||||
---
|
||||
dlls/wined3d/context.c | 5 ++---
|
||||
dlls/wined3d/device.c | 11 ++++++-----
|
||||
dlls/wined3d/drawprim.c | 10 +++++-----
|
||||
dlls/wined3d/swapchain.c | 7 ++++---
|
||||
dlls/wined3d/texture.c | 21 +++++++++++++++------
|
||||
dlls/wined3d/wined3d_private.h | 2 ++
|
||||
6 files changed, 34 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
|
||||
index 114422b..d6a36c9 100644
|
||||
--- a/dlls/wined3d/context.c
|
||||
+++ b/dlls/wined3d/context.c
|
||||
@@ -2379,7 +2379,6 @@ static void context_validate_onscreen_formats(struct wined3d_context *context,
|
||||
{
|
||||
/* Onscreen surfaces are always in a swapchain */
|
||||
struct wined3d_swapchain *swapchain = context->current_rt.texture->swapchain;
|
||||
- struct wined3d_surface *surface;
|
||||
|
||||
if (context->render_offscreen || !depth_stencil) return;
|
||||
if (match_depth_stencil_format(swapchain->ds_format, depth_stencil->format)) return;
|
||||
@@ -2390,8 +2389,8 @@ static void context_validate_onscreen_formats(struct wined3d_context *context,
|
||||
WARN("Depth stencil format is not supported by WGL, rendering the backbuffer in an FBO\n");
|
||||
|
||||
/* The currently active context is the necessary context to access the swapchain's onscreen buffers */
|
||||
- surface = context->current_rt.texture->sub_resources[context->current_rt.sub_resource_idx].u.surface;
|
||||
- surface_load_location(surface, context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
+ wined3d_texture_load_location(context->current_rt.texture, context->current_rt.sub_resource_idx,
|
||||
+ context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
swapchain->render_to_fbo = TRUE;
|
||||
swapchain_update_draw_bindings(swapchain);
|
||||
context_set_render_offscreen(context, TRUE);
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index 312c8c1..8f5122a 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -324,14 +324,15 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
|
||||
for (i = 0; i < rt_count; ++i)
|
||||
{
|
||||
struct wined3d_rendertarget_view *rtv = fb->render_targets[i];
|
||||
- struct wined3d_surface *rt = wined3d_rendertarget_view_get_surface(rtv);
|
||||
|
||||
- if (rt && rtv->format->id != WINED3DFMT_NULL)
|
||||
+ if (rtv && rtv->format->id != WINED3DFMT_NULL)
|
||||
{
|
||||
+ struct wined3d_texture *rt = wined3d_texture_from_resource(fb->render_targets[i]->resource);
|
||||
+
|
||||
if (flags & WINED3DCLEAR_TARGET && !is_full_clear(target, draw_rect, rect_count ? clear_rect : NULL))
|
||||
- surface_load_location(rt, context, rtv->resource->draw_binding);
|
||||
+ wined3d_texture_load_location(rt, rtv->sub_resource_idx, context, rtv->resource->draw_binding);
|
||||
else
|
||||
- wined3d_texture_prepare_location(rt->container, rtv->sub_resource_idx,
|
||||
+ wined3d_texture_prepare_location(rt, rtv->sub_resource_idx,
|
||||
context, rtv->resource->draw_binding);
|
||||
}
|
||||
}
|
||||
@@ -4155,7 +4156,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
|
||||
if (!dst_point.x && !dst_point.y && src_rect.right == width && src_rect.bottom == height)
|
||||
wined3d_texture_prepare_texture(texture, context, FALSE);
|
||||
else
|
||||
- surface_load_location(surface, context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
+ wined3d_texture_load_location(texture, sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
wined3d_texture_bind_and_dirtify(texture, context, FALSE);
|
||||
|
||||
wined3d_surface_upload_data(surface, gl_info, resource->format,
|
||||
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
|
||||
index c086491..78628c5 100644
|
||||
--- a/dlls/wined3d/drawprim.c
|
||||
+++ b/dlls/wined3d/drawprim.c
|
||||
@@ -437,19 +437,19 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
|
||||
for (i = 0; i < gl_info->limits.buffers; ++i)
|
||||
{
|
||||
struct wined3d_rendertarget_view *rtv = fb->render_targets[i];
|
||||
- struct wined3d_surface *target = wined3d_rendertarget_view_get_surface(rtv);
|
||||
|
||||
- if (target && rtv->format->id != WINED3DFMT_NULL)
|
||||
+ if (rtv && rtv->format->id != WINED3DFMT_NULL)
|
||||
{
|
||||
+ struct wined3d_texture *target = wined3d_texture_from_resource(rtv->resource);
|
||||
if (state->render_states[WINED3D_RS_COLORWRITEENABLE])
|
||||
{
|
||||
- surface_load_location(target, context, rtv->resource->draw_binding);
|
||||
- wined3d_texture_invalidate_location(target->container,
|
||||
+ wined3d_texture_load_location(target, rtv->sub_resource_idx, context, rtv->resource->draw_binding);
|
||||
+ wined3d_texture_invalidate_location(target,
|
||||
rtv->sub_resource_idx, ~rtv->resource->draw_binding);
|
||||
}
|
||||
else
|
||||
{
|
||||
- wined3d_texture_prepare_location(target->container, rtv->sub_resource_idx,
|
||||
+ wined3d_texture_prepare_location(target, rtv->sub_resource_idx,
|
||||
context, rtv->resource->draw_binding);
|
||||
}
|
||||
}
|
||||
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
|
||||
index f65a00d..df840f3 100644
|
||||
--- a/dlls/wined3d/swapchain.c
|
||||
+++ b/dlls/wined3d/swapchain.c
|
||||
@@ -327,7 +327,7 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
|
||||
if (texture->resource.multisample_type)
|
||||
{
|
||||
location = WINED3D_LOCATION_RB_RESOLVED;
|
||||
- surface_load_location(back_buffer, context, location);
|
||||
+ wined3d_texture_load_location(texture, 0, context, location);
|
||||
}
|
||||
|
||||
context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, back_buffer, NULL, location);
|
||||
@@ -556,14 +556,15 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
|
||||
*/
|
||||
if (!swapchain->render_to_fbo && render_to_fbo && wined3d_settings.offscreen_rendering_mode == ORM_FBO)
|
||||
{
|
||||
- surface_load_location(back_buffer, context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
+ wined3d_texture_load_location(back_buffer->container, 0, context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
wined3d_texture_invalidate_location(back_buffer->container, 0, WINED3D_LOCATION_DRAWABLE);
|
||||
swapchain->render_to_fbo = TRUE;
|
||||
swapchain_update_draw_bindings(swapchain);
|
||||
}
|
||||
else
|
||||
{
|
||||
- surface_load_location(back_buffer, context, back_buffer->container->resource.draw_binding);
|
||||
+ wined3d_texture_load_location(swapchain->back_buffers[0], 0, context,
|
||||
+ swapchain->back_buffers[0]->resource.draw_binding);
|
||||
}
|
||||
|
||||
if (swapchain->render_to_fbo)
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index 465fb05..619105f 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -317,7 +317,7 @@ static void wined3d_texture_update_map_binding(struct wined3d_texture *texture)
|
||||
for (i = 0; i < sub_count; ++i)
|
||||
{
|
||||
if (texture->sub_resources[i].locations == texture->resource.map_binding
|
||||
- && !texture->texture_ops->texture_load_location(texture, i, context, map_binding))
|
||||
+ && !wined3d_texture_load_location(texture, i, context, map_binding))
|
||||
ERR("Failed to load location %s.\n", wined3d_debug_location(map_binding));
|
||||
if (texture->resource.map_binding == WINED3D_LOCATION_BUFFER)
|
||||
wined3d_texture_remove_buffer_object(texture, i, context->gl_info);
|
||||
@@ -786,7 +786,7 @@ void wined3d_texture_load(struct wined3d_texture *texture,
|
||||
TRACE("Reloading because of color key value change.\n");
|
||||
for (i = 0; i < sub_count; i++)
|
||||
{
|
||||
- if (!texture->texture_ops->texture_load_location(texture, i, context, texture->resource.map_binding))
|
||||
+ if (!wined3d_texture_load_location(texture, i, context, texture->resource.map_binding))
|
||||
ERR("Failed to load location %s.\n", wined3d_debug_location(texture->resource.map_binding));
|
||||
else
|
||||
wined3d_texture_invalidate_location(texture, i, ~texture->resource.map_binding);
|
||||
@@ -804,7 +804,7 @@ void wined3d_texture_load(struct wined3d_texture *texture,
|
||||
/* Reload the surfaces if the texture is marked dirty. */
|
||||
for (i = 0; i < sub_count; ++i)
|
||||
{
|
||||
- if (!texture->texture_ops->texture_load_location(texture, i, context,
|
||||
+ if (!wined3d_texture_load_location(texture, i, context,
|
||||
srgb ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB))
|
||||
ERR("Failed to load location (srgb %#x).\n", srgb);
|
||||
}
|
||||
@@ -1285,7 +1285,7 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
|
||||
WARN("Ignoring dirty_region %s.\n", debug_box(dirty_region));
|
||||
|
||||
context = context_acquire(texture->resource.device, NULL);
|
||||
- if (!texture->texture_ops->texture_load_location(texture, sub_resource_idx,
|
||||
+ if (!wined3d_texture_load_location(texture, sub_resource_idx,
|
||||
context, texture->resource.map_binding))
|
||||
{
|
||||
ERR("Failed to load location %s.\n", wined3d_debug_location(texture->resource.map_binding));
|
||||
@@ -1331,6 +1331,7 @@ static HRESULT wined3d_texture_upload_data(struct wined3d_texture *texture,
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
+/* Context activation is done by the caller. */
|
||||
static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
const struct wined3d_context *context, const struct wined3d_sub_resource_data *data)
|
||||
{
|
||||
@@ -1525,7 +1526,7 @@ static void wined3d_texture_unload(struct wined3d_resource *resource)
|
||||
struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[i];
|
||||
|
||||
if (resource->pool != WINED3D_POOL_DEFAULT
|
||||
- && texture->texture_ops->texture_load_location(texture, i, context, resource->map_binding))
|
||||
+ && wined3d_texture_load_location(texture, i, context, resource->map_binding))
|
||||
{
|
||||
wined3d_texture_invalidate_location(texture, i, ~resource->map_binding);
|
||||
}
|
||||
@@ -1644,7 +1645,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
|
||||
{
|
||||
if (resource->usage & WINED3DUSAGE_DYNAMIC)
|
||||
WARN_(d3d_perf)("Mapping a dynamic texture without WINED3D_MAP_DISCARD.\n");
|
||||
- ret = texture->texture_ops->texture_load_location(texture,
|
||||
+ ret = wined3d_texture_load_location(texture,
|
||||
sub_resource_idx, context, texture->resource.map_binding);
|
||||
}
|
||||
|
||||
@@ -2004,6 +2005,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
+/* Context activation is done by the caller. */
|
||||
static void texture3d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
const struct wined3d_context *context, const struct wined3d_sub_resource_data *data)
|
||||
{
|
||||
@@ -2633,3 +2635,10 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
+
|
||||
+/* Context activation is done by the caller. Context may be NULL. */
|
||||
+BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
+ struct wined3d_context *context, DWORD location)
|
||||
+{
|
||||
+ return texture->texture_ops->texture_load_location(texture, sub_resource_idx, context, location);
|
||||
+}
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 0f2dd36..0f540db 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -2580,6 +2580,8 @@ void *wined3d_texture_map_bo_address(const struct wined3d_bo_address *data, size
|
||||
const struct wined3d_gl_info *gl_info, GLenum binding, DWORD flags) DECLSPEC_HIDDEN;
|
||||
BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
|
||||
+BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
+ struct wined3d_context *context, DWORD location);
|
||||
void wined3d_texture_prepare_texture(struct wined3d_texture *texture,
|
||||
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
|
||||
void wined3d_texture_set_dirty(struct wined3d_texture *texture) DECLSPEC_HIDDEN;
|
||||
--
|
||||
2.8.0
|
||||
|
||||
@@ -1,176 +0,0 @@
|
||||
From b7cf2e2b12b808a6f7fc16b4b8b3b0d3f00bdb48 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 6 Mar 2016 22:08:36 +0100
|
||||
Subject: Revert "wined3d: Merge surface_prepare_buffer() and
|
||||
wined3d_volume_prepare_pbo()."
|
||||
|
||||
This reverts commit 87143e60ed5708b976754da872f7643ce0982172.
|
||||
---
|
||||
dlls/wined3d/surface.c | 44 ++++++++++++++++++++++++++++++++++--------
|
||||
dlls/wined3d/texture.c | 21 --------------------
|
||||
dlls/wined3d/volume.c | 20 ++++++++++++++++++-
|
||||
dlls/wined3d/wined3d_private.h | 2 --
|
||||
4 files changed, 55 insertions(+), 32 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
|
||||
index 3cd3782..208c254 100644
|
||||
--- a/dlls/wined3d/surface.c
|
||||
+++ b/dlls/wined3d/surface.c
|
||||
@@ -489,6 +489,40 @@ static void surface_get_memory(const struct wined3d_surface *surface, struct win
|
||||
data->buffer_object = 0;
|
||||
}
|
||||
|
||||
+static void surface_prepare_buffer(struct wined3d_surface *surface)
|
||||
+{
|
||||
+ struct wined3d_context *context;
|
||||
+ GLuint *buffer_object;
|
||||
+ GLenum error;
|
||||
+ const struct wined3d_gl_info *gl_info;
|
||||
+
|
||||
+ buffer_object = &surface->container->sub_resources[surface_get_sub_resource_idx(surface)].buffer_object;
|
||||
+ if (*buffer_object)
|
||||
+ return;
|
||||
+
|
||||
+ context = context_acquire(surface->resource.device, NULL);
|
||||
+ gl_info = context->gl_info;
|
||||
+
|
||||
+ GL_EXTCALL(glGenBuffers(1, buffer_object));
|
||||
+ error = gl_info->gl_ops.gl.p_glGetError();
|
||||
+ if (!*buffer_object || error != GL_NO_ERROR)
|
||||
+ ERR("Failed to create a PBO with error %s (%#x).\n", debug_glerror(error), error);
|
||||
+
|
||||
+ TRACE("Binding PBO %u.\n", *buffer_object);
|
||||
+
|
||||
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, *buffer_object));
|
||||
+ checkGLcall("glBindBuffer");
|
||||
+
|
||||
+ GL_EXTCALL(glBufferData(GL_PIXEL_UNPACK_BUFFER, surface->resource.size + 4,
|
||||
+ NULL, GL_STREAM_DRAW));
|
||||
+ checkGLcall("glBufferData");
|
||||
+
|
||||
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
|
||||
+ checkGLcall("glBindBuffer");
|
||||
+
|
||||
+ context_release(context);
|
||||
+}
|
||||
+
|
||||
static void surface_prepare_system_memory(struct wined3d_surface *surface)
|
||||
{
|
||||
TRACE("surface %p.\n", surface);
|
||||
@@ -507,9 +541,6 @@ static void surface_prepare_system_memory(struct wined3d_surface *surface)
|
||||
|
||||
void surface_prepare_map_memory(struct wined3d_surface *surface)
|
||||
{
|
||||
- struct wined3d_texture *texture = surface->container;
|
||||
- struct wined3d_context *context;
|
||||
-
|
||||
switch (surface->resource.map_binding)
|
||||
{
|
||||
case WINED3D_LOCATION_SYSMEM:
|
||||
@@ -517,7 +548,7 @@ void surface_prepare_map_memory(struct wined3d_surface *surface)
|
||||
break;
|
||||
|
||||
case WINED3D_LOCATION_USER_MEMORY:
|
||||
- if (!texture->user_memory)
|
||||
+ if (!surface->container->user_memory)
|
||||
ERR("Map binding is set to WINED3D_LOCATION_USER_MEMORY but surface->user_memory is NULL.\n");
|
||||
break;
|
||||
|
||||
@@ -527,10 +558,7 @@ void surface_prepare_map_memory(struct wined3d_surface *surface)
|
||||
break;
|
||||
|
||||
case WINED3D_LOCATION_BUFFER:
|
||||
- context = context_acquire(texture->resource.device, NULL);
|
||||
- wined3d_texture_prepare_buffer_object(texture,
|
||||
- surface_get_sub_resource_idx(surface), context->gl_info);
|
||||
- context_release(context);
|
||||
+ surface_prepare_buffer(surface);
|
||||
break;
|
||||
|
||||
default:
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index 9846f07..a8e9194 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -690,27 +690,6 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
|
||||
return wined3d_surface_update_desc(surface, gl_info);
|
||||
}
|
||||
|
||||
-/* Context activation is done by the caller. */
|
||||
-void wined3d_texture_prepare_buffer_object(struct wined3d_texture *texture,
|
||||
- unsigned int sub_resource_idx, const struct wined3d_gl_info *gl_info)
|
||||
-{
|
||||
- GLuint *buffer_object;
|
||||
-
|
||||
- buffer_object = &texture->sub_resources[sub_resource_idx].buffer_object;
|
||||
- if (*buffer_object)
|
||||
- return;
|
||||
-
|
||||
- GL_EXTCALL(glGenBuffers(1, buffer_object));
|
||||
- GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, *buffer_object));
|
||||
- GL_EXTCALL(glBufferData(GL_PIXEL_UNPACK_BUFFER,
|
||||
- texture->sub_resources[sub_resource_idx].resource->size, NULL, GL_STREAM_DRAW));
|
||||
- GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
|
||||
- checkGLcall("Create buffer object");
|
||||
-
|
||||
- TRACE("Created buffer object %u for texture %p, sub-resource %u.\n",
|
||||
- *buffer_object, texture, sub_resource_idx);
|
||||
-}
|
||||
-
|
||||
void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
|
||||
{
|
||||
DWORD alloc_flag = srgb ? WINED3D_TEXTURE_SRGB_ALLOCATED : WINED3D_TEXTURE_RGB_ALLOCATED;
|
||||
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
|
||||
index fcadd39..ef0d69b 100644
|
||||
--- a/dlls/wined3d/volume.c
|
||||
+++ b/dlls/wined3d/volume.c
|
||||
@@ -362,6 +362,24 @@ void wined3d_volume_load(struct wined3d_volume *volume, struct wined3d_context *
|
||||
srgb_mode ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB);
|
||||
}
|
||||
|
||||
+/* Context activation is done by the caller. */
|
||||
+static void wined3d_volume_prepare_pbo(struct wined3d_volume *volume, struct wined3d_context *context)
|
||||
+{
|
||||
+ GLuint *buffer_object = &volume->container->sub_resources[volume->texture_level].buffer_object;
|
||||
+ const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
+
|
||||
+ if (*buffer_object)
|
||||
+ return;
|
||||
+
|
||||
+ GL_EXTCALL(glGenBuffers(1, buffer_object));
|
||||
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, *buffer_object));
|
||||
+ GL_EXTCALL(glBufferData(GL_PIXEL_UNPACK_BUFFER, volume->resource.size, NULL, GL_STREAM_DRAW));
|
||||
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
|
||||
+ checkGLcall("Create PBO");
|
||||
+
|
||||
+ TRACE("Created PBO %u for volume %p.\n", *buffer_object, volume);
|
||||
+}
|
||||
+
|
||||
static void wined3d_volume_free_pbo(struct wined3d_volume *volume)
|
||||
{
|
||||
GLuint *buffer_object = &volume->container->sub_resources[volume->texture_level].buffer_object;
|
||||
@@ -488,7 +506,7 @@ HRESULT wined3d_volume_map(struct wined3d_volume *volume,
|
||||
context = context_acquire(device, NULL);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
- wined3d_texture_prepare_buffer_object(texture, volume->texture_level, gl_info);
|
||||
+ wined3d_volume_prepare_pbo(volume, context);
|
||||
if (flags & WINED3D_MAP_DISCARD)
|
||||
wined3d_volume_validate_location(volume, WINED3D_LOCATION_BUFFER);
|
||||
else
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 28121b7..468ff11 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -2420,8 +2420,6 @@ struct wined3d_resource *wined3d_texture_get_sub_resource(const struct wined3d_t
|
||||
UINT sub_resource_idx) DECLSPEC_HIDDEN;
|
||||
void wined3d_texture_load(struct wined3d_texture *texture,
|
||||
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
|
||||
-void wined3d_texture_prepare_buffer_object(struct wined3d_texture *texture,
|
||||
- unsigned int sub_resource_idx, const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
|
||||
void wined3d_texture_prepare_texture(struct wined3d_texture *texture,
|
||||
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
|
||||
void wined3d_texture_set_dirty(struct wined3d_texture *texture) DECLSPEC_HIDDEN;
|
||||
--
|
||||
2.7.1
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
From 130d9dfce6a2aa843885d204471605967c76b164 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
|
||||
Date: Tue, 17 Nov 2015 23:13:29 -0800
|
||||
Subject: wined3d: Call texture_load_location instead of surface_load_location.
|
||||
|
||||
---
|
||||
dlls/wined3d/device.c | 9 ++++++---
|
||||
dlls/wined3d/drawprim.c | 2 +-
|
||||
dlls/wined3d/surface.c | 38 ++++++++++++++++++++++++--------------
|
||||
dlls/wined3d/swapchain.c | 8 ++++----
|
||||
dlls/wined3d/texture.c | 2 +-
|
||||
5 files changed, 36 insertions(+), 23 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index f12cbf4..4be5c0c 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -203,12 +203,15 @@ void device_switch_onscreen_ds(struct wined3d_device *device,
|
||||
{
|
||||
if (device->onscreen_depth_stencil)
|
||||
{
|
||||
- surface_load_location(device->onscreen_depth_stencil, context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
+ struct wined3d_texture *texture = device->onscreen_depth_stencil->container;
|
||||
+ wined3d_texture_load_location(texture,
|
||||
+ surface_get_sub_resource_idx(device->onscreen_depth_stencil),
|
||||
+ context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
|
||||
surface_modify_ds_location(device->onscreen_depth_stencil, WINED3D_LOCATION_TEXTURE_RGB,
|
||||
device->onscreen_depth_stencil->ds_current_size.cx,
|
||||
device->onscreen_depth_stencil->ds_current_size.cy);
|
||||
- wined3d_texture_decref(device->onscreen_depth_stencil->container);
|
||||
+ wined3d_texture_decref(texture);
|
||||
}
|
||||
device->onscreen_depth_stencil = depth_stencil;
|
||||
wined3d_texture_incref(device->onscreen_depth_stencil->container);
|
||||
@@ -283,7 +286,7 @@ static void prepare_ds_clear(struct wined3d_surface *ds, struct wined3d_context
|
||||
}
|
||||
|
||||
/* Full load. */
|
||||
- surface_load_location(ds, context, location);
|
||||
+ wined3d_texture_load_location(ds->container, surface_get_sub_resource_idx(ds), context, location);
|
||||
SetRect(out_rect, 0, 0, ds->ds_current_size.cx, ds->ds_current_size.cy);
|
||||
}
|
||||
|
||||
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
|
||||
index 78628c5..83fe4c3 100644
|
||||
--- a/dlls/wined3d/drawprim.c
|
||||
+++ b/dlls/wined3d/drawprim.c
|
||||
@@ -481,7 +481,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
|
||||
|
||||
IntersectRect(&r, &draw_rect, ¤t_rect);
|
||||
if (!EqualRect(&r, &draw_rect))
|
||||
- surface_load_location(ds, context, location);
|
||||
+ wined3d_texture_load_location(ds->container, surface_get_sub_resource_idx(ds), context, location);
|
||||
else
|
||||
wined3d_texture_prepare_location(ds->container, dsv->sub_resource_idx, context, location);
|
||||
}
|
||||
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
|
||||
index 3435d17..68bf333 100644
|
||||
--- a/dlls/wined3d/surface.c
|
||||
+++ b/dlls/wined3d/surface.c
|
||||
@@ -450,9 +450,11 @@ static void surface_depth_blt_fbo(const struct wined3d_device *device,
|
||||
|
||||
/* Make sure the locations are up-to-date. Loading the destination
|
||||
* surface isn't required if the entire surface is overwritten. */
|
||||
- surface_load_location(src_surface, context, src_location);
|
||||
+ wined3d_texture_load_location(src_surface->container, surface_get_sub_resource_idx(src_surface),
|
||||
+ context, src_location);
|
||||
if (!surface_is_full_rect(dst_surface, dst_rect))
|
||||
- surface_load_location(dst_surface, context, dst_location);
|
||||
+ wined3d_texture_load_location(dst_surface->container, surface_get_sub_resource_idx(dst_surface),
|
||||
+ context, dst_location);
|
||||
else
|
||||
wined3d_texture_prepare_location(dst_texture, dst_sub_resource_idx, context, dst_location);
|
||||
|
||||
@@ -546,9 +548,11 @@ static void surface_blt_fbo(const struct wined3d_device *device,
|
||||
* surface isn't required if the entire surface is overwritten. (And is
|
||||
* in fact harmful if we're being called by surface_load_location() with
|
||||
* the purpose of loading the destination surface.) */
|
||||
- surface_load_location(src_surface, old_ctx, src_location);
|
||||
+ wined3d_texture_load_location(src_surface->container, surface_get_sub_resource_idx(src_surface),
|
||||
+ old_ctx, src_location);
|
||||
if (!surface_is_full_rect(dst_surface, &dst_rect))
|
||||
- surface_load_location(dst_surface, old_ctx, dst_location);
|
||||
+ wined3d_texture_load_location(dst_surface->container, surface_get_sub_resource_idx(dst_surface),
|
||||
+ old_ctx, dst_location);
|
||||
else
|
||||
wined3d_texture_prepare_location(dst_texture, dst_sub_resource_idx, old_ctx, dst_location);
|
||||
|
||||
@@ -1192,7 +1196,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
|
||||
if (update_w == dst_w && update_h == dst_h)
|
||||
wined3d_texture_prepare_texture(dst_texture, context, FALSE);
|
||||
else
|
||||
- surface_load_location(dst_surface, context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
+ wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
wined3d_texture_bind_and_dirtify(dst_texture, context, FALSE);
|
||||
|
||||
wined3d_texture_get_memory(src_texture, src_sub_resource_idx, &data,
|
||||
@@ -2298,7 +2302,7 @@ static void surface_blt_to_drawable(const struct wined3d_device *device,
|
||||
gl_info = context->gl_info;
|
||||
|
||||
/* Make sure the surface is up-to-date. This should probably use
|
||||
- * surface_load_location() and worry about the destination surface too,
|
||||
+ * wined3d_texture_load_location() and worry about the destination surface too,
|
||||
* unless we're overwriting it completely. */
|
||||
wined3d_texture_load(src_texture, context, FALSE);
|
||||
|
||||
@@ -2796,7 +2800,8 @@ static void surface_load_sysmem(struct wined3d_surface *surface,
|
||||
}
|
||||
|
||||
if (sub_resource->locations & (WINED3D_LOCATION_RB_MULTISAMPLE | WINED3D_LOCATION_RB_RESOLVED))
|
||||
- surface_load_location(surface, context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
+ wined3d_texture_load_location(surface->container, surface_get_sub_resource_idx(surface),
|
||||
+ context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
|
||||
/* Download the surface to system memory. */
|
||||
if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
|
||||
@@ -2834,7 +2839,8 @@ static HRESULT surface_load_drawable(struct wined3d_surface *surface,
|
||||
}
|
||||
|
||||
surface_get_rect(surface, NULL, &r);
|
||||
- surface_load_location(surface, context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
+ wined3d_texture_load_location(texture, surface_get_sub_resource_idx(surface),
|
||||
+ context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
surface_blt_to_drawable(texture->resource.device, context,
|
||||
WINED3D_TEXF_POINT, FALSE, surface, &r, surface, &r);
|
||||
|
||||
@@ -2912,7 +2918,8 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
|
||||
{
|
||||
/* Performance warning... */
|
||||
FIXME("Downloading RGB surface %p to reload it as sRGB.\n", surface);
|
||||
- surface_load_location(surface, context, texture->resource.map_binding);
|
||||
+ wined3d_texture_load_location(texture, surface_get_sub_resource_idx(surface),
|
||||
+ context, texture->resource.map_binding);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2922,7 +2929,8 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
|
||||
{
|
||||
/* Performance warning... */
|
||||
FIXME("Downloading sRGB surface %p to reload it as RGB.\n", surface);
|
||||
- surface_load_location(surface, context, texture->resource.map_binding);
|
||||
+ wined3d_texture_load_location(texture, surface_get_sub_resource_idx(surface),
|
||||
+ context, texture->resource.map_binding);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2930,7 +2938,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
|
||||
{
|
||||
WARN("Trying to load a texture from sysmem, but no simple location is valid.\n");
|
||||
/* Lets hope we get it from somewhere... */
|
||||
- surface_load_location(surface, context, WINED3D_LOCATION_SYSMEM);
|
||||
+ wined3d_texture_load_location(texture, surface_get_sub_resource_idx(surface), context, WINED3D_LOCATION_SYSMEM);
|
||||
}
|
||||
|
||||
wined3d_texture_prepare_texture(texture, context, srgb);
|
||||
@@ -2948,7 +2956,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
|
||||
{
|
||||
TRACE("Removing the pbo attached to surface %p.\n", surface);
|
||||
|
||||
- surface_load_location(surface, context, WINED3D_LOCATION_SYSMEM);
|
||||
+ wined3d_texture_load_location(texture, sub_resource_idx, context, WINED3D_LOCATION_SYSMEM);
|
||||
wined3d_texture_set_map_binding(texture, WINED3D_LOCATION_SYSMEM);
|
||||
}
|
||||
|
||||
@@ -3077,7 +3085,8 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte
|
||||
{
|
||||
ERR("Surface %p does not have any up to date location.\n", surface);
|
||||
wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_DISCARDED);
|
||||
- return surface_load_location(surface, context, location);
|
||||
+ wined3d_texture_load_location(texture, sub_resource_idx, context, location);
|
||||
+ return;
|
||||
}
|
||||
|
||||
if (texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
|
||||
@@ -4231,7 +4240,8 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
|
||||
if (!wined3d_resource_is_offscreen(&dst_texture->resource))
|
||||
{
|
||||
struct wined3d_context *context = context_acquire(device, dst_surface);
|
||||
- surface_load_location(dst_surface, context, dst_texture->resource.draw_binding);
|
||||
+ wined3d_texture_load_location(dst_texture, surface_get_sub_resource_idx(dst_surface),
|
||||
+ context, dst_texture->resource.draw_binding);
|
||||
context_release(context);
|
||||
}
|
||||
return WINED3D_OK;
|
||||
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
|
||||
index b9c6055..a02fdf0 100644
|
||||
--- a/dlls/wined3d/swapchain.c
|
||||
+++ b/dlls/wined3d/swapchain.c
|
||||
@@ -453,7 +453,7 @@ static void wined3d_swapchain_rotate(struct wined3d_swapchain *swapchain, struct
|
||||
sub_resource = &texture->sub_resources[0];
|
||||
|
||||
if (!(sub_resource->locations & supported_locations))
|
||||
- surface_load_location(sub_resource->u.surface, context, texture->resource.draw_binding);
|
||||
+ wined3d_texture_load_location(texture, 0, context, texture->resource.draw_binding);
|
||||
|
||||
texture_prev->texture_rgb = texture->texture_rgb;
|
||||
texture_prev->rb_multisample = texture->rb_multisample;
|
||||
@@ -630,12 +630,12 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
|
||||
|
||||
static void swapchain_gl_frontbuffer_updated(struct wined3d_swapchain *swapchain)
|
||||
{
|
||||
- struct wined3d_surface *surface;
|
||||
+ struct wined3d_texture *texture = swapchain->front_buffer;
|
||||
+ struct wined3d_surface *surface = texture->sub_resources[0].u.surface;
|
||||
struct wined3d_context *context;
|
||||
|
||||
- surface = swapchain->front_buffer->sub_resources[0].u.surface;
|
||||
context = context_acquire(swapchain->device, surface);
|
||||
- surface_load_location(surface, context, surface->container->resource.draw_binding);
|
||||
+ wined3d_texture_load_location(texture, 0, context, texture->resource.draw_binding);
|
||||
context_release(context);
|
||||
SetRectEmpty(&swapchain->front_buffer_update);
|
||||
}
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index 30a4581..9780cc5 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -2575,7 +2575,7 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
|
||||
if (device->d3d_initialized)
|
||||
context = context_acquire(device, NULL);
|
||||
|
||||
- surface_load_location(surface, context, texture->resource.map_binding);
|
||||
+ wined3d_texture_load_location(texture, sub_resource_idx, context, texture->resource.map_binding);
|
||||
wined3d_texture_invalidate_location(texture, sub_resource_idx, ~texture->resource.map_binding);
|
||||
|
||||
if (!surface->dc)
|
||||
--
|
||||
2.8.0
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
From 9d8d5fb99efea2a4d8628429c811457b1b347647 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 6 Mar 2016 22:08:37 +0100
|
||||
Subject: Revert "wined3d: Cleanup sub-resource buffer objects in
|
||||
wined3d_texture_cleanup()."
|
||||
|
||||
This reverts commit 45fa5b6471093db4f97f90b661d1f89d56aa48e7.
|
||||
---
|
||||
dlls/wined3d/surface.c | 11 ++++++++++-
|
||||
dlls/wined3d/texture.c | 27 ---------------------------
|
||||
dlls/wined3d/volume.c | 3 +++
|
||||
3 files changed, 13 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
|
||||
index 208c254..994756d 100644
|
||||
--- a/dlls/wined3d/surface.c
|
||||
+++ b/dlls/wined3d/surface.c
|
||||
@@ -48,10 +48,13 @@ static unsigned int surface_get_sub_resource_idx(const struct wined3d_surface *s
|
||||
void wined3d_surface_cleanup(struct wined3d_surface *surface)
|
||||
{
|
||||
struct wined3d_surface *overlay, *cur;
|
||||
+ GLuint buffer_object;
|
||||
|
||||
TRACE("surface %p.\n", surface);
|
||||
|
||||
- if (surface->rb_multisample || surface->rb_resolved || !list_empty(&surface->renderbuffers))
|
||||
+ buffer_object = surface->container->sub_resources[surface_get_sub_resource_idx(surface)].buffer_object;
|
||||
+ if (buffer_object || surface->rb_multisample
|
||||
+ || surface->rb_resolved || !list_empty(&surface->renderbuffers))
|
||||
{
|
||||
struct wined3d_renderbuffer_entry *entry, *entry2;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
@@ -61,6 +64,12 @@ void wined3d_surface_cleanup(struct wined3d_surface *surface)
|
||||
context = context_acquire(device, NULL);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
+ if (buffer_object)
|
||||
+ {
|
||||
+ TRACE("Deleting buffer object %u.\n", buffer_object);
|
||||
+ GL_EXTCALL(glDeleteBuffers(1, &buffer_object));
|
||||
+ }
|
||||
+
|
||||
if (surface->rb_multisample)
|
||||
{
|
||||
TRACE("Deleting multisample renderbuffer %u.\n", surface->rb_multisample);
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index a8e9194..cb2b310f 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -108,35 +108,8 @@ static void wined3d_texture_unload_gl_texture(struct wined3d_texture *texture)
|
||||
|
||||
static void wined3d_texture_cleanup(struct wined3d_texture *texture)
|
||||
{
|
||||
- unsigned int sub_count = texture->level_count * texture->layer_count;
|
||||
- struct wined3d_device *device = texture->resource.device;
|
||||
- struct wined3d_context *context = NULL;
|
||||
- const struct wined3d_gl_info *gl_info;
|
||||
- GLuint buffer_object;
|
||||
- unsigned int i;
|
||||
-
|
||||
TRACE("texture %p.\n", texture);
|
||||
|
||||
- for (i = 0; i < sub_count; ++i)
|
||||
- {
|
||||
- if (!(buffer_object = texture->sub_resources[i].buffer_object))
|
||||
- continue;
|
||||
-
|
||||
- TRACE("Deleting buffer object %u.\n", buffer_object);
|
||||
-
|
||||
- /* We may not be able to get a context in wined3d_texture_cleanup() in
|
||||
- * general, but if a buffer object was previously created we can. */
|
||||
- if (!context)
|
||||
- {
|
||||
- context = context_acquire(device, NULL);
|
||||
- gl_info = context->gl_info;
|
||||
- }
|
||||
-
|
||||
- GL_EXTCALL(glDeleteBuffers(1, &buffer_object));
|
||||
- }
|
||||
- if (context)
|
||||
- context_release(context);
|
||||
-
|
||||
texture->texture_ops->texture_cleanup_sub_resources(texture);
|
||||
wined3d_texture_unload_gl_texture(texture);
|
||||
resource_cleanup(&texture->resource);
|
||||
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
|
||||
index ef0d69b..3782642 100644
|
||||
--- a/dlls/wined3d/volume.c
|
||||
+++ b/dlls/wined3d/volume.c
|
||||
@@ -397,6 +397,9 @@ void wined3d_volume_cleanup(struct wined3d_volume *volume)
|
||||
{
|
||||
TRACE("volume %p.\n", volume);
|
||||
|
||||
+ if (volume->container->sub_resources[volume->texture_level].buffer_object)
|
||||
+ wined3d_volume_free_pbo(volume);
|
||||
+
|
||||
resource_cleanup(&volume->resource);
|
||||
}
|
||||
|
||||
--
|
||||
2.7.1
|
||||
|
||||
@@ -0,0 +1,378 @@
|
||||
From 7bce6d69497a6dcb14bcaf8b02f9b0e68f5cbbd1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
|
||||
Date: Wed, 18 Nov 2015 08:31:14 +0000
|
||||
Subject: wined3d: Share surface and volume system memory loading code.
|
||||
|
||||
---
|
||||
dlls/wined3d/surface.c | 110 -------------------------------------------
|
||||
dlls/wined3d/texture.c | 125 ++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
dlls/wined3d/volume.c | 44 -----------------
|
||||
3 files changed, 124 insertions(+), 155 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
|
||||
index 68bf333..1189b97 100644
|
||||
--- a/dlls/wined3d/surface.c
|
||||
+++ b/dlls/wined3d/surface.c
|
||||
@@ -2720,67 +2720,6 @@ static void surface_load_ds_location(struct wined3d_surface *surface, struct win
|
||||
}
|
||||
}
|
||||
|
||||
-static DWORD resource_access_from_location(DWORD location)
|
||||
-{
|
||||
- switch (location)
|
||||
- {
|
||||
- case WINED3D_LOCATION_SYSMEM:
|
||||
- case WINED3D_LOCATION_USER_MEMORY:
|
||||
- case WINED3D_LOCATION_BUFFER:
|
||||
- return WINED3D_RESOURCE_ACCESS_CPU;
|
||||
-
|
||||
- case WINED3D_LOCATION_DRAWABLE:
|
||||
- case WINED3D_LOCATION_TEXTURE_SRGB:
|
||||
- case WINED3D_LOCATION_TEXTURE_RGB:
|
||||
- case WINED3D_LOCATION_RB_MULTISAMPLE:
|
||||
- case WINED3D_LOCATION_RB_RESOLVED:
|
||||
- return WINED3D_RESOURCE_ACCESS_GPU;
|
||||
-
|
||||
- default:
|
||||
- FIXME("Unhandled location %#x.\n", location);
|
||||
- return 0;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-static void surface_copy_simple_location(struct wined3d_surface *surface, DWORD location)
|
||||
-{
|
||||
- unsigned int sub_resource_idx = surface_get_sub_resource_idx(surface);
|
||||
- struct wined3d_texture *texture = surface->container;
|
||||
- struct wined3d_device *device = texture->resource.device;
|
||||
- struct wined3d_texture_sub_resource *sub_resource;
|
||||
- struct wined3d_context *context;
|
||||
- const struct wined3d_gl_info *gl_info;
|
||||
- struct wined3d_bo_address dst, src;
|
||||
-
|
||||
- sub_resource = &texture->sub_resources[sub_resource_idx];
|
||||
- wined3d_texture_get_memory(texture, sub_resource_idx, &dst, location);
|
||||
- wined3d_texture_get_memory(texture, sub_resource_idx, &src, sub_resource->locations);
|
||||
-
|
||||
- if (dst.buffer_object)
|
||||
- {
|
||||
- context = context_acquire(device, NULL);
|
||||
- gl_info = context->gl_info;
|
||||
- GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, dst.buffer_object));
|
||||
- GL_EXTCALL(glBufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, sub_resource->size, src.addr));
|
||||
- GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
|
||||
- checkGLcall("Upload PBO");
|
||||
- context_release(context);
|
||||
- return;
|
||||
- }
|
||||
- if (src.buffer_object)
|
||||
- {
|
||||
- context = context_acquire(device, NULL);
|
||||
- gl_info = context->gl_info;
|
||||
- GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, src.buffer_object));
|
||||
- GL_EXTCALL(glGetBufferSubData(GL_PIXEL_PACK_BUFFER, 0, sub_resource->size, dst.addr));
|
||||
- GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, 0));
|
||||
- checkGLcall("Download PBO");
|
||||
- context_release(context);
|
||||
- return;
|
||||
- }
|
||||
- memcpy(dst.addr, src.addr, sub_resource->size);
|
||||
-}
|
||||
-
|
||||
/* Context activation is done by the caller. */
|
||||
static void surface_load_sysmem(struct wined3d_surface *surface,
|
||||
struct wined3d_context *context, DWORD dst_location)
|
||||
@@ -2793,12 +2732,6 @@ static void surface_load_sysmem(struct wined3d_surface *surface,
|
||||
wined3d_texture_prepare_location(texture, sub_resource_idx, context, dst_location);
|
||||
|
||||
sub_resource = &texture->sub_resources[sub_resource_idx];
|
||||
- if (sub_resource->locations & surface_simple_locations)
|
||||
- {
|
||||
- surface_copy_simple_location(surface, dst_location);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
if (sub_resource->locations & (WINED3D_LOCATION_RB_MULTISAMPLE | WINED3D_LOCATION_RB_RESOLVED))
|
||||
wined3d_texture_load_location(surface->container, surface_get_sub_resource_idx(surface),
|
||||
context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
@@ -3048,46 +2981,11 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte
|
||||
unsigned int sub_resource_idx = surface_get_sub_resource_idx(surface);
|
||||
struct wined3d_texture *texture = surface->container;
|
||||
struct wined3d_texture_sub_resource *sub_resource;
|
||||
- unsigned int surface_w, surface_h;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("surface %p, location %s.\n", surface, wined3d_debug_location(location));
|
||||
|
||||
- surface_w = wined3d_texture_get_level_width(texture, surface->texture_level);
|
||||
- surface_h = wined3d_texture_get_level_height(texture, surface->texture_level);
|
||||
-
|
||||
sub_resource = &texture->sub_resources[sub_resource_idx];
|
||||
- if (sub_resource->locations & location && (!(texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
|
||||
- || (surface->ds_current_size.cx == surface_w && surface->ds_current_size.cy == surface_h)))
|
||||
- {
|
||||
- TRACE("Location (%#x) is already up to date.\n", location);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- if (WARN_ON(d3d))
|
||||
- {
|
||||
- DWORD required_access = resource_access_from_location(location);
|
||||
- if ((texture->resource.access_flags & required_access) != required_access)
|
||||
- WARN("Operation requires %#x access, but surface only has %#x.\n",
|
||||
- required_access, texture->resource.access_flags);
|
||||
- }
|
||||
-
|
||||
- if (sub_resource->locations & WINED3D_LOCATION_DISCARDED)
|
||||
- {
|
||||
- TRACE("Surface previously discarded, nothing to do.\n");
|
||||
- wined3d_texture_prepare_location(texture, sub_resource_idx, context, location);
|
||||
- wined3d_texture_validate_location(texture, sub_resource_idx, location);
|
||||
- wined3d_texture_invalidate_location(texture, sub_resource_idx, WINED3D_LOCATION_DISCARDED);
|
||||
- goto done;
|
||||
- }
|
||||
-
|
||||
- if (!sub_resource->locations)
|
||||
- {
|
||||
- ERR("Surface %p does not have any up to date location.\n", surface);
|
||||
- wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_DISCARDED);
|
||||
- wined3d_texture_load_location(texture, sub_resource_idx, context, location);
|
||||
- return;
|
||||
- }
|
||||
|
||||
if (texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
|
||||
{
|
||||
@@ -3134,14 +3032,6 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte
|
||||
}
|
||||
|
||||
done:
|
||||
- wined3d_texture_validate_location(texture, sub_resource_idx, location);
|
||||
-
|
||||
- if (texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
|
||||
- {
|
||||
- surface->ds_current_size.cx = surface_w;
|
||||
- surface->ds_current_size.cy = surface_h;
|
||||
- }
|
||||
-
|
||||
return;
|
||||
}
|
||||
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index 9780cc5..708470e 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -2636,9 +2636,132 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
+static BOOL wined3d_texture_copy_sysmem_location(struct wined3d_texture *texture,
|
||||
+ unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location)
|
||||
+{
|
||||
+ struct wined3d_device *device = texture->resource.device;
|
||||
+ const struct wined3d_gl_info *gl_info;
|
||||
+ struct wined3d_bo_address dst, src;
|
||||
+ UINT size = texture->sub_resources[sub_resource_idx].size;
|
||||
+
|
||||
+ wined3d_texture_prepare_location(texture, sub_resource_idx, context, location);
|
||||
+
|
||||
+ wined3d_texture_get_memory(texture, sub_resource_idx, &dst, location);
|
||||
+ wined3d_texture_get_memory(texture, sub_resource_idx, &src,
|
||||
+ texture->sub_resources[sub_resource_idx].locations);
|
||||
+
|
||||
+ if (dst.buffer_object)
|
||||
+ {
|
||||
+ context = context_acquire(device, NULL);
|
||||
+ gl_info = context->gl_info;
|
||||
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, dst.buffer_object));
|
||||
+ GL_EXTCALL(glBufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, size, src.addr));
|
||||
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
|
||||
+ checkGLcall("Upload PBO");
|
||||
+ context_release(context);
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+ if (src.buffer_object)
|
||||
+ {
|
||||
+ context = context_acquire(device, NULL);
|
||||
+ gl_info = context->gl_info;
|
||||
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, src.buffer_object));
|
||||
+ GL_EXTCALL(glGetBufferSubData(GL_PIXEL_PACK_BUFFER, 0, size, dst.addr));
|
||||
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, 0));
|
||||
+ checkGLcall("Download PBO");
|
||||
+ context_release(context);
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+ memcpy(dst.addr, src.addr, size);
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
+static DWORD resource_access_from_location(DWORD location)
|
||||
+{
|
||||
+ switch (location)
|
||||
+ {
|
||||
+ case WINED3D_LOCATION_SYSMEM:
|
||||
+ case WINED3D_LOCATION_USER_MEMORY:
|
||||
+ case WINED3D_LOCATION_BUFFER:
|
||||
+ return WINED3D_RESOURCE_ACCESS_CPU;
|
||||
+
|
||||
+ case WINED3D_LOCATION_DRAWABLE:
|
||||
+ case WINED3D_LOCATION_TEXTURE_SRGB:
|
||||
+ case WINED3D_LOCATION_TEXTURE_RGB:
|
||||
+ case WINED3D_LOCATION_RB_MULTISAMPLE:
|
||||
+ case WINED3D_LOCATION_RB_RESOLVED:
|
||||
+ return WINED3D_RESOURCE_ACCESS_GPU;
|
||||
+
|
||||
+ default:
|
||||
+ FIXME("Unhandled location %#x.\n", location);
|
||||
+ return 0;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/* Context activation is done by the caller. Context may be NULL. */
|
||||
BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
struct wined3d_context *context, DWORD location)
|
||||
{
|
||||
- return texture->texture_ops->texture_load_location(texture, sub_resource_idx, context, location);
|
||||
+ BOOL ret;
|
||||
+ DWORD current = texture->sub_resources[sub_resource_idx].locations;
|
||||
+ struct wined3d_surface *surface = texture->sub_resources[sub_resource_idx].u.surface;
|
||||
+ unsigned int sub_resource_w, sub_resource_h;
|
||||
+
|
||||
+ TRACE("Texture %p, sub_resource %u, location %s.\n", texture, sub_resource_idx,
|
||||
+ wined3d_debug_location(location));
|
||||
+
|
||||
+ sub_resource_w = wined3d_texture_get_level_width(texture, sub_resource_idx % texture->level_count);
|
||||
+ sub_resource_h = wined3d_texture_get_level_height(texture, sub_resource_idx % texture->level_count);
|
||||
+
|
||||
+ if ((current & location) && (!(surface && (texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL))
|
||||
+ || (surface->ds_current_size.cx == sub_resource_w
|
||||
+ && surface->ds_current_size.cy == sub_resource_h)))
|
||||
+ {
|
||||
+ TRACE("Location (%#x) is already up to date.\n", location);
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+
|
||||
+ if (WARN_ON(d3d))
|
||||
+ {
|
||||
+ DWORD required_access = resource_access_from_location(location);
|
||||
+ if ((texture->resource.access_flags & required_access) != required_access)
|
||||
+ WARN("Operation requires %#x access, but texture only has %#x.\n",
|
||||
+ required_access, texture->resource.access_flags);
|
||||
+ }
|
||||
+
|
||||
+ if (!current)
|
||||
+ {
|
||||
+ ERR("Texture %p, sub resource %u does not have any up to date location.\n", texture, sub_resource_idx);
|
||||
+ wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_DISCARDED);
|
||||
+ wined3d_texture_load_location(texture, sub_resource_idx, context, location);
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+
|
||||
+ if (texture->sub_resources[sub_resource_idx].locations & WINED3D_LOCATION_DISCARDED)
|
||||
+ {
|
||||
+ wined3d_texture_prepare_location(texture, sub_resource_idx, context, location);
|
||||
+ ret = TRUE;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ static const DWORD sysmem_locations = WINED3D_LOCATION_SYSMEM | WINED3D_LOCATION_USER_MEMORY
|
||||
+ | WINED3D_LOCATION_BUFFER;
|
||||
+
|
||||
+ if ((location & sysmem_locations) && (current & sysmem_locations))
|
||||
+ ret = wined3d_texture_copy_sysmem_location(texture, sub_resource_idx, context, location);
|
||||
+ else
|
||||
+ ret = texture->texture_ops->texture_load_location(texture, sub_resource_idx, context, location);
|
||||
+ }
|
||||
+
|
||||
+ if (ret)
|
||||
+ {
|
||||
+ wined3d_texture_validate_location(texture, sub_resource_idx, location);
|
||||
+
|
||||
+ if (surface && texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
|
||||
+ {
|
||||
+ surface->ds_current_size.cx = sub_resource_w;
|
||||
+ surface->ds_current_size.cy = sub_resource_h;
|
||||
+ }
|
||||
+ }
|
||||
+ return ret;
|
||||
}
|
||||
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
|
||||
index f59f963..dda5f98 100644
|
||||
--- a/dlls/wined3d/volume.c
|
||||
+++ b/dlls/wined3d/volume.c
|
||||
@@ -119,27 +119,6 @@ static void wined3d_volume_download_data(struct wined3d_volume *volume,
|
||||
|
||||
}
|
||||
|
||||
-static DWORD volume_access_from_location(DWORD location)
|
||||
-{
|
||||
- switch (location)
|
||||
- {
|
||||
- case WINED3D_LOCATION_DISCARDED:
|
||||
- return 0;
|
||||
-
|
||||
- case WINED3D_LOCATION_SYSMEM:
|
||||
- return WINED3D_RESOURCE_ACCESS_CPU;
|
||||
-
|
||||
- case WINED3D_LOCATION_BUFFER:
|
||||
- case WINED3D_LOCATION_TEXTURE_RGB:
|
||||
- case WINED3D_LOCATION_TEXTURE_SRGB:
|
||||
- return WINED3D_RESOURCE_ACCESS_GPU;
|
||||
-
|
||||
- default:
|
||||
- FIXME("Unhandled location %#x.\n", location);
|
||||
- return 0;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
/* Context activation is done by the caller. */
|
||||
static void wined3d_volume_srgb_transfer(struct wined3d_volume *volume,
|
||||
struct wined3d_context *context, BOOL dest_is_srgb)
|
||||
@@ -170,7 +149,6 @@ static void wined3d_volume_srgb_transfer(struct wined3d_volume *volume,
|
||||
BOOL wined3d_volume_load_location(struct wined3d_volume *volume,
|
||||
struct wined3d_context *context, DWORD location)
|
||||
{
|
||||
- DWORD required_access = volume_access_from_location(location);
|
||||
unsigned int sub_resource_idx = volume->texture_level;
|
||||
struct wined3d_texture *texture = volume->container;
|
||||
struct wined3d_texture_sub_resource *sub_resource;
|
||||
@@ -179,30 +157,9 @@ BOOL wined3d_volume_load_location(struct wined3d_volume *volume,
|
||||
TRACE("Volume %p, loading %s, have %s.\n", volume, wined3d_debug_location(location),
|
||||
wined3d_debug_location(sub_resource->locations));
|
||||
|
||||
- if ((sub_resource->locations & location) == location)
|
||||
- {
|
||||
- TRACE("Location(s) already up to date.\n");
|
||||
- return TRUE;
|
||||
- }
|
||||
-
|
||||
- if ((texture->resource.access_flags & required_access) != required_access)
|
||||
- {
|
||||
- ERR("Operation requires %#x access, but volume only has %#x.\n",
|
||||
- required_access, texture->resource.access_flags);
|
||||
- return FALSE;
|
||||
- }
|
||||
-
|
||||
if (!wined3d_texture_prepare_location(texture, sub_resource_idx, context, location))
|
||||
return FALSE;
|
||||
|
||||
- if (sub_resource->locations & WINED3D_LOCATION_DISCARDED)
|
||||
- {
|
||||
- TRACE("Volume previously discarded, nothing to do.\n");
|
||||
- wined3d_texture_validate_location(texture, sub_resource_idx, location);
|
||||
- wined3d_texture_invalidate_location(texture, sub_resource_idx, WINED3D_LOCATION_DISCARDED);
|
||||
- goto done;
|
||||
- }
|
||||
-
|
||||
switch (location)
|
||||
{
|
||||
case WINED3D_LOCATION_TEXTURE_RGB:
|
||||
@@ -285,7 +242,6 @@ BOOL wined3d_volume_load_location(struct wined3d_volume *volume,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
-done:
|
||||
wined3d_texture_validate_location(texture, sub_resource_idx, location);
|
||||
|
||||
return TRUE;
|
||||
--
|
||||
2.8.0
|
||||
|
||||
@@ -1,422 +0,0 @@
|
||||
From 0a30deac1b8dc66d9877369442f4cbc7fbde21cb Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 6 Mar 2016 22:08:39 +0100
|
||||
Subject: Revert "wined3d: Store surface/volume buffer objects in the
|
||||
sub-resource structure."
|
||||
|
||||
This reverts commit fbe27375370c426c781ba50841ef93ea6ff44502.
|
||||
---
|
||||
dlls/wined3d/surface.c | 52 ++++++++++++---------------------
|
||||
dlls/wined3d/texture.c | 4 +--
|
||||
dlls/wined3d/volume.c | 65 +++++++++++++++++-------------------------
|
||||
dlls/wined3d/wined3d_private.h | 6 ++--
|
||||
4 files changed, 51 insertions(+), 76 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
|
||||
index 994756d..303bdc7 100644
|
||||
--- a/dlls/wined3d/surface.c
|
||||
+++ b/dlls/wined3d/surface.c
|
||||
@@ -40,20 +40,13 @@ static const DWORD surface_simple_locations =
|
||||
WINED3D_LOCATION_SYSMEM | WINED3D_LOCATION_USER_MEMORY
|
||||
| WINED3D_LOCATION_DIB | WINED3D_LOCATION_BUFFER;
|
||||
|
||||
-static unsigned int surface_get_sub_resource_idx(const struct wined3d_surface *surface)
|
||||
-{
|
||||
- return surface->texture_layer * surface->container->level_count + surface->texture_level;
|
||||
-}
|
||||
-
|
||||
void wined3d_surface_cleanup(struct wined3d_surface *surface)
|
||||
{
|
||||
struct wined3d_surface *overlay, *cur;
|
||||
- GLuint buffer_object;
|
||||
|
||||
TRACE("surface %p.\n", surface);
|
||||
|
||||
- buffer_object = surface->container->sub_resources[surface_get_sub_resource_idx(surface)].buffer_object;
|
||||
- if (buffer_object || surface->rb_multisample
|
||||
+ if (surface->pbo || surface->rb_multisample
|
||||
|| surface->rb_resolved || !list_empty(&surface->renderbuffers))
|
||||
{
|
||||
struct wined3d_renderbuffer_entry *entry, *entry2;
|
||||
@@ -64,10 +57,10 @@ void wined3d_surface_cleanup(struct wined3d_surface *surface)
|
||||
context = context_acquire(device, NULL);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
- if (buffer_object)
|
||||
+ if (surface->pbo)
|
||||
{
|
||||
- TRACE("Deleting buffer object %u.\n", buffer_object);
|
||||
- GL_EXTCALL(glDeleteBuffers(1, &buffer_object));
|
||||
+ TRACE("Deleting PBO %u.\n", surface->pbo);
|
||||
+ GL_EXTCALL(glDeleteBuffers(1, &surface->pbo));
|
||||
}
|
||||
|
||||
if (surface->rb_multisample)
|
||||
@@ -471,7 +464,7 @@ static void surface_get_memory(const struct wined3d_surface *surface, struct win
|
||||
if (location & WINED3D_LOCATION_BUFFER)
|
||||
{
|
||||
data->addr = NULL;
|
||||
- data->buffer_object = surface->container->sub_resources[surface_get_sub_resource_idx(surface)].buffer_object;
|
||||
+ data->buffer_object = surface->pbo;
|
||||
return;
|
||||
}
|
||||
if (location & WINED3D_LOCATION_USER_MEMORY)
|
||||
@@ -501,25 +494,23 @@ static void surface_get_memory(const struct wined3d_surface *surface, struct win
|
||||
static void surface_prepare_buffer(struct wined3d_surface *surface)
|
||||
{
|
||||
struct wined3d_context *context;
|
||||
- GLuint *buffer_object;
|
||||
GLenum error;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
|
||||
- buffer_object = &surface->container->sub_resources[surface_get_sub_resource_idx(surface)].buffer_object;
|
||||
- if (*buffer_object)
|
||||
+ if (surface->pbo)
|
||||
return;
|
||||
|
||||
context = context_acquire(surface->resource.device, NULL);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
- GL_EXTCALL(glGenBuffers(1, buffer_object));
|
||||
+ GL_EXTCALL(glGenBuffers(1, &surface->pbo));
|
||||
error = gl_info->gl_ops.gl.p_glGetError();
|
||||
- if (!*buffer_object || error != GL_NO_ERROR)
|
||||
+ if (!surface->pbo || error != GL_NO_ERROR)
|
||||
ERR("Failed to create a PBO with error %s (%#x).\n", debug_glerror(error), error);
|
||||
|
||||
- TRACE("Binding PBO %u.\n", *buffer_object);
|
||||
+ TRACE("Binding PBO %u.\n", surface->pbo);
|
||||
|
||||
- GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, *buffer_object));
|
||||
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, surface->pbo));
|
||||
checkGLcall("glBindBuffer");
|
||||
|
||||
GL_EXTCALL(glBufferData(GL_PIXEL_UNPACK_BUFFER, surface->resource.size + 4,
|
||||
@@ -1036,13 +1027,10 @@ static HRESULT wined3d_surface_depth_blt(struct wined3d_surface *src_surface, DW
|
||||
/* Context activation is done by the caller. */
|
||||
static void surface_remove_pbo(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info)
|
||||
{
|
||||
- GLuint *buffer_object;
|
||||
+ GL_EXTCALL(glDeleteBuffers(1, &surface->pbo));
|
||||
+ checkGLcall("glDeleteBuffers(1, &surface->pbo)");
|
||||
|
||||
- buffer_object = &surface->container->sub_resources[surface_get_sub_resource_idx(surface)].buffer_object;
|
||||
- GL_EXTCALL(glDeleteBuffers(1, buffer_object));
|
||||
- checkGLcall("glDeleteBuffers(1, buffer_object)");
|
||||
-
|
||||
- *buffer_object = 0;
|
||||
+ surface->pbo = 0;
|
||||
surface_invalidate_location(surface, WINED3D_LOCATION_BUFFER);
|
||||
}
|
||||
|
||||
@@ -1109,7 +1097,7 @@ static void surface_unload(struct wined3d_resource *resource)
|
||||
}
|
||||
|
||||
/* Destroy PBOs, but load them into real sysmem before */
|
||||
- if (surface->container->sub_resources[surface_get_sub_resource_idx(surface)].buffer_object)
|
||||
+ if (surface->pbo)
|
||||
surface_remove_pbo(surface, gl_info);
|
||||
|
||||
/* Destroy fbo render buffers. This is needed for implicit render targets, for
|
||||
@@ -2179,9 +2167,9 @@ do { \
|
||||
HRESULT wined3d_surface_unmap(struct wined3d_surface *surface)
|
||||
{
|
||||
struct wined3d_device *device = surface->resource.device;
|
||||
- struct wined3d_texture *texture = surface->container;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
struct wined3d_context *context;
|
||||
+ struct wined3d_texture *texture;
|
||||
|
||||
TRACE("surface %p.\n", surface);
|
||||
|
||||
@@ -2203,8 +2191,7 @@ HRESULT wined3d_surface_unmap(struct wined3d_surface *surface)
|
||||
context = context_acquire(device, NULL);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
- GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER,
|
||||
- texture->sub_resources[surface_get_sub_resource_idx(surface)].buffer_object));
|
||||
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, surface->pbo));
|
||||
GL_EXTCALL(glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER));
|
||||
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
|
||||
checkGLcall("glUnmapBuffer");
|
||||
@@ -2218,6 +2205,7 @@ HRESULT wined3d_surface_unmap(struct wined3d_surface *surface)
|
||||
|
||||
if (!(surface->locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_TEXTURE_RGB)))
|
||||
{
|
||||
+ texture = surface->container;
|
||||
if (texture->swapchain && texture->swapchain->front_buffer == texture)
|
||||
texture->swapchain->swapchain_ops->swapchain_frontbuffer_updated(texture->swapchain);
|
||||
else if (texture->resource.format_flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
|
||||
@@ -2319,8 +2307,7 @@ HRESULT wined3d_surface_map(struct wined3d_surface *surface, struct wined3d_map_
|
||||
context = context_acquire(device, NULL);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
- GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER,
|
||||
- texture->sub_resources[surface_get_sub_resource_idx(surface)].buffer_object));
|
||||
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, surface->pbo));
|
||||
base_memory = GL_EXTCALL(glMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_READ_WRITE));
|
||||
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
|
||||
checkGLcall("map PBO");
|
||||
@@ -3706,8 +3693,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
|
||||
/* Don't use PBOs for converted surfaces. During PBO conversion we look at
|
||||
* WINED3D_TEXTURE_CONVERTED but it isn't set (yet) in all cases it is
|
||||
* getting called. */
|
||||
- if ((format.convert || conversion)
|
||||
- && texture->sub_resources[surface_get_sub_resource_idx(surface)].buffer_object)
|
||||
+ if ((format.convert || conversion) && surface->pbo)
|
||||
{
|
||||
TRACE("Removing the pbo attached to surface %p.\n", surface);
|
||||
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index cb2b310f..01f54a9 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -1770,8 +1770,8 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
if (!(surface->resource.map_binding == WINED3D_LOCATION_USER_MEMORY
|
||||
- || texture->flags & WINED3D_TEXTURE_PIN_SYSMEM
|
||||
- || texture->sub_resources[sub_resource_idx].buffer_object))
|
||||
+ || surface->container->flags & WINED3D_TEXTURE_PIN_SYSMEM
|
||||
+ || surface->pbo))
|
||||
surface->resource.map_binding = WINED3D_LOCATION_DIB;
|
||||
}
|
||||
|
||||
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
|
||||
index 3782642..4b726d7 100644
|
||||
--- a/dlls/wined3d/volume.c
|
||||
+++ b/dlls/wined3d/volume.c
|
||||
@@ -214,7 +214,6 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume,
|
||||
struct wined3d_context *context, DWORD location)
|
||||
{
|
||||
DWORD required_access = volume_access_from_location(location);
|
||||
- struct wined3d_texture *texture = volume->container;
|
||||
|
||||
TRACE("Volume %p, loading %s, have %s.\n", volume, wined3d_debug_location(location),
|
||||
wined3d_debug_location(volume->locations));
|
||||
@@ -237,9 +236,9 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume,
|
||||
case WINED3D_LOCATION_TEXTURE_RGB:
|
||||
case WINED3D_LOCATION_TEXTURE_SRGB:
|
||||
if ((location == WINED3D_LOCATION_TEXTURE_RGB
|
||||
- && !(texture->flags & WINED3D_TEXTURE_RGB_ALLOCATED))
|
||||
+ && !(volume->container->flags & WINED3D_TEXTURE_RGB_ALLOCATED))
|
||||
|| (location == WINED3D_LOCATION_TEXTURE_SRGB
|
||||
- && !(texture->flags & WINED3D_TEXTURE_SRGB_ALLOCATED)))
|
||||
+ && !(volume->container->flags & WINED3D_TEXTURE_SRGB_ALLOCATED)))
|
||||
ERR("Trying to load (s)RGB texture without prior allocation.\n");
|
||||
|
||||
if (volume->locations & WINED3D_LOCATION_DISCARDED)
|
||||
@@ -250,18 +249,14 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume,
|
||||
else if (volume->locations & WINED3D_LOCATION_SYSMEM)
|
||||
{
|
||||
struct wined3d_const_bo_address data = {0, volume->resource.heap_memory};
|
||||
- wined3d_texture_bind_and_dirtify(texture, context,
|
||||
+ wined3d_texture_bind_and_dirtify(volume->container, context,
|
||||
location == WINED3D_LOCATION_TEXTURE_SRGB);
|
||||
wined3d_volume_upload_data(volume, context, &data);
|
||||
}
|
||||
else if (volume->locations & WINED3D_LOCATION_BUFFER)
|
||||
{
|
||||
- struct wined3d_const_bo_address data =
|
||||
- {
|
||||
- texture->sub_resources[volume->texture_level].buffer_object,
|
||||
- NULL
|
||||
- };
|
||||
- wined3d_texture_bind_and_dirtify(texture, context,
|
||||
+ struct wined3d_const_bo_address data = {volume->pbo, NULL};
|
||||
+ wined3d_texture_bind_and_dirtify(volume->container, context,
|
||||
location == WINED3D_LOCATION_TEXTURE_SRGB);
|
||||
wined3d_volume_upload_data(volume, context, &data);
|
||||
}
|
||||
@@ -299,9 +294,9 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume,
|
||||
struct wined3d_bo_address data = {0, volume->resource.heap_memory};
|
||||
|
||||
if (volume->locations & WINED3D_LOCATION_TEXTURE_RGB)
|
||||
- wined3d_texture_bind_and_dirtify(texture, context, FALSE);
|
||||
+ wined3d_texture_bind_and_dirtify(volume->container, context, FALSE);
|
||||
else
|
||||
- wined3d_texture_bind_and_dirtify(texture, context, TRUE);
|
||||
+ wined3d_texture_bind_and_dirtify(volume->container, context, TRUE);
|
||||
|
||||
volume->download_count++;
|
||||
wined3d_volume_download_data(volume, context, &data);
|
||||
@@ -316,7 +311,7 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume,
|
||||
break;
|
||||
|
||||
case WINED3D_LOCATION_BUFFER:
|
||||
- if (!texture->sub_resources[volume->texture_level].buffer_object)
|
||||
+ if (!volume->pbo)
|
||||
ERR("Trying to load WINED3D_LOCATION_BUFFER without setting it up first.\n");
|
||||
|
||||
if (volume->locations & WINED3D_LOCATION_DISCARDED)
|
||||
@@ -326,16 +321,12 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume,
|
||||
}
|
||||
else if (volume->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
|
||||
{
|
||||
- struct wined3d_bo_address data =
|
||||
- {
|
||||
- texture->sub_resources[volume->texture_level].buffer_object,
|
||||
- NULL
|
||||
- };
|
||||
+ struct wined3d_bo_address data = {volume->pbo, NULL};
|
||||
|
||||
if (volume->locations & WINED3D_LOCATION_TEXTURE_RGB)
|
||||
- wined3d_texture_bind_and_dirtify(texture, context, FALSE);
|
||||
+ wined3d_texture_bind_and_dirtify(volume->container, context, FALSE);
|
||||
else
|
||||
- wined3d_texture_bind_and_dirtify(texture, context, TRUE);
|
||||
+ wined3d_texture_bind_and_dirtify(volume->container, context, TRUE);
|
||||
|
||||
wined3d_volume_download_data(volume, context, &data);
|
||||
}
|
||||
@@ -365,31 +356,29 @@ void wined3d_volume_load(struct wined3d_volume *volume, struct wined3d_context *
|
||||
/* Context activation is done by the caller. */
|
||||
static void wined3d_volume_prepare_pbo(struct wined3d_volume *volume, struct wined3d_context *context)
|
||||
{
|
||||
- GLuint *buffer_object = &volume->container->sub_resources[volume->texture_level].buffer_object;
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
|
||||
- if (*buffer_object)
|
||||
+ if (volume->pbo)
|
||||
return;
|
||||
|
||||
- GL_EXTCALL(glGenBuffers(1, buffer_object));
|
||||
- GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, *buffer_object));
|
||||
+ GL_EXTCALL(glGenBuffers(1, &volume->pbo));
|
||||
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, volume->pbo));
|
||||
GL_EXTCALL(glBufferData(GL_PIXEL_UNPACK_BUFFER, volume->resource.size, NULL, GL_STREAM_DRAW));
|
||||
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
|
||||
checkGLcall("Create PBO");
|
||||
|
||||
- TRACE("Created PBO %u for volume %p.\n", *buffer_object, volume);
|
||||
+ TRACE("Created PBO %u for volume %p.\n", volume->pbo, volume);
|
||||
}
|
||||
|
||||
static void wined3d_volume_free_pbo(struct wined3d_volume *volume)
|
||||
{
|
||||
- GLuint *buffer_object = &volume->container->sub_resources[volume->texture_level].buffer_object;
|
||||
struct wined3d_context *context = context_acquire(volume->resource.device, NULL);
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
|
||||
- TRACE("Deleting PBO %u belonging to volume %p.\n", *buffer_object, volume);
|
||||
- GL_EXTCALL(glDeleteBuffers(1, buffer_object));
|
||||
+ TRACE("Deleting PBO %u belonging to volume %p.\n", volume->pbo, volume);
|
||||
+ GL_EXTCALL(glDeleteBuffers(1, &volume->pbo));
|
||||
checkGLcall("glDeleteBuffers");
|
||||
- *buffer_object = 0;
|
||||
+ volume->pbo = 0;
|
||||
context_release(context);
|
||||
}
|
||||
|
||||
@@ -397,7 +386,7 @@ void wined3d_volume_cleanup(struct wined3d_volume *volume)
|
||||
{
|
||||
TRACE("volume %p.\n", volume);
|
||||
|
||||
- if (volume->container->sub_resources[volume->texture_level].buffer_object)
|
||||
+ if (volume->pbo)
|
||||
wined3d_volume_free_pbo(volume);
|
||||
|
||||
resource_cleanup(&volume->resource);
|
||||
@@ -428,7 +417,7 @@ static void volume_unload(struct wined3d_resource *resource)
|
||||
wined3d_volume_invalidate_location(volume, ~WINED3D_LOCATION_DISCARDED);
|
||||
}
|
||||
|
||||
- if (volume->container->sub_resources[volume->texture_level].buffer_object)
|
||||
+ if (volume->pbo)
|
||||
{
|
||||
/* Should not happen because only dynamic default pool volumes
|
||||
* have a buffer, and those are not evicted by device_evit_managed_resources
|
||||
@@ -468,12 +457,11 @@ HRESULT wined3d_volume_map(struct wined3d_volume *volume,
|
||||
struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags)
|
||||
{
|
||||
struct wined3d_device *device = volume->resource.device;
|
||||
- struct wined3d_texture *texture = volume->container;
|
||||
struct wined3d_context *context;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
BYTE *base_memory;
|
||||
const struct wined3d_format *format = volume->resource.format;
|
||||
- const unsigned int fmt_flags = texture->resource.format_flags;
|
||||
+ const unsigned int fmt_flags = volume->container->resource.format_flags;
|
||||
|
||||
TRACE("volume %p, map_desc %p, box %s, flags %#x.\n",
|
||||
volume, map_desc, debug_box(box), flags);
|
||||
@@ -495,7 +483,7 @@ HRESULT wined3d_volume_map(struct wined3d_volume *volume,
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
if ((fmt_flags & WINED3DFMT_FLAG_BLOCKS) && box
|
||||
- && !wined3d_texture_check_block_align(texture, volume->texture_level, box))
|
||||
+ && !wined3d_texture_check_block_align(volume->container, volume->texture_level, box))
|
||||
{
|
||||
WARN("Map box %s is misaligned for %ux%u blocks.\n",
|
||||
debug_box(box), format->block_width, format->block_height);
|
||||
@@ -515,7 +503,7 @@ HRESULT wined3d_volume_map(struct wined3d_volume *volume,
|
||||
else
|
||||
wined3d_volume_load_location(volume, context, WINED3D_LOCATION_BUFFER);
|
||||
|
||||
- GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, texture->sub_resources[volume->texture_level].buffer_object));
|
||||
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, volume->pbo));
|
||||
|
||||
if (gl_info->supported[ARB_MAP_BUFFER_RANGE])
|
||||
{
|
||||
@@ -566,7 +554,7 @@ HRESULT wined3d_volume_map(struct wined3d_volume *volume,
|
||||
}
|
||||
else
|
||||
{
|
||||
- wined3d_texture_get_pitch(texture, volume->texture_level,
|
||||
+ wined3d_texture_get_pitch(volume->container, volume->texture_level,
|
||||
&map_desc->row_pitch, &map_desc->slice_pitch);
|
||||
}
|
||||
|
||||
@@ -596,7 +584,7 @@ HRESULT wined3d_volume_map(struct wined3d_volume *volume,
|
||||
|
||||
if (!(flags & (WINED3D_MAP_NO_DIRTY_UPDATE | WINED3D_MAP_READONLY)))
|
||||
{
|
||||
- wined3d_texture_set_dirty(texture);
|
||||
+ wined3d_texture_set_dirty(volume->container);
|
||||
wined3d_volume_invalidate_location(volume, ~volume->resource.map_binding);
|
||||
}
|
||||
|
||||
@@ -624,8 +612,7 @@ HRESULT wined3d_volume_unmap(struct wined3d_volume *volume)
|
||||
struct wined3d_context *context = context_acquire(device, NULL);
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
|
||||
- GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER,
|
||||
- volume->container->sub_resources[volume->texture_level].buffer_object));
|
||||
+ GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, volume->pbo));
|
||||
GL_EXTCALL(glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER));
|
||||
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
|
||||
checkGLcall("Unmap PBO");
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 468ff11..1774039 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -2391,8 +2391,6 @@ struct wined3d_texture
|
||||
struct wined3d_surface *surface;
|
||||
struct wined3d_volume *volume;
|
||||
} u;
|
||||
-
|
||||
- GLuint buffer_object;
|
||||
} sub_resources[1];
|
||||
};
|
||||
|
||||
@@ -2447,6 +2445,7 @@ struct wined3d_volume
|
||||
DWORD locations;
|
||||
GLint texture_level;
|
||||
DWORD download_count;
|
||||
+ GLuint pbo;
|
||||
};
|
||||
|
||||
static inline struct wined3d_volume *volume_from_resource(struct wined3d_resource *resource)
|
||||
@@ -2522,6 +2521,9 @@ struct wined3d_surface
|
||||
|
||||
UINT pow2Width;
|
||||
UINT pow2Height;
|
||||
+
|
||||
+ /* PBO */
|
||||
+ GLuint pbo;
|
||||
GLuint rb_multisample;
|
||||
GLuint rb_resolved;
|
||||
GLenum texture_target;
|
||||
--
|
||||
2.7.1
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
From 25903b870407e8368508fd002f15c509fdd9a66b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
|
||||
Date: Thu, 19 Sep 2013 13:09:58 +0200
|
||||
Subject: wined3d: Discard the backbuffer in discard presents.
|
||||
|
||||
---
|
||||
dlls/wined3d/swapchain.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
|
||||
index a02fdf0..9a36e38 100644
|
||||
--- a/dlls/wined3d/swapchain.c
|
||||
+++ b/dlls/wined3d/swapchain.c
|
||||
@@ -608,6 +608,17 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
|
||||
* up to date and hope WGL flipped front and back buffers and read this data into
|
||||
* the FBO. Don't bother about this for now. */
|
||||
|
||||
+ switch (swapchain->desc.swap_effect)
|
||||
+ {
|
||||
+ case WINED3D_SWAP_EFFECT_DISCARD:
|
||||
+ wined3d_texture_validate_location(swapchain->back_buffers[swapchain->desc.backbuffer_count - 1],
|
||||
+ 0, WINED3D_LOCATION_DISCARDED);
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
if (fb->depth_stencil)
|
||||
{
|
||||
struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(fb->depth_stencil);
|
||||
--
|
||||
2.8.0
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
From 0b0c0691884fbf0335df4d89bf94774205622da4 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 6 Mar 2016 22:08:40 +0100
|
||||
Subject: Revert "wined3d: Avoid volume_from_resource() in
|
||||
texture3d_prepare_texture()."
|
||||
|
||||
This reverts commit 09c862b6a23c35c2157842f1f7a1fa9a8d17da1d.
|
||||
---
|
||||
dlls/wined3d/texture.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index 01f54a9..af1c1de 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -1207,7 +1207,7 @@ static void texture3d_prepare_texture(struct wined3d_texture *texture, struct wi
|
||||
|
||||
for (i = 0; i < sub_count; ++i)
|
||||
{
|
||||
- struct wined3d_volume *volume = texture->sub_resources[i].u.volume;
|
||||
+ struct wined3d_volume *volume = volume_from_resource(texture->sub_resources[i].resource);
|
||||
|
||||
GL_EXTCALL(glTexImage3D(GL_TEXTURE_3D, volume->texture_level,
|
||||
srgb ? format->glGammaInternal : format->glInternal,
|
||||
--
|
||||
2.7.1
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
From 1752f853d8b96b779acbd0b62273e75d7b647732 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
|
||||
Date: Mon, 23 Sep 2013 23:58:41 +0200
|
||||
Subject: wined3d: Don't call the public map function in
|
||||
surface_convert_format.
|
||||
|
||||
TODO: Creating a helper surface and releasing it won't work with the CS.
|
||||
surface_cpu_blt will be called via the CS, so it can't call external
|
||||
methods that enqueue commands in the stream.
|
||||
---
|
||||
dlls/wined3d/surface.c | 78 ++++++++++++++++++++++++++++++++++----------------
|
||||
1 file changed, 53 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
|
||||
index 1189b97..d5e9f36 100644
|
||||
--- a/dlls/wined3d/surface.c
|
||||
+++ b/dlls/wined3d/surface.c
|
||||
@@ -1548,11 +1548,14 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
|
||||
{
|
||||
unsigned int texture_level = sub_resource_idx % src_texture->level_count;
|
||||
const struct wined3d_format *src_format = src_texture->resource.format;
|
||||
- struct wined3d_device *device = src_texture->resource.device;
|
||||
- const struct d3dfmt_converter_desc *conv = NULL;
|
||||
+ void *dst_data = NULL, *src_data = NULL;
|
||||
+ UINT src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch;
|
||||
+ const struct d3dfmt_converter_desc *conv;
|
||||
struct wined3d_texture *dst_texture;
|
||||
struct wined3d_resource_desc desc;
|
||||
- struct wined3d_map_desc src_map;
|
||||
+ struct wined3d_context *context = NULL;
|
||||
+ struct wined3d_device *device = src_texture->resource.device;
|
||||
+ struct wined3d_bo_address src_bo_addr;
|
||||
|
||||
if (!(conv = find_converter(src_format->id, dst_format->id)) && (!device->d3d_initialized
|
||||
|| !is_identity_fixup(src_format->color_fixup) || src_format->convert
|
||||
@@ -1582,34 +1585,45 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- memset(&src_map, 0, sizeof(src_map));
|
||||
- if (FAILED(wined3d_resource_map(&src_texture->resource, sub_resource_idx,
|
||||
- &src_map, NULL, WINED3D_MAP_READONLY)))
|
||||
- {
|
||||
- ERR("Failed to map the source texture.\n");
|
||||
- wined3d_texture_decref(dst_texture);
|
||||
- return NULL;
|
||||
- }
|
||||
+ wined3d_texture_get_pitch(src_texture, sub_resource_idx & src_texture->level_count,
|
||||
+ &src_row_pitch, &src_slice_pitch);
|
||||
+ wined3d_texture_get_pitch(dst_texture, 0, &dst_row_pitch, &dst_slice_pitch);
|
||||
+
|
||||
+ if (device->d3d_initialized)
|
||||
+ context = context_acquire(device, NULL);
|
||||
+
|
||||
+ wined3d_texture_load_location(src_texture, sub_resource_idx, context,
|
||||
+ src_texture->resource.map_binding);
|
||||
+ wined3d_texture_get_memory(src_texture, sub_resource_idx, &src_bo_addr,
|
||||
+ src_texture->resource.map_binding);
|
||||
+ src_data = wined3d_texture_map_bo_address(&src_bo_addr,
|
||||
+ src_texture->sub_resources[sub_resource_idx].size,
|
||||
+ context->gl_info, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READONLY);
|
||||
+ if (!src_data)
|
||||
+ goto error;
|
||||
+
|
||||
if (conv)
|
||||
{
|
||||
- struct wined3d_map_desc dst_map;
|
||||
+ struct wined3d_bo_address dst_bo_addr;
|
||||
|
||||
- memset(&dst_map, 0, sizeof(dst_map));
|
||||
- if (FAILED(wined3d_resource_map(&dst_texture->resource, 0, &dst_map, NULL, 0)))
|
||||
- {
|
||||
- ERR("Failed to map the destination texture.\n");
|
||||
- wined3d_resource_unmap(&src_texture->resource, sub_resource_idx);
|
||||
- wined3d_texture_decref(dst_texture);
|
||||
- return NULL;
|
||||
- }
|
||||
+ wined3d_texture_prepare_location(dst_texture, 0, context, dst_texture->resource.map_binding);
|
||||
+ wined3d_texture_get_memory(dst_texture, 0, &dst_bo_addr,
|
||||
+ dst_texture->resource.map_binding);
|
||||
+ dst_data = wined3d_texture_map_bo_address(&dst_bo_addr,
|
||||
+ dst_texture->sub_resources[0].size,
|
||||
+ context->gl_info, GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
+ if (!dst_data)
|
||||
+ goto error;
|
||||
|
||||
- conv->convert(src_map.data, dst_map.data, src_map.row_pitch, dst_map.row_pitch, desc.width, desc.height);
|
||||
+ conv->convert(src_data, dst_data, src_row_pitch, dst_row_pitch, desc.width, desc.height);
|
||||
|
||||
- wined3d_resource_unmap(&dst_texture->resource, 0);
|
||||
+ wined3d_texture_unmap_bo_address(&dst_bo_addr, context->gl_info, GL_PIXEL_UNPACK_BUFFER);
|
||||
}
|
||||
else
|
||||
{
|
||||
- struct wined3d_bo_address data = {0, src_map.data};
|
||||
+ /* FIXME: This seems weird, considering that we got a wined3d_bo_address from the source
|
||||
+ * surface above. Though not sure if the upload_data would work properly with a PBO src. */
|
||||
+ struct wined3d_bo_address data = {0, src_data};
|
||||
RECT src_rect = {0, 0, desc.width, desc.height};
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
struct wined3d_context *context;
|
||||
@@ -1622,16 +1636,30 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
|
||||
wined3d_texture_prepare_texture(dst_texture, context, FALSE);
|
||||
wined3d_texture_bind_and_dirtify(dst_texture, context, FALSE);
|
||||
wined3d_surface_upload_data(dst_texture->sub_resources[0].u.surface, gl_info, src_format,
|
||||
- &src_rect, src_map.row_pitch, &dst_point, FALSE, wined3d_const_bo_address(&data));
|
||||
+ &src_rect, src_row_pitch, &dst_point, FALSE, wined3d_const_bo_address(&data));
|
||||
|
||||
context_release(context);
|
||||
|
||||
wined3d_texture_validate_location(dst_texture, 0, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
wined3d_texture_invalidate_location(dst_texture, 0, ~WINED3D_LOCATION_TEXTURE_RGB);
|
||||
}
|
||||
- wined3d_resource_unmap(&src_texture->resource, sub_resource_idx);
|
||||
+ wined3d_texture_unmap_bo_address(&src_bo_addr, context->gl_info, GL_PIXEL_UNPACK_BUFFER);
|
||||
+
|
||||
+ if (context)
|
||||
+ context_release(context);
|
||||
|
||||
return dst_texture;
|
||||
+
|
||||
+error:
|
||||
+ ERR("Surface conversion failed.\n");
|
||||
+
|
||||
+ if (src_data)
|
||||
+ wined3d_texture_unmap_bo_address(&src_bo_addr, context->gl_info, GL_PIXEL_UNPACK_BUFFER);
|
||||
+ if (dst_texture)
|
||||
+ wined3d_texture_decref(dst_texture);
|
||||
+ if (context)
|
||||
+ context_release(context);
|
||||
+ return NULL;
|
||||
}
|
||||
|
||||
static HRESULT _Blt_ColorFill(BYTE *buf, unsigned int width, unsigned int height,
|
||||
--
|
||||
2.8.0
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
From a3ec578ff5afb88dddec526bb21981343f7429ea Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 6 Mar 2016 22:08:41 +0100
|
||||
Subject: Revert "wined3d: Avoid surface_from_resource() in
|
||||
swapchain_gl_frontbuffer_updated()."
|
||||
|
||||
This reverts commit c059191e0fe795e4643e56bb2ab806c9ce994055.
|
||||
---
|
||||
dlls/wined3d/swapchain.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
|
||||
index 299a47a..9b8d04c 100644
|
||||
--- a/dlls/wined3d/swapchain.c
|
||||
+++ b/dlls/wined3d/swapchain.c
|
||||
@@ -652,7 +652,7 @@ static void swapchain_gl_frontbuffer_updated(struct wined3d_swapchain *swapchain
|
||||
struct wined3d_surface *surface;
|
||||
struct wined3d_context *context;
|
||||
|
||||
- surface = swapchain->front_buffer->sub_resources[0].u.surface;
|
||||
+ surface = surface_from_resource(swapchain->front_buffer->sub_resources[0].resource);
|
||||
context = context_acquire(swapchain->device, surface);
|
||||
surface_load_location(surface, context, surface->container->resource.draw_binding);
|
||||
context_release(context);
|
||||
--
|
||||
2.7.1
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
From 317bc57491a7d82cc7274c31371bae4d49001e01 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefandoesinger@gmx.at>
|
||||
Date: Sun, 3 Apr 2016 14:45:06 +0100
|
||||
Subject: wined3d: Don't call the public map function in surface_cpu_blt.
|
||||
|
||||
---
|
||||
dlls/wined3d/surface.c | 67 +++++++++++++++++++++++++++++++++++++++++---------
|
||||
1 file changed, 56 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
|
||||
index d5e9f36..4746c5a 100644
|
||||
--- a/dlls/wined3d/surface.c
|
||||
+++ b/dlls/wined3d/surface.c
|
||||
@@ -3392,16 +3392,33 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
|
||||
const BYTE *sbuf;
|
||||
BYTE *dbuf;
|
||||
int x, y;
|
||||
+ struct wined3d_device *device = dst_texture->resource.device;
|
||||
+ struct wined3d_context *context = NULL;
|
||||
+ struct wined3d_bo_address src_bo_addr, dst_bo_addr;
|
||||
|
||||
TRACE("dst_texture %p, dst_sub_resource_idx %u, dst_box %s, src_texture %p, "
|
||||
"src_sub_resource_idx %u, src_box %s, flags %#x, fx %p, filter %s.\n",
|
||||
dst_texture, dst_sub_resource_idx, debug_box(dst_box), src_texture,
|
||||
src_sub_resource_idx, debug_box(src_box), flags, fx, debug_d3dtexturefiltertype(filter));
|
||||
|
||||
+ if (device->d3d_initialized)
|
||||
+ context = context_acquire(device, NULL);
|
||||
+
|
||||
+ wined3d_texture_load_location(dst_texture, dst_sub_resource_idx,
|
||||
+ context, dst_texture->resource.map_binding);
|
||||
+
|
||||
if (src_texture == dst_texture && src_sub_resource_idx == dst_sub_resource_idx)
|
||||
{
|
||||
same_sub_resource = TRUE;
|
||||
- wined3d_resource_map(&dst_texture->resource, dst_sub_resource_idx, &dst_map, NULL, 0);
|
||||
+
|
||||
+ wined3d_texture_get_memory(dst_texture, dst_sub_resource_idx, &dst_bo_addr,
|
||||
+ dst_texture->resource.map_binding);
|
||||
+ dst_map.data = wined3d_texture_map_bo_address(&dst_bo_addr,
|
||||
+ dst_texture->sub_resources[dst_sub_resource_idx].size,
|
||||
+ context->gl_info, GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
+ wined3d_texture_get_pitch(dst_texture, dst_sub_resource_idx % dst_texture->level_count,
|
||||
+ &dst_map.row_pitch, &dst_map.slice_pitch);
|
||||
+
|
||||
src_map = dst_map;
|
||||
src_format = dst_texture->resource.format;
|
||||
dst_format = src_format;
|
||||
@@ -3426,7 +3443,16 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
|
||||
src_texture = converted_texture;
|
||||
src_sub_resource_idx = 0;
|
||||
}
|
||||
- wined3d_resource_map(&src_texture->resource, src_sub_resource_idx, &src_map, NULL, WINED3D_MAP_READONLY);
|
||||
+ wined3d_texture_load_location(src_texture, src_sub_resource_idx,
|
||||
+ context, src_texture->resource.map_binding);
|
||||
+ wined3d_texture_get_pitch(src_texture, src_sub_resource_idx % src_texture->level_count,
|
||||
+ &src_map.row_pitch, &src_map.slice_pitch);
|
||||
+ wined3d_texture_get_memory(src_texture, src_sub_resource_idx, &src_bo_addr,
|
||||
+ src_texture->resource.map_binding);
|
||||
+ src_map.data = wined3d_texture_map_bo_address(&src_bo_addr,
|
||||
+ src_texture->sub_resources[src_sub_resource_idx].size,
|
||||
+ context->gl_info, GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
+
|
||||
src_format = src_texture->resource.format;
|
||||
src_fmt_flags = src_texture->resource.format_flags;
|
||||
}
|
||||
@@ -3436,7 +3462,13 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
|
||||
src_fmt_flags = dst_fmt_flags;
|
||||
}
|
||||
|
||||
- wined3d_resource_map(&dst_texture->resource, dst_sub_resource_idx, &dst_map, dst_box, 0);
|
||||
+ wined3d_texture_get_memory(dst_texture, dst_sub_resource_idx, &dst_bo_addr,
|
||||
+ dst_texture->resource.map_binding);
|
||||
+ dst_map.data = wined3d_texture_map_bo_address(&dst_bo_addr,
|
||||
+ dst_texture->sub_resources[dst_sub_resource_idx].size,
|
||||
+ context->gl_info, GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
+ wined3d_texture_get_pitch(dst_texture, dst_sub_resource_idx % dst_texture->level_count,
|
||||
+ &dst_map.row_pitch, &dst_map.slice_pitch);
|
||||
}
|
||||
|
||||
bpp = dst_format->byte_count;
|
||||
@@ -3450,12 +3482,9 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
|
||||
sbase = (BYTE *)src_map.data
|
||||
+ ((src_box->top / src_format->block_height) * src_map.row_pitch)
|
||||
+ ((src_box->left / src_format->block_width) * src_format->block_byte_count);
|
||||
- if (same_sub_resource)
|
||||
- dbuf = (BYTE *)dst_map.data
|
||||
- + ((dst_box->top / dst_format->block_height) * dst_map.row_pitch)
|
||||
- + ((dst_box->left / dst_format->block_width) * dst_format->block_byte_count);
|
||||
- else
|
||||
- dbuf = dst_map.data;
|
||||
+ dbuf = (BYTE *)dst_map.data
|
||||
+ + ((dst_box->top / dst_format->block_height) * dst_map.row_pitch)
|
||||
+ + ((dst_box->left / dst_format->block_width) * dst_format->block_byte_count);
|
||||
|
||||
if (src_fmt_flags & dst_fmt_flags & WINED3DFMT_FLAG_BLOCKS)
|
||||
{
|
||||
@@ -3847,16 +3876,32 @@ do { \
|
||||
}
|
||||
}
|
||||
|
||||
+ wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx,
|
||||
+ ~dst_texture->resource.map_binding);
|
||||
+
|
||||
error:
|
||||
if (flags)
|
||||
FIXME(" Unsupported flags %#x.\n", flags);
|
||||
|
||||
release:
|
||||
- wined3d_resource_unmap(&dst_texture->resource, dst_sub_resource_idx);
|
||||
+ wined3d_texture_unmap_bo_address(&dst_bo_addr, context->gl_info, GL_PIXEL_UNPACK_BUFFER);
|
||||
+
|
||||
+ if (dst_texture->swapchain
|
||||
+ && dst_texture == dst_texture->swapchain->front_buffer)
|
||||
+ {
|
||||
+ RECT *r = &dst_texture->swapchain->front_buffer_update;
|
||||
+
|
||||
+ SetRect(r, dst_box->left, dst_box->top, dst_box->right, dst_box->bottom);
|
||||
+ if (!(dst_texture->sub_resources[dst_sub_resource_idx].locations
|
||||
+ & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_TEXTURE_RGB)))
|
||||
+ dst_texture->swapchain->swapchain_ops->swapchain_frontbuffer_updated(dst_texture->swapchain);
|
||||
+ }
|
||||
if (src_texture && !same_sub_resource)
|
||||
- wined3d_resource_unmap(&src_texture->resource, src_sub_resource_idx);
|
||||
+ wined3d_texture_unmap_bo_address(&src_bo_addr, context->gl_info, GL_PIXEL_UNPACK_BUFFER);
|
||||
if (converted_texture)
|
||||
wined3d_texture_decref(converted_texture);
|
||||
+ if (context)
|
||||
+ context_release(context);
|
||||
|
||||
return hr;
|
||||
}
|
||||
--
|
||||
2.8.0
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
From 22489d4035d07941ef326dc05ac4fda8fee8b985 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 6 Mar 2016 22:08:43 +0100
|
||||
Subject: Revert "wined3d: Avoid surface_from_resource() in
|
||||
texture2d_prepare_texture()."
|
||||
|
||||
This reverts commit b309b831deb81f47b22f0c25a5fc0a1db6759d6d.
|
||||
---
|
||||
dlls/wined3d/texture.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index af1c1de..651318c 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -868,7 +868,7 @@ static void texture2d_prepare_texture(struct wined3d_texture *texture, struct wi
|
||||
|
||||
for (i = 0; i < sub_count; ++i)
|
||||
{
|
||||
- struct wined3d_surface *surface = texture->sub_resources[i].u.surface;
|
||||
+ struct wined3d_surface *surface = surface_from_resource(texture->sub_resources[i].resource);
|
||||
GLsizei height = surface->pow2Height;
|
||||
GLsizei width = surface->pow2Width;
|
||||
|
||||
--
|
||||
2.7.1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,27 +0,0 @@
|
||||
From a88ae9c0bcb8ba8eb4fd9892a6928f38c9add605 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 6 Mar 2016 22:08:44 +0100
|
||||
Subject: Revert "wined3d: Avoid surface_from_resource() in
|
||||
wined3d_texture_update_desc()."
|
||||
|
||||
This reverts commit aad8f74cc8b6cf382026bbaf2f929d240f2d326f.
|
||||
---
|
||||
dlls/wined3d/texture.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index 651318c..a664155 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -631,7 +631,7 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
- surface = texture->sub_resources[0].u.surface;
|
||||
+ surface = surface_from_resource(texture->sub_resources[0].resource);
|
||||
if (surface->resource.map_count || (surface->flags & SFLAG_DCINUSE))
|
||||
{
|
||||
WARN("Surface is mapped or the DC is in use.\n");
|
||||
--
|
||||
2.7.1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From e2f09806ffc0332e4b3fdb3a6112ad9a2bedb1c2 Mon Sep 17 00:00:00 2001
|
||||
From 536b18f20cf89bb8a177794057ad7dbae5c26e4c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
|
||||
Date: Sun, 7 Jul 2013 12:06:31 +0200
|
||||
Subject: wined3d: Preload buffers if streamsrc is not dirty
|
||||
@@ -18,10 +18,10 @@ here...
|
||||
3 files changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
|
||||
index 4e91176..7eef51e 100644
|
||||
index ce4d9d7..43920ac 100644
|
||||
--- a/dlls/wined3d/buffer.c
|
||||
+++ b/dlls/wined3d/buffer.c
|
||||
@@ -711,7 +711,7 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined
|
||||
@@ -716,7 +716,7 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined
|
||||
checkGLcall("glUnmapBuffer");
|
||||
}
|
||||
|
||||
@@ -31,10 +31,10 @@ index 4e91176..7eef51e 100644
|
||||
buffer->flags &= ~(WINED3D_BUFFER_SYNC | WINED3D_BUFFER_DISCARD);
|
||||
}
|
||||
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
|
||||
index 46aa0cc..116bf67 100644
|
||||
index a67aeca..ccba3e5 100644
|
||||
--- a/dlls/wined3d/context.c
|
||||
+++ b/dlls/wined3d/context.c
|
||||
@@ -3227,8 +3227,12 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de
|
||||
@@ -3414,8 +3414,12 @@ BOOL context_apply_draw_state(struct wined3d_context *context,
|
||||
for (i = 0, map = context->stream_info.use_map; map; map >>= 1, ++i)
|
||||
{
|
||||
if (map & 1)
|
||||
@@ -49,17 +49,17 @@ index 46aa0cc..116bf67 100644
|
||||
if (state->index_buffer)
|
||||
{
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index d320a62..4bbfe42 100644
|
||||
index f38e1aa..2fffc07 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -2786,7 +2786,6 @@ void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *co
|
||||
BYTE *buffer_get_sysmem(struct wined3d_buffer *This, struct wined3d_context *context) DECLSPEC_HIDDEN;
|
||||
@@ -3007,7 +3007,6 @@ void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *co
|
||||
BYTE *buffer_get_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) DECLSPEC_HIDDEN;
|
||||
void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_context *context,
|
||||
const struct wined3d_state *state) DECLSPEC_HIDDEN;
|
||||
-void buffer_mark_used(struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
|
||||
HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset,
|
||||
struct wined3d_buffer *src_buffer, unsigned int src_offset, unsigned int size) DECLSPEC_HIDDEN;
|
||||
HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer,
|
||||
const struct wined3d_box *box, const void *data) DECLSPEC_HIDDEN;
|
||||
|
||||
--
|
||||
2.6.4
|
||||
2.8.0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user