mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Added patch to implement copying resources between compatible formats.
This commit is contained in:
parent
a5daeb1e36
commit
e2a70628df
@ -433,6 +433,7 @@ patch_enable_all ()
|
||||
enable_wined3d_Accounting="$1"
|
||||
enable_wined3d_CSMT_Helper="$1"
|
||||
enable_wined3d_CSMT_Main="$1"
|
||||
enable_wined3d_Copy_Resource_Typeless="$1"
|
||||
enable_wined3d_Core_Context="$1"
|
||||
enable_wined3d_DXTn="$1"
|
||||
enable_wined3d_GTX_560M="$1"
|
||||
@ -1552,6 +1553,9 @@ patch_enable ()
|
||||
wined3d-CSMT_Main)
|
||||
enable_wined3d_CSMT_Main="$2"
|
||||
;;
|
||||
wined3d-Copy_Resource_Typeless)
|
||||
enable_wined3d_Copy_Resource_Typeless="$2"
|
||||
;;
|
||||
wined3d-Core_Context)
|
||||
enable_wined3d_Core_Context="$2"
|
||||
;;
|
||||
@ -2155,6 +2159,9 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
|
||||
if test "$enable_wined3d_Accounting" -gt 1; then
|
||||
abort "Patchset wined3d-Accounting disabled, but wined3d-CSMT_Helper depends on that."
|
||||
fi
|
||||
if test "$enable_wined3d_Copy_Resource_Typeless" -gt 1; then
|
||||
abort "Patchset wined3d-Copy_Resource_Typeless disabled, but wined3d-CSMT_Helper depends on that."
|
||||
fi
|
||||
if test "$enable_wined3d_DXTn" -gt 1; then
|
||||
abort "Patchset wined3d-DXTn disabled, but wined3d-CSMT_Helper depends on that."
|
||||
fi
|
||||
@ -2173,12 +2180,20 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
|
||||
enable_ntdll_DllRedirects=1
|
||||
enable_wined3d_1DTextures=1
|
||||
enable_wined3d_Accounting=1
|
||||
enable_wined3d_Copy_Resource_Typeless=1
|
||||
enable_wined3d_DXTn=1
|
||||
enable_wined3d_QUERY_Stubs=1
|
||||
enable_wined3d_Revert_Buffer_Upload=1
|
||||
enable_wined3d_Silence_FIXMEs=1
|
||||
fi
|
||||
|
||||
if test "$enable_wined3d_Copy_Resource_Typeless" -eq 1; then
|
||||
if test "$enable_d3d11_Depth_Bias" -gt 1; then
|
||||
abort "Patchset d3d11-Depth_Bias disabled, but wined3d-Copy_Resource_Typeless depends on that."
|
||||
fi
|
||||
enable_d3d11_Depth_Bias=1
|
||||
fi
|
||||
|
||||
if test "$enable_wineboot_ProxySettings" -eq 1; then
|
||||
if test "$enable_wineboot_DriveSerial" -gt 1; then
|
||||
abort "Patchset wineboot-DriveSerial disabled, but wineboot-ProxySettings depends on that."
|
||||
@ -9107,6 +9122,28 @@ if test "$enable_wined3d_Accounting" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset wined3d-Copy_Resource_Typeless
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * d3d11-Depth_Bias
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/d3d11/tests/d3d11.c, dlls/wined3d/cs.c, dlls/wined3d/device.c, dlls/wined3d/directx.c, dlls/wined3d/utils.c,
|
||||
# | dlls/wined3d/wined3d_gl.h, dlls/wined3d/wined3d_private.h
|
||||
# |
|
||||
if test "$enable_wined3d_Copy_Resource_Typeless" -eq 1; then
|
||||
patch_apply wined3d-Copy_Resource_Typeless/0001-d3d11-tests-Add-more-advanced-CopySubresourceRegion-.patch
|
||||
patch_apply wined3d-Copy_Resource_Typeless/0002-wined3d-Add-WINED3DFMT_R8G8B8A8_SNORM-to-WINED3DFMT_.patch
|
||||
patch_apply wined3d-Copy_Resource_Typeless/0003-wined3d-Implement-copying-sub-resources-between-comp.patch
|
||||
patch_apply wined3d-Copy_Resource_Typeless/0004-wined3d-Use-wined3d_cs_emit_copy_sub_resource-also-f.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Michael Müller", "d3d11/tests: Add more advanced CopySubresourceRegion tests.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "wined3d: Add WINED3DFMT_R8G8B8A8_SNORM to WINED3DFMT_R8G8B8A8_TYPELESS group.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "wined3d: Implement copying sub resources between compatible formats.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "wined3d: Use wined3d_cs_emit_copy_sub_resource also for wined3d_device_copy_resource.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset wined3d-QUERY_Stubs
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
@ -9156,8 +9193,8 @@ fi
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * d3d11-Deferred_Context, d3d9-Tests, makedep-PARENTSPEC, ntdll-Attach_Process_DLLs, ntdll-DllOverrides_WOW64, ntdll-
|
||||
# | Loader_Machine_Type, ntdll-DllRedirects, wined3d-1DTextures, wined3d-Accounting, wined3d-DXTn, wined3d-QUERY_Stubs,
|
||||
# | wined3d-Revert_Buffer_Upload, wined3d-Silence_FIXMEs
|
||||
# | Loader_Machine_Type, ntdll-DllRedirects, wined3d-1DTextures, wined3d-Accounting, d3d11-Depth_Bias, wined3d-
|
||||
# | Copy_Resource_Typeless, wined3d-DXTn, wined3d-QUERY_Stubs, wined3d-Revert_Buffer_Upload, wined3d-Silence_FIXMEs
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * configure.ac, dlls/wined3d-csmt/Makefile.in, dlls/wined3d-csmt/version.rc
|
||||
@ -9282,8 +9319,9 @@ fi
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * d3d11-Deferred_Context, d3d9-Tests, makedep-PARENTSPEC, ntdll-Attach_Process_DLLs, ntdll-DllOverrides_WOW64, ntdll-
|
||||
# | Loader_Machine_Type, ntdll-DllRedirects, wined3d-1DTextures, wined3d-Accounting, wined3d-DXTn, wined3d-QUERY_Stubs,
|
||||
# | wined3d-Revert_Buffer_Upload, wined3d-Silence_FIXMEs, wined3d-CSMT_Helper
|
||||
# | Loader_Machine_Type, ntdll-DllRedirects, wined3d-1DTextures, wined3d-Accounting, d3d11-Depth_Bias, wined3d-
|
||||
# | Copy_Resource_Typeless, wined3d-DXTn, wined3d-QUERY_Stubs, wined3d-Revert_Buffer_Upload, wined3d-Silence_FIXMEs,
|
||||
# | wined3d-CSMT_Helper
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#11674] Support for CSMT (command stream) to increase graphic performance
|
||||
|
@ -4,6 +4,7 @@ Depends: wined3d-QUERY_Stubs
|
||||
Depends: wined3d-1DTextures
|
||||
Depends: wined3d-Silence_FIXMEs
|
||||
Depends: wined3d-Revert_Buffer_Upload
|
||||
Depends: wined3d-Copy_Resource_Typeless
|
||||
Depends: d3d9-Tests
|
||||
Depends: d3d11-Deferred_Context
|
||||
Depends: makedep-PARENTSPEC
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 28bce0d64734c37b48c470b5fb16cf383d8e25be Mon Sep 17 00:00:00 2001
|
||||
From 1c8d189c654011204d1c15673ae128930778c4b6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Mon, 20 Feb 2017 00:27:25 +0100
|
||||
Subject: wined3d: Improve wined3d_cs_emit_update_sub_resource.
|
||||
@ -10,10 +10,10 @@ Subject: wined3d: Improve wined3d_cs_emit_update_sub_resource.
|
||||
3 files changed, 75 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index b8bad5bc91b..5e365a37d93 100644
|
||||
index c2b5a2f965f..8a4f4358e9d 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -402,6 +402,7 @@ struct wined3d_cs_update_sub_resource
|
||||
@@ -403,6 +403,7 @@ struct wined3d_cs_update_sub_resource
|
||||
unsigned int sub_resource_idx;
|
||||
struct wined3d_box box;
|
||||
struct wined3d_sub_resource_data data;
|
||||
@ -21,7 +21,7 @@ index b8bad5bc91b..5e365a37d93 100644
|
||||
};
|
||||
|
||||
struct wined3d_cs_add_dirty_texture_region
|
||||
@@ -2138,6 +2139,51 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
|
||||
@@ -2150,6 +2151,51 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
|
||||
unsigned int slice_pitch)
|
||||
{
|
||||
struct wined3d_cs_update_sub_resource *op;
|
||||
@ -73,7 +73,7 @@ index b8bad5bc91b..5e365a37d93 100644
|
||||
|
||||
op = cs->ops->require_space(cs, sizeof(*op), WINED3D_CS_QUEUE_MAP);
|
||||
op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE;
|
||||
@@ -2151,8 +2197,6 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
|
||||
@@ -2163,8 +2209,6 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
|
||||
wined3d_resource_acquire(resource);
|
||||
|
||||
cs->ops->submit(cs, WINED3D_CS_QUEUE_MAP);
|
||||
@ -82,8 +82,8 @@ index b8bad5bc91b..5e365a37d93 100644
|
||||
cs->ops->finish(cs, WINED3D_CS_QUEUE_MAP);
|
||||
}
|
||||
|
||||
@@ -2279,6 +2323,11 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
|
||||
/* WINED3D_CS_OP_CLEAR_UNORDERED_ACCESS_VIEW */ wined3d_cs_exec_clear_unordered_access_view,
|
||||
@@ -2435,6 +2479,11 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
|
||||
/* WINED3D_CS_OP_COPY_SUB_RESOURCE */ wined3d_cs_exec_copy_sub_resource,
|
||||
};
|
||||
|
||||
+static BOOL wined3d_cs_st_check_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id)
|
||||
@ -94,7 +94,7 @@ index b8bad5bc91b..5e365a37d93 100644
|
||||
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id)
|
||||
{
|
||||
if (size > (cs->data_size - cs->end))
|
||||
@@ -2332,6 +2381,7 @@ static void wined3d_cs_st_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
|
||||
@@ -2488,6 +2537,7 @@ static void wined3d_cs_st_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
|
||||
|
||||
static const struct wined3d_cs_ops wined3d_cs_st_ops =
|
||||
{
|
||||
@ -102,7 +102,7 @@ index b8bad5bc91b..5e365a37d93 100644
|
||||
wined3d_cs_st_require_space,
|
||||
wined3d_cs_st_submit,
|
||||
wined3d_cs_st_finish,
|
||||
@@ -2364,6 +2414,19 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs, enum wined3d_cs_queue_id
|
||||
@@ -2520,6 +2570,19 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs, enum wined3d_cs_queue_id
|
||||
wined3d_cs_queue_submit(&cs->queue[queue_id], cs);
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ index b8bad5bc91b..5e365a37d93 100644
|
||||
static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size_t size, struct wined3d_cs *cs)
|
||||
{
|
||||
size_t queue_size = ARRAY_SIZE(queue->data);
|
||||
@@ -2425,6 +2488,14 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size
|
||||
@@ -2581,6 +2644,14 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size
|
||||
return packet->data;
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ index b8bad5bc91b..5e365a37d93 100644
|
||||
static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id)
|
||||
{
|
||||
if (cs->thread_id == GetCurrentThreadId())
|
||||
@@ -2444,6 +2515,7 @@ static void wined3d_cs_mt_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
|
||||
@@ -2600,6 +2671,7 @@ static void wined3d_cs_mt_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
|
||||
|
||||
static const struct wined3d_cs_ops wined3d_cs_mt_ops =
|
||||
{
|
||||
@ -146,10 +146,10 @@ index b8bad5bc91b..5e365a37d93 100644
|
||||
wined3d_cs_mt_submit,
|
||||
wined3d_cs_mt_finish,
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index b165543cc5c..208a10c92f9 100644
|
||||
index 56171835762..23f14349a62 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -4270,8 +4270,6 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
|
||||
@@ -4285,8 +4285,6 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
|
||||
return;
|
||||
}
|
||||
|
||||
@ -159,10 +159,10 @@ index b165543cc5c..208a10c92f9 100644
|
||||
}
|
||||
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 8675eda180d..038699fe91d 100644
|
||||
index bd43fc55dea..e1a79f6282c 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -3391,6 +3391,7 @@ struct wined3d_cs_queue
|
||||
@@ -3398,6 +3398,7 @@ struct wined3d_cs_queue
|
||||
|
||||
struct wined3d_cs_ops
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -402,6 +402,9 @@ struct wined3d_cs_update_sub_resource
|
||||
@@ -403,6 +403,9 @@ struct wined3d_cs_update_sub_resource
|
||||
unsigned int sub_resource_idx;
|
||||
struct wined3d_box box;
|
||||
struct wined3d_sub_resource_data data;
|
||||
@ -47,7 +47,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
};
|
||||
|
||||
struct wined3d_cs_add_dirty_texture_region
|
||||
@@ -2138,6 +2141,53 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
|
||||
@@ -2150,6 +2153,53 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
|
||||
unsigned int slice_pitch)
|
||||
{
|
||||
struct wined3d_cs_update_sub_resource *op;
|
||||
@ -101,7 +101,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
|
||||
op = cs->ops->require_space(cs, sizeof(*op), WINED3D_CS_QUEUE_MAP);
|
||||
op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE;
|
||||
@@ -2151,8 +2201,10 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
|
||||
@@ -2163,8 +2213,10 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
|
||||
wined3d_resource_acquire(resource);
|
||||
|
||||
cs->ops->submit(cs, WINED3D_CS_QUEUE_MAP);
|
||||
@ -112,8 +112,8 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
cs->ops->finish(cs, WINED3D_CS_QUEUE_MAP);
|
||||
}
|
||||
|
||||
@@ -2279,6 +2331,13 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
|
||||
/* WINED3D_CS_OP_CLEAR_UNORDERED_ACCESS_VIEW */ wined3d_cs_exec_clear_unordered_access_view,
|
||||
@@ -2435,6 +2487,13 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
|
||||
/* WINED3D_CS_OP_COPY_SUB_RESOURCE */ wined3d_cs_exec_copy_sub_resource,
|
||||
};
|
||||
|
||||
+#if defined(STAGING_CSMT)
|
||||
@ -126,7 +126,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id)
|
||||
{
|
||||
if (size > (cs->data_size - cs->end))
|
||||
@@ -2332,6 +2391,9 @@ static void wined3d_cs_st_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
|
||||
@@ -2488,6 +2547,9 @@ static void wined3d_cs_st_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
|
||||
|
||||
static const struct wined3d_cs_ops wined3d_cs_st_ops =
|
||||
{
|
||||
@ -136,7 +136,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
wined3d_cs_st_require_space,
|
||||
wined3d_cs_st_submit,
|
||||
wined3d_cs_st_finish,
|
||||
@@ -2364,6 +2426,21 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs, enum wined3d_cs_queue_id
|
||||
@@ -2520,6 +2582,21 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs, enum wined3d_cs_queue_id
|
||||
wined3d_cs_queue_submit(&cs->queue[queue_id], cs);
|
||||
}
|
||||
|
||||
@ -158,7 +158,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size_t size, struct wined3d_cs *cs)
|
||||
{
|
||||
size_t queue_size = ARRAY_SIZE(queue->data);
|
||||
@@ -2425,6 +2502,16 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size
|
||||
@@ -2581,6 +2658,16 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size
|
||||
return packet->data;
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id)
|
||||
{
|
||||
if (cs->thread_id == GetCurrentThreadId())
|
||||
@@ -2444,6 +2531,9 @@ static void wined3d_cs_mt_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
|
||||
@@ -2600,6 +2687,9 @@ static void wined3d_cs_mt_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
|
||||
|
||||
static const struct wined3d_cs_ops wined3d_cs_mt_ops =
|
||||
{
|
||||
@ -198,7 +198,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
wined3d_device_delete_opengl_contexts(device);
|
||||
|
||||
if (device->fb.depth_stencil)
|
||||
@@ -4176,6 +4179,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
|
||||
@@ -4180,6 +4183,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
if (dst_texture->sub_resources[dst_sub_resource_idx].map_count)
|
||||
{
|
||||
WARN("Destination sub-resource %u is mapped.\n", dst_sub_resource_idx);
|
||||
@@ -4186,6 +4190,19 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
|
||||
@@ -4190,6 +4194,19 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
|
||||
{
|
||||
WARN("Source sub-resource %u is mapped.\n", src_sub_resource_idx);
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
@ -226,7 +226,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
}
|
||||
|
||||
if (!src_box)
|
||||
@@ -4279,8 +4296,10 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
|
||||
@@ -4283,8 +4300,10 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
|
||||
return;
|
||||
}
|
||||
|
||||
@ -237,7 +237,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
wined3d_cs_emit_update_sub_resource(device->cs, resource, sub_resource_idx, box, data, row_pitch, depth_pitch);
|
||||
}
|
||||
|
||||
@@ -5229,3 +5248,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
|
||||
@@ -5233,3 +5252,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
|
||||
else
|
||||
return CallWindowProcA(proc, window, message, wparam, lparam);
|
||||
}
|
||||
|
@ -0,0 +1,180 @@
|
||||
From 2e62577012d1fae93b3fabf6c4e1ef932b097aa8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sun, 9 Jul 2017 00:58:50 +0200
|
||||
Subject: d3d11/tests: Add more advanced CopySubresourceRegion tests.
|
||||
|
||||
---
|
||||
dlls/d3d11/tests/d3d11.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 121 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
|
||||
index f15d4873ab1..5a6bd46b905 100644
|
||||
--- a/dlls/d3d11/tests/d3d11.c
|
||||
+++ b/dlls/d3d11/tests/d3d11.c
|
||||
@@ -10446,6 +10446,7 @@ static void test_copy_subresource_region(void)
|
||||
struct d3d11_test_context test_context;
|
||||
ID3D11Buffer *dst_buffer, *src_buffer;
|
||||
D3D11_SUBRESOURCE_DATA resource_data;
|
||||
+ D3D11_MAPPED_SUBRESOURCE map_desc;
|
||||
D3D11_TEXTURE2D_DESC texture_desc;
|
||||
ID3D11SamplerState *sampler_state;
|
||||
ID3D11ShaderResourceView *ps_srv;
|
||||
@@ -10455,7 +10456,7 @@ static void test_copy_subresource_region(void)
|
||||
struct resource_readback rb;
|
||||
ID3D11PixelShader *ps;
|
||||
ID3D11Device *device;
|
||||
- unsigned int i, j;
|
||||
+ unsigned int i, j, k;
|
||||
D3D11_BOX box;
|
||||
DWORD color;
|
||||
HRESULT hr;
|
||||
@@ -10512,13 +10513,19 @@ static void test_copy_subresource_region(void)
|
||||
0x0010000a, 0x00000000, 0x0100003e,
|
||||
};
|
||||
static const float red[] = {1.0f, 0.0f, 0.0f, 0.5f};
|
||||
- static const DWORD initial_data[16] = {0};
|
||||
+ static const DWORD initial_data[32] = {0};
|
||||
static const DWORD bitmap_data[] =
|
||||
{
|
||||
+ /* 1. layer */
|
||||
0xff0000ff, 0xff00ffff, 0xff00ff00, 0xffffff00,
|
||||
0xffff0000, 0xffff00ff, 0xff000000, 0xff7f7f7f,
|
||||
0xffffffff, 0xffffffff, 0xffffffff, 0xff000000,
|
||||
0xffffffff, 0xff000000, 0xff000000, 0xff000000,
|
||||
+ /* second layer / mip map level / ... */
|
||||
+ 0xffff44ff, 0xff00edd0, 0xfff22fff, 0xff0ccc00,
|
||||
+ 0xff8f8f8f, 0xff00ffff, 0xff000120, 0xffff1234,
|
||||
+ 0xff0560ff, 0xffff34ff, 0xff12ff00, 0xffffff00,
|
||||
+ 0xffff2222, 0xfff1111f, 0xff031200, 0x0ff02200,
|
||||
};
|
||||
static const DWORD expected_colors[] =
|
||||
{
|
||||
@@ -10527,6 +10534,34 @@ static void test_copy_subresource_region(void)
|
||||
0xff7f7f7f, 0xffff0000, 0xffff00ff, 0xff7f7f7f,
|
||||
0xffffffff, 0xffffffff, 0xff000000, 0x00000000,
|
||||
};
|
||||
+ struct
|
||||
+ {
|
||||
+ DXGI_FORMAT src_format;
|
||||
+ DXGI_FORMAT dst_format;
|
||||
+ UINT width;
|
||||
+ UINT height;
|
||||
+ UINT levels;
|
||||
+ UINT layers;
|
||||
+ UINT src_sub_index;
|
||||
+ UINT dst_sub_index;
|
||||
+ }
|
||||
+ compatible_formats[] =
|
||||
+ {
|
||||
+ {DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UINT, 4, 4, 1, 1, 0, 0},
|
||||
+ {DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_SNORM, 4, 4, 1, 1, 0, 0},
|
||||
+ {DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_SINT, 4, 4, 1, 1, 0, 0},
|
||||
+ {DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_TYPELESS, 4, 4, 1, 1, 0, 0},
|
||||
+ {DXGI_FORMAT_R8G8B8A8_TYPELESS, DXGI_FORMAT_R8G8B8A8_UNORM, 4, 4, 1, 1, 0, 0},
|
||||
+ {DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UINT, 4, 4, 1, 2, 1, 1},
|
||||
+ {DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UINT, 4, 4, 1, 2, 0, 1},
|
||||
+ {DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UINT, 2, 2, 2, 2, 0, 0},
|
||||
+ {DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UINT, 2, 2, 2, 2, 0, 1},
|
||||
+ {DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UINT, 2, 2, 2, 2, 0, 2},
|
||||
+ {DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UINT, 2, 2, 2, 2, 0, 3},
|
||||
+ {DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UINT, 2, 2, 2, 2, 1, 0},
|
||||
+ {DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UINT, 2, 2, 2, 2, 2, 0},
|
||||
+ {DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UINT, 2, 2, 2, 2, 3, 0},
|
||||
+ };
|
||||
|
||||
if (!init_test_context(&test_context, NULL))
|
||||
return;
|
||||
@@ -10652,6 +10687,90 @@ static void test_copy_subresource_region(void)
|
||||
ID3D11Texture2D_Release(dst_texture);
|
||||
ID3D11Texture2D_Release(src_texture);
|
||||
|
||||
+ /* test copy between compatible formats */
|
||||
+ texture_desc.SampleDesc.Count = 1;
|
||||
+ texture_desc.SampleDesc.Quality = 0;
|
||||
+ texture_desc.MiscFlags = 0;
|
||||
+
|
||||
+ for (k = 0; k < sizeof(compatible_formats) / sizeof(compatible_formats[0]); k++)
|
||||
+ {
|
||||
+ UINT level_src, level_src_width, level_src_height;
|
||||
+ UINT level_dst, level_dst_width, level_dst_height;
|
||||
+ D3D11_SUBRESOURCE_DATA src_data[4], dst_data[4];
|
||||
+ const DWORD *c_result, *c_expected;
|
||||
+ DWORD offset = 0;
|
||||
+
|
||||
+ texture_desc.Width = compatible_formats[k].width;
|
||||
+ texture_desc.Height = compatible_formats[k].height;
|
||||
+ texture_desc.MipLevels = compatible_formats[k].levels;
|
||||
+ texture_desc.ArraySize = compatible_formats[k].layers;
|
||||
+
|
||||
+ texture_desc.Usage = D3D11_USAGE_IMMUTABLE;
|
||||
+ texture_desc.Format = compatible_formats[k].src_format;
|
||||
+ texture_desc.CPUAccessFlags = 0;
|
||||
+ texture_desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||
+
|
||||
+ for (i = 0; i < texture_desc.MipLevels * texture_desc.ArraySize; i++)
|
||||
+ {
|
||||
+ level_src = i % texture_desc.ArraySize;
|
||||
+ level_src_width = (texture_desc.Width >> level_src);
|
||||
+ level_src_height = (texture_desc.Height >> level_src);
|
||||
+
|
||||
+ src_data[i].pSysMem = bitmap_data + offset;
|
||||
+ src_data[i].SysMemPitch = level_src_width * sizeof(*bitmap_data);
|
||||
+ src_data[i].SysMemSlicePitch = 0;
|
||||
+
|
||||
+ dst_data[i].pSysMem = initial_data + offset;
|
||||
+ dst_data[i].SysMemPitch = level_src_width * sizeof(*initial_data);
|
||||
+ dst_data[i].SysMemSlicePitch = 0;
|
||||
+
|
||||
+ offset += level_src_width * level_src_height;
|
||||
+ }
|
||||
+
|
||||
+ hr = ID3D11Device_CreateTexture2D(device, &texture_desc, src_data, &src_texture);
|
||||
+ ok(SUCCEEDED(hr), "Failed to create 2d texture for format %#x for test %d, hr %#x.\n", compatible_formats[k].src_format, k, hr);
|
||||
+
|
||||
+ texture_desc.Usage = D3D11_USAGE_STAGING;
|
||||
+ texture_desc.Format = compatible_formats[k].dst_format;
|
||||
+ texture_desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
|
||||
+ texture_desc.BindFlags = 0;
|
||||
+
|
||||
+ hr = ID3D11Device_CreateTexture2D(device, &texture_desc, dst_data, &dst_texture);
|
||||
+ ok(SUCCEEDED(hr), "Failed to create 2d texture for format %#x, hr %#x.\n", compatible_formats[k].dst_format, hr);
|
||||
+
|
||||
+ level_src = compatible_formats[k].src_sub_index % texture_desc.ArraySize;
|
||||
+ level_src_width = (texture_desc.Width >> level_src);
|
||||
+ level_src_height = (texture_desc.Height >> level_src);
|
||||
+
|
||||
+ level_dst = compatible_formats[k].dst_sub_index % texture_desc.ArraySize;
|
||||
+ level_dst_width = (texture_desc.Width >> level_dst);
|
||||
+ level_dst_height = (texture_desc.Height >> level_dst);
|
||||
+
|
||||
+ set_box(&box, 0, 0, 0, min(level_src_width, level_dst_width), min(level_src_height, level_dst_height), 1);
|
||||
+ ID3D11DeviceContext_CopySubresourceRegion(context, (ID3D11Resource *)dst_texture, compatible_formats[k].dst_sub_index,
|
||||
+ 0, 0, 0, (ID3D11Resource *)src_texture, compatible_formats[k].src_sub_index, &box);
|
||||
+
|
||||
+ hr = ID3D11DeviceContext_Map(context, (ID3D11Resource *)dst_texture, compatible_formats[k].dst_sub_index, D3D11_MAP_READ, 0, &map_desc);
|
||||
+ ok(SUCCEEDED(hr), "Failed to map 2d texture for test %d, hr %#x.\n", k, hr);
|
||||
+
|
||||
+ c_expected = src_data[compatible_formats[k].src_sub_index].pSysMem;
|
||||
+ for (i = 0; i < min(level_src_width, level_dst_width); i++)
|
||||
+ {
|
||||
+ for (j = 0; j < min(level_src_height, level_dst_height); j++)
|
||||
+ {
|
||||
+ c_result = (DWORD*)((char*)map_desc.pData + j * map_desc.RowPitch);
|
||||
+ todo_wine ok(c_result[i] == c_expected[j * level_src_width + i],
|
||||
+ "Got unexpected color 0x%08x at (%u, %u), expected 0x%08x for test %u.\n",
|
||||
+ c_result[i], i, j, c_expected[j * level_src_width + i], k);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ ID3D11DeviceContext_Unmap(context, (ID3D11Resource *)dst_texture, 0);
|
||||
+
|
||||
+ ID3D11Texture2D_Release(dst_texture);
|
||||
+ ID3D11Texture2D_Release(src_texture);
|
||||
+ }
|
||||
+
|
||||
ID3D11DeviceContext_PSSetShaderResources(context, 0, 1, &ps_srv);
|
||||
ID3D11DeviceContext_PSSetSamplers(context, 0, 1, &sampler_state);
|
||||
ID3D11DeviceContext_PSSetShader(context, ps, NULL, 0);
|
||||
--
|
||||
2.13.1
|
||||
|
@ -0,0 +1,25 @@
|
||||
From a9ecabd2f82e39d94fcbf734241e4291f8c167f4 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sun, 9 Jul 2017 01:05:54 +0200
|
||||
Subject: wined3d: Add WINED3DFMT_R8G8B8A8_SNORM to
|
||||
WINED3DFMT_R8G8B8A8_TYPELESS group.
|
||||
|
||||
---
|
||||
dlls/wined3d/utils.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
|
||||
index 7462103aeee..1cfc2e82c7f 100644
|
||||
--- a/dlls/wined3d/utils.c
|
||||
+++ b/dlls/wined3d/utils.c
|
||||
@@ -234,6 +234,7 @@ static const struct wined3d_typed_format_info typed_formats[] =
|
||||
{WINED3DFMT_R8G8B8A8_SINT, WINED3DFMT_R8G8B8A8_TYPELESS, "IIII"},
|
||||
{WINED3DFMT_R8G8B8A8_UNORM_SRGB, WINED3DFMT_R8G8B8A8_TYPELESS, "uuuu"},
|
||||
{WINED3DFMT_R8G8B8A8_UNORM, WINED3DFMT_R8G8B8A8_TYPELESS, "uuuu"},
|
||||
+ {WINED3DFMT_R8G8B8A8_SNORM, WINED3DFMT_R8G8B8A8_TYPELESS, "iiii"},
|
||||
{WINED3DFMT_R16G16_UNORM, WINED3DFMT_R16G16_TYPELESS, "uu"},
|
||||
{WINED3DFMT_R16G16_SNORM, WINED3DFMT_R16G16_TYPELESS, "ii"},
|
||||
{WINED3DFMT_R16G16_UINT, WINED3DFMT_R16G16_TYPELESS, "UU"},
|
||||
--
|
||||
2.13.1
|
||||
|
@ -0,0 +1,300 @@
|
||||
From ee5dba7ce1957961af9bfcebf0f797debbc41d3a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sun, 9 Jul 2017 01:04:33 +0200
|
||||
Subject: wined3d: Implement copying sub resources between compatible formats.
|
||||
|
||||
---
|
||||
dlls/d3d11/tests/d3d11.c | 2 +-
|
||||
dlls/wined3d/cs.c | 156 +++++++++++++++++++++++++++++++++++++++++
|
||||
dlls/wined3d/device.c | 9 ++-
|
||||
dlls/wined3d/directx.c | 4 ++
|
||||
dlls/wined3d/wined3d_gl.h | 1 +
|
||||
dlls/wined3d/wined3d_private.h | 3 +
|
||||
6 files changed, 171 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
|
||||
index 155b8642d04..e2ef854b0aa 100644
|
||||
--- a/dlls/d3d11/tests/d3d11.c
|
||||
+++ b/dlls/d3d11/tests/d3d11.c
|
||||
@@ -10116,7 +10116,7 @@ static void test_copy_subresource_region(void)
|
||||
for (j = 0; j < min(level_src_height, level_dst_height); j++)
|
||||
{
|
||||
c_result = (DWORD*)((char*)map_desc.pData + j * map_desc.RowPitch);
|
||||
- todo_wine ok(c_result[i] == c_expected[j * level_src_width + i],
|
||||
+ ok(c_result[i] == c_expected[j * level_src_width + i],
|
||||
"Got unexpected color 0x%08x at (%u, %u), expected 0x%08x for test %u.\n",
|
||||
c_result[i], i, j, c_expected[j * level_src_width + i], k);
|
||||
}
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index c7df670682d..88dbedd8d89 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -70,6 +70,7 @@ enum wined3d_cs_op
|
||||
WINED3D_CS_OP_UPDATE_SUB_RESOURCE,
|
||||
WINED3D_CS_OP_ADD_DIRTY_TEXTURE_REGION,
|
||||
WINED3D_CS_OP_CLEAR_UNORDERED_ACCESS_VIEW,
|
||||
+ WINED3D_CS_OP_COPY_SUB_RESOURCE,
|
||||
WINED3D_CS_OP_STOP,
|
||||
};
|
||||
|
||||
@@ -418,6 +419,17 @@ struct wined3d_cs_clear_unordered_access_view
|
||||
struct wined3d_uvec4 clear_value;
|
||||
};
|
||||
|
||||
+struct wined3d_cs_copy_sub_resource
|
||||
+{
|
||||
+ enum wined3d_cs_op opcode;
|
||||
+ struct wined3d_resource *dst_resource;
|
||||
+ unsigned int dst_sub_resource_idx;
|
||||
+ struct wined3d_box dst_box;
|
||||
+ struct wined3d_resource *src_resource;
|
||||
+ unsigned int src_sub_resource_idx;
|
||||
+ struct wined3d_box src_box;
|
||||
+};
|
||||
+
|
||||
struct wined3d_cs_stop
|
||||
{
|
||||
enum wined3d_cs_op opcode;
|
||||
@@ -2227,6 +2239,149 @@ void wined3d_cs_emit_clear_unordered_access_view_uint(struct wined3d_cs *cs,
|
||||
cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT);
|
||||
}
|
||||
|
||||
+static void wined3d_cs_exec_copy_sub_resource(struct wined3d_cs *cs, const void *data)
|
||||
+{
|
||||
+ struct wined3d_cs_copy_sub_resource *op = (void*)data;
|
||||
+
|
||||
+ if (op->dst_resource->type == WINED3D_RTYPE_BUFFER)
|
||||
+ {
|
||||
+ if (FAILED(wined3d_buffer_copy(buffer_from_resource(op->dst_resource), op->dst_box.left,
|
||||
+ buffer_from_resource(op->src_resource), op->src_box.left,
|
||||
+ op->src_box.right - op->src_box.left)))
|
||||
+ ERR("Failed to copy buffer.\n");
|
||||
+ }
|
||||
+ else if (op->dst_resource->type == WINED3D_RTYPE_TEXTURE_1D ||
|
||||
+ op->dst_resource->type == WINED3D_RTYPE_TEXTURE_2D ||
|
||||
+ op->dst_resource->type == WINED3D_RTYPE_TEXTURE_3D)
|
||||
+ {
|
||||
+ struct wined3d_texture *dst_texture, *src_texture;
|
||||
+ struct gl_texture *gl_tex_src, *gl_tex_dst;
|
||||
+ unsigned int update_w, update_h, update_d;
|
||||
+ const struct wined3d_gl_info *gl_info;
|
||||
+ unsigned int src_level, src_layer;
|
||||
+ unsigned int dst_level, dst_layer;
|
||||
+ struct wined3d_context *context;
|
||||
+ BOOL partial_update = FALSE;
|
||||
+
|
||||
+ update_w = op->dst_box.right - op->dst_box.left;
|
||||
+ update_h = op->dst_box.bottom - op->dst_box.top;
|
||||
+ update_d = op->dst_box.back - op->dst_box.front;
|
||||
+
|
||||
+ dst_texture = texture_from_resource(op->dst_resource);
|
||||
+ src_texture = texture_from_resource(op->src_resource);
|
||||
+
|
||||
+ context = context_acquire(cs->device, NULL, 0);
|
||||
+ gl_info = context->gl_info;
|
||||
+
|
||||
+ if (!wined3d_texture_load_location(src_texture, op->src_sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB))
|
||||
+ {
|
||||
+ FIXME("Failed to load source sub-resource into WINED3D_LOCATION_TEXTURE_RGB.\n");
|
||||
+ context_release(context);
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
+ src_level = op->src_sub_resource_idx % src_texture->level_count;
|
||||
+ src_layer = op->src_sub_resource_idx / src_texture->level_count;
|
||||
+ dst_level = op->dst_sub_resource_idx % dst_texture->level_count;
|
||||
+ dst_layer = op->dst_sub_resource_idx / dst_texture->level_count;
|
||||
+
|
||||
+ switch (op->dst_resource->type)
|
||||
+ {
|
||||
+ case WINED3D_RTYPE_TEXTURE_3D:
|
||||
+ partial_update |= (update_d != wined3d_texture_get_level_depth(dst_texture, dst_level));
|
||||
+ case WINED3D_RTYPE_TEXTURE_2D:
|
||||
+ partial_update |= (update_h != wined3d_texture_get_level_height(dst_texture, dst_level));
|
||||
+ case WINED3D_RTYPE_TEXTURE_1D:
|
||||
+ partial_update |= (update_w != wined3d_texture_get_level_width(dst_texture, dst_level));
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (!partial_update)
|
||||
+ {
|
||||
+ wined3d_texture_prepare_texture(dst_texture, context, FALSE);
|
||||
+ }
|
||||
+ else if (!wined3d_texture_load_location(dst_texture, op->dst_sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB))
|
||||
+ {
|
||||
+ FIXME("Failed to load destination sub-resource.\n");
|
||||
+ context_release(context);
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
+ switch (op->dst_resource->type)
|
||||
+ {
|
||||
+ case WINED3D_RTYPE_TEXTURE_1D:
|
||||
+ op->src_box.top = src_layer;
|
||||
+ op->dst_box.top = dst_layer;
|
||||
+ break;
|
||||
+ case WINED3D_RTYPE_TEXTURE_2D:
|
||||
+ op->src_box.front = src_layer;
|
||||
+ op->dst_box.front = dst_layer;
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ gl_tex_src = wined3d_texture_get_gl_texture(src_texture, FALSE);
|
||||
+ gl_tex_dst = wined3d_texture_get_gl_texture(dst_texture, FALSE);
|
||||
+
|
||||
+ GL_EXTCALL(glCopyImageSubData(gl_tex_src->name, src_texture->target, src_level,
|
||||
+ op->src_box.left, op->src_box.top, op->src_box.front,
|
||||
+ gl_tex_dst->name, dst_texture->target, dst_level,
|
||||
+ op->dst_box.left, op->dst_box.top, op->dst_box.front,
|
||||
+ update_w, update_h, update_d));
|
||||
+ checkGLcall("Copy texture content");
|
||||
+
|
||||
+ wined3d_texture_validate_location(dst_texture, op->dst_sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
+ wined3d_texture_invalidate_location(dst_texture, op->dst_sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB);
|
||||
+
|
||||
+ context_release(context);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(op->dst_resource->type));
|
||||
+ }
|
||||
+
|
||||
+error:
|
||||
+ wined3d_resource_release(op->src_resource);
|
||||
+ wined3d_resource_release(op->dst_resource);
|
||||
+}
|
||||
+
|
||||
+void wined3d_cs_emit_copy_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *dst_resource,
|
||||
+ unsigned int dst_sub_resource_idx, const struct wined3d_box *dst_box, struct wined3d_resource *src_resource,
|
||||
+ unsigned int src_sub_resource_idx, const struct wined3d_box *src_box)
|
||||
+{
|
||||
+ const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info;
|
||||
+ struct wined3d_cs_blt_sub_resource *op;
|
||||
+
|
||||
+ if (!gl_info->supported[ARB_TEXTURE_VIEW] && src_resource->format->id != dst_resource->format->id)
|
||||
+ {
|
||||
+ FIXME("ARB_TEXTURE_VIEW not supported, cannot copy sub-resource.\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (!gl_info->supported[ARB_COPY_IMAGE])
|
||||
+ {
|
||||
+ wined3d_cs_emit_blt_sub_resource(cs, dst_resource, dst_sub_resource_idx, dst_box,
|
||||
+ src_resource, src_sub_resource_idx, src_box, 0, NULL, WINED3D_TEXF_POINT);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ op = cs->ops->require_space(cs, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
|
||||
+ op->opcode = WINED3D_CS_OP_COPY_SUB_RESOURCE;
|
||||
+ op->dst_resource = dst_resource;
|
||||
+ op->dst_sub_resource_idx = dst_sub_resource_idx;
|
||||
+ op->dst_box = *dst_box;
|
||||
+ op->src_resource = src_resource;
|
||||
+ op->src_sub_resource_idx = src_sub_resource_idx;
|
||||
+ op->src_box = *src_box;
|
||||
+
|
||||
+ wined3d_resource_acquire(dst_resource);
|
||||
+ wined3d_resource_acquire(src_resource);
|
||||
+
|
||||
+ cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT);
|
||||
+}
|
||||
+
|
||||
static void wined3d_cs_emit_stop(struct wined3d_cs *cs)
|
||||
{
|
||||
struct wined3d_cs_stop *op;
|
||||
@@ -2284,6 +2439,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
|
||||
/* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource,
|
||||
/* WINED3D_CS_OP_ADD_DIRTY_TEXTURE_REGION */ wined3d_cs_exec_add_dirty_texture_region,
|
||||
/* WINED3D_CS_OP_CLEAR_UNORDERED_ACCESS_VIEW */ wined3d_cs_exec_clear_unordered_access_view,
|
||||
+ /* WINED3D_CS_OP_COPY_SUB_RESOURCE */ wined3d_cs_exec_copy_sub_resource,
|
||||
};
|
||||
|
||||
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id)
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index 3d12e417a43..43b88913e55 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -4062,7 +4062,10 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
- if (src_resource->format->id != dst_resource->format->id)
|
||||
+ if (src_resource->format->id != dst_resource->format->id &&
|
||||
+ (src_resource->format->typeless_id != dst_resource->format->typeless_id ||
|
||||
+ src_resource->format->gl_view_class != dst_resource->format->gl_view_class ||
|
||||
+ !src_resource->format->typeless_id))
|
||||
{
|
||||
WARN("Resource formats (%s / %s) don't match.\n",
|
||||
debug_d3dformat(dst_resource->format->id),
|
||||
@@ -4164,8 +4167,8 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
- wined3d_cs_emit_blt_sub_resource(device->cs, dst_resource, dst_sub_resource_idx, &dst_box,
|
||||
- src_resource, src_sub_resource_idx, src_box, 0, NULL, WINED3D_TEXF_POINT);
|
||||
+ wined3d_cs_emit_copy_sub_resource(device->cs, dst_resource, dst_sub_resource_idx, &dst_box,
|
||||
+ src_resource, src_sub_resource_idx, src_box);
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
|
||||
index b18d1aa3619..8a03dd5913f 100644
|
||||
--- a/dlls/wined3d/directx.c
|
||||
+++ b/dlls/wined3d/directx.c
|
||||
@@ -116,6 +116,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
|
||||
{"GL_ARB_color_buffer_float", ARB_COLOR_BUFFER_FLOAT },
|
||||
{"GL_ARB_compute_shader", ARB_COMPUTE_SHADER },
|
||||
{"GL_ARB_copy_buffer", ARB_COPY_BUFFER },
|
||||
+ {"GL_ARB_copy_image", ARB_COPY_IMAGE },
|
||||
{"GL_ARB_debug_output", ARB_DEBUG_OUTPUT },
|
||||
{"GL_ARB_depth_buffer_float", ARB_DEPTH_BUFFER_FLOAT },
|
||||
{"GL_ARB_depth_clamp", ARB_DEPTH_CLAMP },
|
||||
@@ -2700,6 +2701,8 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
|
||||
USE_GL_FUNC(glDispatchComputeIndirect)
|
||||
/* GL_ARB_copy_buffer */
|
||||
USE_GL_FUNC(glCopyBufferSubData)
|
||||
+ /* GL_ARB_copy_image */
|
||||
+ USE_GL_FUNC(glCopyImageSubData)
|
||||
/* GL_ARB_debug_output */
|
||||
USE_GL_FUNC(glDebugMessageCallbackARB)
|
||||
USE_GL_FUNC(glDebugMessageControlARB)
|
||||
@@ -3884,6 +3887,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
|
||||
|
||||
{ARB_CLEAR_BUFFER_OBJECT, MAKEDWORD_VERSION(4, 3)},
|
||||
{ARB_COMPUTE_SHADER, MAKEDWORD_VERSION(4, 3)},
|
||||
+ {ARB_COPY_IMAGE, MAKEDWORD_VERSION(4, 3)},
|
||||
{ARB_DEBUG_OUTPUT, MAKEDWORD_VERSION(4, 3)},
|
||||
{ARB_ES3_COMPATIBILITY, MAKEDWORD_VERSION(4, 3)},
|
||||
{ARB_FRAGMENT_LAYER_VIEWPORT, MAKEDWORD_VERSION(4, 3)},
|
||||
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h
|
||||
index 05558760850..a743ad20316 100644
|
||||
--- a/dlls/wined3d/wined3d_gl.h
|
||||
+++ b/dlls/wined3d/wined3d_gl.h
|
||||
@@ -50,6 +50,7 @@ enum wined3d_gl_extension
|
||||
ARB_COLOR_BUFFER_FLOAT,
|
||||
ARB_COMPUTE_SHADER,
|
||||
ARB_COPY_BUFFER,
|
||||
+ ARB_COPY_IMAGE,
|
||||
ARB_DEBUG_OUTPUT,
|
||||
ARB_DEPTH_BUFFER_FLOAT,
|
||||
ARB_DEPTH_CLAMP,
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 1025c98f180..7d2bdf45e52 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -3478,6 +3478,9 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou
|
||||
void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource,
|
||||
unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch,
|
||||
unsigned int slice_pitch) DECLSPEC_HIDDEN;
|
||||
+void wined3d_cs_emit_copy_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *dst_resource,
|
||||
+ unsigned int dst_sub_resource_idx, const struct wined3d_box *dst_box, struct wined3d_resource *src_resource,
|
||||
+ unsigned int src_sub_resource_idx, const struct wined3d_box *src_box) DECLSPEC_HIDDEN;
|
||||
void wined3d_cs_init_object(struct wined3d_cs *cs,
|
||||
void (*callback)(void *object), void *object) DECLSPEC_HIDDEN;
|
||||
HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx,
|
||||
--
|
||||
2.13.1
|
||||
|
@ -0,0 +1,49 @@
|
||||
From 064e00bdc54c94a29c5c55a5adf9c70565f50d7a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sun, 9 Jul 2017 04:05:54 +0200
|
||||
Subject: wined3d: Use wined3d_cs_emit_copy_sub_resource also for
|
||||
wined3d_device_copy_resource.
|
||||
|
||||
---
|
||||
dlls/wined3d/device.c | 11 ++++++-----
|
||||
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index 0515317d4f0..42749c7c87a 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -4046,7 +4046,10 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device,
|
||||
return;
|
||||
}
|
||||
|
||||
- if (src_resource->format->id != dst_resource->format->id)
|
||||
+ if (src_resource->format->id != dst_resource->format->id &&
|
||||
+ (src_resource->format->typeless_id != dst_resource->format->typeless_id ||
|
||||
+ src_resource->format->gl_view_class != dst_resource->format->gl_view_class ||
|
||||
+ !src_resource->format->typeless_id))
|
||||
{
|
||||
WARN("Resource formats (%s / %s) don't match.\n",
|
||||
debug_d3dformat(dst_resource->format->id),
|
||||
@@ -4057,8 +4060,7 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device,
|
||||
if (dst_resource->type == WINED3D_RTYPE_BUFFER)
|
||||
{
|
||||
wined3d_box_set(&box, 0, 0, src_resource->size, 1, 0, 1);
|
||||
- wined3d_cs_emit_blt_sub_resource(device->cs, dst_resource, 0, &box,
|
||||
- src_resource, 0, &box, 0, NULL, WINED3D_TEXF_POINT);
|
||||
+ wined3d_cs_emit_copy_sub_resource(device->cs, dst_resource, 0, &box, src_resource, 0, &box);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4084,8 +4086,7 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device,
|
||||
{
|
||||
unsigned int idx = j * dst_texture->level_count + i;
|
||||
|
||||
- wined3d_cs_emit_blt_sub_resource(device->cs, dst_resource, idx, &box,
|
||||
- src_resource, idx, &box, 0, NULL, WINED3D_TEXF_POINT);
|
||||
+ wined3d_cs_emit_copy_sub_resource(device->cs, dst_resource, idx, &box, src_resource, idx, &box);
|
||||
}
|
||||
}
|
||||
}
|
||||
--
|
||||
2.13.1
|
||||
|
2
patches/wined3d-Copy_Resource_Typeless/definition
Normal file
2
patches/wined3d-Copy_Resource_Typeless/definition
Normal file
@ -0,0 +1,2 @@
|
||||
Fixes: Implement copying resources between compatible formats
|
||||
Depends: d3d11-Depth_Bias
|
Loading…
x
Reference in New Issue
Block a user