You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-12-15 08:03:15 -08:00
Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
265554a9da | ||
|
|
38d4b8ca78 | ||
|
|
9c06e8eab3 | ||
|
|
78a888cd3d | ||
|
|
1f7871a75c | ||
|
|
815194acd6 | ||
|
|
7e9e516c71 | ||
|
|
ea30d81923 | ||
|
|
a8cce16566 | ||
|
|
20ba4773d6 | ||
|
|
64988e15df | ||
|
|
1a739efaa4 | ||
|
|
27156e4a6e | ||
|
|
112b476921 | ||
|
|
2465e06751 | ||
|
|
0e9c421030 | ||
|
|
04570cc4c7 | ||
|
|
c062a34be3 | ||
|
|
42ab95dc1f | ||
|
|
e1dea6b9ac | ||
|
|
74477d5d72 | ||
|
|
978b387c1c | ||
|
|
01d377c9ef | ||
|
|
317665ee20 | ||
|
|
3d1b6a4bc0 | ||
|
|
e33772ec34 | ||
|
|
342cfbc5de | ||
|
|
91b4afcd38 | ||
|
|
5f55fc20dc | ||
|
|
3714d05e91 | ||
|
|
39778538c2 | ||
|
|
0c15cda214 | ||
|
|
858b0697d2 | ||
|
|
0394bb10be | ||
|
|
e004127f41 | ||
|
|
5cba568c93 | ||
|
|
e2610f8a45 | ||
|
|
e250393ba4 | ||
|
|
ce66dea197 | ||
|
|
7cd95e9f79 | ||
|
|
c605cf204a | ||
|
|
a8f798fc3c |
@@ -1,4 +1,4 @@
|
||||
From 3dc4a148d7c91afea8f589f47daca82c5c27b7c1 Mon Sep 17 00:00:00 2001
|
||||
From efd5485d5026fceb01c7a25bb47a780505adea68 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Thu, 2 Oct 2014 19:44:31 +0200
|
||||
Subject: [PATCH] ntdll: Print a warning message specifying the wine-staging
|
||||
@@ -9,7 +9,7 @@ Subject: [PATCH] ntdll: Print a warning message specifying the wine-staging
|
||||
1 file changed, 19 insertions(+)
|
||||
|
||||
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
|
||||
index 74eb1b7f500..95639558155 100644
|
||||
index c20d6a5d87b..717f321bc6e 100644
|
||||
--- a/dlls/ntdll/loader.c
|
||||
+++ b/dlls/ntdll/loader.c
|
||||
@@ -43,6 +43,7 @@ WINE_DECLARE_DEBUG_CHANNEL(relay);
|
||||
@@ -20,7 +20,7 @@ index 74eb1b7f500..95639558155 100644
|
||||
|
||||
#ifdef _WIN64
|
||||
#define DEFAULT_SECURITY_COOKIE_64 (((ULONGLONG)0x00002b99 << 32) | 0x2ddfa232)
|
||||
@@ -3870,6 +3871,7 @@ void WINAPI LdrShutdownProcess(void)
|
||||
@@ -3879,6 +3880,7 @@ void WINAPI LdrShutdownProcess(void)
|
||||
process_detach();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ index 74eb1b7f500..95639558155 100644
|
||||
|
||||
/******************************************************************
|
||||
* RtlExitUserProcess (NTDLL.@)
|
||||
@@ -4366,6 +4368,9 @@ static void release_address_space(void)
|
||||
@@ -4388,6 +4390,9 @@ static void release_address_space(void)
|
||||
*/
|
||||
void loader_init( CONTEXT *context, void **entry )
|
||||
{
|
||||
@@ -38,9 +38,9 @@ index 74eb1b7f500..95639558155 100644
|
||||
static int attach_done;
|
||||
NTSTATUS status;
|
||||
ULONG_PTR cookie, port = 0;
|
||||
@@ -4455,6 +4460,20 @@ void loader_init( CONTEXT *context, void **entry )
|
||||
arm64ec_thread_init();
|
||||
#endif
|
||||
@@ -4485,6 +4490,20 @@ void loader_init( CONTEXT *context, void **entry )
|
||||
}
|
||||
|
||||
wm = get_modref( NtCurrentTeb()->Peb->ImageBaseAddress );
|
||||
+ /* This hunk occasionally applies in the wrong place;
|
||||
+ * add a comment here to try to prevent that. */
|
||||
@@ -60,5 +60,5 @@ index 74eb1b7f500..95639558155 100644
|
||||
|
||||
NtCurrentTeb()->FlsSlots = fls_alloc_data();
|
||||
--
|
||||
2.47.2
|
||||
2.51.0
|
||||
|
||||
|
||||
@@ -1,245 +0,0 @@
|
||||
From 0fbce9fe4b69f27b7df82c6517c364aab57de63b Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Fri, 30 Jul 2021 15:57:29 +1000
|
||||
Subject: [PATCH 1/2] d3dx11_43: Implement D3DX11GetImageInfoFromMemory
|
||||
|
||||
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=50210
|
||||
|
||||
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
---
|
||||
dlls/d3dx11_42/Makefile.in | 1 +
|
||||
dlls/d3dx11_43/Makefile.in | 1 +
|
||||
dlls/d3dx11_43/main.c | 9 --
|
||||
dlls/d3dx11_43/texture.c | 167 +++++++++++++++++++++++++++++++++++++
|
||||
4 files changed, 169 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3dx11_42/Makefile.in b/dlls/d3dx11_42/Makefile.in
|
||||
index 7fcce18a8e1..78ca5f707a7 100644
|
||||
--- a/dlls/d3dx11_42/Makefile.in
|
||||
+++ b/dlls/d3dx11_42/Makefile.in
|
||||
@@ -2,6 +2,7 @@ EXTRADEFS = -DD3DX11_SDK_VERSION=42
|
||||
MODULE = d3dx11_42.dll
|
||||
IMPORTLIB = d3dx11_42
|
||||
IMPORTS = d3dcompiler
|
||||
+DELAYIMPORTS = windowscodecs
|
||||
PARENTSRC = ../d3dx11_43
|
||||
|
||||
EXTRADLLFLAGS = -Wb,--prefer-native
|
||||
diff --git a/dlls/d3dx11_43/Makefile.in b/dlls/d3dx11_43/Makefile.in
|
||||
index ccd4319ace2..6854c73ebcb 100644
|
||||
--- a/dlls/d3dx11_43/Makefile.in
|
||||
+++ b/dlls/d3dx11_43/Makefile.in
|
||||
@@ -2,6 +2,7 @@ EXTRADEFS = -DD3DX11_SDK_VERSION=43
|
||||
MODULE = d3dx11_43.dll
|
||||
IMPORTLIB = d3dx11
|
||||
IMPORTS = d3dcompiler
|
||||
+DELAYIMPORTS = windowscodecs
|
||||
|
||||
EXTRADLLFLAGS = -Wb,--prefer-native
|
||||
|
||||
diff --git a/dlls/d3dx11_43/main.c b/dlls/d3dx11_43/main.c
|
||||
index 5dad027864f..00c1db35e42 100644
|
||||
--- a/dlls/d3dx11_43/main.c
|
||||
+++ b/dlls/d3dx11_43/main.c
|
||||
@@ -66,12 +66,3 @@ HRESULT WINAPI D3DX11GetImageInfoFromFileW(const WCHAR *filename, ID3DX11ThreadP
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
-
|
||||
-HRESULT WINAPI D3DX11GetImageInfoFromMemory(const void *src_data, SIZE_T src_data_size, ID3DX11ThreadPump *pump,
|
||||
- D3DX11_IMAGE_INFO *img_info, HRESULT *hresult)
|
||||
-{
|
||||
- FIXME("src_data %p, src_data_size %Iu, pump %p, img_info %p, hresult %p stub!\n",
|
||||
- src_data, src_data_size, pump, img_info, hresult);
|
||||
-
|
||||
- return E_NOTIMPL;
|
||||
-}
|
||||
diff --git a/dlls/d3dx11_43/texture.c b/dlls/d3dx11_43/texture.c
|
||||
index 81ac8ee6db7..bbf937cdab0 100644
|
||||
--- a/dlls/d3dx11_43/texture.c
|
||||
+++ b/dlls/d3dx11_43/texture.c
|
||||
@@ -15,14 +15,181 @@
|
||||
* 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 COBJMACROS
|
||||
|
||||
#include "d3dx11.h"
|
||||
#include "d3dcompiler.h"
|
||||
+#include "wincodec.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
|
||||
|
||||
+HRESULT WINAPI WICCreateImagingFactory_Proxy(UINT sdk_version, IWICImagingFactory **imaging_factory);
|
||||
+
|
||||
+static const struct
|
||||
+{
|
||||
+ const GUID *wic_container_guid;
|
||||
+ D3DX11_IMAGE_FILE_FORMAT d3dx_file_format;
|
||||
+}
|
||||
+file_formats[] =
|
||||
+{
|
||||
+ { &GUID_ContainerFormatBmp, D3DX11_IFF_BMP },
|
||||
+ { &GUID_ContainerFormatJpeg, D3DX11_IFF_JPG },
|
||||
+ { &GUID_ContainerFormatPng, D3DX11_IFF_PNG },
|
||||
+ { &GUID_ContainerFormatDds, D3DX11_IFF_DDS },
|
||||
+ { &GUID_ContainerFormatTiff, D3DX11_IFF_TIFF },
|
||||
+ { &GUID_ContainerFormatGif, D3DX11_IFF_GIF },
|
||||
+ { &GUID_ContainerFormatWmp, D3DX11_IFF_WMP },
|
||||
+};
|
||||
+
|
||||
+static D3DX11_IMAGE_FILE_FORMAT wic_container_guid_to_file_format(GUID *container_format)
|
||||
+{
|
||||
+ unsigned int i;
|
||||
+
|
||||
+ for (i = 0; i < ARRAY_SIZE(file_formats); ++i)
|
||||
+ {
|
||||
+ if (IsEqualGUID(file_formats[i].wic_container_guid, container_format))
|
||||
+ return file_formats[i].d3dx_file_format;
|
||||
+ }
|
||||
+ return D3DX11_IFF_FORCE_DWORD;
|
||||
+}
|
||||
+
|
||||
+static D3D11_RESOURCE_DIMENSION wic_dimension_to_d3dx11_dimension(WICDdsDimension wic_dimension)
|
||||
+{
|
||||
+ switch (wic_dimension)
|
||||
+ {
|
||||
+ case WICDdsTexture1D:
|
||||
+ return D3D11_RESOURCE_DIMENSION_TEXTURE1D;
|
||||
+ case WICDdsTexture2D:
|
||||
+ case WICDdsTextureCube:
|
||||
+ return D3D11_RESOURCE_DIMENSION_TEXTURE2D;
|
||||
+ case WICDdsTexture3D:
|
||||
+ return D3D11_RESOURCE_DIMENSION_TEXTURE3D;
|
||||
+ default:
|
||||
+ return D3D11_RESOURCE_DIMENSION_UNKNOWN;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static const DXGI_FORMAT to_be_converted_format[] =
|
||||
+{
|
||||
+ DXGI_FORMAT_UNKNOWN,
|
||||
+ DXGI_FORMAT_R8_UNORM,
|
||||
+ DXGI_FORMAT_R8G8_UNORM,
|
||||
+ DXGI_FORMAT_B5G6R5_UNORM,
|
||||
+ DXGI_FORMAT_B4G4R4A4_UNORM,
|
||||
+ DXGI_FORMAT_B5G5R5A1_UNORM,
|
||||
+ DXGI_FORMAT_B8G8R8X8_UNORM,
|
||||
+ DXGI_FORMAT_B8G8R8A8_UNORM
|
||||
+};
|
||||
+
|
||||
+static DXGI_FORMAT get_d3dx11_dds_format(DXGI_FORMAT format)
|
||||
+{
|
||||
+ unsigned int i;
|
||||
+
|
||||
+ for (i = 0; i < ARRAY_SIZE(to_be_converted_format); ++i)
|
||||
+ {
|
||||
+ if (format == to_be_converted_format[i])
|
||||
+ return DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
+ }
|
||||
+ return format;
|
||||
+}
|
||||
+
|
||||
+HRESULT WINAPI D3DX11GetImageInfoFromMemory(const void *src_data, SIZE_T src_data_size, ID3DX11ThreadPump *pump,
|
||||
+ D3DX11_IMAGE_INFO *img_info, HRESULT *hresult)
|
||||
+{
|
||||
+ IWICImagingFactory *factory = NULL;
|
||||
+ IWICDdsDecoder *dds_decoder = NULL;
|
||||
+ IWICBitmapDecoder *decoder = NULL;
|
||||
+ WICDdsParameters dds_params;
|
||||
+ IWICStream *stream = NULL;
|
||||
+ GUID container_format;
|
||||
+ HRESULT hr;
|
||||
+
|
||||
+ TRACE("src_data %p, src_data_size %Iu, pump %p, img_info %p, hresult %p.\n",
|
||||
+ src_data, src_data_size, pump, img_info, hresult);
|
||||
+
|
||||
+ if (!src_data || !src_data_size || !img_info)
|
||||
+ return E_FAIL;
|
||||
+ if (pump)
|
||||
+ FIXME("Thread pump is not supported yet.\n");
|
||||
+
|
||||
+ WICCreateImagingFactory_Proxy(WINCODEC_SDK_VERSION, &factory);
|
||||
+ IWICImagingFactory_CreateStream(factory, &stream);
|
||||
+ hr = IWICStream_InitializeFromMemory(stream, (BYTE *)src_data, src_data_size);
|
||||
+ if (FAILED(hr))
|
||||
+ {
|
||||
+ WARN("Failed to initialize stream.\n");
|
||||
+ goto end;
|
||||
+ }
|
||||
+ hr = IWICImagingFactory_CreateDecoderFromStream(factory, (IStream *)stream, NULL, 0, &decoder);
|
||||
+ if (FAILED(hr))
|
||||
+ goto end;
|
||||
+
|
||||
+ hr = IWICBitmapDecoder_GetContainerFormat(decoder, &container_format);
|
||||
+ if (FAILED(hr))
|
||||
+ goto end;
|
||||
+ img_info->ImageFileFormat = wic_container_guid_to_file_format(&container_format);
|
||||
+ if (img_info->ImageFileFormat == D3DX11_IFF_FORCE_DWORD)
|
||||
+ {
|
||||
+ hr = E_FAIL;
|
||||
+ WARN("Unsupported image file format %s.\n", debugstr_guid(&container_format));
|
||||
+ goto end;
|
||||
+ }
|
||||
+
|
||||
+ if (img_info->ImageFileFormat == D3DX11_IFF_DDS)
|
||||
+ {
|
||||
+ hr = IWICBitmapDecoder_QueryInterface(decoder, &IID_IWICDdsDecoder, (void **)&dds_decoder);
|
||||
+ if (FAILED(hr))
|
||||
+ goto end;
|
||||
+ hr = IWICDdsDecoder_GetParameters(dds_decoder, &dds_params);
|
||||
+ if (FAILED(hr))
|
||||
+ goto end;
|
||||
+ img_info->Width = dds_params.Width;
|
||||
+ img_info->Height = dds_params.Height;
|
||||
+ img_info->ArraySize = dds_params.ArraySize;
|
||||
+ img_info->Depth = dds_params.Depth;
|
||||
+ img_info->MipLevels = dds_params.MipLevels;
|
||||
+ img_info->ResourceDimension = wic_dimension_to_d3dx11_dimension(dds_params.Dimension);
|
||||
+ img_info->Format = get_d3dx11_dds_format(dds_params.DxgiFormat);
|
||||
+ img_info->MiscFlags = 0;
|
||||
+ if (dds_params.Dimension == WICDdsTextureCube)
|
||||
+ {
|
||||
+ img_info->MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE;
|
||||
+ img_info->ArraySize *= 6;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ FIXME("Unsupported image format %d\n", img_info->ImageFileFormat);
|
||||
+ img_info->Width = 1;
|
||||
+ img_info->Height = 1;
|
||||
+ img_info->ArraySize = 1;
|
||||
+ img_info->Depth = 1;
|
||||
+ img_info->MipLevels = 1;
|
||||
+ img_info->ResourceDimension = D3D11_RESOURCE_DIMENSION_TEXTURE2D;
|
||||
+ img_info->Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
+ img_info->MiscFlags = 0;
|
||||
+ }
|
||||
+
|
||||
+end:
|
||||
+ if (dds_decoder)
|
||||
+ IWICDdsDecoder_Release(dds_decoder);
|
||||
+ if (decoder)
|
||||
+ IWICBitmapDecoder_Release(decoder);
|
||||
+ if (stream)
|
||||
+ IWICStream_Release(stream);
|
||||
+ if (factory)
|
||||
+ IWICImagingFactory_Release(factory);
|
||||
+
|
||||
+ if (hr != S_OK)
|
||||
+ {
|
||||
+ WARN("Invalid or unsupported image file.\n");
|
||||
+ return E_FAIL;
|
||||
+ }
|
||||
+ return S_OK;
|
||||
+}
|
||||
+
|
||||
HRESULT WINAPI D3DX11CreateShaderResourceViewFromMemory(ID3D11Device *device, const void *data,
|
||||
SIZE_T data_size, D3DX11_IMAGE_LOAD_INFO *load_info, ID3DX11ThreadPump *pump,
|
||||
ID3D11ShaderResourceView **view, HRESULT *hresult)
|
||||
--
|
||||
2.40.1
|
||||
|
||||
@@ -1,407 +0,0 @@
|
||||
From 7285c2c90f43cd46d873a2ddb65e9c6c9d63f750 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Tue, 3 Aug 2021 11:13:18 +1000
|
||||
Subject: [PATCH 2/2] d3dx11_42: Implement D3DX11CreateTextureFromMemory
|
||||
|
||||
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
---
|
||||
dlls/d3dx11_43/texture.c | 359 ++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 354 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3dx11_43/texture.c b/dlls/d3dx11_43/texture.c
|
||||
index bbf937cdab0..10dedf30c0f 100644
|
||||
--- a/dlls/d3dx11_43/texture.c
|
||||
+++ b/dlls/d3dx11_43/texture.c
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "wincodec.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
+#include "wine/heap.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
|
||||
|
||||
@@ -43,6 +44,33 @@ file_formats[] =
|
||||
{ &GUID_ContainerFormatWmp, D3DX11_IFF_WMP },
|
||||
};
|
||||
|
||||
+static const struct
|
||||
+{
|
||||
+ const GUID *wic_guid;
|
||||
+ DXGI_FORMAT dxgi_format;
|
||||
+}
|
||||
+wic_pixel_formats[] =
|
||||
+{
|
||||
+ { &GUID_WICPixelFormatBlackWhite, DXGI_FORMAT_R1_UNORM },
|
||||
+ { &GUID_WICPixelFormat8bppAlpha, DXGI_FORMAT_A8_UNORM },
|
||||
+ { &GUID_WICPixelFormat8bppGray, DXGI_FORMAT_R8_UNORM },
|
||||
+ { &GUID_WICPixelFormat16bppGray, DXGI_FORMAT_R16_UNORM },
|
||||
+ { &GUID_WICPixelFormat16bppGrayHalf, DXGI_FORMAT_R16_FLOAT },
|
||||
+ { &GUID_WICPixelFormat32bppGrayFloat, DXGI_FORMAT_R32_FLOAT },
|
||||
+ { &GUID_WICPixelFormat16bppBGR565, DXGI_FORMAT_B5G6R5_UNORM },
|
||||
+ { &GUID_WICPixelFormat16bppBGRA5551, DXGI_FORMAT_B5G5R5A1_UNORM },
|
||||
+ { &GUID_WICPixelFormat32bppBGR, DXGI_FORMAT_B8G8R8X8_UNORM },
|
||||
+ { &GUID_WICPixelFormat32bppBGRA, DXGI_FORMAT_B8G8R8A8_UNORM },
|
||||
+ { &GUID_WICPixelFormat32bppRGBA, DXGI_FORMAT_R8G8B8A8_UNORM },
|
||||
+ { &GUID_WICPixelFormat32bppRGBA, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB },
|
||||
+ { &GUID_WICPixelFormat32bppRGBA1010102, DXGI_FORMAT_R10G10B10A2_UNORM },
|
||||
+ { &GUID_WICPixelFormat32bppRGBA1010102XR, DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM },
|
||||
+ { &GUID_WICPixelFormat64bppRGBA, DXGI_FORMAT_R16G16B16A16_UNORM },
|
||||
+ { &GUID_WICPixelFormat64bppRGBAHalf, DXGI_FORMAT_R16G16B16A16_FLOAT },
|
||||
+ { &GUID_WICPixelFormat96bppRGBFloat, DXGI_FORMAT_R32G32B32_FLOAT },
|
||||
+ { &GUID_WICPixelFormat128bppRGBAFloat, DXGI_FORMAT_R32G32B32A32_FLOAT }
|
||||
+};
|
||||
+
|
||||
static D3DX11_IMAGE_FILE_FORMAT wic_container_guid_to_file_format(GUID *container_format)
|
||||
{
|
||||
unsigned int i;
|
||||
@@ -95,6 +123,175 @@ static DXGI_FORMAT get_d3dx11_dds_format(DXGI_FORMAT format)
|
||||
return format;
|
||||
}
|
||||
|
||||
+static const DXGI_FORMAT block_compressed_formats[] =
|
||||
+{
|
||||
+ DXGI_FORMAT_BC1_TYPELESS, DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM_SRGB,
|
||||
+ DXGI_FORMAT_BC2_TYPELESS, DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC2_UNORM_SRGB,
|
||||
+ DXGI_FORMAT_BC3_TYPELESS, DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_BC3_UNORM_SRGB,
|
||||
+ DXGI_FORMAT_BC4_TYPELESS, DXGI_FORMAT_BC4_UNORM, DXGI_FORMAT_BC4_SNORM,
|
||||
+ DXGI_FORMAT_BC5_TYPELESS, DXGI_FORMAT_BC5_UNORM, DXGI_FORMAT_BC5_SNORM,
|
||||
+ DXGI_FORMAT_BC6H_TYPELESS, DXGI_FORMAT_BC6H_UF16, DXGI_FORMAT_BC6H_SF16,
|
||||
+ DXGI_FORMAT_BC7_TYPELESS, DXGI_FORMAT_BC7_UNORM, DXGI_FORMAT_BC7_UNORM_SRGB
|
||||
+};
|
||||
+
|
||||
+static BOOL is_block_compressed(DXGI_FORMAT format)
|
||||
+{
|
||||
+ unsigned int i;
|
||||
+
|
||||
+ for (i = 0; i < ARRAY_SIZE(block_compressed_formats); ++i)
|
||||
+ if (format == block_compressed_formats[i])
|
||||
+ return TRUE;
|
||||
+
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+static unsigned int get_bpp_from_format(DXGI_FORMAT format)
|
||||
+{
|
||||
+ switch (format)
|
||||
+ {
|
||||
+ case DXGI_FORMAT_R32G32B32A32_TYPELESS:
|
||||
+ case DXGI_FORMAT_R32G32B32A32_FLOAT:
|
||||
+ case DXGI_FORMAT_R32G32B32A32_UINT:
|
||||
+ case DXGI_FORMAT_R32G32B32A32_SINT:
|
||||
+ return 128;
|
||||
+ case DXGI_FORMAT_R32G32B32_TYPELESS:
|
||||
+ case DXGI_FORMAT_R32G32B32_FLOAT:
|
||||
+ case DXGI_FORMAT_R32G32B32_UINT:
|
||||
+ case DXGI_FORMAT_R32G32B32_SINT:
|
||||
+ return 96;
|
||||
+ case DXGI_FORMAT_R16G16B16A16_TYPELESS:
|
||||
+ case DXGI_FORMAT_R16G16B16A16_FLOAT:
|
||||
+ case DXGI_FORMAT_R16G16B16A16_UNORM:
|
||||
+ case DXGI_FORMAT_R16G16B16A16_UINT:
|
||||
+ case DXGI_FORMAT_R16G16B16A16_SNORM:
|
||||
+ case DXGI_FORMAT_R16G16B16A16_SINT:
|
||||
+ case DXGI_FORMAT_R32G32_TYPELESS:
|
||||
+ case DXGI_FORMAT_R32G32_FLOAT:
|
||||
+ case DXGI_FORMAT_R32G32_UINT:
|
||||
+ case DXGI_FORMAT_R32G32_SINT:
|
||||
+ case DXGI_FORMAT_R32G8X24_TYPELESS:
|
||||
+ case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
|
||||
+ case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
|
||||
+ case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
|
||||
+ case DXGI_FORMAT_Y416:
|
||||
+ case DXGI_FORMAT_Y210:
|
||||
+ case DXGI_FORMAT_Y216:
|
||||
+ return 64;
|
||||
+ case DXGI_FORMAT_R10G10B10A2_TYPELESS:
|
||||
+ case DXGI_FORMAT_R10G10B10A2_UNORM:
|
||||
+ case DXGI_FORMAT_R10G10B10A2_UINT:
|
||||
+ case DXGI_FORMAT_R11G11B10_FLOAT:
|
||||
+ case DXGI_FORMAT_R8G8B8A8_TYPELESS:
|
||||
+ case DXGI_FORMAT_R8G8B8A8_UNORM:
|
||||
+ case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
|
||||
+ case DXGI_FORMAT_R8G8B8A8_UINT:
|
||||
+ case DXGI_FORMAT_R8G8B8A8_SNORM:
|
||||
+ case DXGI_FORMAT_R8G8B8A8_SINT:
|
||||
+ case DXGI_FORMAT_R16G16_TYPELESS:
|
||||
+ case DXGI_FORMAT_R16G16_FLOAT:
|
||||
+ case DXGI_FORMAT_R16G16_UNORM:
|
||||
+ case DXGI_FORMAT_R16G16_UINT:
|
||||
+ case DXGI_FORMAT_R16G16_SNORM:
|
||||
+ case DXGI_FORMAT_R16G16_SINT:
|
||||
+ case DXGI_FORMAT_R32_TYPELESS:
|
||||
+ case DXGI_FORMAT_D32_FLOAT:
|
||||
+ case DXGI_FORMAT_R32_FLOAT:
|
||||
+ case DXGI_FORMAT_R32_UINT:
|
||||
+ case DXGI_FORMAT_R32_SINT:
|
||||
+ case DXGI_FORMAT_R24G8_TYPELESS:
|
||||
+ case DXGI_FORMAT_D24_UNORM_S8_UINT:
|
||||
+ case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
|
||||
+ case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
|
||||
+ case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
|
||||
+ case DXGI_FORMAT_R8G8_B8G8_UNORM:
|
||||
+ case DXGI_FORMAT_G8R8_G8B8_UNORM:
|
||||
+ case DXGI_FORMAT_B8G8R8A8_UNORM:
|
||||
+ case DXGI_FORMAT_B8G8R8X8_UNORM:
|
||||
+ case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
|
||||
+ case DXGI_FORMAT_B8G8R8A8_TYPELESS:
|
||||
+ case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
|
||||
+ case DXGI_FORMAT_B8G8R8X8_TYPELESS:
|
||||
+ case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
|
||||
+ case DXGI_FORMAT_AYUV:
|
||||
+ case DXGI_FORMAT_Y410:
|
||||
+ case DXGI_FORMAT_YUY2:
|
||||
+ return 32;
|
||||
+ case DXGI_FORMAT_P010:
|
||||
+ case DXGI_FORMAT_P016:
|
||||
+ return 24;
|
||||
+ case DXGI_FORMAT_R8G8_TYPELESS:
|
||||
+ case DXGI_FORMAT_R8G8_UNORM:
|
||||
+ case DXGI_FORMAT_R8G8_UINT:
|
||||
+ case DXGI_FORMAT_R8G8_SNORM:
|
||||
+ case DXGI_FORMAT_R8G8_SINT:
|
||||
+ case DXGI_FORMAT_R16_TYPELESS:
|
||||
+ case DXGI_FORMAT_R16_FLOAT:
|
||||
+ case DXGI_FORMAT_D16_UNORM:
|
||||
+ case DXGI_FORMAT_R16_UNORM:
|
||||
+ case DXGI_FORMAT_R16_UINT:
|
||||
+ case DXGI_FORMAT_R16_SNORM:
|
||||
+ case DXGI_FORMAT_R16_SINT:
|
||||
+ case DXGI_FORMAT_B5G6R5_UNORM:
|
||||
+ case DXGI_FORMAT_B5G5R5A1_UNORM:
|
||||
+ case DXGI_FORMAT_A8P8:
|
||||
+ case DXGI_FORMAT_B4G4R4A4_UNORM:
|
||||
+ return 16;
|
||||
+ case DXGI_FORMAT_NV12:
|
||||
+ case DXGI_FORMAT_420_OPAQUE:
|
||||
+ case DXGI_FORMAT_NV11:
|
||||
+ return 12;
|
||||
+ case DXGI_FORMAT_R8_TYPELESS:
|
||||
+ case DXGI_FORMAT_R8_UNORM:
|
||||
+ case DXGI_FORMAT_R8_UINT:
|
||||
+ case DXGI_FORMAT_R8_SNORM:
|
||||
+ case DXGI_FORMAT_R8_SINT:
|
||||
+ case DXGI_FORMAT_A8_UNORM:
|
||||
+ case DXGI_FORMAT_AI44:
|
||||
+ case DXGI_FORMAT_IA44:
|
||||
+ case DXGI_FORMAT_P8:
|
||||
+ case DXGI_FORMAT_BC2_TYPELESS:
|
||||
+ case DXGI_FORMAT_BC2_UNORM:
|
||||
+ case DXGI_FORMAT_BC2_UNORM_SRGB:
|
||||
+ case DXGI_FORMAT_BC3_TYPELESS:
|
||||
+ case DXGI_FORMAT_BC3_UNORM:
|
||||
+ case DXGI_FORMAT_BC3_UNORM_SRGB:
|
||||
+ case DXGI_FORMAT_BC5_TYPELESS:
|
||||
+ case DXGI_FORMAT_BC5_UNORM:
|
||||
+ case DXGI_FORMAT_BC5_SNORM:
|
||||
+ case DXGI_FORMAT_BC6H_TYPELESS:
|
||||
+ case DXGI_FORMAT_BC6H_UF16:
|
||||
+ case DXGI_FORMAT_BC6H_SF16:
|
||||
+ case DXGI_FORMAT_BC7_TYPELESS:
|
||||
+ case DXGI_FORMAT_BC7_UNORM:
|
||||
+ case DXGI_FORMAT_BC7_UNORM_SRGB:
|
||||
+ return 8;
|
||||
+ case DXGI_FORMAT_BC1_TYPELESS:
|
||||
+ case DXGI_FORMAT_BC1_UNORM:
|
||||
+ case DXGI_FORMAT_BC1_UNORM_SRGB:
|
||||
+ case DXGI_FORMAT_BC4_TYPELESS:
|
||||
+ case DXGI_FORMAT_BC4_UNORM:
|
||||
+ case DXGI_FORMAT_BC4_SNORM:
|
||||
+ return 4;
|
||||
+ case DXGI_FORMAT_R1_UNORM:
|
||||
+ return 1;
|
||||
+ default:
|
||||
+ return 0;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static const GUID *dxgi_format_to_wic_guid(DXGI_FORMAT format)
|
||||
+{
|
||||
+ unsigned int i;
|
||||
+
|
||||
+ for (i = 0; i < ARRAY_SIZE(wic_pixel_formats); ++i)
|
||||
+ {
|
||||
+ if (wic_pixel_formats[i].dxgi_format == format)
|
||||
+ return wic_pixel_formats[i].wic_guid;
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
HRESULT WINAPI D3DX11GetImageInfoFromMemory(const void *src_data, SIZE_T src_data_size, ID3DX11ThreadPump *pump,
|
||||
D3DX11_IMAGE_INFO *img_info, HRESULT *hresult)
|
||||
{
|
||||
@@ -220,14 +417,166 @@ HRESULT WINAPI D3DX11CreateTextureFromFileW(ID3D11Device *device, const WCHAR *f
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
-HRESULT WINAPI D3DX11CreateTextureFromMemory(ID3D11Device *device, const void *data,
|
||||
- SIZE_T data_size, D3DX11_IMAGE_LOAD_INFO *load_info, ID3DX11ThreadPump *pump,
|
||||
+HRESULT WINAPI D3DX11CreateTextureFromMemory(ID3D11Device *device, const void *src_data,
|
||||
+ SIZE_T src_data_size, D3DX11_IMAGE_LOAD_INFO *load_info, ID3DX11ThreadPump *pump,
|
||||
ID3D11Resource **texture, HRESULT *hresult)
|
||||
{
|
||||
- FIXME("device %p, data %p, data_size %Iu, load_info %p, pump %p, texture %p, hresult %p stub.\n",
|
||||
- device, data, data_size, load_info, pump, texture, hresult);
|
||||
+ unsigned int frame_count, width, height, stride, frame_size;
|
||||
+ IWICFormatConverter *converter = NULL;
|
||||
+ IWICDdsFrameDecode *dds_frame = NULL;
|
||||
+ D3D11_TEXTURE2D_DESC texture_2d_desc;
|
||||
+ D3D11_SUBRESOURCE_DATA resource_data;
|
||||
+ IWICBitmapFrameDecode *frame = NULL;
|
||||
+ IWICImagingFactory *factory = NULL;
|
||||
+ IWICBitmapDecoder *decoder = NULL;
|
||||
+ ID3D11Texture2D *texture_2d;
|
||||
+ D3DX11_IMAGE_INFO img_info;
|
||||
+ IWICStream *stream = NULL;
|
||||
+ const GUID *dst_format;
|
||||
+ BYTE *buffer = NULL;
|
||||
+ BOOL can_convert;
|
||||
+ GUID src_format;
|
||||
+ HRESULT hr;
|
||||
|
||||
- return E_NOTIMPL;
|
||||
+ TRACE("device %p, data %p, data_size %Iu, load_info %p, pump %p, texture %p, hresult %p.\n",
|
||||
+ device, src_data, src_data_size, load_info, pump, texture, hresult);
|
||||
+
|
||||
+ if (!src_data || !src_data_size || !texture)
|
||||
+ return E_FAIL;
|
||||
+ if (pump)
|
||||
+ FIXME("Thread pump is not supported yet.\n");
|
||||
+
|
||||
+ if (load_info)
|
||||
+ {
|
||||
+ img_info.Width = load_info->Width;
|
||||
+ img_info.Height = load_info->Height;
|
||||
+ img_info.Depth = load_info->Depth;
|
||||
+ img_info.ArraySize = 1;
|
||||
+ img_info.MipLevels = load_info->MipLevels;
|
||||
+ img_info.MiscFlags = load_info->MiscFlags;
|
||||
+ img_info.Format = load_info->Format;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (FAILED(D3DX11GetImageInfoFromMemory(src_data, src_data_size, NULL, &img_info, NULL)))
|
||||
+ return E_FAIL;
|
||||
+ if (img_info.MiscFlags & D3D11_RESOURCE_MISC_TEXTURECUBE)
|
||||
+ {
|
||||
+ FIXME("Cube map is not supported.\n");
|
||||
+ return E_FAIL;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (FAILED(hr = WICCreateImagingFactory_Proxy(WINCODEC_SDK_VERSION, &factory)))
|
||||
+ goto end;
|
||||
+ if (FAILED(hr = IWICImagingFactory_CreateStream(factory, &stream)))
|
||||
+ goto end;
|
||||
+ if (FAILED(hr = IWICStream_InitializeFromMemory(stream, (BYTE *)src_data, src_data_size)))
|
||||
+ goto end;
|
||||
+ if (FAILED(hr = IWICImagingFactory_CreateDecoderFromStream(factory, (IStream *)stream, NULL, 0, &decoder)))
|
||||
+ goto end;
|
||||
+ if (FAILED(hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count)) || !frame_count)
|
||||
+ goto end;
|
||||
+ if (FAILED(hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame)))
|
||||
+ goto end;
|
||||
+ if (FAILED(hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &src_format)))
|
||||
+ goto end;
|
||||
+
|
||||
+ width = img_info.Width;
|
||||
+ height = img_info.Height;
|
||||
+ if (is_block_compressed(img_info.Format))
|
||||
+ {
|
||||
+ width = (width + 3) & ~3;
|
||||
+ height = (height + 3) & ~3;
|
||||
+ }
|
||||
+ stride = (width * get_bpp_from_format(img_info.Format) + 7) / 8;
|
||||
+ frame_size = stride * height;
|
||||
+
|
||||
+ if (!(buffer = heap_alloc(frame_size)))
|
||||
+ {
|
||||
+ hr = E_FAIL;
|
||||
+ goto end;
|
||||
+ }
|
||||
+
|
||||
+ if (is_block_compressed(img_info.Format))
|
||||
+ {
|
||||
+ if (FAILED(hr = IWICBitmapFrameDecode_QueryInterface(frame, &IID_IWICDdsFrameDecode, (void **)&dds_frame)))
|
||||
+ goto end;
|
||||
+ if (FAILED(hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, stride * 4, frame_size, buffer)))
|
||||
+ goto end;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (!(dst_format = dxgi_format_to_wic_guid(img_info.Format)))
|
||||
+ {
|
||||
+ hr = E_FAIL;
|
||||
+ FIXME("Unsupported DXGI format %#x.\n", img_info.Format);
|
||||
+ goto end;
|
||||
+ }
|
||||
+
|
||||
+ if (IsEqualGUID(&src_format, dst_format))
|
||||
+ {
|
||||
+ if (FAILED(hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, stride, frame_size, buffer)))
|
||||
+ goto end;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (FAILED(hr = IWICImagingFactory_CreateFormatConverter(factory, &converter)))
|
||||
+ goto end;
|
||||
+ if (FAILED(hr = IWICFormatConverter_CanConvert(converter, &src_format, dst_format, &can_convert)))
|
||||
+ goto end;
|
||||
+ if (!can_convert)
|
||||
+ {
|
||||
+ WARN("Format converting %s to %s is not supported by WIC.\n",
|
||||
+ debugstr_guid(&src_format), debugstr_guid(dst_format));
|
||||
+ goto end;
|
||||
+ }
|
||||
+ if (FAILED(hr = IWICFormatConverter_Initialize(converter, (IWICBitmapSource *)frame, dst_format,
|
||||
+ WICBitmapDitherTypeErrorDiffusion, 0, 0, WICBitmapPaletteTypeCustom)))
|
||||
+ goto end;
|
||||
+ if (FAILED(hr = IWICFormatConverter_CopyPixels(converter, NULL, stride, frame_size, buffer)))
|
||||
+ goto end;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ memset(&texture_2d_desc, 0, sizeof(texture_2d_desc));
|
||||
+ texture_2d_desc.Width = width;
|
||||
+ texture_2d_desc.Height = height;
|
||||
+ texture_2d_desc.MipLevels = 1;
|
||||
+ texture_2d_desc.ArraySize = img_info.ArraySize;
|
||||
+ texture_2d_desc.Format = img_info.Format;
|
||||
+ texture_2d_desc.SampleDesc.Count = 1;
|
||||
+ texture_2d_desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
+ texture_2d_desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||
+ texture_2d_desc.MiscFlags = img_info.MiscFlags;
|
||||
+
|
||||
+ resource_data.pSysMem = buffer;
|
||||
+ resource_data.SysMemPitch = stride;
|
||||
+ resource_data.SysMemSlicePitch = frame_size;
|
||||
+
|
||||
+ if (FAILED(hr = ID3D11Device_CreateTexture2D(device, &texture_2d_desc, &resource_data, &texture_2d)))
|
||||
+ goto end;
|
||||
+
|
||||
+ *texture = (ID3D11Resource *)texture_2d;
|
||||
+ hr = S_OK;
|
||||
+
|
||||
+end:
|
||||
+ if (converter)
|
||||
+ IWICFormatConverter_Release(converter);
|
||||
+ if (dds_frame)
|
||||
+ IWICDdsFrameDecode_Release(dds_frame);
|
||||
+ if (buffer)
|
||||
+ heap_free(buffer);
|
||||
+ if (frame)
|
||||
+ IWICBitmapFrameDecode_Release(frame);
|
||||
+ if (decoder)
|
||||
+ IWICBitmapDecoder_Release(decoder);
|
||||
+ if (stream)
|
||||
+ IWICStream_Release(stream);
|
||||
+ if (factory)
|
||||
+ IWICImagingFactory_Release(factory);
|
||||
+
|
||||
+ return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI D3DX11SaveTextureToFileW(ID3D11DeviceContext *context, ID3D11Resource *texture,
|
||||
--
|
||||
2.40.1
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
From 30d677139afe2af3f72c68ba11f1bbaead6f1c11 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Wed, 2 Aug 2023 08:24:11 +1000
|
||||
Subject: [PATCH] d3dx11_43: D3DX11GetImageInfoFromMemory - Only use frame for
|
||||
non DDS images
|
||||
|
||||
---
|
||||
dlls/d3dx11_43/texture.c | 18 +++++++++++++++---
|
||||
1 file changed, 15 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3dx11_43/texture.c b/dlls/d3dx11_43/texture.c
|
||||
index 10dedf30c0f..f3f7d350131 100644
|
||||
--- a/dlls/d3dx11_43/texture.c
|
||||
+++ b/dlls/d3dx11_43/texture.c
|
||||
@@ -295,6 +295,7 @@ static const GUID *dxgi_format_to_wic_guid(DXGI_FORMAT format)
|
||||
HRESULT WINAPI D3DX11GetImageInfoFromMemory(const void *src_data, SIZE_T src_data_size, ID3DX11ThreadPump *pump,
|
||||
D3DX11_IMAGE_INFO *img_info, HRESULT *hresult)
|
||||
{
|
||||
+ IWICBitmapFrameDecode *frame = NULL;
|
||||
IWICImagingFactory *factory = NULL;
|
||||
IWICDdsDecoder *dds_decoder = NULL;
|
||||
IWICBitmapDecoder *decoder = NULL;
|
||||
@@ -358,9 +359,18 @@ HRESULT WINAPI D3DX11GetImageInfoFromMemory(const void *src_data, SIZE_T src_dat
|
||||
}
|
||||
else
|
||||
{
|
||||
- FIXME("Unsupported image format %d\n", img_info->ImageFileFormat);
|
||||
- img_info->Width = 1;
|
||||
- img_info->Height = 1;
|
||||
+ unsigned int frame_count;
|
||||
+
|
||||
+ hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
|
||||
+ if (FAILED(hr) || !frame_count)
|
||||
+ goto end;
|
||||
+ hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
|
||||
+ if (FAILED(hr))
|
||||
+ goto end;
|
||||
+ hr = IWICBitmapFrameDecode_GetSize(frame, &img_info->Width, &img_info->Height);
|
||||
+ if (FAILED(hr))
|
||||
+ goto end;
|
||||
+
|
||||
img_info->ArraySize = 1;
|
||||
img_info->Depth = 1;
|
||||
img_info->MipLevels = 1;
|
||||
@@ -372,6 +382,8 @@ HRESULT WINAPI D3DX11GetImageInfoFromMemory(const void *src_data, SIZE_T src_dat
|
||||
end:
|
||||
if (dds_decoder)
|
||||
IWICDdsDecoder_Release(dds_decoder);
|
||||
+ if (frame)
|
||||
+ IWICBitmapFrameDecode_Release(frame);
|
||||
if (decoder)
|
||||
IWICBitmapDecoder_Release(decoder);
|
||||
if (stream)
|
||||
--
|
||||
2.40.1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,234 @@
|
||||
From da45b8dd00ab02ba03d8608afdf32085f5d28603 Mon Sep 17 00:00:00 2001
|
||||
From: Connor McAdams <cmcadams@codeweavers.com>
|
||||
Date: Wed, 17 Sep 2025 15:26:50 -0400
|
||||
Subject: [PATCH] d3dx10: Create 3D textures for images representing 3D
|
||||
textures.
|
||||
|
||||
Signed-off-by: Connor McAdams <cmcadams@codeweavers.com>
|
||||
---
|
||||
dlls/d3dx10_43/async.c | 11 +++++-
|
||||
dlls/d3dx10_43/tests/d3dx10.c | 35 ++++++++++++------
|
||||
dlls/d3dx10_43/texture.c | 69 +++++++++++++++++++++++++++--------
|
||||
3 files changed, 86 insertions(+), 29 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3dx10_43/async.c b/dlls/d3dx10_43/async.c
|
||||
index 62627886804..e2cd14a7736 100644
|
||||
--- a/dlls/d3dx10_43/async.c
|
||||
+++ b/dlls/d3dx10_43/async.c
|
||||
@@ -322,6 +322,8 @@ struct texture_processor
|
||||
{
|
||||
ID3DX10DataProcessor ID3DX10DataProcessor_iface;
|
||||
ID3D10Device *device;
|
||||
+ D3DX10_IMAGE_INFO img_info;
|
||||
+ D3DX10_IMAGE_INFO *img_info_out;
|
||||
D3DX10_IMAGE_LOAD_INFO load_info;
|
||||
D3D10_SUBRESOURCE_DATA *resource_data;
|
||||
};
|
||||
@@ -334,6 +336,7 @@ static inline struct texture_processor *texture_processor_from_ID3DX10DataProces
|
||||
static HRESULT WINAPI texture_processor_Process(ID3DX10DataProcessor *iface, void *data, SIZE_T size)
|
||||
{
|
||||
struct texture_processor *processor = texture_processor_from_ID3DX10DataProcessor(iface);
|
||||
+ HRESULT hr;
|
||||
|
||||
TRACE("iface %p, data %p, size %Iu.\n", iface, data, size);
|
||||
|
||||
@@ -343,7 +346,10 @@ static HRESULT WINAPI texture_processor_Process(ID3DX10DataProcessor *iface, voi
|
||||
free(processor->resource_data);
|
||||
processor->resource_data = NULL;
|
||||
}
|
||||
- return load_texture_data(data, size, &processor->load_info, &processor->resource_data);
|
||||
+ hr = load_texture_data(data, size, &processor->load_info, &processor->resource_data);
|
||||
+ if (SUCCEEDED(hr) && processor->img_info_out)
|
||||
+ *processor->img_info_out = processor->img_info;
|
||||
+ return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI texture_processor_CreateDeviceObject(ID3DX10DataProcessor *iface, void **object)
|
||||
@@ -594,7 +600,10 @@ HRESULT WINAPI D3DX10CreateAsyncTextureProcessor(ID3D10Device *device,
|
||||
object->ID3DX10DataProcessor_iface.lpVtbl = &texture_processor_vtbl;
|
||||
object->device = device;
|
||||
ID3D10Device_AddRef(device);
|
||||
+ if (load_info)
|
||||
+ object->img_info_out = load_info->pSrcInfo;
|
||||
init_load_info(load_info, &object->load_info);
|
||||
+ object->load_info.pSrcInfo = &object->img_info;
|
||||
|
||||
*processor = &object->ID3DX10DataProcessor_iface;
|
||||
return S_OK;
|
||||
diff --git a/dlls/d3dx10_43/tests/d3dx10.c b/dlls/d3dx10_43/tests/d3dx10.c
|
||||
index f660b9a2953..818889138a5 100644
|
||||
--- a/dlls/d3dx10_43/tests/d3dx10.c
|
||||
+++ b/dlls/d3dx10_43/tests/d3dx10.c
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "initguid.h"
|
||||
#include "d3d10_1.h"
|
||||
#include "d3dx10.h"
|
||||
+#include "wine/wined3d.h"
|
||||
#include "wine/test.h"
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -69,6 +70,8 @@
|
||||
#define DDS_PF_BUMPLUMINANCE 0x00040000
|
||||
#define DDS_PF_BUMPDUDV 0x00080000
|
||||
|
||||
+static bool wined3d_opengl;
|
||||
+
|
||||
struct dds_pixel_format
|
||||
{
|
||||
DWORD size;
|
||||
@@ -1751,13 +1754,8 @@ static void check_test_image_load_info_resource_(uint32_t line, ID3D10Resource *
|
||||
HRESULT hr;
|
||||
|
||||
ID3D10Resource_GetType(resource, &resource_dimension);
|
||||
- todo_wine_if(image_load_info->expected_type == D3D10_RESOURCE_DIMENSION_TEXTURE3D)
|
||||
- ok(resource_dimension == image_load_info->expected_type, "Got unexpected ResourceDimension %u, expected %u.\n",
|
||||
- resource_dimension, image_load_info->expected_type);
|
||||
-
|
||||
- if (resource_dimension != image_load_info->expected_type)
|
||||
- return;
|
||||
-
|
||||
+ ok(resource_dimension == image_load_info->expected_type, "Got unexpected ResourceDimension %u, expected %u.\n",
|
||||
+ resource_dimension, image_load_info->expected_type);
|
||||
switch (resource_dimension)
|
||||
{
|
||||
case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
|
||||
@@ -1826,10 +1824,9 @@ static void check_resource_info(ID3D10Resource *resource, const struct test_imag
|
||||
}
|
||||
|
||||
ID3D10Resource_GetType(resource, &resource_dimension);
|
||||
- todo_wine_if (image->expected_info.ResourceDimension == D3D10_RESOURCE_DIMENSION_TEXTURE3D)
|
||||
- ok(resource_dimension == image->expected_info.ResourceDimension,
|
||||
- "Got unexpected ResourceDimension %u, expected %u.\n",
|
||||
- resource_dimension, image->expected_info.ResourceDimension);
|
||||
+ ok(resource_dimension == image->expected_info.ResourceDimension,
|
||||
+ "Got unexpected ResourceDimension %u, expected %u.\n",
|
||||
+ resource_dimension, image->expected_info.ResourceDimension);
|
||||
|
||||
switch (resource_dimension)
|
||||
{
|
||||
@@ -2022,7 +2019,10 @@ static void check_resource_data(ID3D10Resource *resource, const struct test_imag
|
||||
|
||||
if (SUCCEEDED(ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture3D, (void **)&texture3d)))
|
||||
{
|
||||
- check_texture3d_data(texture3d, image, line);
|
||||
+ if (wined3d_opengl && is_block_compressed(image->expected_info.Format))
|
||||
+ skip("Skipping compressed format 3D texture readback test.\n");
|
||||
+ else
|
||||
+ check_texture3d_data(texture3d, image, line);
|
||||
ID3D10Texture3D_Release(texture3d);
|
||||
}
|
||||
else if (SUCCEEDED(ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture2D, (void **)&texture2d)))
|
||||
@@ -5992,6 +5992,17 @@ static void test_preprocess_shader(void)
|
||||
|
||||
START_TEST(d3dx10)
|
||||
{
|
||||
+ HMODULE wined3d;
|
||||
+
|
||||
+ if ((wined3d = GetModuleHandleA("wined3d.dll")))
|
||||
+ {
|
||||
+ enum wined3d_renderer (CDECL *p_wined3d_get_renderer)(void);
|
||||
+
|
||||
+ if ((p_wined3d_get_renderer = (void *)GetProcAddress(wined3d, "wined3d_get_renderer"))
|
||||
+ && p_wined3d_get_renderer() == WINED3D_RENDERER_OPENGL)
|
||||
+ wined3d_opengl = true;
|
||||
+ }
|
||||
+
|
||||
test_D3DX10UnsetAllDeviceObjects();
|
||||
test_D3DX10CreateAsyncMemoryLoader();
|
||||
test_D3DX10CreateAsyncFileLoader();
|
||||
diff --git a/dlls/d3dx10_43/texture.c b/dlls/d3dx10_43/texture.c
|
||||
index 4d279bccbd5..a21ce7ff139 100644
|
||||
--- a/dlls/d3dx10_43/texture.c
|
||||
+++ b/dlls/d3dx10_43/texture.c
|
||||
@@ -439,9 +439,12 @@ static HRESULT create_texture(ID3D10Device *device, const void *data, SIZE_T siz
|
||||
{
|
||||
D3D10_SUBRESOURCE_DATA *resource_data;
|
||||
D3DX10_IMAGE_LOAD_INFO load_info_copy;
|
||||
+ D3DX10_IMAGE_INFO img_info;
|
||||
HRESULT hr;
|
||||
|
||||
init_load_info(load_info, &load_info_copy);
|
||||
+ if (!load_info_copy.pSrcInfo)
|
||||
+ load_info_copy.pSrcInfo = &img_info;
|
||||
|
||||
if (FAILED((hr = load_texture_data(data, size, &load_info_copy, &resource_data))))
|
||||
return hr;
|
||||
@@ -774,25 +777,59 @@ end:
|
||||
HRESULT create_d3d_texture(ID3D10Device *device, D3DX10_IMAGE_LOAD_INFO *load_info,
|
||||
D3D10_SUBRESOURCE_DATA *resource_data, ID3D10Resource **texture)
|
||||
{
|
||||
- D3D10_TEXTURE2D_DESC texture_2d_desc;
|
||||
- ID3D10Texture2D *texture_2d;
|
||||
HRESULT hr;
|
||||
|
||||
- memset(&texture_2d_desc, 0, sizeof(texture_2d_desc));
|
||||
- texture_2d_desc.Width = load_info->Width;
|
||||
- texture_2d_desc.Height = load_info->Height;
|
||||
- texture_2d_desc.MipLevels = load_info->MipLevels;
|
||||
- texture_2d_desc.ArraySize = load_info->MiscFlags & D3D10_RESOURCE_MISC_TEXTURECUBE ? 6 : 1;
|
||||
- texture_2d_desc.Format = load_info->Format;
|
||||
- texture_2d_desc.SampleDesc.Count = 1;
|
||||
- texture_2d_desc.Usage = load_info->Usage;
|
||||
- texture_2d_desc.BindFlags = load_info->BindFlags;
|
||||
- texture_2d_desc.MiscFlags = load_info->MiscFlags;
|
||||
-
|
||||
- if (FAILED(hr = ID3D10Device_CreateTexture2D(device, &texture_2d_desc, resource_data, &texture_2d)))
|
||||
- return hr;
|
||||
+ *texture = NULL;
|
||||
+ switch (load_info->pSrcInfo->ResourceDimension)
|
||||
+ {
|
||||
+ case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
|
||||
+ {
|
||||
+ D3D10_TEXTURE2D_DESC texture_2d_desc = { 0 };
|
||||
+ ID3D10Texture2D *texture_2d;
|
||||
+
|
||||
+ texture_2d_desc.Width = load_info->Width;
|
||||
+ texture_2d_desc.Height = load_info->Height;
|
||||
+ texture_2d_desc.MipLevels = load_info->MipLevels;
|
||||
+ texture_2d_desc.ArraySize = load_info->pSrcInfo->ArraySize;
|
||||
+ texture_2d_desc.Format = load_info->Format;
|
||||
+ texture_2d_desc.SampleDesc.Count = 1;
|
||||
+ texture_2d_desc.Usage = load_info->Usage;
|
||||
+ texture_2d_desc.BindFlags = load_info->BindFlags;
|
||||
+ texture_2d_desc.CPUAccessFlags = load_info->CpuAccessFlags;
|
||||
+ texture_2d_desc.MiscFlags = load_info->MiscFlags;
|
||||
+
|
||||
+ if (FAILED(hr = ID3D10Device_CreateTexture2D(device, &texture_2d_desc, resource_data, &texture_2d)))
|
||||
+ return hr;
|
||||
+ *texture = (ID3D10Resource *)texture_2d;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ case D3D10_RESOURCE_DIMENSION_TEXTURE3D:
|
||||
+ {
|
||||
+ D3D10_TEXTURE3D_DESC texture_3d_desc = { 0 };
|
||||
+ ID3D10Texture3D *texture_3d;
|
||||
+
|
||||
+ texture_3d_desc.Width = load_info->Width;
|
||||
+ texture_3d_desc.Height = load_info->Height;
|
||||
+ texture_3d_desc.Depth = load_info->Depth;
|
||||
+ texture_3d_desc.MipLevels = load_info->MipLevels;
|
||||
+ texture_3d_desc.Format = load_info->Format;
|
||||
+ texture_3d_desc.Usage = load_info->Usage;
|
||||
+ texture_3d_desc.BindFlags = load_info->BindFlags;
|
||||
+ texture_3d_desc.CPUAccessFlags = load_info->CpuAccessFlags;
|
||||
+ texture_3d_desc.MiscFlags = load_info->MiscFlags;
|
||||
+
|
||||
+ if (FAILED(hr = ID3D10Device_CreateTexture3D(device, &texture_3d_desc, resource_data, &texture_3d)))
|
||||
+ return hr;
|
||||
+ *texture = (ID3D10Resource *)texture_3d;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ default:
|
||||
+ FIXME("Unhandled resource dimension %d.\n", load_info->pSrcInfo->ResourceDimension);
|
||||
+ return E_NOTIMPL;
|
||||
+ }
|
||||
|
||||
- *texture = (ID3D10Resource *)texture_2d;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
--
|
||||
2.51.0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,2 @@
|
||||
Fixes: [50210] - Implement D3DX11GetImageInfoFromMemory
|
||||
Fixes: [45533] - Implement D3DX11CreateTextureFromMemory
|
||||
|
||||
# This patchset will need to wait until the new wined3dx dll implemented.
|
||||
Disabled: True
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
From 4295a5251ba743d6a7cef9847ba58f6b4b3319c9 Mon Sep 17 00:00:00 2001
|
||||
From: Connor McAdams <cmcadams@codeweavers.com>
|
||||
Date: Thu, 11 Sep 2025 14:42:19 -0400
|
||||
Subject: [PATCH 1/2] d3dx9: Add support for setting vec{2,3} effect parameters
|
||||
in ID3DXEffect::SetRawValue().
|
||||
|
||||
Signed-off-by: Connor McAdams <cmcadams@codeweavers.com>
|
||||
---
|
||||
dlls/d3dx9_36/effect.c | 44 ++++++++++++++++++++++++++++--------
|
||||
dlls/d3dx9_36/tests/effect.c | 3 ---
|
||||
2 files changed, 35 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
|
||||
index 72e216d3fff..500832340d3 100644
|
||||
--- a/dlls/d3dx9_36/effect.c
|
||||
+++ b/dlls/d3dx9_36/effect.c
|
||||
@@ -4456,20 +4456,46 @@ static HRESULT WINAPI d3dx_effect_SetRawValue(ID3DXEffect *iface, D3DXHANDLE par
|
||||
{
|
||||
uint8_t *dst_data;
|
||||
|
||||
- if (param->columns != 4)
|
||||
+ if (param->columns == 4)
|
||||
{
|
||||
- FIXME("Vec%u parameters are currently unsupported.\n", param->columns);
|
||||
- return E_NOTIMPL;
|
||||
- }
|
||||
+ if ((byte_offset + bytes) > param->bytes)
|
||||
+ {
|
||||
+ FIXME("Writing adjacent parameters is currently unsupported.\n");
|
||||
+ return E_NOTIMPL;
|
||||
+ }
|
||||
|
||||
- if ((byte_offset + bytes) > param->bytes)
|
||||
+ dst_data = param_get_data_and_dirtify(effect, param, !byte_offset ? bytes : param->bytes, TRUE);
|
||||
+ memcpy(dst_data + byte_offset, data, bytes);
|
||||
+ }
|
||||
+ else
|
||||
{
|
||||
- FIXME("Writing adjacent parameters is currently unsupported.\n");
|
||||
- return E_NOTIMPL;
|
||||
+ unsigned int src_elems = (bytes + 0xf) / sizeof(D3DXVECTOR4);
|
||||
+ unsigned int dst_stride = sizeof(float) * param->columns;
|
||||
+ unsigned int dst_elems = max(1, param->element_count);
|
||||
+ const D3DXVECTOR4 *src_data = data;
|
||||
+ unsigned int i, bytes_left;
|
||||
+
|
||||
+ if (byte_offset)
|
||||
+ {
|
||||
+ FIXME("Setting Vec%u parameters with an offset is currently unsupported.\n", param->columns);
|
||||
+ return E_NOTIMPL;
|
||||
+ }
|
||||
+
|
||||
+ if (src_elems > dst_elems)
|
||||
+ {
|
||||
+ FIXME("Writing adjacent parameters is currently unsupported.\n");
|
||||
+ return E_NOTIMPL;
|
||||
+ }
|
||||
+
|
||||
+ bytes_left = bytes;
|
||||
+ dst_data = param_get_data_and_dirtify(effect, param, dst_elems * dst_stride, TRUE);
|
||||
+ for (i = 0; i < src_elems; ++i)
|
||||
+ {
|
||||
+ memcpy(dst_data + (i * dst_stride), &src_data[i], min(bytes_left, dst_stride));
|
||||
+ bytes_left -= sizeof(*src_data);
|
||||
+ }
|
||||
}
|
||||
|
||||
- dst_data = param_get_data_and_dirtify(effect, param, !byte_offset ? bytes : param->bytes, TRUE);
|
||||
- memcpy(dst_data + byte_offset, data, bytes);
|
||||
break;
|
||||
}
|
||||
|
||||
diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c
|
||||
index 2b9f607b045..1be4a28777b 100644
|
||||
--- a/dlls/d3dx9_36/tests/effect.c
|
||||
+++ b/dlls/d3dx9_36/tests/effect.c
|
||||
@@ -9068,17 +9068,14 @@ static void test_effect_set_raw_value(IDirect3DDevice9 *device)
|
||||
{ "2", 0, 8,
|
||||
{ .f = { 0.0f, 1.0f } },
|
||||
{ .f = { 0.0f, 1.0f } },
|
||||
- .todo_hr = TRUE
|
||||
},
|
||||
{ "2_2", 0, 16,
|
||||
{ .f = { 0.0f, 1.0f, 0.0f, 2.0f } },
|
||||
{ .f = { 0.0f, 1.0f, 0.0f, 0.0f } },
|
||||
- .todo_hr = TRUE
|
||||
},
|
||||
{ "2_2", 0, 24,
|
||||
{ .f = { 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 0.0f } },
|
||||
{ .f = { 0.0f, 1.0f, 4.0f, 0.0f } },
|
||||
- .todo_hr = TRUE
|
||||
},
|
||||
{ "4", 0, 16,
|
||||
{ .f = { 1.0f, 2.0f, 0.0f, 3.0f } },
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
From b3fa43c5d012f89417a31b15bc3f88fe10fbf429 Mon Sep 17 00:00:00 2001
|
||||
From: Connor McAdams <cmcadams@codeweavers.com>
|
||||
Date: Fri, 19 Sep 2025 13:58:15 -0400
|
||||
Subject: [PATCH 2/2] d3dx9: Add partial support for setting D3DXPC_STRUCT
|
||||
parameters in ID3DXEffect::SetRawValue().
|
||||
|
||||
Signed-off-by: Connor McAdams <cmcadams@codeweavers.com>
|
||||
---
|
||||
dlls/d3dx9_36/effect.c | 48 ++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 48 insertions(+)
|
||||
|
||||
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
|
||||
index 500832340d3..119f280e1a8 100644
|
||||
--- a/dlls/d3dx9_36/effect.c
|
||||
+++ b/dlls/d3dx9_36/effect.c
|
||||
@@ -4530,6 +4530,54 @@ static HRESULT WINAPI d3dx_effect_SetRawValue(ID3DXEffect *iface, D3DXHANDLE par
|
||||
break;
|
||||
}
|
||||
|
||||
+ case D3DXPC_STRUCT:
|
||||
+ {
|
||||
+ const uint8_t *cur_param_data = data;
|
||||
+ UINT bytes_left = bytes;
|
||||
+ unsigned int i;
|
||||
+ HRESULT hr;
|
||||
+
|
||||
+ if (byte_offset)
|
||||
+ {
|
||||
+ FIXME("Setting structure members at an offset is currently unsupported.\n");
|
||||
+ return E_NOTIMPL;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < param->member_count; ++i)
|
||||
+ {
|
||||
+ UINT member_size = param->members[i].class == D3DXPC_MATRIX_ROWS ? 64 : 16;
|
||||
+ unsigned int member_elems = max(1, param->members[i].element_count);
|
||||
+ struct d3dx_parameter *member = ¶m->members[i];
|
||||
+
|
||||
+ if (member->class != D3DXPC_MATRIX_ROWS && member->class != D3DXPC_VECTOR)
|
||||
+ {
|
||||
+ FIXME("Unhandled structure member parameter class %s.\n", debug_d3dxparameter_class(member->class));
|
||||
+ return E_NOTIMPL;
|
||||
+ }
|
||||
+
|
||||
+ member_size *= member_elems;
|
||||
+ hr = iface->lpVtbl->SetRawValue(iface, (D3DXHANDLE)member, (const void *)cur_param_data, 0,
|
||||
+ min(member_size, bytes_left));
|
||||
+ if (FAILED(hr))
|
||||
+ {
|
||||
+ WARN("Failed with hr %#lx.\n", hr);
|
||||
+ return hr;
|
||||
+ }
|
||||
+
|
||||
+ if (bytes_left <= member_size)
|
||||
+ {
|
||||
+ bytes_left = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+ cur_param_data += member_size;
|
||||
+ bytes_left -= member_size;
|
||||
+ }
|
||||
+
|
||||
+ if (bytes_left)
|
||||
+ FIXME("%u bytes were leftover, might have attempted to write an adjacent parameter.\n", bytes_left);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
default:
|
||||
FIXME("Unhandled parameter class %s.\n", debug_d3dxparameter_class(param->class));
|
||||
return E_NOTIMPL;
|
||||
--
|
||||
2.51.0
|
||||
|
||||
1
patches/d3dx9-setrawvalue/definition
Normal file
1
patches/d3dx9-setrawvalue/definition
Normal file
@@ -0,0 +1 @@
|
||||
Fixes: [48598] d3dx9: Improve Rendering in MudRunner.
|
||||
@@ -1,220 +0,0 @@
|
||||
From 7ba5e4a89be15deeb704078ad8321c7cc5aa02eb Mon Sep 17 00:00:00 2001
|
||||
From: Christian Costa <titan.costa@gmail.com>
|
||||
Date: Mon, 22 Jul 2013 21:51:20 +0200
|
||||
Subject: [PATCH] d3dx9_36: Implement ID3DXSkinInfoImpl_UpdateSkinnedMesh.
|
||||
|
||||
This patch fixes last problem of bug 32572.
|
||||
---
|
||||
dlls/d3dx9_36/skin.c | 86 ++++++++++++++++++++++++++++++++++++--
|
||||
dlls/d3dx9_36/tests/mesh.c | 83 ++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 166 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3dx9_36/skin.c b/dlls/d3dx9_36/skin.c
|
||||
index b81fb6863d3..75ee6d44a95 100644
|
||||
--- a/dlls/d3dx9_36/skin.c
|
||||
+++ b/dlls/d3dx9_36/skin.c
|
||||
@@ -2,6 +2,7 @@
|
||||
* Skin Info operations specific to D3DX9.
|
||||
*
|
||||
* Copyright (C) 2011 Dylan Smith
|
||||
+ * Copyright (C) 2013 Christian Costa
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -399,10 +400,89 @@ static HRESULT WINAPI d3dx9_skin_info_GetDeclaration(ID3DXSkinInfo *iface,
|
||||
static HRESULT WINAPI d3dx9_skin_info_UpdateSkinnedMesh(ID3DXSkinInfo *iface, const D3DXMATRIX *bone_transforms,
|
||||
const D3DXMATRIX *bone_inv_transpose_transforms, const void *src_vertices, void *dst_vertices)
|
||||
{
|
||||
- FIXME("iface %p, bone_transforms %p, bone_inv_transpose_transforms %p, src_vertices %p, dst_vertices %p stub!\n",
|
||||
- iface, bone_transforms, bone_inv_transpose_transforms, src_vertices, dst_vertices);
|
||||
+ struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
|
||||
+ DWORD size = D3DXGetFVFVertexSize(skin->fvf);
|
||||
+ DWORD i, j;
|
||||
|
||||
- return E_NOTIMPL;
|
||||
+ TRACE("iface %p, bone_transforms %p, bone_inv_transpose_transforms %p, src_vertices %p, dst_vertices %p\n",
|
||||
+ skin, bone_transforms, bone_inv_transpose_transforms, src_vertices, dst_vertices);
|
||||
+
|
||||
+ if (bone_inv_transpose_transforms)
|
||||
+ FIXME("Skinning vertices with two position elements not supported\n");
|
||||
+
|
||||
+ if ((skin->fvf & D3DFVF_POSITION_MASK) != D3DFVF_XYZ) {
|
||||
+ FIXME("Vertex type %#lx not supported\n", skin->fvf & D3DFVF_POSITION_MASK);
|
||||
+ return E_FAIL;
|
||||
+ }
|
||||
+
|
||||
+ /* Reset all positions */
|
||||
+ for (i = 0; i < skin->num_vertices; i++) {
|
||||
+ D3DXVECTOR3 *position = (D3DXVECTOR3*)((BYTE*)dst_vertices + size * i);
|
||||
+ position->x = 0.0f;
|
||||
+ position->y = 0.0f;
|
||||
+ position->z = 0.0f;
|
||||
+ }
|
||||
+
|
||||
+ /* Update positions that are influenced by bones */
|
||||
+ for (i = 0; i < skin->num_bones; i++) {
|
||||
+ D3DXMATRIX bone_inverse, matrix;
|
||||
+
|
||||
+ D3DXMatrixInverse(&bone_inverse, NULL, &skin->bones[i].transform);
|
||||
+ D3DXMatrixMultiply(&matrix, &bone_transforms[i], &bone_inverse);
|
||||
+ D3DXMatrixMultiply(&matrix, &matrix, &skin->bones[i].transform);
|
||||
+
|
||||
+ for (j = 0; j < skin->bones[i].num_influences; j++) {
|
||||
+ D3DXVECTOR3 position;
|
||||
+ D3DXVECTOR3 *position_src = (D3DXVECTOR3*)((BYTE*)src_vertices + size * skin->bones[i].vertices[j]);
|
||||
+ D3DXVECTOR3 *position_dest = (D3DXVECTOR3*)((BYTE*)dst_vertices + size * skin->bones[i].vertices[j]);
|
||||
+ FLOAT weight = skin->bones[i].weights[j];
|
||||
+
|
||||
+ D3DXVec3TransformCoord(&position, position_src, &matrix);
|
||||
+ position_dest->x += weight * position.x;
|
||||
+ position_dest->y += weight * position.y;
|
||||
+ position_dest->z += weight * position.z;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (skin->fvf & D3DFVF_NORMAL) {
|
||||
+ /* Reset all normals */
|
||||
+ for (i = 0; i < skin->num_vertices; i++) {
|
||||
+ D3DXVECTOR3 *normal = (D3DXVECTOR3*)((BYTE*)dst_vertices + size * i + sizeof(D3DXVECTOR3));
|
||||
+ normal->x = 0.0f;
|
||||
+ normal->y = 0.0f;
|
||||
+ normal->z = 0.0f;
|
||||
+ }
|
||||
+
|
||||
+ /* Update normals that are influenced by bones */
|
||||
+ for (i = 0; i < skin->num_bones; i++) {
|
||||
+ D3DXMATRIX bone_inverse, matrix;
|
||||
+
|
||||
+ D3DXMatrixInverse(&bone_inverse, NULL, &skin->bones[i].transform);
|
||||
+ D3DXMatrixMultiply(&matrix, &skin->bones[i].transform, &bone_transforms[i]);
|
||||
+
|
||||
+ for (j = 0; j < skin->bones[i].num_influences; j++) {
|
||||
+ D3DXVECTOR3 normal;
|
||||
+ D3DXVECTOR3 *normal_src = (D3DXVECTOR3*)((BYTE*)src_vertices + size * skin->bones[i].vertices[j] + sizeof(D3DXVECTOR3));
|
||||
+ D3DXVECTOR3 *normal_dest = (D3DXVECTOR3*)((BYTE*)dst_vertices + size * skin->bones[i].vertices[j] + sizeof(D3DXVECTOR3));
|
||||
+ FLOAT weight = skin->bones[i].weights[j];
|
||||
+
|
||||
+ D3DXVec3TransformNormal(&normal, normal_src, &bone_inverse);
|
||||
+ D3DXVec3TransformNormal(&normal, &normal, &matrix);
|
||||
+ normal_dest->x += weight * normal.x;
|
||||
+ normal_dest->y += weight * normal.y;
|
||||
+ normal_dest->z += weight * normal.z;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Normalize all normals that are influenced by bones*/
|
||||
+ for (i = 0; i < skin->num_vertices; i++) {
|
||||
+ D3DXVECTOR3 *normal_dest = (D3DXVECTOR3*)((BYTE*)dst_vertices + (i * size) + sizeof(D3DXVECTOR3));
|
||||
+ if ((normal_dest->x != 0.0f) && (normal_dest->y != 0.0f) && (normal_dest->z != 0.0f))
|
||||
+ D3DXVec3Normalize(normal_dest, normal_dest);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return D3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3dx9_skin_info_ConvertToBlendedMesh(ID3DXSkinInfo *iface, ID3DXMesh *mesh_in,
|
||||
diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c
|
||||
index 1daec158a5f..64b02276843 100644
|
||||
--- a/dlls/d3dx9_36/tests/mesh.c
|
||||
+++ b/dlls/d3dx9_36/tests/mesh.c
|
||||
@@ -5241,6 +5241,88 @@ static void test_create_skin_info(void)
|
||||
ok(hr == D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, got %#lx\n", hr);
|
||||
}
|
||||
|
||||
+static void test_update_skinned_mesh(void)
|
||||
+{
|
||||
+ static DWORD bone0_vertices[2] = { 1, 3 };
|
||||
+ static FLOAT bone0_weights[2] = { 1.0f, 0.5f };
|
||||
+ static DWORD bone1_vertices[2] = { 2, 3 };
|
||||
+ static FLOAT bone1_weights[2] = { 1.0f, 0.5f };
|
||||
+ static D3DMATRIX bones_matrix[2] =
|
||||
+ { { { {
|
||||
+ 1.0f, 0.0f, 0.0f, 0.0f,
|
||||
+ 0.0f, 1.0f, 0.0f, 0.0f,
|
||||
+ 0.0f, 0.0f, 1.0f, 0.0f,
|
||||
+ 2.0f, 2.0f, 4.0f, 1.0f
|
||||
+ } } },
|
||||
+ { { {
|
||||
+ 1.0f, 0.0f, 0.0f, 0.0f,
|
||||
+ 0.0f, 1.0f, 0.0f, 0.0f,
|
||||
+ 0.0f, 0.0f, 1.0f, 0.0f,
|
||||
+ -4.0f, -4.0f, 4.0f, 1.0f
|
||||
+ } } } };
|
||||
+ static D3DVECTOR vertices_src[] = {{ 1.0f, 1.0f, 1.0f },
|
||||
+ { 1.0f, 0.0f, 0.0f },
|
||||
+ { 1.0f, 1.0f, -1.0f },
|
||||
+ { 0.0f, 1.0f, 0.0f },
|
||||
+ { -1.0f, -1.0f, 1.0f },
|
||||
+ { 0.0f, 0.0f, 1.0f },
|
||||
+ { -1.0f, -1.0f, -1.0f },
|
||||
+ { -1.0f, 0.0f, 0.0f },
|
||||
+ };
|
||||
+ static D3DVECTOR vertices_ref[] = {{ 0.0f, 0.0f, 0.0f },
|
||||
+ { 0.0f, 0.0f, 0.0f },
|
||||
+ { 3.0f, 3.0f, 3.0f },
|
||||
+ { 0.0f, 1.0f, 0.0f },
|
||||
+ { -5.0f, -5.0f, 5.0f },
|
||||
+ { 0.0f, 0.0f, 1.0f },
|
||||
+ { -2.0f, -2.0f, 3.0f },
|
||||
+ { -1.0f, 0.0f, 0.0f },
|
||||
+ };
|
||||
+ D3DVECTOR vertices_dest[8];
|
||||
+ HRESULT hr;
|
||||
+ ID3DXSkinInfo *skin_info;
|
||||
+ D3DXMATRIX matrix;
|
||||
+ int i;
|
||||
+
|
||||
+ D3DXMatrixIdentity(&matrix);
|
||||
+ for (i = 0; i < 8; i++)
|
||||
+ {
|
||||
+ vertices_dest[i].x = 10000.0f;
|
||||
+ vertices_dest[i].y = 10000.0f;
|
||||
+ vertices_dest[i].z = 10000.0f;
|
||||
+ }
|
||||
+
|
||||
+ hr = D3DXCreateSkinInfoFVF(4, D3DFVF_XYZ | D3DFVF_NORMAL, 2, &skin_info);
|
||||
+ ok(hr == D3D_OK, "Expected D3D_OK, got %#lx\n", hr);
|
||||
+
|
||||
+ skin_info->lpVtbl->SetBoneInfluence(skin_info, 0, 2, bone0_vertices, bone0_weights);
|
||||
+ ok(hr == D3D_OK, "Expected D3D_OK, got %#lx\n", hr);
|
||||
+ skin_info->lpVtbl->SetBoneOffsetMatrix(skin_info, 0, &matrix);
|
||||
+ ok(hr == D3D_OK, "Expected D3D_OK, got %#lx\n", hr);
|
||||
+ skin_info->lpVtbl->SetBoneInfluence(skin_info, 1, 2, bone1_vertices, bone1_weights);
|
||||
+ ok(hr == D3D_OK, "Expected D3D_OK, got %#lx\n", hr);
|
||||
+ skin_info->lpVtbl->SetBoneOffsetMatrix(skin_info, 1, &matrix);
|
||||
+ ok(hr == D3D_OK, "Expected D3D_OK, got %#lx\n", hr);
|
||||
+ skin_info->lpVtbl->UpdateSkinnedMesh(skin_info, bones_matrix, NULL, vertices_src, vertices_dest);
|
||||
+ ok(hr == D3D_OK, "Expected D3D_OK, got %#lx\n", hr);
|
||||
+ for (i = 0; i < 4; i++)
|
||||
+ {
|
||||
+ ok(compare(vertices_dest[i*2].x, vertices_ref[i*2].x), "Vertex[%d].position.x: got %g, expected %g\n",
|
||||
+ i, vertices_dest[i*2].x, vertices_ref[i*2].x);
|
||||
+ ok(compare(vertices_dest[i*2].y, vertices_ref[i*2].y), "Vertex[%d].position.y: got %g, expected %g\n",
|
||||
+ i, vertices_dest[i*2].y, vertices_ref[i*2].y);
|
||||
+ ok(compare(vertices_dest[i*2].z, vertices_ref[i*2].z), "Vertex[%d].position.z: got %g, expected %g\n",
|
||||
+ i, vertices_dest[i*2].z, vertices_ref[i*2].z);
|
||||
+ ok(compare(vertices_dest[i*2+1].x, vertices_ref[i*2+1].x), "Vertex[%d].normal.x: got %g, expected %g\n",
|
||||
+ i, vertices_dest[i*2+1].x, vertices_ref[i*2+1].x);
|
||||
+ ok(compare(vertices_dest[i*2+1].y, vertices_ref[i*2+1].y), "Vertex[%d].normal.y: got %g, expected %g\n",
|
||||
+ i, vertices_dest[i*2+1].y, vertices_ref[i*2+1].y);
|
||||
+ ok(compare(vertices_dest[i*2+1].z, vertices_ref[i*2+1].z), "Vertex[%d].normal.z: got %g, expected %g\n",
|
||||
+ i, vertices_dest[i*2+1].z, vertices_ref[i*2+1].z);
|
||||
+ }
|
||||
+ skin_info->lpVtbl->Release(skin_info);
|
||||
+}
|
||||
+
|
||||
static void test_convert_adjacency_to_point_reps(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
@@ -11484,6 +11566,7 @@ START_TEST(mesh)
|
||||
D3DXGenerateAdjacencyTest();
|
||||
test_update_semantics();
|
||||
test_create_skin_info();
|
||||
+ test_update_skinned_mesh();
|
||||
test_convert_adjacency_to_point_reps();
|
||||
test_convert_point_reps_to_adjacency();
|
||||
test_weld_vertices();
|
||||
--
|
||||
2.38.1
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
Fixes: [32572] Support for ID3DXSkinInfoImpl_UpdateSkinnedMesh
|
||||
@@ -0,0 +1,93 @@
|
||||
From 78fcd523dff585ce007405bd75d459aa2c4fb13a Mon Sep 17 00:00:00 2001
|
||||
From: Connor McAdams <cmcadams@codeweavers.com>
|
||||
Date: Wed, 3 Sep 2025 13:04:51 -0400
|
||||
Subject: [PATCH] d3dx9: Implement
|
||||
ID3DXAnimationController::RegisterAnimationSet().
|
||||
|
||||
Signed-off-by: Connor McAdams <cmcadams@codeweavers.com>
|
||||
---
|
||||
dlls/d3dx9_36/animation.c | 34 ++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 32 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3dx9_36/animation.c b/dlls/d3dx9_36/animation.c
|
||||
index 8a38c05ed0c..1bb775bc44a 100644
|
||||
--- a/dlls/d3dx9_36/animation.c
|
||||
+++ b/dlls/d3dx9_36/animation.c
|
||||
@@ -29,8 +29,13 @@ struct d3dx9_animation_controller
|
||||
LONG ref;
|
||||
|
||||
UINT max_outputs;
|
||||
+
|
||||
+ ID3DXAnimationSet **animation_sets;
|
||||
+ UINT num_sets;
|
||||
UINT max_sets;
|
||||
+
|
||||
UINT max_tracks;
|
||||
+
|
||||
UINT max_events;
|
||||
};
|
||||
|
||||
@@ -75,6 +80,14 @@ static ULONG WINAPI d3dx9_animation_controller_Release(ID3DXAnimationController
|
||||
|
||||
if (!refcount)
|
||||
{
|
||||
+ unsigned int i;
|
||||
+
|
||||
+ for (i = 0; i < animation->max_sets; i++)
|
||||
+ {
|
||||
+ if (animation->animation_sets[i])
|
||||
+ animation->animation_sets[i]->lpVtbl->Release(animation->animation_sets[i]);
|
||||
+ }
|
||||
+ free(animation->animation_sets);
|
||||
free(animation);
|
||||
}
|
||||
|
||||
@@ -129,9 +142,17 @@ static HRESULT WINAPI d3dx9_animation_controller_RegisterAnimationOutput(ID3DXAn
|
||||
static HRESULT WINAPI d3dx9_animation_controller_RegisterAnimationSet(ID3DXAnimationController *iface,
|
||||
ID3DXAnimationSet *anim_set)
|
||||
{
|
||||
+ struct d3dx9_animation_controller *animation = impl_from_ID3DXAnimationController(iface);
|
||||
+
|
||||
FIXME("iface %p, anim_set %p stub.\n", iface, anim_set);
|
||||
|
||||
- return E_NOTIMPL;
|
||||
+ if (!anim_set || animation->num_sets >= animation->max_sets)
|
||||
+ return D3DERR_INVALIDCALL;
|
||||
+
|
||||
+ animation->animation_sets[animation->num_sets++] = anim_set;
|
||||
+ anim_set->lpVtbl->AddRef(anim_set);
|
||||
+
|
||||
+ return D3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3dx9_animation_controller_UnregisterAnimationSet(ID3DXAnimationController *iface,
|
||||
@@ -144,9 +165,11 @@ static HRESULT WINAPI d3dx9_animation_controller_UnregisterAnimationSet(ID3DXAni
|
||||
|
||||
static UINT WINAPI d3dx9_animation_controller_GetNumAnimationSets(ID3DXAnimationController *iface)
|
||||
{
|
||||
+ struct d3dx9_animation_controller *animation = impl_from_ID3DXAnimationController(iface);
|
||||
+
|
||||
FIXME("iface %p stub.\n", iface);
|
||||
|
||||
- return 0;
|
||||
+ return animation->num_sets;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3dx9_animation_controller_GetAnimationSet(ID3DXAnimationController *iface,
|
||||
@@ -459,6 +482,13 @@ HRESULT WINAPI D3DXCreateAnimationController(UINT max_outputs, UINT max_sets,
|
||||
object->ID3DXAnimationController_iface.lpVtbl = &d3dx9_animation_controller_vtbl;
|
||||
object->ref = 1;
|
||||
object->max_outputs = max_outputs;
|
||||
+
|
||||
+ object->animation_sets = calloc(max_sets, sizeof(*object->animation_sets));
|
||||
+ if (!object->animation_sets)
|
||||
+ {
|
||||
+ free(object);
|
||||
+ return E_OUTOFMEMORY;
|
||||
+ }
|
||||
object->max_sets = max_sets;
|
||||
object->max_tracks = max_tracks;
|
||||
object->max_events = max_events;
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
From ee45504fb838a5e7bfeec350c6a7c5a318400c68 Mon Sep 17 00:00:00 2001
|
||||
From: Connor McAdams <cmcadams@codeweavers.com>
|
||||
Date: Wed, 3 Sep 2025 13:31:04 -0400
|
||||
Subject: [PATCH] d3dx9: Implement
|
||||
ID3DXAnimationController::{Get,Set}TrackDesc().
|
||||
|
||||
Signed-off-by: Connor McAdams <cmcadams@codeweavers.com>
|
||||
---
|
||||
dlls/d3dx9_36/animation.c | 30 ++++++++++++++++++++++++++++--
|
||||
1 file changed, 28 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3dx9_36/animation.c b/dlls/d3dx9_36/animation.c
|
||||
index 1bb775bc44a..6ded652930a 100644
|
||||
--- a/dlls/d3dx9_36/animation.c
|
||||
+++ b/dlls/d3dx9_36/animation.c
|
||||
@@ -23,6 +23,11 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
|
||||
|
||||
+struct d3dx9_track
|
||||
+{
|
||||
+ D3DXTRACK_DESC desc;
|
||||
+};
|
||||
+
|
||||
struct d3dx9_animation_controller
|
||||
{
|
||||
ID3DXAnimationController ID3DXAnimationController_iface;
|
||||
@@ -34,6 +39,7 @@ struct d3dx9_animation_controller
|
||||
UINT num_sets;
|
||||
UINT max_sets;
|
||||
|
||||
+ struct d3dx9_track *tracks;
|
||||
UINT max_tracks;
|
||||
|
||||
UINT max_events;
|
||||
@@ -269,17 +275,29 @@ static HRESULT WINAPI d3dx9_animation_controller_SetTrackEnable(ID3DXAnimationCo
|
||||
static HRESULT WINAPI d3dx9_animation_controller_SetTrackDesc(ID3DXAnimationController *iface,
|
||||
UINT track, D3DXTRACK_DESC *desc)
|
||||
{
|
||||
+ struct d3dx9_animation_controller *animation = impl_from_ID3DXAnimationController(iface);
|
||||
+
|
||||
FIXME("iface %p, track %u, desc %p stub.\n", iface, track, desc);
|
||||
|
||||
- return E_NOTIMPL;
|
||||
+ if (track > animation->max_tracks || !desc)
|
||||
+ return D3DERR_INVALIDCALL;
|
||||
+
|
||||
+ animation->tracks[track].desc = *desc;
|
||||
+ return D3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3dx9_animation_controller_GetTrackDesc(ID3DXAnimationController *iface,
|
||||
UINT track, D3DXTRACK_DESC *desc)
|
||||
{
|
||||
+ struct d3dx9_animation_controller *animation = impl_from_ID3DXAnimationController(iface);
|
||||
+
|
||||
FIXME("iface %p, track %u, desc %p stub.\n", iface, track, desc);
|
||||
|
||||
- return E_NOTIMPL;
|
||||
+ if (track > animation->max_tracks || !desc)
|
||||
+ return D3DERR_INVALIDCALL;
|
||||
+
|
||||
+ *desc = animation->tracks[track].desc;
|
||||
+ return D3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3dx9_animation_controller_SetPriorityBlend(ID3DXAnimationController *iface,
|
||||
@@ -490,6 +508,14 @@ HRESULT WINAPI D3DXCreateAnimationController(UINT max_outputs, UINT max_sets,
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
object->max_sets = max_sets;
|
||||
+
|
||||
+ object->tracks = calloc(max_tracks, sizeof(*object->tracks));
|
||||
+ if (!object->tracks)
|
||||
+ {
|
||||
+ free(object->animation_sets);
|
||||
+ free(object);
|
||||
+ return E_OUTOFMEMORY;
|
||||
+ }
|
||||
object->max_tracks = max_tracks;
|
||||
object->max_events = max_events;
|
||||
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
From fa933a9493c8b4a2e9626c1815bb5ef4309627b4 Mon Sep 17 00:00:00 2001
|
||||
From: Connor McAdams <cmcadams@codeweavers.com>
|
||||
Date: Wed, 3 Sep 2025 13:33:16 -0400
|
||||
Subject: [PATCH] d3dx9: Implement
|
||||
ID3DXAnimationController::{Get,Set}TrackAnimationSet().
|
||||
|
||||
Signed-off-by: Connor McAdams <cmcadams@codeweavers.com>
|
||||
---
|
||||
dlls/d3dx9_36/animation.c | 38 ++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 36 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3dx9_36/animation.c b/dlls/d3dx9_36/animation.c
|
||||
index 6ded652930a..ccd16778c3e 100644
|
||||
--- a/dlls/d3dx9_36/animation.c
|
||||
+++ b/dlls/d3dx9_36/animation.c
|
||||
@@ -26,6 +26,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
|
||||
struct d3dx9_track
|
||||
{
|
||||
D3DXTRACK_DESC desc;
|
||||
+ int set_idx;
|
||||
};
|
||||
|
||||
struct d3dx9_animation_controller
|
||||
@@ -219,17 +220,47 @@ static double WINAPI d3dx9_animation_controller_GetTime(ID3DXAnimationController
|
||||
static HRESULT WINAPI d3dx9_animation_controller_SetTrackAnimationSet(ID3DXAnimationController *iface,
|
||||
UINT track, ID3DXAnimationSet *anim_set)
|
||||
{
|
||||
+ struct d3dx9_animation_controller *animation = impl_from_ID3DXAnimationController(iface);
|
||||
+ unsigned int i;
|
||||
+ int idx;
|
||||
+
|
||||
FIXME("iface %p, track %u, anim_set %p stub.\n", iface, track, anim_set);
|
||||
|
||||
- return E_NOTIMPL;
|
||||
+ if (track > animation->max_tracks || !anim_set || (animation->tracks[track].set_idx >= 0))
|
||||
+ return D3DERR_INVALIDCALL;
|
||||
+
|
||||
+ idx = -1;
|
||||
+ for (i = 0; i < animation->num_sets; i++)
|
||||
+ {
|
||||
+ if (animation->animation_sets[i] == anim_set)
|
||||
+ {
|
||||
+ idx = i;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ animation->tracks[track].set_idx = idx;
|
||||
+
|
||||
+ return idx >= 0 ? D3D_OK : D3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3dx9_animation_controller_GetTrackAnimationSet(ID3DXAnimationController *iface,
|
||||
UINT track, ID3DXAnimationSet **anim_set)
|
||||
{
|
||||
+ struct d3dx9_animation_controller *animation = impl_from_ID3DXAnimationController(iface);
|
||||
+ int set_idx;
|
||||
+
|
||||
FIXME("iface %p, track %u, anim_set %p stub.\n", iface, track, anim_set);
|
||||
|
||||
- return E_NOTIMPL;
|
||||
+ if (track > animation->max_tracks || !anim_set)
|
||||
+ return D3DERR_INVALIDCALL;
|
||||
+
|
||||
+ set_idx = animation->tracks[track].set_idx;
|
||||
+ *anim_set = set_idx >= 0 ? animation->animation_sets[set_idx] : NULL;
|
||||
+
|
||||
+ if (*anim_set)
|
||||
+ (*anim_set)->lpVtbl->AddRef(*anim_set);
|
||||
+ return D3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3dx9_animation_controller_SetTrackPriority(ID3DXAnimationController *iface,
|
||||
@@ -486,6 +517,7 @@ HRESULT WINAPI D3DXCreateAnimationController(UINT max_outputs, UINT max_sets,
|
||||
UINT max_tracks, UINT max_events, ID3DXAnimationController **controller)
|
||||
{
|
||||
struct d3dx9_animation_controller *object;
|
||||
+ unsigned int i;
|
||||
|
||||
TRACE("max_outputs %u, max_sets %u, max_tracks %u, max_events %u, controller %p.\n",
|
||||
max_outputs, max_sets, max_tracks, max_events, controller);
|
||||
@@ -516,6 +548,8 @@ HRESULT WINAPI D3DXCreateAnimationController(UINT max_outputs, UINT max_sets,
|
||||
free(object);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
+ for (i = 0; i < max_tracks; ++i)
|
||||
+ object->tracks[i].set_idx = -1;
|
||||
object->max_tracks = max_tracks;
|
||||
object->max_events = max_events;
|
||||
|
||||
--
|
||||
2.50.1
|
||||
|
||||
1
patches/d3dx9_animation_TrackDesc/definition
Normal file
1
patches/d3dx9_animation_TrackDesc/definition
Normal file
@@ -0,0 +1 @@
|
||||
Fixes: [48598] d3dx9: Improve ID3DXAnimationController Animation set support.
|
||||
@@ -1,54 +0,0 @@
|
||||
From 826f68ed53563b81d225b49131bbd3595c6d885b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sun, 6 Sep 2015 20:21:42 +0200
|
||||
Subject: [PATCH] ddraw: Set dwZBufferBitDepth in ddraw7_GetCaps.
|
||||
|
||||
---
|
||||
dlls/ddraw/ddraw.c | 24 ++++++++++++++++++++++++
|
||||
1 file changed, 24 insertions(+)
|
||||
|
||||
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
|
||||
index 8d608656143..cc8adccf049 100644
|
||||
--- a/dlls/ddraw/ddraw.c
|
||||
+++ b/dlls/ddraw/ddraw.c
|
||||
@@ -1434,6 +1434,28 @@ HRESULT ddraw_get_d3dcaps(const struct ddraw *ddraw, D3DDEVICEDESC7 *caps)
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
+HRESULT CALLBACK enum_zbuffer(DDPIXELFORMAT *format, void *ctx)
|
||||
+{
|
||||
+ DDCAPS *caps = ctx;
|
||||
+
|
||||
+ switch (format->dwZBufferBitDepth)
|
||||
+ {
|
||||
+ case 8:
|
||||
+ caps->dwZBufferBitDepths |= DDBD_8;
|
||||
+ break;
|
||||
+ case 16:
|
||||
+ caps->dwZBufferBitDepths |= DDBD_16;
|
||||
+ break;
|
||||
+ case 24:
|
||||
+ caps->dwZBufferBitDepths |= DDBD_24;
|
||||
+ break;
|
||||
+ case 32:
|
||||
+ caps->dwZBufferBitDepths |= DDBD_32;
|
||||
+ break;
|
||||
+ }
|
||||
+ return D3DENUMRET_OK;
|
||||
+}
|
||||
+
|
||||
/*****************************************************************************
|
||||
* IDirectDraw7::GetCaps
|
||||
*
|
||||
@@ -1514,6 +1536,8 @@ static HRESULT WINAPI ddraw7_GetCaps(IDirectDraw7 *iface, DDCAPS *DriverCaps, DD
|
||||
caps.dwCaps |= DDCAPS_ALIGNSTRIDE;
|
||||
caps.dwAlignStrideAlign = DDRAW_STRIDE_ALIGNMENT;
|
||||
|
||||
+ IDirect3D7_EnumZBufferFormats(&ddraw->IDirect3D7_iface, &IID_IDirect3DHALDevice, enum_zbuffer, &caps);
|
||||
+
|
||||
caps.ddsOldCaps.dwCaps = caps.ddsCaps.dwCaps;
|
||||
|
||||
if(DriverCaps)
|
||||
--
|
||||
2.20.1
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
Fixes: [37019] Don't set HWTRANSFORMANDLIGHT flag on d3d7 RGB device
|
||||
Fixes: [27002] Properly initialize caps->dwZBufferBitDepths in ddraw7_GetCaps
|
||||
@@ -7,4 +7,3 @@
|
||||
# Carmageddon 2 demo
|
||||
# The Sims Online
|
||||
Fixes: [19153] Resident Evil 1 fails to start (needs IDirect3D3::EnumDevices() to return a device named "RGB Emulation")
|
||||
Depends: ddraw-Device_Caps
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user