d3dx9_36-DDS: Rebase and re-enable.

Patch 0001 was implemented upstream by ee4ad2a0a460cf9737c7d0d6057b57528e8ea912.
This commit is contained in:
Elizabeth Figura
2025-02-20 22:30:31 -06:00
parent acb3c0bb3c
commit 0e1220c76d
2 changed files with 14 additions and 46 deletions

View File

@@ -1,32 +0,0 @@
From 5d9d9cbdb4043848aa5ebdd8a1349d9c876650e3 Mon Sep 17 00:00:00 2001
From: Christian Costa <titan.costa@gmail.com>
Date: Sun, 11 Jan 2015 16:18:03 +0100
Subject: [PATCH] d3dx9_36: Add support for FOURCC surface to
save_dds_surface_to_memory.
---
dlls/d3dx9_36/surface.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c
index 26809a47e18..db334ee83f1 100644
--- a/dlls/d3dx9_36/surface.c
+++ b/dlls/d3dx9_36/surface.c
@@ -433,6 +433,14 @@ static HRESULT d3dformat_to_dds_pixel_format(struct dds_pixel_format *pixel_form
}
}
+ /* Reuse dds_fourcc_to_d3dformat as D3DFORMAT and FOURCC are DWORD with same values */
+ if (dds_fourcc_to_d3dformat(d3dformat) != D3DFMT_UNKNOWN)
+ {
+ pixel_format->flags |= DDS_PF_FOURCC;
+ pixel_format->fourcc = d3dformat;
+ return D3D_OK;
+ }
+
WARN("Unknown pixel format %#x.\n", d3dformat);
return E_NOTIMPL;
}
--
2.35.1

View File

@@ -1,4 +1,4 @@
From 96af775034dae1c0b133b315c45b7172090d3498 Mon Sep 17 00:00:00 2001
From 71d1c176af87bdc48326d5883fbea608314ee0a4 Mon Sep 17 00:00:00 2001
From: Christian Costa <titan.costa@gmail.com>
Date: Sun, 11 Jan 2015 16:29:30 +0100
Subject: [PATCH] d3dx9_36: Improve D3DXSaveTextureToFile to save simple
@@ -11,23 +11,23 @@ Subject: [PATCH] d3dx9_36: Improve D3DXSaveTextureToFile to save simple
3 files changed, 66 insertions(+), 4 deletions(-)
diff --git a/dlls/d3dx9_36/d3dx9_private.h b/dlls/d3dx9_36/d3dx9_private.h
index 34a9f6eec7f..878dff3fc01 100644
index 6a9b3e12b7b..0c6374f35ca 100644
--- a/dlls/d3dx9_36/d3dx9_private.h
+++ b/dlls/d3dx9_36/d3dx9_private.h
@@ -178,6 +178,8 @@ HRESULT lock_surface(IDirect3DSurface9 *surface, const RECT *surface_rect, D3DLO
@@ -316,6 +316,8 @@ HRESULT lock_surface(IDirect3DSurface9 *surface, const RECT *surface_rect, D3DLO
IDirect3DSurface9 **temp_surface, BOOL write);
HRESULT unlock_surface(IDirect3DSurface9 *surface, const RECT *surface_rect,
IDirect3DSurface9 *temp_surface, BOOL update);
+HRESULT save_dds_texture_to_memory(ID3DXBuffer **dst_buffer, IDirect3DBaseTexture9 *src_texture,
+ const PALETTEENTRY *src_palette);
HRESULT d3dx_pixels_init(const void *data, uint32_t row_pitch, uint32_t slice_pitch,
const PALETTEENTRY *palette, D3DFORMAT format, uint32_t left, uint32_t top, uint32_t right, uint32_t bottom,
uint32_t front, uint32_t back, struct d3dx_pixels *pixels);
const PALETTEENTRY *palette, enum d3dx_pixel_format_id format, uint32_t left, uint32_t top, uint32_t right,
uint32_t bottom, uint32_t front, uint32_t back, struct d3dx_pixels *pixels);
diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c
index 31bce97bbab..212d452c654 100644
index 9d2dc96a979..912a3e3c849 100644
--- a/dlls/d3dx9_36/surface.c
+++ b/dlls/d3dx9_36/surface.c
@@ -574,6 +574,69 @@ static HRESULT save_dds_surface_to_memory(ID3DXBuffer **dst_buffer, IDirect3DSur
@@ -628,6 +628,69 @@ static HRESULT save_dds_surface_to_memory(ID3DXBuffer **dst_buffer, IDirect3DSur
return D3D_OK;
}
@@ -87,21 +87,21 @@ index 31bce97bbab..212d452c654 100644
+
+ if (SUCCEEDED(hr))
+ {
+ hr = save_dds_surface_to_memory(dst_buffer, surface, NULL);
+ hr = save_dds_surface_to_memory(dst_buffer, surface, NULL, NULL);
+ IDirect3DSurface9_Release(surface);
+ }
+
+ return hr;
+}
+
HRESULT load_cube_texture_from_dds(IDirect3DCubeTexture9 *cube_texture, const void *src_data,
const PALETTEENTRY *palette, DWORD filter, DWORD color_key, const D3DXIMAGE_INFO *src_info)
{
static const uint8_t bmp_file_signature[] = { 'B', 'M' };
static const uint8_t jpg_file_signature[] = { 0xff, 0xd8 };
static const uint8_t png_file_signature[] = { 0x89, 'P', 'N', 'G', 0x0d, 0x0a, 0x1a, 0x0a };
diff --git a/dlls/d3dx9_36/texture.c b/dlls/d3dx9_36/texture.c
index b42c9db3f2d..d84bac25cfe 100644
index 719a2787445..3f76ec209f9 100644
--- a/dlls/d3dx9_36/texture.c
+++ b/dlls/d3dx9_36/texture.c
@@ -1847,10 +1847,7 @@ HRESULT WINAPI D3DXSaveTextureToFileInMemory(ID3DXBuffer **dst_buffer, D3DXIMAGE
@@ -1866,10 +1866,7 @@ HRESULT WINAPI D3DXSaveTextureToFileInMemory(ID3DXBuffer **dst_buffer, D3DXIMAGE
if (!dst_buffer || !src_texture) return D3DERR_INVALIDCALL;
if (file_format == D3DXIFF_DDS)
@@ -114,5 +114,5 @@ index b42c9db3f2d..d84bac25cfe 100644
type = IDirect3DBaseTexture9_GetType(src_texture);
switch (type)
--
2.45.2
2.47.2