Added patch for d3d11 1d textures.

This commit is contained in:
Michael Müller
2016-08-31 17:42:50 +02:00
parent 8ca9f08b92
commit 6b709dc505
42 changed files with 3858 additions and 203 deletions

View File

@@ -1,18 +1,18 @@
From 8aa63bc1c917384f24353625459d8381d2474e54 Mon Sep 17 00:00:00 2001
From 3b8bb25493ee434d987b8768a4e0187b29d9f342 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 | 169 ++++++++++++++++++++++++++++++++++++-------------
2 files changed, 124 insertions(+), 155 deletions(-)
dlls/wined3d/surface.c | 110 ----------------------------
dlls/wined3d/texture.c | 192 +++++++++++++++++++++++++++++++------------------
2 files changed, 124 insertions(+), 178 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 6d5b22b..5805557 100644
index 5118429..59effac 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2865,67 +2865,6 @@ static void surface_load_ds_location(struct wined3d_surface *surface, struct win
@@ -2867,67 +2867,6 @@ static void surface_load_ds_location(struct wined3d_surface *surface, struct win
}
}
@@ -80,7 +80,7 @@ index 6d5b22b..5805557 100644
/* Context activation is done by the caller. */
static void surface_load_sysmem(struct wined3d_surface *surface,
struct wined3d_context *context, DWORD dst_location)
@@ -2938,12 +2877,6 @@ static void surface_load_sysmem(struct wined3d_surface *surface,
@@ -2940,12 +2879,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];
@@ -93,7 +93,7 @@ index 6d5b22b..5805557 100644
if (sub_resource->locations & (WINED3D_LOCATION_RB_MULTISAMPLE | WINED3D_LOCATION_RB_RESOLVED))
wined3d_texture_load_location(texture, sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB);
@@ -3188,46 +3121,11 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte
@@ -3190,46 +3123,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;
@@ -140,7 +140,7 @@ index 6d5b22b..5805557 100644
if (texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
{
@@ -3274,14 +3172,6 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte
@@ -3276,14 +3174,6 @@ void surface_load_location(struct wined3d_surface *surface, struct wined3d_conte
}
done:
@@ -156,7 +156,7 @@ index 6d5b22b..5805557 100644
}
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 2d155cb..40d333f 100644
index 4ec5501..c8b181b 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -80,27 +80,6 @@ GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture)
@@ -184,10 +184,10 @@ index 2d155cb..40d333f 100644
- }
-}
-
static void wined3d_texture_evict_sysmem(struct wined3d_texture *texture)
static BOOL is_power_of_two(UINT x)
{
struct wined3d_texture_sub_resource *sub_resource;
@@ -174,12 +153,135 @@ void wined3d_texture_invalidate_location(struct wined3d_texture *texture,
return (x != 0) && !(x & (x - 1));
@@ -179,12 +158,135 @@ void wined3d_texture_invalidate_location(struct wined3d_texture *texture,
sub_resource_idx, texture);
}
@@ -324,7 +324,7 @@ index 2d155cb..40d333f 100644
}
/* Context activation is done by the caller. */
@@ -2209,7 +2311,6 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
@@ -1610,7 +1712,6 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
struct wined3d_context *context, DWORD location)
{
struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx];
@@ -332,7 +332,54 @@ index 2d155cb..40d333f 100644
unsigned int row_pitch, slice_pitch;
TRACE("texture %p, sub_resource_idx %u, context %p, location %s.\n",
@@ -2217,30 +2318,9 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
@@ -1618,30 +1719,9 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
TRACE("Current resource location %s.\n", 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 1d texture 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("1d texture 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:
@@ -1724,7 +1804,6 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
return FALSE;
}
-done:
wined3d_texture_validate_location(texture, sub_resource_idx, location);
return TRUE;
@@ -2709,7 +2788,6 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
struct wined3d_context *context, DWORD location)
{
struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx];
- DWORD required_access = wined3d_resource_access_from_location(location);
unsigned int row_pitch, slice_pitch;
TRACE("texture %p, sub_resource_idx %u, context %p, location %s.\n",
@@ -2717,30 +2795,9 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
TRACE("Current resource location %s.\n", wined3d_debug_location(sub_resource->locations));
@@ -363,7 +410,7 @@ index 2d155cb..40d333f 100644
switch (location)
{
case WINED3D_LOCATION_TEXTURE_RGB:
@@ -2325,7 +2405,6 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
@@ -2825,7 +2882,6 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
return FALSE;
}
@@ -372,5 +419,5 @@ index 2d155cb..40d333f 100644
return TRUE;
--
2.9.0
2.8.1

View File

@@ -1,4 +1,4 @@
From ef8df8ff00cb4cc235b01ee452f806824ef00b3a Mon Sep 17 00:00:00 2001
From 67f6c320ba0d32d73a7cde737a1ecea30f627cca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Fri, 30 Aug 2013 17:00:35 +0200
Subject: wined3d: Wrap GL BOs in a structure
@@ -6,17 +6,17 @@ Subject: wined3d: Wrap GL BOs in a structure
The idea is to use those structures for mapping through the command stream and caching
them for DISCARD maps.
---
dlls/wined3d/device.c | 53 ++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/device.c | 53 +++++++++++++++++++++++++++++++++++++++
dlls/wined3d/surface.c | 2 +-
dlls/wined3d/texture.c | 53 ++++++++++++++++++------------------------
dlls/wined3d/wined3d_private.h | 15 +++++++++++-
4 files changed, 91 insertions(+), 32 deletions(-)
dlls/wined3d/texture.c | 57 ++++++++++++++++++------------------------
dlls/wined3d/wined3d_private.h | 15 ++++++++++-
4 files changed, 93 insertions(+), 34 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 5562b31..928fcda 100644
index 56d45e5..824fa89 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5270,3 +5270,56 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
@@ -5241,3 +5241,56 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
else
return CallWindowProcA(proc, window, message, wparam, lparam);
}
@@ -74,10 +74,10 @@ index 5562b31..928fcda 100644
+ wined3d_device_destroy_bo(device, context, bo);
+}
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 444237e..46f79db 100644
index a0b6d62..e187742 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3080,7 +3080,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
@@ -3075,7 +3075,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. */
@@ -87,10 +87,10 @@ index 444237e..46f79db 100644
TRACE("Removing the pbo attached to surface %p.\n", surface);
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index d98503d..d0acd74 100644
index 6ca00ce..06ae160 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -206,7 +206,7 @@ void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int su
@@ -342,7 +342,7 @@ void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int su
if (locations & WINED3D_LOCATION_BUFFER)
{
data->addr = NULL;
@@ -99,7 +99,7 @@ index d98503d..d0acd74 100644
return;
}
if (locations & WINED3D_LOCATION_USER_MEMORY)
@@ -303,18 +303,17 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
@@ -439,18 +439,17 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
/* Context activation is done by the caller. */
static void wined3d_texture_remove_buffer_object(struct wined3d_texture *texture,
@@ -124,7 +124,7 @@ index d98503d..d0acd74 100644
}
static void wined3d_texture_update_map_binding(struct wined3d_texture *texture)
@@ -334,7 +333,7 @@ static void wined3d_texture_update_map_binding(struct wined3d_texture *texture)
@@ -470,7 +469,7 @@ static void wined3d_texture_update_map_binding(struct wined3d_texture *texture)
&& !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)
@@ -133,7 +133,7 @@ index d98503d..d0acd74 100644
}
if (context)
@@ -491,28 +490,25 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture)
@@ -627,28 +626,25 @@ 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;
@@ -167,7 +167,7 @@ index d98503d..d0acd74 100644
}
if (context)
context_release(context);
@@ -1185,22 +1181,19 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
@@ -1321,22 +1317,19 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
/* Context activation is done by the caller. */
static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *texture,
@@ -195,7 +195,7 @@ index d98503d..d0acd74 100644
}
static void wined3d_texture_force_reload(struct wined3d_texture *texture)
@@ -1326,7 +1319,7 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned
@@ -1462,7 +1455,7 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned
return TRUE;
case WINED3D_LOCATION_BUFFER:
@@ -204,7 +204,25 @@ index d98503d..d0acd74 100644
return TRUE;
case WINED3D_LOCATION_TEXTURE_RGB:
@@ -1592,8 +1585,8 @@ static void wined3d_texture_unload(struct wined3d_resource *resource)
@@ -1742,7 +1735,7 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
}
else if (sub_resource->locations & WINED3D_LOCATION_BUFFER)
{
- struct wined3d_const_bo_address data = {sub_resource->buffer_object, NULL};
+ struct wined3d_const_bo_address data = {sub_resource->buffer->name, NULL};
wined3d_texture_bind_and_dirtify(texture, context, location == WINED3D_LOCATION_TEXTURE_SRGB);
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
texture1d_upload_data(texture, sub_resource_idx, context, &data, row_pitch, slice_pitch);
@@ -1787,7 +1780,7 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
case WINED3D_LOCATION_BUFFER:
if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
{
- struct wined3d_bo_address data = {sub_resource->buffer_object, NULL};
+ struct wined3d_bo_address data = {sub_resource->buffer->name, NULL};
if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
wined3d_texture_bind_and_dirtify(texture, context, FALSE);
@@ -2068,8 +2061,8 @@ static void wined3d_texture_unload(struct wined3d_resource *resource)
wined3d_texture_invalidate_location(texture, i, ~WINED3D_LOCATION_DISCARDED);
}
@@ -215,7 +233,7 @@ index d98503d..d0acd74 100644
if (resource->type == WINED3D_RTYPE_TEXTURE_2D)
{
@@ -2188,7 +2181,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
@@ -2845,7 +2838,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
}
else if (sub_resource->locations & WINED3D_LOCATION_BUFFER)
{
@@ -224,7 +242,7 @@ index d98503d..d0acd74 100644
wined3d_texture_bind_and_dirtify(texture, context,
location == WINED3D_LOCATION_TEXTURE_SRGB);
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
@@ -2234,7 +2227,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
@@ -2891,7 +2884,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
case WINED3D_LOCATION_BUFFER:
if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
{
@@ -234,10 +252,10 @@ index d98503d..d0acd74 100644
if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
wined3d_texture_bind_and_dirtify(texture, context, FALSE);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index f84b267..76be9c5 100644
index e6d6647..3796ebb 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2427,6 +2427,14 @@ struct wined3d_state
@@ -2433,6 +2433,14 @@ struct wined3d_state
struct wined3d_rasterizer_state *rasterizer_state;
};
@@ -252,7 +270,7 @@ index f84b267..76be9c5 100644
#define WINED3D_UNMAPPED_STAGE ~0U
/* Multithreaded flag. Removed from the public header to signal that
@@ -2535,6 +2543,11 @@ void device_invalidate_state(const struct wined3d_device *device, DWORD state) D
@@ -2543,6 +2551,11 @@ void device_invalidate_state(const struct wined3d_device *device, DWORD state) D
void device_invalidate_shader_constants(const struct wined3d_device *device, DWORD mask) DECLSPEC_HIDDEN;
void device_exec_update_texture(struct wined3d_context *context, struct wined3d_texture *src_texture,
struct wined3d_texture *dst_texture) DECLSPEC_HIDDEN;
@@ -264,7 +282,7 @@ index f84b267..76be9c5 100644
static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
{
@@ -2722,7 +2735,7 @@ struct wined3d_texture
@@ -2731,7 +2744,7 @@ struct wined3d_texture
unsigned int map_count;
DWORD locations;
@@ -274,5 +292,5 @@ index f84b267..76be9c5 100644
} sub_resources[1];
};
--
2.9.0
2.8.1

File diff suppressed because it is too large Load Diff