Wine-devel
Threads by month
- ----- 2026 -----
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
August 2019
- 66 participants
- 557 discussions
Signed-off-by: Sven Baars <sven.wine(a)gmail.com>
---
v2: Fix compilation without mingw
dlls/msvfw32/tests/Makefile.in | 3 +-
dlls/msvfw32/tests/mciwnd.c | 203 +++++++++++++++++++++++++++++++++
2 files changed, 205 insertions(+), 1 deletion(-)
create mode 100644 dlls/msvfw32/tests/mciwnd.c
diff --git a/dlls/msvfw32/tests/Makefile.in b/dlls/msvfw32/tests/Makefile.in
index ecb26dbb19..01d83acb10 100644
--- a/dlls/msvfw32/tests/Makefile.in
+++ b/dlls/msvfw32/tests/Makefile.in
@@ -1,8 +1,9 @@
TESTDLL = msvfw32.dll
-IMPORTS = msvfw32 advapi32 gdi32
+IMPORTS = msvfw32 advapi32 gdi32 user32
C_SRCS = \
drawdib.c \
+ mciwnd.c \
msvfw.c
RC_SRCS = \
diff --git a/dlls/msvfw32/tests/mciwnd.c b/dlls/msvfw32/tests/mciwnd.c
new file mode 100644
index 0000000000..27ca2e8d20
--- /dev/null
+++ b/dlls/msvfw32/tests/mciwnd.c
@@ -0,0 +1,203 @@
+/*
+ * Unit tests for MCIWnd
+ *
+ * Copyright 2019 Sven Baars
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define WIN32_LEAN_AND_MEAN
+
+#include <windows.h>
+#include <vfw.h>
+
+#include "wine/heap.h"
+#include "wine/test.h"
+
+static const DWORD file_header[] = /* file_header */
+{
+ FOURCC_RIFF, 0x8c0 /* file size */,
+ formtypeAVI,
+ FOURCC_LIST, 0xc0 /* list length */,
+ listtypeAVIHEADER, ckidAVIMAINHDR, sizeof(MainAVIHeader),
+};
+
+static const MainAVIHeader main_avi_header =
+{
+ 0x0001046b, /* dwMicroSecPerFrame */
+ 0x00000000, /* dwMaxBytesPerSec */
+ 0x00000000, /* dwPaddingGranularity */
+ 0x00000810, /* dwFlags */
+ 2, /* dwTotalFrames */
+ 0, /* dwInitialFrames */
+ 1, /* dwStreams */
+ 0x48, /* dwSuggestedBufferSize*/
+ 5, /* dwWidth */
+ 5, /* dwHeight */
+ { 0, 0, 0, 0 } /* dwReserved[4] */
+};
+
+static const DWORD stream_list[] =
+{
+ FOURCC_LIST, 0x74 /* length */,
+ listtypeSTREAMHEADER, ckidSTREAMHEADER, 0x38 /* length */,
+};
+
+static const AVIStreamHeader avi_stream_header =
+{
+ streamtypeVIDEO, /* fccType */
+ 0, /* fccHandler */
+ 0, /* dwFlags */
+ 0, /* wPriority */
+ 0, /* wLanguage */
+ 0, /* dwInitialFrames */
+ 1, /* dwScale */
+ 0xf, /* dwRate */
+ 0, /* dwStart */
+ 2, /* dwLength */
+ 0x48, /* dwSuggestedBufferSize*/
+ 0, /* dwQuality */
+ 0, /* dwSampleSize */
+ { 0, 0, 0, 0 } /* short left right top bottom */
+};
+
+static const DWORD video_stream_format[] =
+{
+ ckidSTREAMFORMAT,
+ 0x28 /* length */,
+ 0x28 /* length */,
+ 5 /* width */,
+ 5 /* height */,
+ 0x00180001 ,
+ mmioFOURCC('c', 'v', 'i', 'd'),
+ 0x245a,
+ 0, 0, 0, 0,
+};
+
+static const DWORD padding[] =
+{
+ ckidAVIPADDING, 0x718 /* length */,
+};
+
+static const DWORD data[] =
+{
+ FOURCC_LIST, 0xa4 /* length */, listtypeAVIMOVIE,
+ mmioFOURCC('0', '0', 'd', 'b'), 0x48, 0x48000000, 0x08000800,
+ 0x00100100, 0x00003e00, 0x08000000, 0x00200800,
+ 0x00001600, 0x00000000, 0x00003a00, 0x22e306f9,
+ 0xfc120000, 0x0a000022, 0x00000000, 0x00300000,
+ 0x00c01200, 0x00000000, 0x02010000, 0x00000000,
+ mmioFOURCC('0', '0', 'd', 'b'), 0x48, 0x48000000, 0x08000800,
+ 0x00100100, 0x00003e00, 0x08000000, 0x00200800,
+ 0x00001600, 0x00000000, 0x00003a00, 0x22e306f9,
+ 0xfc120000, 0x0a000022, 0x00000000, 0x00300000,
+ 0x00c01200, 0x00000000, 0x02010000, 0x00000000,
+ mmioFOURCC('i', 'd', 'x', '1'), 0x20, mmioFOURCC('0', '0', 'd', 'b'), 0x10,
+ 0x04, 0x48, mmioFOURCC('0', '0', 'd', 'b'), 0x10,
+ 0x54, 0x48,
+};
+
+static BOOL create_avi_file(char *fname)
+{
+ HANDLE hFile;
+ DWORD written;
+ char temp_path[MAX_PATH];
+ BOOL ret;
+ BYTE *buffer;
+ ULONG buffer_length;
+
+ ret = GetTempPathA(sizeof(temp_path), temp_path);
+ ok(ret, "Failed to get a temp path, err %d\n", GetLastError());
+ if (!ret)
+ return FALSE;
+
+ ret = GetTempFileNameA(temp_path, "mci", 0, fname);
+ ok(ret, "Failed to get a temp name, err %d\n", GetLastError());
+ if (!ret)
+ return FALSE;
+ DeleteFileA(fname);
+
+ lstrcatA(fname, ".avi");
+
+ hFile = CreateFileA(fname, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ ok(hFile != INVALID_HANDLE_VALUE, "Failed to create a file, err %d\n", GetLastError());
+ if (hFile == INVALID_HANDLE_VALUE) return FALSE;
+
+ buffer_length = padding[1];
+ buffer = heap_alloc_zero(buffer_length);
+
+ WriteFile(hFile, file_header, sizeof(file_header), &written, NULL);
+ WriteFile(hFile, &main_avi_header, sizeof(MainAVIHeader), &written, NULL);
+ WriteFile(hFile, stream_list, sizeof(stream_list), &written, NULL);
+ WriteFile(hFile, &avi_stream_header, sizeof(AVIStreamHeader), &written, NULL);
+ WriteFile(hFile, video_stream_format, sizeof(video_stream_format), &written, NULL);
+ WriteFile(hFile, padding, sizeof(padding), &written, NULL);
+ WriteFile(hFile, buffer, buffer_length, &written, NULL);
+ WriteFile(hFile, data, sizeof(data), &written, NULL);
+
+ heap_free(buffer);
+
+ CloseHandle(hFile);
+ return ret;
+}
+
+static void test_MCIWndCreate(void)
+{
+ HWND parent, window;
+ HMODULE hinst = GetModuleHandleA(NULL);
+ char fname[MAX_PATH];
+ char invalid_fname[] = "invalid.avi";
+ char error[200];
+ LRESULT ret;
+
+ create_avi_file(fname);
+
+ window = MCIWndCreateA(NULL, hinst, MCIWNDF_NOERRORDLG, fname);
+ ok(window != NULL, "Failed to create an MCIWnd window without parent\n");
+
+ ret = SendMessageA(window, MCIWNDM_GETERRORA, sizeof(error), (LPARAM)error);
+ ok(!ret || broken(ret == ERROR_INVALID_HANDLE) /* w2003std, w2008s64 */,
+ "Unexpected error %ld\n", ret);
+
+ DestroyWindow(window);
+
+ parent = CreateWindowExA(0, "static", "msvfw32 test",
+ WS_POPUP, 0, 0, 100, 100,
+ 0, 0, 0, NULL);
+ ok(parent != NULL, "Failed to create a window\n");
+ window = MCIWndCreateA(parent, hinst, MCIWNDF_NOERRORDLG, fname);
+ ok(window != NULL, "Failed to create an MCIWnd window\n");
+
+ ret = SendMessageA(window, MCIWNDM_GETERRORA, sizeof(error), (LPARAM)error);
+ ok(!ret || broken(ret == ERROR_INVALID_HANDLE) /* w2003std, w2008s64 */,
+ "Unexpected error %ld\n", ret);
+
+ DestroyWindow(parent);
+
+ window = MCIWndCreateA(NULL, hinst, MCIWNDF_NOERRORDLG, invalid_fname);
+ ok(window != NULL, "Failed to create an MCIWnd window\n");
+
+ ret = SendMessageA(window, MCIWNDM_GETERRORA, sizeof(error), (LPARAM)error);
+ todo_wine ok(ret == MCIERR_FILE_NOT_FOUND, "Unexpected error %ld\n", ret);
+
+ DestroyWindow(window);
+
+ DeleteFileA(fname);
+}
+
+START_TEST(mciwnd)
+{
+ test_MCIWndCreate();
+}
--
2.17.1
2
4
[PATCH] iphlpapi: Account for structs inpcb and tcpcb being unavailable for userland in FreeBSD 12.
by Gerald Pfeifer 17 Aug '19
by Gerald Pfeifer 17 Aug '19
17 Aug '19
FreeBSD 12, specifically __FreeBSD_version 1200026 and later, no longer
exposes struct inpcb and struct tcpcb to userland. New structs xinpcb
and xtcpcb shall be used instead.
I have been carrying this patch as part of the FreeBSD ports of Wine
(both emulators/wine and emulators/wine-devel) since March 2017, and
Gleb Smirnoff, who contributed this originally, indicated that he was
going to push upstream, see
https://lists.freebsd.org/pipermail/svn-ports-head/2017-March/143196.html
which just has not happened so far.
This will be good to have on the Wine 4.0 branch as well.
Gerald
From: Gleb Smirnoff <glebius(a)FreeBSD.org>
Signed-off-by: Gerald Pfeifer <gerald(a)pfeifer.com>
---
dlls/iphlpapi/ipstats.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c
index 0b762ebc8e..0e07853b30 100644
--- a/dlls/iphlpapi/ipstats.c
+++ b/dlls/iphlpapi/ipstats.c
@@ -2226,6 +2226,15 @@ DWORD build_tcp_table( TCP_TABLE_CLASS class, void **tablep, BOOL order, HANDLE
pXIG->xig_len > sizeof (struct xinpgen);
pXIG = (struct xinpgen *)((char *)pXIG + pXIG->xig_len))
{
+#if __FreeBSD_version >= 1200026
+ struct xtcpcb *pTCPData;
+ struct xinpcb *pINData;
+ struct xsocket *pSockData;
+
+ pTCPData = (struct xtcpcb *)pXIG;
+ pINData = &pTCPData->xt_inp;
+ pSockData = &pINData->xi_socket;
+#else
struct tcpcb *pTCPData = NULL;
struct inpcb *pINData;
struct xsocket *pSockData;
@@ -2233,6 +2242,7 @@ DWORD build_tcp_table( TCP_TABLE_CLASS class, void **tablep, BOOL order, HANDLE
pTCPData = &((struct xtcpcb *)pXIG)->xt_tp;
pINData = &((struct xtcpcb *)pXIG)->xt_inp;
pSockData = &((struct xtcpcb *)pXIG)->xt_socket;
+#endif
/* Ignore sockets for other protocols */
if (pSockData->xso_protocol != IPPROTO_TCP)
@@ -2538,11 +2548,19 @@ DWORD build_udp_table( UDP_TABLE_CLASS class, void **tablep, BOOL order, HANDLE
pXIG->xig_len > sizeof (struct xinpgen);
pXIG = (struct xinpgen *)((char *)pXIG + pXIG->xig_len))
{
+#if __FreeBSD_version >= 1200026
+ struct xinpcb *pINData;
+ struct xsocket *pSockData;
+
+ pINData = (struct xinpcb *)pXIG;
+ pSockData = &pINData->xi_socket;
+#else
struct inpcb *pINData;
struct xsocket *pSockData;
pINData = &((struct xinpcb *)pXIG)->xi_inp;
pSockData = &((struct xinpcb *)pXIG)->xi_socket;
+#endif
/* Ignore sockets for other protocols */
if (pSockData->xso_protocol != IPPROTO_UDP)
--
2.22.0
1
0
Binary packages for various distributions will be available from:
https://www.winehq.org/download
Summary since last release
* Rebased to current wine 4.14 (841 patches are applied to wine vanilla)
* FAudio is now used, same as vanilla wine.
The following patches are from the mailing list whilst AJ was on leave.
If these
aren't accepted upstream by 4.14, they will be dropped or moved to staging
patchsets after that release.
* winebus: Use the SDL joystick index as device id instead of instance id
* ntoskrnl: Update the interface if it is already in the
device_interfaces tree
* winex11.drv: Ignore XGrabPointer-induced warp events as well
* wine.inf: Remove registration for the winebus service.
* winebus.sys: Report the native product string for some Xbox gamepads
* user32: Also scan for mouse devices in GetRawInputDeviceList().
* cryptext: Implement CryptExtOpenCER.
* ntoskrnl.exe: IoInvalidateDeviceRelations() receives the parent PDO.
* winebus.sys: Initialize and teardown the HID backends while the bus
FDO is still extant.
* wineboot: Create a root-enumerated device object for winebus.
* winebus.sys: Implement AddDevice().
* winebus.inf: Add new INF file and copy it to the INF directory.
Upstreamed (Either directly from staging or fixed with a similar patch).
* wined3d: Reset context before destruction.
* include: Add IDebugClient2-7 interfaces.
Added:
* [46274] user32: Prevent a recursive loop with the activation messages.
Updated:
* wintab32-improvements
* wusa-MSU_Package_Installer
* fsutil-Stub_Program
* advapi32-Token_Integrity_Level
Where can you help
* Run Steam/Battle.net/GOG/UPlay/Epic
* Test your favorite game.
* Test your favorite applications.
* Improve staging patches and get them accepted upstream.
As always, if you find a bug, please report it via
https://bugs.winehq.org
Best Regards
 Alistair.
1
0
From: Zebediah Figura <z.figura12(a)gmail.com>
It seems this is identical to version 1, but with an additional UWOP_EPILOG
opcode.
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
Encountered while debugging <https://bugs.winehq.org/show_bug.cgi?id=40285>;
this doesn't help the application at all, but at least lets us get to the
unhandled exception filter instead of livelocking.
dlls/ntdll/signal_x86_64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
index 886d69790d0..cc349958e51 100644
--- a/dlls/ntdll/signal_x86_64.c
+++ b/dlls/ntdll/signal_x86_64.c
@@ -3840,7 +3840,7 @@ PVOID WINAPI RtlVirtualUnwind( ULONG type, ULONG64 base, ULONG64 pc,
info = (struct UNWIND_INFO *)((char *)base + function->UnwindData);
handler_data = (union handler_data *)&info->opcodes[(info->count + 1) & ~1];
- if (info->version != 1)
+ if (info->version != 1 && info->version != 2)
{
FIXME( "unknown unwind info version %u at %p\n", info->version, info );
return NULL;
--
2.20.1
1
1
Re: [PATCH 1/2] api-ms-win-crt-private-l1-1-0: Add functions to make Star Citizen work
by Benedikt Bär | Relamp.tk 16 Aug '19
by Benedikt Bär | Relamp.tk 16 Aug '19
16 Aug '19
On Do, Aug 15, 2019 at 3:17 AM, Marvin <testbot(a)winehq.org> wrote:
> Thank you for your contribution to Wine!
>
> This is an automated notification to let you know that your patch has
> been reviewed and its status set to "Committed".
>
> This means that your patch has been approved, and committed to the
> main git tree. Congratulations!
>
> Commit:
> https://source.winehq.org/git/wine.git/commit/a20295ce3ddde224f9d958f6a4e5d…
Hi Piotr,
Sorry for the late response - I had quite busy days.
After looking at the commit in wine master, I noticed some of the
functions of the patch didn't make it, namely:
_o__wsetlocale
_o_atoi
_o_ceil
_o_floor
Both in api-ms-win-crt-private-l1-1-0 and ucrtbase.
This gets the game to crash with "wine: Call from 0x7b462ff5 to
unimplemented function api-ms-win-crt-private-l1-1-0.dll._o_floor,
aborting"
Is there a reason these got ommited?
I'm happy to send these in a new patch again if needed.
Many thanks,
Benedikt
3
2
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
include/dsound.h | 351 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 351 insertions(+)
diff --git a/include/dsound.h b/include/dsound.h
index d4f391829d..23e2a59231 100644
--- a/include/dsound.h
+++ b/include/dsound.h
@@ -132,6 +132,46 @@ DEFINE_GUID(GUID_DSCFX_CLASS_NS, 0xE07F903F,0x62FD,0x4E60,0x8C,0xDD,0
DEFINE_GUID(GUID_DSCFX_MS_NS, 0x11C5C73B,0x66E9,0x4BA1,0xA0,0xBA,0xE8,0x14,0xC6,0xEE,0xD9,0x2D);
DEFINE_GUID(GUID_DSCFX_SYSTEM_NS, 0x5AB0882E,0x7274,0x4516,0x87,0x7D,0x4E,0xEE,0x99,0xBA,0x4F,0xD0);
+DEFINE_GUID(IID_IDirectSoundFXGargle, 0xd616f352,0xd622,0x11ce,0xaa,0xc5,0x00,0x20,0xaf,0x0b,0x99,0xa3);
+typedef struct IDirectSoundFXGargle8 *LPDIRECTSOUNDFXGARGLE8;
+#define IDirectSoundFXGargle8 IDirectSoundFXGargle
+#define IID_IDirectSoundFXGargle8 IID_IDirectSoundFXGargle
+
+DEFINE_GUID(IID_IDirectSoundFXChorus, 0x880842e3,0x145f,0x43e6,0xa9,0x34,0xa7,0x18,0x06,0xe5,0x05,0x47);
+typedef struct IDirectSoundFXChorus8 *LPDIRECTSOUNDFXCHORUS8;
+#define IDirectSoundFXChorus8 IDirectSoundFXChorus
+#define IID_IDirectSoundFXChorus8 IID_IDirectSoundFXChorus
+
+DEFINE_GUID(IID_IDirectSoundFXFlanger, 0x903e9878,0x2c92,0x4072,0x9b,0x2c,0xea,0x68,0xf5,0x39,0x67,0x83);
+typedef struct IDirectSoundFXFlanger8 *LPDIRECTSOUNDFXFLANGER8;
+#define IDirectSoundFXFlanger8 IDirectSoundFXFlanger
+#define IID_IDirectSoundFXFlanger8 IID_IDirectSoundFXFlanger
+
+DEFINE_GUID(IID_IDirectSoundFXEcho, 0x8bd28edf,0x50db,0x4e92,0xa2,0xbd,0x44,0x54,0x88, 0xd1,0xed,0x42);
+typedef struct IDirectSoundFXEcho8 *LPDIRECTSOUNDFXECHO8;
+#define IDirectSoundFXEcho8 IDirectSoundFXEcho
+#define IID_IDirectSoundFXEcho8 IID_IDirectSoundFXEcho
+
+DEFINE_GUID(IID_IDirectSoundFXDistortion, 0x8ecf4326,0x455f,0x4d8b,0xbd,0xa9,0x8d,0x5d,0x3e,0x9e,0x3e,0x0b);
+typedef struct IDirectSoundFXDistortion8 *LPDIRECTSOUNDFXDISTORTION8;
+#define IDirectSoundFXDistortion8 IDirectSoundFXDistortion
+#define IID_IDirectSoundFXDistortion8 IID_IDirectSoundFXDistortion
+
+DEFINE_GUID(IID_IDirectSoundFXCompressor, 0x4bbd1154,0x62f6,0x4e2c,0xa1,0x5c,0xd3,0xb6,0xc4,0x17,0xf7,0xa0);
+typedef struct IDirectSoundFXCompressor8 *LPDIRECTSOUNDFXCOMPRESSOR8;
+#define IDirectSoundFXCompressor8 IDirectSoundFXCompressor
+#define IID_IDirectSoundFXCompressor8 IID_IDirectSoundFXCompressor
+
+DEFINE_GUID(IID_IDirectSoundFXParamEq, 0xc03ca9fe,0xfe90,0x4204,0x80,0x78,0x82,0x33,0x4c,0xd1,0x77,0xda);
+typedef struct IDirectSoundFXParamEq8 *LPDIRECTSOUNDFXPARAMEQ8;
+#define IDirectSoundFXParamEq8 IDirectSoundFXParamEq
+#define IID_IDirectSoundFXParamEq8 IID_IDirectSoundFXParamEq
+
+DEFINE_GUID(IID_IDirectSoundFXWavesReverb, 0x46858c3a,0x0dc6,0x45e3,0xb7,0x60,0xd4,0xee,0xf1,0x6c,0xb3,0x25);
+typedef struct IDirectSoundFXWavesReverb8 *LPDIRECTSOUNDFXWAVESREVERB8;
+#define IDirectSoundFXWavesReverb8 IDirectSoundFXWavesReverb
+#define IID_IDirectSoundFXWavesReverb8 IID_IDirectSoundFXWavesReverb
+
#define _FACDS 0x878
#define MAKE_DSHRESULT(code) MAKE_HRESULT(1,_FACDS,code)
@@ -1278,6 +1318,317 @@ DECLARE_INTERFACE_(IDirectSoundFXI3DL2Reverb,IUnknown)
#define IDirectSoundFXI3DL2Reverb_GetPreset(p,a) (p)->GetPreset(a)
#endif
+typedef struct _DSFXGargle
+{
+ DWORD dwRateHz;
+ DWORD dwWaveShape;
+} DSFXGargle, *LPDSFXGargle;
+
+typedef const DSFXGargle *LPCDSFXGargle;
+
+#define INTERFACE IDirectSoundFXGargle
+DECLARE_INTERFACE_(IDirectSoundFXGargle,IUnknown)
+{
+ /*** IUnknown methods ***/
+ STDMETHOD(QueryInterface)(THIS_ REFIID, void**) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+
+ /*** IDirectSoundFXGargle methods ***/
+ STDMETHOD(SetAllParameters)(THIS_ const DSFXGargle *gargle) PURE;
+ STDMETHOD(GetAllParameters)(THIS_ DSFXGargle *gargle) PURE;
+};
+#undef INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+#define IDirectSoundFXGargle_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
+#define IDirectSoundFXGargle_AddRef(p) (p)->lpVtbl->AddRef(p)
+#define IDirectSoundFXGargle_Release(p) (p)->lpVtbl->Release(p)
+#define IDirectSoundFXGargle_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a)
+#define IDirectSoundFXGargle_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a)
+#else
+#define IDirectSoundFXGargle_QueryInterface(p,a,b) (p)->QueryInterface(p,a,b)
+#define IDirectSoundFXGargle_AddRef(p) (p)->AddRef(p)
+#define IDirectSoundFXGargle_Release(p) (p)->Release(p)
+#define IDirectSoundFXGargle_SetAllParameters(p,a) (p)->SetAllParameters(a)
+#define IDirectSoundFXGargle_GetAllParameters(p,a) (p)->GetAllParameters(a)
+#endif
+
+typedef struct _DSFXChorus
+{
+ FLOAT fWetDryMix;
+ FLOAT fDepth;
+ FLOAT fFeedback;
+ FLOAT fFrequency;
+ LONG lWaveform;
+ FLOAT fDelay;
+ LONG lPhase;
+} DSFXChorus, *LPDSFXChorus;
+
+typedef const DSFXChorus *LPCDSFXChorus;
+
+#define INTERFACE IDirectSoundFXChorus
+DECLARE_INTERFACE_(IDirectSoundFXChorus,IUnknown)
+{
+ /*** IUnknown methods ***/
+ STDMETHOD(QueryInterface)(THIS_ REFIID, void**) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+
+ /*** IDirectSoundFXChorus methods ***/
+ STDMETHOD(SetAllParameters)(THIS_ const DSFXChorus *chorus) PURE;
+ STDMETHOD(GetAllParameters)(THIS_ DSFXChorus *chorus) PURE;
+};
+#undef INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+#define IDirectSoundFXChorus_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
+#define IDirectSoundFXChorus_AddRef(p) (p)->lpVtbl->AddRef(p)
+#define IDirectSoundFXChorus_Release(p) (p)->lpVtbl->Release(p)
+#define IDirectSoundFXChorus_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a)
+#define IDirectSoundFXChorus_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a)
+#else
+#define IDirectSoundFXChorus_QueryInterface(p,a,b) (p)->QueryInterface(p,a,b)
+#define IDirectSoundFXChorus_AddRef(p) (p)->AddRef(p)
+#define IDirectSoundFXChorus_Release(p) (p)->Release(p)
+#define IDirectSoundFXChorus_SetAllParameters(p,a) (p)->SetAllParameters(a)
+#define IDirectSoundFXChorus_GetAllParameters(p,a) (p)->GetAllParameters(a)
+#endif
+
+typedef struct _DSFXFlanger
+{
+ FLOAT fWetDryMix;
+ FLOAT fDepth;
+ FLOAT fFeedback;
+ FLOAT fFrequency;
+ LONG lWaveform;
+ FLOAT fDelay;
+ LONG lPhase;
+} DSFXFlanger, *LPDSFXFlanger;
+
+typedef const DSFXFlanger *LPCDSFXFlanger;
+
+#define INTERFACE IDirectSoundFXFlanger
+DECLARE_INTERFACE_(IDirectSoundFXFlanger,IUnknown)
+{
+ /*** IUnknown methods ***/
+ STDMETHOD(QueryInterface)(THIS_ REFIID, void**) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+
+ /*** IDirectSoundFXFlanger methods ***/
+ STDMETHOD(SetAllParameters)(THIS_ const DSFXFlanger *flanger) PURE;
+ STDMETHOD(GetAllParameters)(THIS_ DSFXFlanger *flanger) PURE;
+};
+#undef INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+#define IDirectSoundFXFlanger_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
+#define IDirectSoundFXFlanger_AddRef(p) (p)->lpVtbl->AddRef(p)
+#define IDirectSoundFXFlanger_Release(p) (p)->lpVtbl->Release(p)
+#define IDirectSoundFXFlanger_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a)
+#define IDirectSoundFXFlanger_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a)
+#else
+#define IDirectSoundFXFlanger_QueryInterface(p,a,b) (p)->QueryInterface(p,a,b)
+#define IDirectSoundFXFlanger_AddRef(p) (p)->AddRef(p)
+#define IDirectSoundFXFlanger_Release(p) (p)->Release(p)
+#define IDirectSoundFXFlanger_SetAllParameters(p,a) (p)->SetAllParameters(a)
+#define IDirectSoundFXFlanger_GetAllParameters(p,a) (p)->GetAllParameters(a)
+#endif
+
+typedef struct _DSFXEcho
+{
+ FLOAT fWetDryMix;
+ FLOAT fFeedback;
+ FLOAT fLeftDelay;
+ FLOAT fRightDelay;
+ LONG lPanDelay;
+} DSFXEcho, *LPDSFXEcho;
+
+typedef const DSFXEcho *LPCDSFXEcho;
+
+#define INTERFACE IDirectSoundFXEcho
+DECLARE_INTERFACE_(IDirectSoundFXEcho,IUnknown)
+{
+ /*** IUnknown methods ***/
+ STDMETHOD(QueryInterface)(THIS_ REFIID, void**) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+
+ /*** IDirectSoundFXEcho methods ***/
+ STDMETHOD(SetAllParameters)(THIS_ const DSFXEcho *echo) PURE;
+ STDMETHOD(GetAllParameters)(THIS_ DSFXEcho *echo) PURE;
+};
+#undef INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+#define IDirectSoundFXEcho_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
+#define IDirectSoundFXEcho_AddRef(p) (p)->lpVtbl->AddRef(p)
+#define IDirectSoundFXEcho_Release(p) (p)->lpVtbl->Release(p)
+#define IDirectSoundFXEcho_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a)
+#define IDirectSoundFXEcho_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a)
+#else
+#define IDirectSoundFXEcho_QueryInterface(p,a,b) (p)->QueryInterface(p,a,b)
+#define IDirectSoundFXEcho_AddRef(p) (p)->AddRef(p)
+#define IDirectSoundFXEcho_Release(p) (p)->Release(p)
+#define IDirectSoundFXEcho_SetAllParameters(p,a) (p)->SetAllParameters(a)
+#define IDirectSoundFXEcho_GetAllParameters(p,a) (p)->GetAllParameters(a)
+#endif
+
+typedef struct _DSFXDistortion
+{
+ FLOAT fGain;
+ FLOAT fEdge;
+ FLOAT fPostEQCenterFrequency;
+ FLOAT fPostEQBandwidth;
+ FLOAT fPreLowpassCutoff;
+} DSFXDistortion, *LPDSFXDistortion;
+
+typedef const DSFXDistortion *LPCDSFXDistortion;
+
+#define INTERFACE IDirectSoundFXDistortion
+DECLARE_INTERFACE_(IDirectSoundFXDistortion,IUnknown)
+{
+ /*** IUnknown methods ***/
+ STDMETHOD(QueryInterface)(THIS_ REFIID, void**) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+
+ /*** IDirectSoundFXDistortion methods ***/
+ STDMETHOD(SetAllParameters)(THIS_ const DSFXDistortion *distortion) PURE;
+ STDMETHOD(GetAllParameters)(THIS_ DSFXDistortion *distortion) PURE;
+};
+#undef INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+#define IDirectSoundFXDistortion_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
+#define IDirectSoundFXDistortion_AddRef(p) (p)->lpVtbl->AddRef(p)
+#define IDirectSoundFXDistortion_Release(p) (p)->lpVtbl->Release(p)
+#define IDirectSoundFXDistortion_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a)
+#define IDirectSoundFXDistortion_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a)
+#else
+#define IDirectSoundFXDistortion_QueryInterface(p,a,b) (p)->QueryInterface(p,a,b)
+#define IDirectSoundFXDistortion_AddRef(p) (p)->AddRef(p)
+#define IDirectSoundFXDistortion_Release(p) (p)->Release(p)
+#define IDirectSoundFXDistortion_SetAllParameters(p,a) (p)->SetAllParameters(a)
+#define IDirectSoundFXDistortion_GetAllParameters(p,a) (p)->GetAllParameters(a)
+#endif
+
+typedef struct _DSFXCompressor
+{
+ FLOAT fGain;
+ FLOAT fAttack;
+ FLOAT fRelease;
+ FLOAT fThreshold;
+ FLOAT fRatio;
+ FLOAT fPredelay;
+} DSFXCompressor, *LPDSFXCompressor;
+
+typedef const DSFXCompressor *LPCDSFXCompressor;
+
+#define INTERFACE IDirectSoundFXCompressor
+DECLARE_INTERFACE_(IDirectSoundFXCompressor, IUnknown)
+{
+ /*** IUnknown methods ***/
+ STDMETHOD(QueryInterface)(THIS_ REFIID, void**) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+
+ /*** IDirectSoundFXCompressor methods ***/
+ STDMETHOD(SetAllParameters)(THIS_ const DSFXCompressor *compressor) PURE;
+ STDMETHOD(GetAllParameters)(THIS_ DSFXCompressor *compressor) PURE;
+};
+#undef INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+#define IDirectSoundFXCompressor_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
+#define IDirectSoundFXCompressor_AddRef(p) (p)->lpVtbl->AddRef(p)
+#define IDirectSoundFXCompressor_Release(p) (p)->lpVtbl->Release(p)
+#define IDirectSoundFXCompressor_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a)
+#define IDirectSoundFXCompressor_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a)
+#else
+#define IDirectSoundFXCompressor_QueryInterface(p,a,b) (p)->QueryInterface(p,a,b)
+#define IDirectSoundFXCompressor_AddRef(p) (p)->AddRef(p)
+#define IDirectSoundFXCompressor_Release(p) (p)->Release(p)
+#define IDirectSoundFXCompressor_SetAllParameters(p,a) (p)->SetAllParameters(a)
+#define IDirectSoundFXCompressor_GetAllParameters(p,a) (p)->GetAllParameters(a)
+#endif
+
+typedef struct _DSFXParamEq
+{
+ FLOAT fCenter;
+ FLOAT fBandwidth;
+ FLOAT fGain;
+} DSFXParamEq, *LPDSFXParamEq;
+
+typedef const DSFXParamEq *LPCDSFXParamEq;
+
+#define INTERFACE IDirectSoundFXParamEq
+DECLARE_INTERFACE_(IDirectSoundFXParamEq, IUnknown)
+{
+ /*** IUnknown methods ***/
+ STDMETHOD(QueryInterface)(THIS_ REFIID, void**) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+
+ /*** IDirectSoundFXParamEq methods ***/
+ STDMETHOD(SetAllParameters)(THIS_ const DSFXParamEq *param) PURE;
+ STDMETHOD(GetAllParameters)(THIS_ DSFXParamEq *param) PURE;
+};
+#undef INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+#define IDirectSoundFXParamEq_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
+#define IDirectSoundFXParamEq_AddRef(p) (p)->lpVtbl->AddRef(p)
+#define IDirectSoundFXParamEq_Release(p) (p)->lpVtbl->Release(p)
+#define IDirectSoundFXParamEq_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a)
+#define IDirectSoundFXParamEq_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a)
+#else
+#define IDirectSoundFXParamEq_QueryInterface(p,a,b) (p)->QueryInterface(p,a,b)
+#define IDirectSoundFXParamEq_AddRef(p) (p)->AddRef(p)
+#define IDirectSoundFXParamEq_Release(p) (p)->Release(p)
+#define IDirectSoundFXParamEq_SetAllParameters(p,a) (p)->SetAllParameters(a)
+#define IDirectSoundFXParamEq_GetAllParameters(p,a) (p)->GetAllParameters(a)
+#endif
+
+typedef struct _DSFXWavesReverb
+{
+ FLOAT fInGain;
+ FLOAT fReverbMix;
+ FLOAT fReverbTime;
+ FLOAT fHighFreqRTRatio;
+} DSFXWavesReverb, *LPDSFXWavesReverb;
+
+typedef const DSFXWavesReverb *LPCDSFXWavesReverb;
+
+#define INTERFACE IDirectSoundFXWavesReverb
+DECLARE_INTERFACE_(IDirectSoundFXWavesReverb,IUnknown)
+{
+ /*** IUnknown methods ***/
+ STDMETHOD(QueryInterface)(THIS_ REFIID, void**) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+
+ /*** IDirectSoundFXWavesReverb methods ***/
+ STDMETHOD(SetAllParameters)(THIS_ const DSFXWavesReverb *reverb) PURE;
+ STDMETHOD(GetAllParameters)(THIS_ DSFXWavesReverb *reverb) PURE;
+};
+#undef INTERFACE
+
+#if !defined(__cplusplus) || defined(CINTERFACE)
+#define IDirectSoundFXWavesReverb_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
+#define IDirectSoundFXWavesReverb_AddRef(p) (p)->lpVtbl->AddRef(p)
+#define IDirectSoundFXWavesReverb_Release(p) (p)->lpVtbl->Release(p)
+#define IDirectSoundFXWavesReverb_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a)
+#define IDirectSoundFXWavesReverb_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a)
+#else
+#define IDirectSoundFXWavesReverb_QueryInterface(p,a,b) (p)->QueryInterface(p,a,b)
+#define IDirectSoundFXWavesReverb_AddRef(p) (p)->AddRef(p)
+#define IDirectSoundFXWavesReverb_Release(p) (p)->Release(p)
+#define IDirectSoundFXWavesReverb_SetAllParameters(p,a) (p)->SetAllParameters(a)
+#define IDirectSoundFXWavesReverb_GetAllParameters(p,a) (p)->GetAllParameters(a)
+#endif
+
#ifdef __cplusplus
} /* extern "C" */
#endif /* defined(__cplusplus) */
--
2.17.1
1
0
[PATCH 1/5] widl: Store the type for casts and sizeof() expressions as a decl_spec_t.
by Zebediah Figura 16 Aug '19
by Zebediah Figura 16 Aug '19
16 Aug '19
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
tools/widl/expr.c | 12 ++++++------
tools/widl/widltypes.h | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/tools/widl/expr.c b/tools/widl/expr.c
index 85ba4639e1..3d40da571f 100644
--- a/tools/widl/expr.c
+++ b/tools/widl/expr.c
@@ -202,7 +202,7 @@ expr_t *make_exprt(enum expr_type type, var_t *var, expr_t *expr)
e = xmalloc(sizeof(expr_t));
e->type = type;
e->ref = expr;
- e->u.tref = tref;
+ e->u.tref = var->declspec;
e->is_const = FALSE;
if (type == EXPR_SIZEOF)
{
@@ -591,7 +591,7 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc
break;
case EXPR_CAST:
result = resolve_expression(expr_loc, cont_type, e->ref);
- result.type = e->u.tref;
+ result.type = e->u.tref.type;
break;
case EXPR_SIZEOF:
result.is_temporary = FALSE;
@@ -759,13 +759,13 @@ void write_expr(FILE *h, const expr_t *e, int brackets,
break;
case EXPR_CAST:
fprintf(h, "(");
- write_type_decl(h, e->u.tref, NULL);
+ write_type_decl(h, e->u.tref.type, NULL);
fprintf(h, ")");
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type, local_var_prefix);
break;
case EXPR_SIZEOF:
fprintf(h, "sizeof(");
- write_type_decl(h, e->u.tref, NULL);
+ write_type_decl(h, e->u.tref.type, NULL);
fprintf(h, ")");
break;
case EXPR_SHL:
@@ -917,7 +917,7 @@ int compare_expr(const expr_t *a, const expr_t *b)
return ret;
return compare_expr(a->u.ext, b->u.ext);
case EXPR_CAST:
- ret = compare_type(a->u.tref, b->u.tref);
+ ret = compare_type(a->u.tref.type, b->u.tref.type);
if (ret != 0)
return ret;
/* Fall through. */
@@ -929,7 +929,7 @@ int compare_expr(const expr_t *a, const expr_t *b)
case EXPR_POS:
return compare_expr(a->ref, b->ref);
case EXPR_SIZEOF:
- return compare_type(a->u.tref, b->u.tref);
+ return compare_type(a->u.tref.type, b->u.tref.type);
case EXPR_VOID:
return 0;
}
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 43931c9813..3f2a719f2d 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -319,7 +319,7 @@ struct _expr_t {
double dval;
const char *sval;
const expr_t *ext;
- type_t *tref;
+ decl_spec_t tref;
} u;
const expr_t *ext2;
int is_const;
--
2.22.0
1
4
[PATCH 5/5] wined3d: Merge wined3d_texture_upload_data() and wined3d_texture_gl_upload_data().
by Henri Verbeet 15 Aug '19
by Henri Verbeet 15 Aug '19
15 Aug '19
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/texture.c | 148 +++++++++++++++++++----------------------
dlls/wined3d/wined3d_private.h | 4 --
2 files changed, 67 insertions(+), 85 deletions(-)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 339768131ff..1f9e5817699 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1837,13 +1837,11 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
return WINED3D_OK;
}
-/* This call just uploads data, the caller is responsible for binding the
- * correct texture. */
-/* Context activation is done by the caller. */
-void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
- struct wined3d_context *context, const struct wined3d_format *format, const struct wined3d_box *src_box,
- const struct wined3d_const_bo_address *data, unsigned int src_row_pitch, unsigned int src_slice_pitch,
- unsigned int dst_x, unsigned int dst_y, unsigned int dst_z, BOOL srgb)
+static void wined3d_texture_gl_upload_data(struct wined3d_context *context,
+ const struct wined3d_const_bo_address *src_bo_addr, const struct wined3d_format *src_format,
+ const struct wined3d_box *src_box, unsigned int src_row_pitch, unsigned int src_slice_pitch,
+ struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, unsigned int dst_location,
+ unsigned int dst_x, unsigned int dst_y, unsigned int dst_z)
{
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
const struct wined3d_gl_info *gl_info = context_gl->gl_info;
@@ -1858,34 +1856,49 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
BOOL decompress;
GLenum target;
- TRACE("texture %p, sub_resource_idx %u, context %p, format %s, src_box %s, data %s, "
- "src_row_pitch %#x, src_slice_pitch %#x, dst_x %u, dst_y %u, dst_z %u, srgb %#x.\n",
- texture, sub_resource_idx, context, debug_d3dformat(format->id), debug_box(src_box),
- debug_const_bo_address(data), src_row_pitch, src_slice_pitch, dst_x, dst_y, dst_z, srgb);
+ BOOL srgb = FALSE;
+
+ TRACE("context %p, src_bo_addr %s, src_format %s, src_box %s, src_row_pitch %u, src_slice_pitch %u, "
+ "dst_texture %p, dst_sub_resource_idx %u, dst_location %s, dst_x %u, dst_y %u, dst_z %u.\n",
+ context, debug_const_bo_address(src_bo_addr), debug_d3dformat(src_format->id), debug_box(src_box),
+ src_row_pitch, src_slice_pitch, dst_texture, dst_sub_resource_idx,
+ wined3d_debug_location(dst_location), dst_x, dst_y, dst_z);
+
+ if (dst_location == WINED3D_LOCATION_TEXTURE_SRGB)
+ {
+ srgb = TRUE;
+ }
+ else if (dst_location != WINED3D_LOCATION_TEXTURE_RGB)
+ {
+ FIXME("Unhandled location %s.\n", wined3d_debug_location(dst_location));
+ return;
+ }
+
+ wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(dst_texture), wined3d_context_gl(context), srgb);
- if (texture->sub_resources[sub_resource_idx].map_count)
+ if (dst_texture->sub_resources[dst_sub_resource_idx].map_count)
{
WARN("Uploading a texture that is currently mapped, setting WINED3D_TEXTURE_PIN_SYSMEM.\n");
- texture->flags |= WINED3D_TEXTURE_PIN_SYSMEM;
+ dst_texture->flags |= WINED3D_TEXTURE_PIN_SYSMEM;
}
- if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_HEIGHT_SCALE)
+ if (src_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_HEIGHT_SCALE)
{
- update_h *= format->height_scale.numerator;
- update_h /= format->height_scale.denominator;
+ update_h *= src_format->height_scale.numerator;
+ update_h /= src_format->height_scale.denominator;
}
- target = wined3d_texture_gl_get_sub_resource_target(wined3d_texture_gl(texture), sub_resource_idx);
- level = sub_resource_idx % texture->level_count;
+ target = wined3d_texture_gl_get_sub_resource_target(wined3d_texture_gl(dst_texture), dst_sub_resource_idx);
+ level = dst_sub_resource_idx % dst_texture->level_count;
switch (target)
{
case GL_TEXTURE_1D_ARRAY:
- dst_y = sub_resource_idx / texture->level_count;
+ dst_y = dst_sub_resource_idx / dst_texture->level_count;
update_h = 1;
break;
case GL_TEXTURE_2D_ARRAY:
- dst_z = sub_resource_idx / texture->level_count;
+ dst_z = dst_sub_resource_idx / dst_texture->level_count;
update_d = 1;
break;
case GL_TEXTURE_2D_MULTISAMPLE:
@@ -1894,41 +1907,41 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
return;
}
- bo.buffer_object = data->buffer_object;
- bo.addr = (BYTE *)data->addr + src_box->front * src_slice_pitch;
- if (texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS)
+ bo.buffer_object = src_bo_addr->buffer_object;
+ bo.addr = (BYTE *)src_bo_addr->addr + src_box->front * src_slice_pitch;
+ if (dst_texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS)
{
- bo.addr += (src_box->top / format->block_height) * src_row_pitch;
- bo.addr += (src_box->left / format->block_width) * format->block_byte_count;
+ bo.addr += (src_box->top / src_format->block_height) * src_row_pitch;
+ bo.addr += (src_box->left / src_format->block_width) * src_format->block_byte_count;
}
else
{
bo.addr += src_box->top * src_row_pitch;
- bo.addr += src_box->left * format->byte_count;
+ bo.addr += src_box->left * src_format->byte_count;
}
- decompress = texture->resource.format_flags & WINED3DFMT_FLAG_DECOMPRESS;
- if (format->upload || decompress)
+ decompress = dst_texture->resource.format_flags & WINED3DFMT_FLAG_DECOMPRESS;
+ if (src_format->upload || decompress)
{
- const struct wined3d_format *compressed_format = format;
+ const struct wined3d_format *compressed_format = src_format;
unsigned int dst_row_pitch, dst_slice_pitch;
void *src_mem;
if (decompress)
{
- format = wined3d_resource_get_decompress_format(&texture->resource);
+ src_format = wined3d_resource_get_decompress_format(&dst_texture->resource);
}
else
{
- if (texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS)
+ if (dst_texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS)
ERR("Converting a block-based format.\n");
- f = *wined3d_format_gl(format);
- f.f.byte_count = format->conv_byte_count;
- format = &f.f;
+ f = *wined3d_format_gl(src_format);
+ f.f.byte_count = src_format->conv_byte_count;
+ src_format = &f.f;
}
- wined3d_format_calculate_pitch(format, 1, update_w, update_h, &dst_row_pitch, &dst_slice_pitch);
+ wined3d_format_calculate_pitch(src_format, 1, update_w, update_h, &dst_row_pitch, &dst_slice_pitch);
/* Note that uploading 3D textures may require quite some address
* space; it may make sense to upload them per-slice instead. */
@@ -1944,7 +1957,7 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
compressed_format->decompress(src_mem, converted_mem, src_row_pitch, src_slice_pitch,
dst_row_pitch, dst_slice_pitch, update_w, update_h, update_d);
else
- format->upload(src_mem, converted_mem, src_row_pitch, src_slice_pitch,
+ src_format->upload(src_mem, converted_mem, src_row_pitch, src_slice_pitch,
dst_row_pitch, dst_slice_pitch, update_w, update_h, update_d);
wined3d_context_gl_unmap_bo_address(context_gl, &bo, GL_PIXEL_UNPACK_BUFFER);
@@ -1960,8 +1973,8 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
checkGLcall("glBindBuffer");
}
- format_gl = wined3d_format_gl(format);
- if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED)
+ format_gl = wined3d_format_gl(src_format);
+ if (src_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED)
{
unsigned int dst_row_pitch, dst_slice_pitch;
const BYTE *addr = bo.addr;
@@ -1969,13 +1982,13 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
if (srgb)
internal = format_gl->srgb_internal;
- else if (texture->resource.bind_flags & WINED3D_BIND_RENDER_TARGET
- && wined3d_resource_is_offscreen(&texture->resource))
+ else if (dst_texture->resource.bind_flags & WINED3D_BIND_RENDER_TARGET
+ && wined3d_resource_is_offscreen(&dst_texture->resource))
internal = format_gl->rt_internal;
else
internal = format_gl->internal;
- wined3d_format_calculate_pitch(format, 1, update_w, update_h, &dst_row_pitch, &dst_slice_pitch);
+ wined3d_format_calculate_pitch(src_format, 1, update_w, update_h, &dst_row_pitch, &dst_slice_pitch);
TRACE("Uploading compressed data, target %#x, level %u, x %u, y %u, z %u, "
"w %u, h %u, d %u, format %#x, image_size %#x, addr %p.\n",
@@ -2002,7 +2015,7 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
}
else
{
- unsigned int row_count = (update_h + format->block_height - 1) / format->block_height;
+ unsigned int row_count = (update_h + src_format->block_height - 1) / src_format->block_height;
unsigned int row, y, z;
/* glCompressedTexSubImage2D() ignores pixel store state, so we
@@ -2014,15 +2027,15 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
if (target == GL_TEXTURE_2D_ARRAY || target == GL_TEXTURE_3D)
{
GL_EXTCALL(glCompressedTexSubImage3D(target, level, dst_x, y, z,
- update_w, format->block_height, 1, internal, dst_row_pitch, addr));
+ update_w, src_format->block_height, 1, internal, dst_row_pitch, addr));
}
else
{
GL_EXTCALL(glCompressedTexSubImage2D(target, level, dst_x, y,
- update_w, format->block_height, internal, dst_row_pitch, addr));
+ update_w, src_format->block_height, internal, dst_row_pitch, addr));
}
- y += format->block_height;
+ y += src_format->block_height;
addr += src_row_pitch;
}
}
@@ -2036,7 +2049,7 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
target, level, dst_x, dst_y, dst_z, update_w, update_h,
update_d, format_gl->format, format_gl->type, bo.addr);
- gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ROW_LENGTH, src_row_pitch / format->byte_count);
+ gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ROW_LENGTH, src_row_pitch / src_format->byte_count);
if (target == GL_TEXTURE_2D_ARRAY || target == GL_TEXTURE_3D)
{
GL_EXTCALL(glTexSubImage3D(target, level, dst_x, dst_y, dst_z,
@@ -2065,12 +2078,12 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
if (gl_info->quirks & WINED3D_QUIRK_FBO_TEX_UPDATE)
{
- struct wined3d_device *device = texture->resource.device;
+ struct wined3d_device *device = dst_texture->resource.device;
unsigned int i;
for (i = 0; i < device->context_count; ++i)
{
- wined3d_context_gl_texture_update(wined3d_context_gl(device->contexts[i]), wined3d_texture_gl(texture));
+ wined3d_context_gl_texture_update(wined3d_context_gl(device->contexts[i]), wined3d_texture_gl(dst_texture));
}
}
}
@@ -2559,6 +2572,7 @@ static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_g
struct wined3d_bo_address data;
BYTE *src_mem, *dst_mem = NULL;
struct wined3d_box src_box;
+ DWORD dst_location;
BOOL depth;
depth = texture_gl->t.resource.bind_flags & WINED3D_BIND_DEPTH_STENCIL;
@@ -2602,10 +2616,10 @@ static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_g
{
DWORD src_location = sub_resource->locations & WINED3D_LOCATION_RB_RESOLVED ?
WINED3D_LOCATION_RB_RESOLVED : WINED3D_LOCATION_RB_MULTISAMPLE;
- DWORD dst_location = srgb ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB;
RECT src_rect;
SetRect(&src_rect, src_box.left, src_box.top, src_box.right, src_box.bottom);
+ dst_location = srgb ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB;
if (fbo_blitter_supported(WINED3D_BLIT_OP_COLOR_BLIT, gl_info,
&texture_gl->t.resource, src_location, &texture_gl->t.resource, dst_location))
texture2d_blt_fbo(device, &context_gl->c, WINED3D_TEXF_POINT, &texture_gl->t, sub_resource_idx,
@@ -2618,6 +2632,7 @@ static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_g
if (srgb)
{
+ dst_location = WINED3D_LOCATION_TEXTURE_SRGB;
if ((sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | texture_gl->t.resource.map_binding))
== WINED3D_LOCATION_TEXTURE_RGB)
{
@@ -2628,6 +2643,7 @@ static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_g
}
else
{
+ dst_location = WINED3D_LOCATION_TEXTURE_RGB;
if ((sub_resource->locations & (WINED3D_LOCATION_TEXTURE_SRGB | texture_gl->t.resource.map_binding))
== WINED3D_LOCATION_TEXTURE_SRGB)
{
@@ -2644,7 +2660,6 @@ static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_g
wined3d_texture_load_location(&texture_gl->t, sub_resource_idx, &context_gl->c, WINED3D_LOCATION_SYSMEM);
}
- wined3d_texture_gl_bind_and_dirtify(texture_gl, context_gl, srgb);
wined3d_texture_get_pitch(&texture_gl->t, level, &src_row_pitch, &src_slice_pitch);
format = texture_gl->t.resource.format;
@@ -2687,8 +2702,8 @@ static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_g
data.addr = dst_mem;
}
- wined3d_texture_upload_data(&texture_gl->t, sub_resource_idx, &context_gl->c, format, &src_box,
- wined3d_const_bo_address(&data), src_row_pitch, src_slice_pitch, 0, 0, 0, srgb);
+ wined3d_texture_gl_upload_data(&context_gl->c, wined3d_const_bo_address(&data), format, &src_box,
+ src_row_pitch, src_slice_pitch, &texture_gl->t, sub_resource_idx, dst_location, 0, 0, 0);
heap_free(dst_mem);
@@ -2781,35 +2796,6 @@ static BOOL wined3d_texture_gl_load_location(struct wined3d_texture *texture,
}
}
-static void wined3d_texture_gl_upload_data(struct wined3d_context *context,
- const struct wined3d_const_bo_address *src_bo_addr, const struct wined3d_format *src_format,
- const struct wined3d_box *src_box, unsigned int src_row_pitch, unsigned int src_slice_pitch,
- struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, unsigned int dst_location,
- unsigned int dst_x, unsigned int dst_y, unsigned int dst_z)
-{
- BOOL srgb = FALSE;
-
- TRACE("context %p, src_bo_addr %s, src_format %s, src_box %s, src_row_pitch %u, src_slice_pitch %u, "
- "dst_texture %p, dst_sub_resource_idx %u, dst_location %s, dst_x %u, dst_y %u, dst_z %u.\n",
- context, debug_const_bo_address(src_bo_addr), debug_d3dformat(src_format->id), debug_box(src_box),
- src_row_pitch, src_slice_pitch, dst_texture, dst_sub_resource_idx,
- wined3d_debug_location(dst_location), dst_x, dst_y, dst_z);
-
- if (dst_location == WINED3D_LOCATION_TEXTURE_SRGB)
- {
- srgb = TRUE;
- }
- else if (dst_location != WINED3D_LOCATION_TEXTURE_RGB)
- {
- FIXME("Unhandled location %s.\n", wined3d_debug_location(dst_location));
- return;
- }
-
- wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(dst_texture), wined3d_context_gl(context), srgb);
- wined3d_texture_upload_data(dst_texture, dst_sub_resource_idx, context, src_format,
- src_box, src_bo_addr, src_row_pitch, src_slice_pitch, dst_x, dst_y, dst_z, srgb);
-}
-
static const struct wined3d_texture_ops texture_gl_ops =
{
wined3d_texture_gl_prepare_location,
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 3e01ec9bdbd..dde334cbdbb 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3666,10 +3666,6 @@ void wined3d_texture_set_swapchain(struct wined3d_texture *texture,
void wined3d_texture_sub_resources_destroyed(struct wined3d_texture *texture) DECLSPEC_HIDDEN;
void wined3d_texture_translate_drawable_coords(const struct wined3d_texture *texture,
HWND window, RECT *rect) DECLSPEC_HIDDEN;
-void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
- struct wined3d_context *context, const struct wined3d_format *format, const struct wined3d_box *src_box,
- const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch,
- unsigned int dst_x, unsigned int dst_y, unsigned int dst_z, BOOL srgb) DECLSPEC_HIDDEN;
void wined3d_texture_upload_from_texture(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx,
unsigned int dst_x, unsigned int dst_y, unsigned int dst_z, struct wined3d_texture *src_texture,
unsigned int src_sub_resource_idx, const struct wined3d_box *src_box) DECLSPEC_HIDDEN;
--
2.11.0
1
0
15 Aug '19
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/adapter_gl.c | 14 +++++++++
dlls/wined3d/adapter_vk.c | 21 ++++++++++++++
dlls/wined3d/directx.c | 21 ++++++++++++++
dlls/wined3d/surface.c | 61 ++++++++++++++-------------------------
dlls/wined3d/texture.c | 65 ++++++++++++++++++------------------------
dlls/wined3d/wined3d_private.h | 16 +++++++++++
6 files changed, 120 insertions(+), 78 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c
index 61bdc8acd3c..10b8aea4e4b 100644
--- a/dlls/wined3d/adapter_gl.c
+++ b/dlls/wined3d/adapter_gl.c
@@ -4653,6 +4653,18 @@ static void adapter_gl_uninit_3d(struct wined3d_device *device)
wined3d_cs_finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
}
+static void *adapter_gl_map_bo_address(struct wined3d_context *context,
+ const struct wined3d_bo_address *data, size_t size, GLenum binding, uint32_t flags)
+{
+ return wined3d_context_gl_map_bo_address(wined3d_context_gl(context), data, size, binding, flags);
+}
+
+static void adapter_gl_unmap_bo_address(struct wined3d_context *context,
+ const struct wined3d_bo_address *data, GLenum binding)
+{
+ return wined3d_context_gl_unmap_bo_address(wined3d_context_gl(context), data, binding);
+}
+
static HRESULT adapter_gl_create_swapchain(struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain)
{
@@ -5126,6 +5138,8 @@ static const struct wined3d_adapter_ops wined3d_adapter_gl_ops =
adapter_gl_check_format,
adapter_gl_init_3d,
adapter_gl_uninit_3d,
+ adapter_gl_map_bo_address,
+ adapter_gl_unmap_bo_address,
adapter_gl_create_swapchain,
adapter_gl_destroy_swapchain,
adapter_gl_create_buffer,
diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c
index bb98810fd5d..5261fd3fec0 100644
--- a/dlls/wined3d/adapter_vk.c
+++ b/dlls/wined3d/adapter_vk.c
@@ -466,6 +466,25 @@ static void adapter_vk_uninit_3d(struct wined3d_device *device)
wined3d_context_vk_cleanup(context_vk);
}
+static void *adapter_vk_map_bo_address(struct wined3d_context *context,
+ const struct wined3d_bo_address *data, size_t size, GLenum binding, uint32_t flags)
+{
+ if (data->buffer_object)
+ {
+ ERR("Unsupported buffer object %#lx.\n", data->buffer_object);
+ return NULL;
+ }
+
+ return data->addr;
+}
+
+static void adapter_vk_unmap_bo_address(struct wined3d_context *context,
+ const struct wined3d_bo_address *data, GLenum binding)
+{
+ if (data->buffer_object)
+ ERR("Unsupported buffer object %#lx.\n", data->buffer_object);
+}
+
static HRESULT adapter_vk_create_swapchain(struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain)
{
@@ -789,6 +808,8 @@ static const struct wined3d_adapter_ops wined3d_adapter_vk_ops =
adapter_vk_check_format,
adapter_vk_init_3d,
adapter_vk_uninit_3d,
+ adapter_vk_map_bo_address,
+ adapter_vk_unmap_bo_address,
adapter_vk_create_swapchain,
adapter_vk_destroy_swapchain,
adapter_vk_create_buffer,
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index ecff67dfba7..fd03ce63494 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -2352,6 +2352,25 @@ static void adapter_no3d_uninit_3d(struct wined3d_device *device)
wined3d_context_cleanup(context_no3d);
}
+static void *adapter_no3d_map_bo_address(struct wined3d_context *context,
+ const struct wined3d_bo_address *data, size_t size, GLenum binding, uint32_t flags)
+{
+ if (data->buffer_object)
+ {
+ ERR("Unsupported buffer object %#lx.\n", data->buffer_object);
+ return NULL;
+ }
+
+ return data->addr;
+}
+
+static void adapter_no3d_unmap_bo_address(struct wined3d_context *context,
+ const struct wined3d_bo_address *data, GLenum binding)
+{
+ if (data->buffer_object)
+ ERR("Unsupported buffer object %#lx.\n", data->buffer_object);
+}
+
static HRESULT adapter_no3d_create_swapchain(struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain)
{
@@ -2598,6 +2617,8 @@ static const struct wined3d_adapter_ops wined3d_adapter_no3d_ops =
adapter_no3d_check_format,
adapter_no3d_init_3d,
adapter_no3d_uninit_3d,
+ adapter_no3d_map_bo_address,
+ adapter_no3d_unmap_bo_address,
adapter_no3d_create_swapchain,
adapter_no3d_destroy_swapchain,
adapter_no3d_create_buffer,
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 00278d5ca8b..a43f0f2f2c2 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -600,12 +600,11 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
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;
- struct wined3d_context_gl *context_gl = NULL;
unsigned int src_row_pitch, src_slice_pitch;
- struct wined3d_context *context = NULL;
struct wined3d_texture *dst_texture;
struct wined3d_bo_address src_data;
struct wined3d_resource_desc desc;
+ struct wined3d_context *context;
DWORD map_binding;
if (!(conv = find_converter(src_format->id, dst_format->id)) && (!device->d3d_initialized
@@ -637,11 +636,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
return NULL;
}
- if (device->d3d_initialized)
- {
- context = context_acquire(device, NULL, 0);
- context_gl = wined3d_context_gl(context);
- }
+ context = context_acquire(device, NULL, 0);
map_binding = src_texture->resource.map_binding;
if (!wined3d_texture_load_location(src_texture, sub_resource_idx, context, map_binding))
@@ -662,16 +657,16 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
wined3d_texture_get_pitch(dst_texture, 0, &dst_row_pitch, &dst_slice_pitch);
wined3d_texture_get_memory(dst_texture, 0, &dst_data, map_binding);
- src = wined3d_context_gl_map_bo_address(context_gl, &src_data,
+ src = wined3d_context_map_bo_address(context, &src_data,
src_texture->sub_resources[sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ);
- dst = wined3d_context_gl_map_bo_address(context_gl, &dst_data,
+ dst = wined3d_context_map_bo_address(context, &dst_data,
dst_texture->sub_resources[0].size, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_WRITE);
conv->convert(src, dst, src_row_pitch, dst_row_pitch, desc.width, desc.height);
wined3d_texture_invalidate_location(dst_texture, 0, ~map_binding);
- wined3d_context_gl_unmap_bo_address(context_gl, &dst_data, GL_PIXEL_UNPACK_BUFFER);
- wined3d_context_gl_unmap_bo_address(context_gl, &src_data, GL_PIXEL_UNPACK_BUFFER);
+ wined3d_context_unmap_bo_address(context, &dst_data, GL_PIXEL_UNPACK_BUFFER);
+ wined3d_context_unmap_bo_address(context, &src_data, GL_PIXEL_UNPACK_BUFFER);
}
else
{
@@ -688,8 +683,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
wined3d_texture_invalidate_location(dst_texture, 0, ~WINED3D_LOCATION_TEXTURE_RGB);
}
- if (context)
- context_release(context);
+ context_release(context);
return dst_texture;
}
@@ -1638,11 +1632,10 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
const struct wined3d_format *src_format, *dst_format;
struct wined3d_texture *converted_texture = NULL;
struct wined3d_bo_address src_data, dst_data;
- struct wined3d_context_gl *context_gl = NULL;
unsigned int src_fmt_flags, dst_fmt_flags;
struct wined3d_map_desc dst_map, src_map;
- struct wined3d_context *context = NULL;
unsigned int x, sx, xinc, y, sy, yinc;
+ struct wined3d_context *context;
unsigned int texture_level;
HRESULT hr = WINED3D_OK;
BOOL same_sub_resource;
@@ -1656,11 +1649,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
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, 0);
- context_gl = wined3d_context_gl(context);
- }
+ context = context_acquire(device, NULL, 0);
if (src_texture == dst_texture && src_sub_resource_idx == dst_sub_resource_idx)
{
@@ -1673,7 +1662,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~map_binding);
wined3d_texture_get_pitch(dst_texture, texture_level, &dst_map.row_pitch, &dst_map.slice_pitch);
wined3d_texture_get_memory(dst_texture, dst_sub_resource_idx, &dst_data, map_binding);
- dst_map.data = wined3d_context_gl_map_bo_address(context_gl, &dst_data,
+ dst_map.data = wined3d_context_map_bo_address(context, &dst_data,
dst_texture->sub_resources[dst_sub_resource_idx].size,
GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ | WINED3D_MAP_WRITE);
@@ -1694,8 +1683,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
{
FIXME("Cannot convert %s to %s.\n", debug_d3dformat(src_texture->resource.format->id),
debug_d3dformat(dst_texture->resource.format->id));
- if (context)
- context_release(context);
+ context_release(context);
return WINED3DERR_NOTAVAILABLE;
}
src_texture = converted_texture;
@@ -1710,7 +1698,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
ERR("Failed to load the source sub-resource into %s.\n", wined3d_debug_location(map_binding));
wined3d_texture_get_pitch(src_texture, texture_level, &src_map.row_pitch, &src_map.slice_pitch);
wined3d_texture_get_memory(src_texture, src_sub_resource_idx, &src_data, map_binding);
- src_map.data = wined3d_context_gl_map_bo_address(context_gl, &src_data,
+ src_map.data = wined3d_context_map_bo_address(context, &src_data,
src_texture->sub_resources[src_sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ);
map_binding = dst_texture->resource.map_binding;
@@ -1720,7 +1708,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~map_binding);
wined3d_texture_get_pitch(dst_texture, texture_level, &dst_map.row_pitch, &dst_map.slice_pitch);
wined3d_texture_get_memory(dst_texture, dst_sub_resource_idx, &dst_data, map_binding);
- dst_map.data = wined3d_context_gl_map_bo_address(context_gl, &dst_data,
+ dst_map.data = wined3d_context_map_bo_address(context, &dst_data,
dst_texture->sub_resources[dst_sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_WRITE);
}
flags &= ~WINED3D_BLT_RAW;
@@ -2097,9 +2085,9 @@ error:
FIXME(" Unsupported flags %#x.\n", flags);
release:
- wined3d_context_gl_unmap_bo_address(context_gl, &dst_data, GL_PIXEL_UNPACK_BUFFER);
+ wined3d_context_unmap_bo_address(context, &dst_data, GL_PIXEL_UNPACK_BUFFER);
if (!same_sub_resource)
- wined3d_context_gl_unmap_bo_address(context_gl, &src_data, GL_PIXEL_UNPACK_BUFFER);
+ wined3d_context_unmap_bo_address(context, &src_data, GL_PIXEL_UNPACK_BUFFER);
if (SUCCEEDED(hr) && dst_texture->swapchain && dst_texture->swapchain->front_buffer == dst_texture)
{
SetRect(&dst_texture->swapchain->front_buffer_update,
@@ -2108,8 +2096,7 @@ release:
}
if (converted_texture)
wined3d_texture_decref(converted_texture);
- if (context)
- context_release(context);
+ context_release(context);
return hr;
}
@@ -2118,9 +2105,8 @@ static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view,
const struct wined3d_box *box, const struct wined3d_color *colour)
{
struct wined3d_device *device = view->resource->device;
- struct wined3d_context_gl *context_gl = NULL;
unsigned int x, y, z, w, h, d, bpp, level;
- struct wined3d_context *context = NULL;
+ struct wined3d_context *context;
struct wined3d_texture *texture;
struct wined3d_bo_address data;
struct wined3d_map_desc map;
@@ -2146,11 +2132,7 @@ static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view,
return;
}
- if (device->d3d_initialized)
- {
- context = context_acquire(device, NULL, 0);
- context_gl = wined3d_context_gl(context);
- }
+ context = context_acquire(device, NULL, 0);
texture = texture_from_resource(view->resource);
level = view->sub_resource_idx % texture->level_count;
@@ -2175,7 +2157,7 @@ static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view,
wined3d_texture_invalidate_location(texture, view->sub_resource_idx, ~map_binding);
wined3d_texture_get_pitch(texture, level, &map.row_pitch, &map.slice_pitch);
wined3d_texture_get_memory(texture, view->sub_resource_idx, &data, map_binding);
- map.data = wined3d_context_gl_map_bo_address(context_gl, &data,
+ map.data = wined3d_context_map_bo_address(context, &data,
texture->sub_resources[view->sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_WRITE);
map.data = (BYTE *)map.data
+ (box->front * map.slice_pitch)
@@ -2236,9 +2218,8 @@ static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view,
memcpy(dst, map.data, w * h * bpp);
}
- wined3d_context_gl_unmap_bo_address(context_gl, &data, GL_PIXEL_UNPACK_BUFFER);
- if (context)
- context_release(context);
+ wined3d_context_unmap_bo_address(context, &data, GL_PIXEL_UNPACK_BUFFER);
+ context_release(context);
}
static void cpu_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_device *device,
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 1b5ca2eeaf5..339768131ff 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -700,7 +700,6 @@ void wined3d_texture_sub_resources_destroyed(struct wined3d_texture *texture)
static void wined3d_texture_create_dc(void *object)
{
const struct wined3d_texture_idx *idx = object;
- struct wined3d_context_gl *context_gl = NULL;
struct wined3d_context *context = NULL;
unsigned int sub_resource_idx, level;
const struct wined3d_format *format;
@@ -737,19 +736,26 @@ static void wined3d_texture_create_dc(void *object)
}
}
- if (device->d3d_initialized)
+ if (!(texture->sub_resources[sub_resource_idx].locations & texture->resource.map_binding))
{
context = context_acquire(device, NULL, 0);
- context_gl = wined3d_context_gl(context);
+ wined3d_texture_load_location(texture, sub_resource_idx, 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);
wined3d_texture_get_pitch(texture, level, &row_pitch, &slice_pitch);
wined3d_texture_get_memory(texture, sub_resource_idx, &data, texture->resource.map_binding);
- desc.pMemory = wined3d_context_gl_map_bo_address(context_gl, &data,
- texture->sub_resources[sub_resource_idx].size,
- GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ | WINED3D_MAP_WRITE);
+ if (data.buffer_object)
+ {
+ if (!context)
+ context = context_acquire(device, NULL, 0);
+ desc.pMemory = wined3d_context_map_bo_address(context, &data,
+ texture->sub_resources[sub_resource_idx].size,
+ GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ | WINED3D_MAP_WRITE);
+ }
+ else
+ {
+ desc.pMemory = data.addr;
+ }
if (context)
context_release(context);
@@ -779,9 +785,8 @@ static void wined3d_texture_create_dc(void *object)
static void wined3d_texture_destroy_dc(void *object)
{
const struct wined3d_texture_idx *idx = object;
- struct wined3d_context_gl *context_gl = NULL;
D3DKMT_DESTROYDCFROMMEMORY destroy_desc;
- struct wined3d_context *context = NULL;
+ struct wined3d_context *context;
struct wined3d_texture *texture;
struct wined3d_dc_info *dc_info;
struct wined3d_bo_address data;
@@ -809,17 +814,13 @@ static void wined3d_texture_destroy_dc(void *object)
dc_info->dc = NULL;
dc_info->bitmap = NULL;
- if (device->d3d_initialized)
+ wined3d_texture_get_memory(texture, sub_resource_idx, &data, texture->resource.map_binding);
+ if (data.buffer_object)
{
context = context_acquire(device, NULL, 0);
- context_gl = wined3d_context_gl(context);
- }
-
- wined3d_texture_get_memory(texture, sub_resource_idx, &data, texture->resource.map_binding);
- wined3d_context_gl_unmap_bo_address(context_gl, &data, GL_PIXEL_UNPACK_BUFFER);
-
- if (context)
+ wined3d_context_unmap_bo_address(context, &data, GL_PIXEL_UNPACK_BUFFER);
context_release(context);
+ }
}
void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain)
@@ -2906,8 +2907,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
struct wined3d_texture_sub_resource *sub_resource;
struct wined3d_device *device = resource->device;
unsigned int fmt_flags = resource->format_flags;
- struct wined3d_context_gl *context_gl = NULL;
- struct wined3d_context *context = NULL;
+ struct wined3d_context *context;
struct wined3d_texture *texture;
struct wined3d_bo_address data;
unsigned int texture_level;
@@ -2942,11 +2942,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
return WINED3DERR_INVALIDCALL;
}
- if (device->d3d_initialized)
- {
- context = context_acquire(device, NULL, 0);
- context_gl = wined3d_context_gl(context);
- }
+ context = context_acquire(device, NULL, 0);
if (flags & WINED3D_MAP_DISCARD)
{
@@ -2974,12 +2970,11 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
wined3d_texture_invalidate_location(texture, sub_resource_idx, ~resource->map_binding);
wined3d_texture_get_memory(texture, sub_resource_idx, &data, resource->map_binding);
- base_memory = wined3d_context_gl_map_bo_address(context_gl, &data,
+ base_memory = wined3d_context_map_bo_address(context, &data,
sub_resource->size, GL_PIXEL_UNPACK_BUFFER, flags);
TRACE("Base memory pointer %p.\n", base_memory);
- if (context)
- context_release(context);
+ context_release(context);
if (fmt_flags & WINED3DFMT_FLAG_BROKEN_PITCH)
{
@@ -3039,8 +3034,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso
{
struct wined3d_texture_sub_resource *sub_resource;
struct wined3d_device *device = resource->device;
- struct wined3d_context_gl *context_gl = NULL;
- struct wined3d_context *context = NULL;
+ struct wined3d_context *context;
struct wined3d_texture *texture;
struct wined3d_bo_address data;
@@ -3058,17 +3052,12 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso
return WINEDDERR_NOTLOCKED;
}
- if (device->d3d_initialized)
- {
- context = context_acquire(device, NULL, 0);
- context_gl = wined3d_context_gl(context);
- }
+ context = context_acquire(device, NULL, 0);
wined3d_texture_get_memory(texture, sub_resource_idx, &data, texture->resource.map_binding);
- wined3d_context_gl_unmap_bo_address(context_gl, &data, GL_PIXEL_UNPACK_BUFFER);
+ wined3d_context_unmap_bo_address(context, &data, GL_PIXEL_UNPACK_BUFFER);
- if (context)
- context_release(context);
+ context_release(context);
if (texture->swapchain && texture->swapchain->front_buffer == texture)
{
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index c08e4fdf7f9..3e01ec9bdbd 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2787,6 +2787,10 @@ struct wined3d_adapter_ops
const struct wined3d_format *ds_format);
HRESULT (*adapter_init_3d)(struct wined3d_device *device);
void (*adapter_uninit_3d)(struct wined3d_device *device);
+ void *(*adapter_map_bo_address)(struct wined3d_context *context,
+ const struct wined3d_bo_address *data, size_t size, GLenum binding, uint32_t flags);
+ void (*adapter_unmap_bo_address)(struct wined3d_context *context,
+ const struct wined3d_bo_address *data, GLenum binding);
HRESULT (*adapter_create_swapchain)(struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain);
void (*adapter_destroy_swapchain)(struct wined3d_swapchain *swapchain);
@@ -5215,6 +5219,18 @@ static inline float wined3d_get_float_state(const struct wined3d_state *state, e
return tmpvalue.f;
}
+static inline void *wined3d_context_map_bo_address(struct wined3d_context *context,
+ const struct wined3d_bo_address *data, size_t size, GLenum binding, uint32_t flags)
+{
+ return context->device->adapter->adapter_ops->adapter_map_bo_address(context, data, size, binding, flags);
+}
+
+static inline void wined3d_context_unmap_bo_address(struct wined3d_context *context,
+ const struct wined3d_bo_address *data, GLenum binding)
+{
+ return context->device->adapter->adapter_ops->adapter_unmap_bo_address(context, data, binding);
+}
+
/* The WNDCLASS-Name for the fake window which we use to retrieve the GL capabilities */
#define WINED3D_OPENGL_WINDOW_CLASS_NAME "WineD3D_OpenGL"
--
2.11.0
1
0
[PATCH 3/5] wined3d: Introduce wined3d_texture_ops.texture_prepare_location().
by Henri Verbeet 15 Aug '19
by Henri Verbeet 15 Aug '19
15 Aug '19
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/texture.c | 145 +++++++++++++++++++++++++++--------------
dlls/wined3d/wined3d_private.h | 4 +-
2 files changed, 99 insertions(+), 50 deletions(-)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 7cde07ce817..1b5ca2eeaf5 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1795,53 +1795,10 @@ static void wined3d_texture_gl_prepare_rb(struct wined3d_texture_gl *texture_gl,
}
}
-/* Context activation is done by the caller. Context may be NULL in
- * WINED3D_NO3D mode. */
-BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned int sub_resource_idx,
- struct wined3d_context *context, DWORD location)
+BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture,
+ unsigned int sub_resource_idx, struct wined3d_context *context, unsigned int location)
{
- struct wined3d_texture_gl *texture_gl = wined3d_texture_gl(texture);
- struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
-
- switch (location)
- {
- case WINED3D_LOCATION_SYSMEM:
- return wined3d_resource_prepare_sysmem(&texture->resource);
-
- case WINED3D_LOCATION_USER_MEMORY:
- if (!texture->user_memory)
- ERR("Map binding is set to WINED3D_LOCATION_USER_MEMORY but surface->user_memory is NULL.\n");
- return TRUE;
-
- case WINED3D_LOCATION_BUFFER:
- wined3d_texture_prepare_buffer_object(texture, sub_resource_idx, context_gl->gl_info);
- return TRUE;
-
- case WINED3D_LOCATION_TEXTURE_RGB:
- wined3d_texture_gl_prepare_texture(texture_gl, context_gl, FALSE);
- return TRUE;
-
- case WINED3D_LOCATION_TEXTURE_SRGB:
- wined3d_texture_gl_prepare_texture(texture_gl, context_gl, TRUE);
- return TRUE;
-
- case WINED3D_LOCATION_DRAWABLE:
- if (!texture->swapchain && wined3d_settings.offscreen_rendering_mode != ORM_BACKBUFFER)
- ERR("Texture %p does not have a drawable.\n", texture);
- return TRUE;
-
- case WINED3D_LOCATION_RB_MULTISAMPLE:
- wined3d_texture_gl_prepare_rb(texture_gl, context_gl->gl_info, TRUE);
- return TRUE;
-
- case WINED3D_LOCATION_RB_RESOLVED:
- wined3d_texture_gl_prepare_rb(texture_gl, context_gl->gl_info, FALSE);
- return TRUE;
-
- default:
- ERR("Invalid location %s.\n", wined3d_debug_location(location));
- return FALSE;
- }
+ return texture->texture_ops->texture_prepare_location(texture, sub_resource_idx, context, location);
}
static struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(struct wined3d_texture *texture,
@@ -2468,7 +2425,6 @@ static BOOL wined3d_texture_gl_load_sysmem(struct wined3d_texture_gl *texture_gl
struct wined3d_texture_sub_resource *sub_resource;
sub_resource = &texture_gl->t.sub_resources[sub_resource_idx];
- wined3d_texture_prepare_location(&texture_gl->t, sub_resource_idx, &context_gl->c, dst_location);
/* We cannot download data from multisample textures directly. */
if (wined3d_texture_gl_is_multisample_location(texture_gl, WINED3D_LOCATION_TEXTURE_RGB))
@@ -2687,7 +2643,6 @@ static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_g
wined3d_texture_load_location(&texture_gl->t, sub_resource_idx, &context_gl->c, WINED3D_LOCATION_SYSMEM);
}
- wined3d_texture_gl_prepare_texture(texture_gl, context_gl, srgb);
wined3d_texture_gl_bind_and_dirtify(texture_gl, context_gl, srgb);
wined3d_texture_get_pitch(&texture_gl->t, level, &src_row_pitch, &src_slice_pitch);
@@ -2739,6 +2694,53 @@ static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_g
return TRUE;
}
+static BOOL wined3d_texture_gl_prepare_location(struct wined3d_texture *texture,
+ unsigned int sub_resource_idx, struct wined3d_context *context, unsigned int location)
+{
+ struct wined3d_texture_gl *texture_gl = wined3d_texture_gl(texture);
+ struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
+
+ switch (location)
+ {
+ case WINED3D_LOCATION_SYSMEM:
+ return wined3d_resource_prepare_sysmem(&texture->resource);
+
+ case WINED3D_LOCATION_USER_MEMORY:
+ if (!texture->user_memory)
+ ERR("Preparing WINED3D_LOCATION_USER_MEMORY, but texture->user_memory is NULL.\n");
+ return TRUE;
+
+ case WINED3D_LOCATION_BUFFER:
+ wined3d_texture_prepare_buffer_object(texture, sub_resource_idx, context_gl->gl_info);
+ return TRUE;
+
+ case WINED3D_LOCATION_TEXTURE_RGB:
+ wined3d_texture_gl_prepare_texture(texture_gl, context_gl, FALSE);
+ return TRUE;
+
+ case WINED3D_LOCATION_TEXTURE_SRGB:
+ wined3d_texture_gl_prepare_texture(texture_gl, context_gl, TRUE);
+ return TRUE;
+
+ case WINED3D_LOCATION_DRAWABLE:
+ if (!texture->swapchain && wined3d_settings.offscreen_rendering_mode != ORM_BACKBUFFER)
+ ERR("Texture %p does not have a drawable.\n", texture);
+ return TRUE;
+
+ case WINED3D_LOCATION_RB_MULTISAMPLE:
+ wined3d_texture_gl_prepare_rb(texture_gl, context_gl->gl_info, TRUE);
+ return TRUE;
+
+ case WINED3D_LOCATION_RB_RESOLVED:
+ wined3d_texture_gl_prepare_rb(texture_gl, context_gl->gl_info, FALSE);
+ return TRUE;
+
+ default:
+ ERR("Invalid location %s.\n", wined3d_debug_location(location));
+ return FALSE;
+ }
+}
+
/* Context activation is done by the caller. */
static BOOL wined3d_texture_gl_load_location(struct wined3d_texture *texture,
unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location)
@@ -2749,7 +2751,7 @@ static BOOL wined3d_texture_gl_load_location(struct wined3d_texture *texture,
TRACE("texture %p, sub_resource_idx %u, context %p, location %s.\n",
texture, sub_resource_idx, context, wined3d_debug_location(location));
- if (!wined3d_texture_prepare_location(texture, sub_resource_idx, context, location))
+ if (!wined3d_texture_gl_prepare_location(texture, sub_resource_idx, context, location))
return FALSE;
switch (location)
@@ -2809,6 +2811,7 @@ static void wined3d_texture_gl_upload_data(struct wined3d_context *context,
static const struct wined3d_texture_ops texture_gl_ops =
{
+ wined3d_texture_gl_prepare_location,
wined3d_texture_gl_load_location,
wined3d_texture_gl_upload_data,
wined3d_texture_gl_download_data,
@@ -3959,6 +3962,25 @@ static void wined3d_texture_no3d_download_data(struct wined3d_context *context,
FIXME("Not implemented.\n");
}
+static BOOL wined3d_texture_no3d_prepare_location(struct wined3d_texture *texture,
+ unsigned int sub_resource_idx, struct wined3d_context *context, unsigned int location)
+{
+ switch (location)
+ {
+ case WINED3D_LOCATION_SYSMEM:
+ return wined3d_resource_prepare_sysmem(&texture->resource);
+
+ case WINED3D_LOCATION_USER_MEMORY:
+ if (!texture->user_memory)
+ ERR("Preparing WINED3D_LOCATION_USER_MEMORY, but texture->user_memory is NULL.\n");
+ return TRUE;
+
+ default:
+ FIXME("Unhandled location %s.\n", wined3d_debug_location(location));
+ return FALSE;
+ }
+}
+
static BOOL wined3d_texture_no3d_load_location(struct wined3d_texture *texture,
unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location)
{
@@ -3975,6 +3997,7 @@ static BOOL wined3d_texture_no3d_load_location(struct wined3d_texture *texture,
static const struct wined3d_texture_ops wined3d_texture_no3d_ops =
{
+ wined3d_texture_no3d_prepare_location,
wined3d_texture_no3d_load_location,
wined3d_texture_no3d_upload_data,
wined3d_texture_no3d_download_data,
@@ -4011,6 +4034,29 @@ static void wined3d_texture_vk_download_data(struct wined3d_context *context,
FIXME("Not implemented.\n");
}
+static BOOL wined3d_texture_vk_prepare_location(struct wined3d_texture *texture,
+ unsigned int sub_resource_idx, struct wined3d_context *context, unsigned int location)
+{
+ switch (location)
+ {
+ case WINED3D_LOCATION_SYSMEM:
+ return wined3d_resource_prepare_sysmem(&texture->resource);
+
+ case WINED3D_LOCATION_USER_MEMORY:
+ if (!texture->user_memory)
+ ERR("Preparing WINED3D_LOCATION_USER_MEMORY, but texture->user_memory is NULL.\n");
+ return TRUE;
+
+ case WINED3D_LOCATION_TEXTURE_RGB:
+ /* The Vulkan image is created during resource creation. */
+ return TRUE;
+
+ default:
+ FIXME("Unhandled location %s.\n", wined3d_debug_location(location));
+ return FALSE;
+ }
+}
+
static BOOL wined3d_texture_vk_load_location(struct wined3d_texture *texture,
unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location)
{
@@ -4021,6 +4067,7 @@ static BOOL wined3d_texture_vk_load_location(struct wined3d_texture *texture,
static const struct wined3d_texture_ops wined3d_texture_vk_ops =
{
+ wined3d_texture_vk_prepare_location,
wined3d_texture_vk_load_location,
wined3d_texture_vk_upload_data,
wined3d_texture_vk_download_data,
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index fea31302ee0..c08e4fdf7f9 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3471,8 +3471,10 @@ struct wined3d_blt_info
struct wined3d_texture_ops
{
+ BOOL (*texture_prepare_location)(struct wined3d_texture *texture, unsigned int sub_resource_idx,
+ struct wined3d_context *context, unsigned int location);
BOOL (*texture_load_location)(struct wined3d_texture *texture, unsigned int sub_resource_idx,
- struct wined3d_context *context, DWORD location);
+ struct wined3d_context *context, unsigned int location);
void (*texture_upload_data)(struct wined3d_context *context, const struct wined3d_const_bo_address *src_bo_addr,
const struct wined3d_format *src_format, const struct wined3d_box *src_box, unsigned int src_row_pitch,
unsigned int src_slice_pitch, struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx,
--
2.11.0
1
0