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
d3dx11_43-D3DX11CreateTextureFromMemory - Rebased and Enabled
Fix crashes with the HighFleet (patch 2) Fix drawing issue with Puyo Puyo Tetris (patch 3).
This commit is contained in:
@@ -1,63 +1,40 @@
|
||||
From 7285c2c90f43cd46d873a2ddb65e9c6c9d63f750 Mon Sep 17 00:00:00 2001
|
||||
From 18e01f69f4a3ad85253bb73dcd3ff197074c8810 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
|
||||
Subject: [PATCH] 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(-)
|
||||
dlls/d3dx11_43/texture.c | 365 ++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 359 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3dx11_43/texture.c b/dlls/d3dx11_43/texture.c
|
||||
index bbf937cdab0..10dedf30c0f 100644
|
||||
index cbf3b630f58..0bc5ef9ab03 100644
|
||||
--- a/dlls/d3dx11_43/texture.c
|
||||
+++ b/dlls/d3dx11_43/texture.c
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "wincodec.h"
|
||||
@@ -15,12 +15,15 @@
|
||||
* 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 "dxhelpers.h"
|
||||
|
||||
+#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;
|
||||
@@ -277,16 +280,366 @@ 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,
|
||||
- ID3D11Resource **texture, HRESULT *hresult)
|
||||
+static const DXGI_FORMAT block_compressed_formats[] =
|
||||
+{
|
||||
+ DXGI_FORMAT_BC1_TYPELESS, DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM_SRGB,
|
||||
@@ -70,9 +47,12 @@ index bbf937cdab0..10dedf30c0f 100644
|
||||
+};
|
||||
+
|
||||
+static BOOL is_block_compressed(DXGI_FORMAT format)
|
||||
+{
|
||||
{
|
||||
- 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 i;
|
||||
+
|
||||
|
||||
- return E_NOTIMPL;
|
||||
+ for (i = 0; i < ARRAY_SIZE(block_compressed_formats); ++i)
|
||||
+ if (format == block_compressed_formats[i])
|
||||
+ return TRUE;
|
||||
@@ -214,6 +194,33 @@ index bbf937cdab0..10dedf30c0f 100644
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+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 const GUID *dxgi_format_to_wic_guid(DXGI_FORMAT format)
|
||||
+{
|
||||
+ unsigned int i;
|
||||
@@ -225,23 +232,14 @@ index bbf937cdab0..10dedf30c0f 100644
|
||||
+ }
|
||||
+
|
||||
+ 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 WICCreateImagingFactory_Proxy(UINT sdk_version, IWICImagingFactory **imaging_factory);
|
||||
+
|
||||
+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);
|
||||
+ ID3D11Resource **texture, HRESULT *hresult)
|
||||
+ {
|
||||
+ unsigned int frame_count, width, height, stride, frame_size;
|
||||
+ IWICFormatConverter *converter = NULL;
|
||||
+ IWICDdsFrameDecode *dds_frame = NULL;
|
||||
@@ -258,8 +256,7 @@ index bbf937cdab0..10dedf30c0f 100644
|
||||
+ 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);
|
||||
+
|
||||
@@ -399,9 +396,11 @@ index bbf937cdab0..10dedf30c0f 100644
|
||||
+ IWICImagingFactory_Release(factory);
|
||||
+
|
||||
+ return hr;
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
HRESULT WINAPI D3DX11SaveTextureToFileW(ID3D11DeviceContext *context, ID3D11Resource *texture,
|
||||
D3DX11_IMAGE_FILE_FORMAT format, const WCHAR *filename)
|
||||
{
|
||||
--
|
||||
2.40.1
|
||||
2.51.0
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
From 3c5ed75d72440b3c1ff668c3aece8216b561bece Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Sat, 13 Sep 2025 08:17:15 +1000
|
||||
Subject: [PATCH] d3dx9: Add support for GUID_WICPixelFormat16bppGray
|
||||
|
||||
Stop error with HighFleet on startup.
|
||||
---
|
||||
dlls/d3dx9_36/d3dx_helpers.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/dlls/d3dx9_36/d3dx_helpers.c b/dlls/d3dx9_36/d3dx_helpers.c
|
||||
index 60394ca1d9b..26b00191b68 100644
|
||||
--- a/dlls/d3dx9_36/d3dx_helpers.c
|
||||
+++ b/dlls/d3dx9_36/d3dx_helpers.c
|
||||
@@ -140,6 +140,7 @@ static const struct
|
||||
{ &GUID_WICPixelFormat2bppIndexed, D3DX_PIXEL_FORMAT_P2_UINT },
|
||||
{ &GUID_WICPixelFormat4bppIndexed, D3DX_PIXEL_FORMAT_P4_UINT },
|
||||
{ &GUID_WICPixelFormat8bppGray, D3DX_PIXEL_FORMAT_L8_UNORM },
|
||||
+ { &GUID_WICPixelFormat16bppGray, D3DX_PIXEL_FORMAT_R16_UNORM },
|
||||
{ &GUID_WICPixelFormat16bppBGR555, D3DX_PIXEL_FORMAT_B5G5R5X1_UNORM },
|
||||
{ &GUID_WICPixelFormat16bppBGR565, D3DX_PIXEL_FORMAT_B5G6R5_UNORM },
|
||||
{ &GUID_WICPixelFormat24bppBGR, D3DX_PIXEL_FORMAT_B8G8R8_UNORM },
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
From 9d0bf8024bf5d97540fd1fa7456766fea808bc20 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Sat, 13 Sep 2025 08:17:15 +1000
|
||||
Subject: [PATCH] d3dx9_36: Use correct pixel type for DXT* format
|
||||
|
||||
Required for Puyo-Puyo tetris.
|
||||
---
|
||||
dlls/d3dx9_36/d3dx_helpers.c | 18 ++++++++++++++++--
|
||||
1 file changed, 16 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3dx9_36/d3dx_helpers.c b/dlls/d3dx9_36/d3dx_helpers.c
|
||||
index 26b00191b68..694b1b53548 100644
|
||||
--- a/dlls/d3dx9_36/d3dx_helpers.c
|
||||
+++ b/dlls/d3dx9_36/d3dx_helpers.c
|
||||
@@ -290,8 +290,8 @@ static enum d3dx_pixel_format_id d3dx_pixel_format_id_from_dds_pixel_format(cons
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
- TRACE("pixel_format: size %lu, flags %#lx, fourcc %#lx, bpp %lu.\n", pixel_format->size,
|
||||
- pixel_format->flags, pixel_format->fourcc, pixel_format->bpp);
|
||||
+ TRACE("pixel_format: size %lu, flags %#lx, fourcc %s, bpp %lu.\n", pixel_format->size,
|
||||
+ pixel_format->flags, debugstr_fourcc(pixel_format->fourcc), pixel_format->bpp);
|
||||
TRACE("rmask %#lx, gmask %#lx, bmask %#lx, amask %#lx.\n", pixel_format->rmask, pixel_format->gmask,
|
||||
pixel_format->bmask, pixel_format->amask);
|
||||
|
||||
@@ -1152,6 +1152,20 @@ static HRESULT d3dx_initialize_image_from_dds(const void *src_data, uint32_t src
|
||||
if ((image->format = d3dx_pixel_format_id_from_dds_pixel_format(&header->pixel_format)) == D3DX_PIXEL_FORMAT_COUNT)
|
||||
return D3DXERR_INVALIDDATA;
|
||||
|
||||
+ switch (image->format)
|
||||
+ {
|
||||
+ case D3DX_PIXEL_FORMAT_DXT1_UNORM:
|
||||
+ case D3DX_PIXEL_FORMAT_DXT2_UNORM:
|
||||
+ case D3DX_PIXEL_FORMAT_DXT3_UNORM:
|
||||
+ case D3DX_PIXEL_FORMAT_DXT4_UNORM:
|
||||
+ case D3DX_PIXEL_FORMAT_DXT5_UNORM:
|
||||
+ image->format = D3DX_PIXEL_FORMAT_R8G8B8A8_UNORM;
|
||||
+ break;
|
||||
+ default:
|
||||
+ /* Leave format as is */
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
image->image_file_format = D3DX_IMAGE_FILE_FORMAT_DDS;
|
||||
image->layer_count = 1;
|
||||
if (header->flags & DDS_DEPTH)
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
Fixes: [50210] - Implement D3DX11GetImageInfoFromMemory
|
||||
Fixes: [45533] - Implement D3DX11CreateTextureFromMemory
|
||||
Disabled: true
|
||||
|
||||
Reference in New Issue
Block a user