Added patch to implement DXTn support for d3dx9_36.

This commit is contained in:
Sebastian Lackner 2014-11-06 11:04:55 +01:00
parent f6dd7940f0
commit 8d9d2558c9
8 changed files with 523 additions and 17 deletions

View File

@ -39,12 +39,16 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
===================================
**Bugfixes and features included in the next upcoming release [4]:**
**Bugfixes and features included in the next upcoming release [8]:**
* Add stub for NtSetLdtEntries/ZwSetLdtEntries ([Wine Bug #26268](https://bugs.winehq.org/show_bug.cgi?id=26268))
* Allow selection of audio device for PulseAudio backend
* CoWaitForMultipleHandles shouldn't process window events when APC calls are queued ([Wine Bug #32568](https://bugs.winehq.org/show_bug.cgi?id=32568))
* Exception during start of fr-043 caused by missing DXTn support ([Wine Bug #37391](https://bugs.winehq.org/show_bug.cgi?id=37391))
* FairplayKD.sys needs KeSetSystemAffinityThread ([Wine Bug #36822](https://bugs.winehq.org/show_bug.cgi?id=36822))
* Fix crash of Trine Demo on start ([Wine Bug #19231](https://bugs.winehq.org/show_bug.cgi?id=19231))
* Fix crash on mission launch on Airstrike (Eagles of WWII) ([Wine Bug #28851](https://bugs.winehq.org/show_bug.cgi?id=28851))
* Fix texture corruption in CSI: Fatal Conspiracy ([Wine Bug #33768](https://bugs.winehq.org/show_bug.cgi?id=33768))
**Bugs fixed in Wine Staging 1.7.30 [90]:**

1
debian/changelog vendored
View File

@ -6,6 +6,7 @@ wine-compholio (1.7.31) UNRELEASED; urgency=low
* Added patch with stub for NtSetLdtEntries/ZwSetLdtEntries.
* Added patch to prevent processing message events for CoWaitForMultipleHandles when APC calls are queued.
* Added patch with stub for KeSetSystemAffinityThread.
* Added patch to implement DXTn support for d3dx9_36.
* Removed patch for iphlpapi stub functions (accepted upstream).
* Removed patches for FindFirstFileExW (accepted upstream).
* Removed patches for TLB dependencies lookup in resources (accepted upstream).

View File

@ -27,6 +27,7 @@ PATCHLIST := \
configure-Absolute_RPATH.ok \
configure-Detect_Gnutls.ok \
d3dx9_36-CreatePolygon.ok \
d3dx9_36-DXTn.ok \
d3dx9_36-Filter_Warnings.ok \
d3dx9_36-GetShaderSemantics.ok \
d3dx9_36-UpdateSkinnedMesh.ok \
@ -322,6 +323,27 @@ d3dx9_36-CreatePolygon.ok:
echo '+ { "d3dx9_36-CreatePolygon", "Sebastian Lackner", "Implement D3DXCreatePolygon. [rev 2]" },'; \
) > d3dx9_36-CreatePolygon.ok
# Patchset d3dx9_36-DXTn
# |
# | Included patches:
# | * Add DXTn support to d3dx9_36. [by Christian Costa]
# |
# | This patchset fixes the following Wine bugs:
# | * [#33768] Fix texture corruption in CSI: Fatal Conspiracy
# | * [#28851] Fix crash on mission launch on Airstrike (Eagles of WWII)
# | * [#19231] Fix crash of Trine Demo on start
# | * [#37391] Exception during start of fr-043 caused by missing DXTn support
# |
# | Modified files:
# | * dlls/d3dx9_36/Makefile.in, dlls/d3dx9_36/surface.c
# |
.INTERMEDIATE: d3dx9_36-DXTn.ok
d3dx9_36-DXTn.ok: wined3d-DXTn.ok
$(call APPLY_FILE,d3dx9_36-DXTn/0001-d3dx9_36-Add-dxtn-support.patch)
@( \
echo '+ { "d3dx9_36-DXTn", "Christian Costa", "Add DXTn support to d3dx9_36." },'; \
) > d3dx9_36-DXTn.ok
# Patchset d3dx9_36-Filter_Warnings
# |
# | Included patches:
@ -1557,21 +1579,22 @@ winebuild-LinkerVersion.ok:
# Patchset wined3d-DXTn
# |
# | Included patches:
# | * Add support for DXTn software decoding through libxtc_dxtn. [rev 2, by Michael Müller]
# | * Add support for DXTn software decoding through libxtc_dxtn. [rev 3, by Michael Müller / Christian Costa]
# |
# | This patchset fixes the following Wine bugs:
# | * [#25486] Lego Stunt Rally requires DXTn software de/encoding support
# | * [#29586] Tumblebugs 2 requires DXTn software encoding support
# |
# | Modified files:
# | * configure.ac, dlls/wined3d/Makefile.in, dlls/wined3d/dxtn.c, dlls/wined3d/surface.c, dlls/wined3d/wined3d_main.c,
# | dlls/wined3d/wined3d_private.h
# | * configure.ac, dlls/wined3d/Makefile.in, dlls/wined3d/dxtn.c, dlls/wined3d/surface.c, dlls/wined3d/wined3d.spec,
# | dlls/wined3d/wined3d_main.c, dlls/wined3d/wined3d_private.h, include/wine/wined3d.h
# |
.INTERMEDIATE: wined3d-DXTn.ok
wined3d-DXTn.ok:
$(call APPLY_FILE,wined3d-DXTn/0001-wined3d-Add-support-for-DXTn-software-decoding-throu.patch)
$(call APPLY_FILE,wined3d-DXTn/0002-wined3d-Improve-DXTn-support-and-export-conversion-f.patch)
@( \
echo '+ { "wined3d-DXTn", "Michael Müller", "Add support for DXTn software decoding through libxtc_dxtn. [rev 2]" },'; \
echo '+ { "wined3d-DXTn", "Michael Müller / Christian Costa", "Add support for DXTn software decoding through libxtc_dxtn. [rev 3]" },'; \
) > wined3d-DXTn.ok
# Patchset wined3d-Revert_PixelFormat

View File

@ -1,4 +1,4 @@
From 343eb8dc82b72e641dc239a339f2419bb7f936c9 Mon Sep 17 00:00:00 2001
From 8794d625750d35293adecbedc32cc02257817b05 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 20 Jul 2014 22:22:14 +0200
Subject: wined3d: allow changing strict drawing through an exported function
@ -9,18 +9,20 @@ Subject: wined3d: allow changing strict drawing through an exported function
2 files changed, 7 insertions(+)
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index a53c74b..7c9ebbd 100644
index 7a77003..5519a48 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -271,3 +271,5 @@
@ cdecl wined3d_volume_map(ptr ptr ptr long)
@ cdecl wined3d_volume_preload(ptr)
@ cdecl wined3d_volume_unmap(ptr)
+
@@ -219,6 +219,8 @@
@ cdecl wined3d_stateblock_decref(ptr)
@ cdecl wined3d_stateblock_incref(ptr)
+@ cdecl wined3d_strictdrawing_set(long)
\ No newline at end of file
+
@ cdecl wined3d_surface_blt(ptr ptr ptr ptr long ptr long)
@ cdecl wined3d_surface_decref(ptr)
@ cdecl wined3d_surface_from_resource(ptr)
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
index 7ab2448..8b4134d 100644
index 758ba43..7ccd3a1 100644
--- a/dlls/wined3d/wined3d_main.c
+++ b/dlls/wined3d/wined3d_main.c
@@ -505,6 +505,11 @@ void wined3d_unregister_window(HWND window)
@ -36,5 +38,5 @@ index 7ab2448..8b4134d 100644
BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, void *reserved)
{
--
1.8.3.2
2.1.3

View File

@ -0,0 +1,178 @@
From d49f4a13145f3dd88f2be8d67baf8546ddff4bfd Mon Sep 17 00:00:00 2001
From: Christian Costa <titan.costa@gmail.com>
Date: Sat, 1 Nov 2014 13:08:05 +0100
Subject: d3dx9_36: Add dxtn support.
---
dlls/d3dx9_36/Makefile.in | 2 +-
dlls/d3dx9_36/surface.c | 100 ++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 94 insertions(+), 8 deletions(-)
diff --git a/dlls/d3dx9_36/Makefile.in b/dlls/d3dx9_36/Makefile.in
index 5958c57..aa387b5 100644
--- a/dlls/d3dx9_36/Makefile.in
+++ b/dlls/d3dx9_36/Makefile.in
@@ -1,6 +1,6 @@
MODULE = d3dx9_36.dll
IMPORTLIB = d3dx9
-IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
+IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 wined3d
C_SRCS = \
core.c \
diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c
index c91048b..9813ce1 100644
--- a/dlls/d3dx9_36/surface.c
+++ b/dlls/d3dx9_36/surface.c
@@ -26,6 +26,8 @@
#include "ole2.h"
#include "wincodec.h"
+#include "wine/wined3d.h"
+
WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
@@ -1715,6 +1717,24 @@ void point_filter_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slic
}
}
+typedef BOOL (*dxtn_conversion_func)(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h);
+
+static dxtn_conversion_func get_dxtn_conversion_func(D3DFORMAT format, BOOL encode)
+{
+ switch (format)
+ {
+ case D3DFMT_DXT1:
+ return encode ? wined3d_dxt1_encode : wined3d_dxt1_decode;
+ case D3DFMT_DXT3:
+ return encode ? wined3d_dxt3_encode : wined3d_dxt3_decode;
+ case D3DFMT_DXT5:
+ return encode ? wined3d_dxt5_encode : wined3d_dxt5_decode;
+ default:
+ return NULL;
+ }
+}
+
/************************************************************
* D3DXLoadSurfaceFromMemory
*
@@ -1756,6 +1776,7 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
D3DSURFACE_DESC surfdesc;
D3DLOCKED_RECT lockrect;
struct volume src_size, dst_size;
+ HRESULT ret = D3D_OK;
TRACE("(%p, %p, %s, %p, %#x, %u, %p, %s %#x, 0x%08x)\n",
dst_surface, dst_palette, wine_dbgstr_rect(dst_rect), src_memory, src_format,
@@ -1837,8 +1858,15 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
}
else /* Stretching or format conversion. */
{
- if (((srcformatdesc->type != FORMAT_ARGB) && (srcformatdesc->type != FORMAT_INDEX)) ||
- (destformatdesc->type != FORMAT_ARGB))
+ dxtn_conversion_func pre_convert, post_convert;
+ void *tmp_src_memory = NULL, *tmp_dst_memory = NULL;
+ UINT tmp_src_pitch, tmp_dst_pitch;
+
+ pre_convert = get_dxtn_conversion_func(srcformatdesc->format, FALSE);
+ post_convert = get_dxtn_conversion_func(destformatdesc->format, TRUE);
+
+ if ((!pre_convert && (srcformatdesc->type != FORMAT_ARGB) && (srcformatdesc->type != FORMAT_INDEX)) ||
+ (!post_convert && (destformatdesc->type != FORMAT_ARGB)))
{
FIXME("Format conversion missing %#x -> %#x\n", src_format, surfdesc.Format);
return E_NOTIMPL;
@@ -1847,10 +1875,52 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
if (FAILED(IDirect3DSurface9_LockRect(dst_surface, &lockrect, dst_rect, 0)))
return D3DXERR_INVALIDDATA;
+ /* handle pre-conversion */
+ if (pre_convert)
+ {
+ tmp_src_memory = HeapAlloc(GetProcessHeap(), 0, src_size.width * src_size.height * sizeof(DWORD));
+ if (!tmp_src_memory)
+ {
+ ret = E_OUTOFMEMORY;
+ goto error;
+ }
+ tmp_src_pitch = src_size.width * sizeof(DWORD);
+ if (!pre_convert(src_memory, tmp_src_memory, src_pitch, tmp_src_pitch,
+ WINED3DFMT_B8G8R8A8_UNORM, src_size.width, src_size.height))
+ {
+ ret = E_FAIL;
+ goto error;
+ }
+ srcformatdesc = get_format_info(D3DFMT_A8R8G8B8);
+ }
+ else
+ {
+ tmp_src_memory = (void *)src_memory;
+ tmp_src_pitch = src_pitch;
+ }
+
+ /* handle post-conversion */
+ if (post_convert)
+ {
+ tmp_dst_memory = HeapAlloc(GetProcessHeap(), 0, dst_size.width * dst_size.height * sizeof(DWORD));
+ if (!tmp_dst_memory)
+ {
+ ret = E_OUTOFMEMORY;
+ goto error;
+ }
+ tmp_dst_pitch = dst_size.width * sizeof(DWORD);
+ destformatdesc = get_format_info(D3DFMT_A8R8G8B8);
+ }
+ else
+ {
+ tmp_dst_memory = lockrect.pBits;
+ tmp_dst_pitch = lockrect.Pitch;
+ }
+
if ((filter & 0xf) == D3DX_FILTER_NONE)
{
- convert_argb_pixels(src_memory, src_pitch, 0, &src_size, srcformatdesc,
- lockrect.pBits, lockrect.Pitch, 0, &dst_size, destformatdesc, color_key, src_palette);
+ convert_argb_pixels(tmp_src_memory, tmp_src_pitch, 0, &src_size, srcformatdesc,
+ tmp_dst_memory, tmp_dst_pitch, 0, &dst_size, destformatdesc, color_key, src_palette);
}
else /* if ((filter & 0xf) == D3DX_FILTER_POINT) */
{
@@ -1859,14 +1929,30 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
/* Always apply a point filter until D3DX_FILTER_LINEAR,
* D3DX_FILTER_TRIANGLE and D3DX_FILTER_BOX are implemented. */
- point_filter_argb_pixels(src_memory, src_pitch, 0, &src_size, srcformatdesc,
- lockrect.pBits, lockrect.Pitch, 0, &dst_size, destformatdesc, color_key, src_palette);
+ point_filter_argb_pixels(tmp_src_memory, tmp_src_pitch, 0, &src_size, srcformatdesc,
+ tmp_dst_memory, tmp_dst_pitch, 0, &dst_size, destformatdesc, color_key, src_palette);
+ }
+
+ /* handle post-conversion */
+ if (post_convert)
+ {
+ if (!post_convert(tmp_dst_memory, lockrect.pBits, tmp_dst_pitch, lockrect.Pitch,
+ WINED3DFMT_B8G8R8A8_UNORM, dst_size.width, dst_size.height))
+ {
+ ret = E_FAIL;
+ goto error;
+ }
}
+error:
+ if (pre_convert)
+ HeapFree(GetProcessHeap(), 0, tmp_src_memory);
+ if (post_convert)
+ HeapFree(GetProcessHeap(), 0, tmp_dst_memory);
IDirect3DSurface9_UnlockRect(dst_surface);
}
- return D3D_OK;
+ return ret;
}
/************************************************************
--
2.1.3

View File

@ -0,0 +1,8 @@
Author: Christian Costa
Subject: Add DXTn support to d3dx9_36.
Revision: 1
Depends: wined3d-DXTn
Fixes: [33768] Fix texture corruption in CSI: Fatal Conspiracy
Fixes: [28851] Fix crash on mission launch on Airstrike (Eagles of WWII)
Fixes: [19231] Fix crash of Trine Demo on start
Fixes: [37391] Exception during start of fr-043 caused by missing DXTn support

View File

@ -0,0 +1,290 @@
From eea72aef0b19779822191f8dc858fa282cc4bfb0 Mon Sep 17 00:00:00 2001
From: Christian Costa <titan.costa@gmail.com>
Date: Tue, 4 Nov 2014 22:41:45 +0100
Subject: wined3d: Improve DXTn support and export conversion functions for
d3dx9_36.
---
dlls/wined3d/dxtn.c | 128 +++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/surface.c | 32 +++++++++++
dlls/wined3d/wined3d.spec | 7 +++
dlls/wined3d/wined3d_private.h | 5 --
include/wine/wined3d.h | 7 +++
5 files changed, 174 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/dxtn.c b/dlls/wined3d/dxtn.c
index 9c5eef9..c9889cc 100644
--- a/dlls/wined3d/dxtn.c
+++ b/dlls/wined3d/dxtn.c
@@ -27,6 +27,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
static void* txc_dxtn_handle;
static void (*pfetch_2d_texel_rgba_dxt1)(int srcRowStride, const BYTE *pixData, int i, int j, DWORD *texel);
+static void (*pfetch_2d_texel_rgba_dxt3)(int srcRowStride, const BYTE *pixData, int i, int j, DWORD *texel);
+static void (*pfetch_2d_texel_rgba_dxt5)(int srcRowStride, const BYTE *pixData, int i, int j, DWORD *texel);
static void (*ptx_compress_dxtn)(int comps, int width, int height, const BYTE *srcPixData,
GLenum destformat, BYTE *dest, int dstRowStride);
@@ -62,6 +64,70 @@ static inline BOOL dxt1_to_x8r8g8b8(const BYTE *src, BYTE *dst, DWORD pitch_in,
return TRUE;
}
+static inline BOOL dxt3_to_x8r8g8b8(const BYTE *src, BYTE *dst, DWORD pitch_in,
+ DWORD pitch_out, unsigned int w, unsigned int h, BOOL alpha)
+{
+ unsigned int x, y;
+ DWORD color;
+
+ TRACE("Converting %ux%u pixels, pitches %u %u\n", w, h, pitch_in, pitch_out);
+
+ for (y = 0; y < h; ++y)
+ {
+ DWORD *dst_line = (DWORD *)(dst + y * pitch_out);
+ for (x = 0; x < w; ++x)
+ {
+ /* pfetch_2d_texel_rgba_dxt3 doesn't correctly handle pitch */
+ pfetch_2d_texel_rgba_dxt3(0, src + (y / 4) * pitch_in + (x / 4) * 16,
+ x & 3, y & 3, &color);
+ if (alpha)
+ {
+ dst_line[x] = (color & 0xff00ff00) | ((color & 0xff) << 16) |
+ ((color & 0xff0000) >> 16);
+ }
+ else
+ {
+ dst_line[x] = 0xff000000 | ((color & 0xff) << 16) |
+ (color & 0xff00) | ((color & 0xff0000) >> 16);
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+static inline BOOL dxt5_to_x8r8g8b8(const BYTE *src, BYTE *dst, DWORD pitch_in,
+ DWORD pitch_out, unsigned int w, unsigned int h, BOOL alpha)
+{
+ unsigned int x, y;
+ DWORD color;
+
+ TRACE("Converting %ux%u pixels, pitches %u %u\n", w, h, pitch_in, pitch_out);
+
+ for (y = 0; y < h; ++y)
+ {
+ DWORD *dst_line = (DWORD *)(dst + y * pitch_out);
+ for (x = 0; x < w; ++x)
+ {
+ /* pfetch_2d_texel_rgba_dxt5 doesn't correctly handle pitch */
+ pfetch_2d_texel_rgba_dxt5(0, src + (y / 4) * pitch_in + (x / 4) * 16,
+ x & 3, y & 3, &color);
+ if (alpha)
+ {
+ dst_line[x] = (color & 0xff00ff00) | ((color & 0xff) << 16) |
+ ((color & 0xff0000) >> 16);
+ }
+ else
+ {
+ dst_line[x] = 0xff000000 | ((color & 0xff) << 16) |
+ (color & 0xff00) | ((color & 0xff0000) >> 16);
+ }
+ }
+ }
+
+ return TRUE;
+}
+
static inline BOOL x8r8g8b8_to_dxtn(const BYTE *src, BYTE *dst, DWORD pitch_in,
DWORD pitch_out, unsigned int w, unsigned int h, GLenum destformat, BOOL alpha)
{
@@ -177,6 +243,52 @@ BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch
return FALSE;
}
+BOOL wined3d_dxt3_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h)
+{
+ if (!pfetch_2d_texel_rgba_dxt3)
+ {
+ FIXME("Failed to decode DXT3 image, there is a problem with %s.\n", SONAME_LIBTXC_DXTN);
+ return FALSE;
+ }
+
+ switch (format)
+ {
+ case WINED3DFMT_B8G8R8A8_UNORM:
+ return dxt3_to_x8r8g8b8(src, dst, pitch_in, pitch_out, w, h, TRUE);
+ case WINED3DFMT_B8G8R8X8_UNORM:
+ return dxt3_to_x8r8g8b8(src, dst, pitch_in, pitch_out, w, h, FALSE);
+ default:
+ break;
+ }
+
+ FIXME("Cannot find a conversion function from format DXT3 to %s.\n", debug_d3dformat(format));
+ return FALSE;
+}
+
+BOOL wined3d_dxt5_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h)
+{
+ if (!pfetch_2d_texel_rgba_dxt5)
+ {
+ FIXME("Failed to decode DXT5 image, there is a problem with %s.\n", SONAME_LIBTXC_DXTN);
+ return FALSE;
+ }
+
+ switch (format)
+ {
+ case WINED3DFMT_B8G8R8A8_UNORM:
+ return dxt5_to_x8r8g8b8(src, dst, pitch_in, pitch_out, w, h, TRUE);
+ case WINED3DFMT_B8G8R8X8_UNORM:
+ return dxt5_to_x8r8g8b8(src, dst, pitch_in, pitch_out, w, h, FALSE);
+ default:
+ break;
+ }
+
+ FIXME("Cannot find a conversion function from format DXT5 to %s.\n", debug_d3dformat(format));
+ return FALSE;
+}
+
BOOL wined3d_dxt1_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
enum wined3d_format_id format, unsigned int w, unsigned int h)
{
@@ -269,6 +381,8 @@ BOOL wined3d_dxtn_init(void)
#define LOAD_FUNCPTR(f) if((p##f = wine_dlsym(txc_dxtn_handle, #f, NULL, 0)) == NULL){WARN("Can't find symbol %s\n", #f);}
LOAD_FUNCPTR(fetch_2d_texel_rgba_dxt1);
+ LOAD_FUNCPTR(fetch_2d_texel_rgba_dxt3);
+ LOAD_FUNCPTR(fetch_2d_texel_rgba_dxt5);
LOAD_FUNCPTR(tx_compress_dxtn);
#undef LOAD_FUNCPTR
@@ -298,6 +412,13 @@ BOOL wined3d_dxt1_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch
return FALSE;
}
+BOOL wined3d_dxt3_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h)
+{
+ FIXME("Failed to convert DXT3 texture. Wine is compiled without DXT3 support.\n");
+ return FALSE;
+}
+
BOOL wined3d_dxt3_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
enum wined3d_format_id format, unsigned int w, unsigned int h)
{
@@ -305,6 +426,13 @@ BOOL wined3d_dxt3_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch
return FALSE;
}
+BOOL wined3d_dxt5_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h)
+{
+ FIXME("Failed to convert DXT5 texture. Wine is compiled without DXT5 support.\n");
+ return FALSE;
+}
+
BOOL wined3d_dxt5_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
enum wined3d_format_id format, unsigned int w, unsigned int h)
{
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 2f9d323..e224df4 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2427,6 +2427,30 @@ static void convert_dxt1_x8r8g8b8(const BYTE *src, BYTE *dst,
wined3d_dxt1_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8X8_UNORM, w, h);
}
+static void convert_dxt3_a8r8g8b8(const BYTE *src, BYTE *dst,
+ DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
+{
+ wined3d_dxt3_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8A8_UNORM, w, h);
+}
+
+static void convert_dxt3_x8r8g8b8(const BYTE *src, BYTE *dst,
+ DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
+{
+ wined3d_dxt3_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8X8_UNORM, w, h);
+}
+
+static void convert_dxt5_a8r8g8b8(const BYTE *src, BYTE *dst,
+ DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
+{
+ wined3d_dxt5_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8A8_UNORM, w, h);
+}
+
+static void convert_dxt5_x8r8g8b8(const BYTE *src, BYTE *dst,
+ DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
+{
+ wined3d_dxt5_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8X8_UNORM, w, h);
+}
+
static void convert_a8r8g8b8_dxt1(const BYTE *src, BYTE *dst,
DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
{
@@ -2489,8 +2513,16 @@ static const struct d3dfmt_converter_desc converters[] =
{WINED3DFMT_B8G8R8X8_UNORM, WINED3DFMT_B8G8R8A8_UNORM, convert_a8r8g8b8_x8r8g8b8},
{WINED3DFMT_YUY2, WINED3DFMT_B8G8R8X8_UNORM, convert_yuy2_x8r8g8b8},
{WINED3DFMT_YUY2, WINED3DFMT_B5G6R5_UNORM, convert_yuy2_r5g6b5},
+
+ /* decode DXT */
{WINED3DFMT_DXT1, WINED3DFMT_B8G8R8A8_UNORM, convert_dxt1_a8r8g8b8},
{WINED3DFMT_DXT1, WINED3DFMT_B8G8R8X8_UNORM, convert_dxt1_x8r8g8b8},
+ {WINED3DFMT_DXT3, WINED3DFMT_B8G8R8A8_UNORM, convert_dxt3_a8r8g8b8},
+ {WINED3DFMT_DXT3, WINED3DFMT_B8G8R8X8_UNORM, convert_dxt3_x8r8g8b8},
+ {WINED3DFMT_DXT5, WINED3DFMT_B8G8R8A8_UNORM, convert_dxt5_a8r8g8b8},
+ {WINED3DFMT_DXT5, WINED3DFMT_B8G8R8X8_UNORM, convert_dxt5_x8r8g8b8},
+
+ /* encode DXT */
{WINED3DFMT_B8G8R8A8_UNORM, WINED3DFMT_DXT1, convert_a8r8g8b8_dxt1},
{WINED3DFMT_B8G8R8X8_UNORM, WINED3DFMT_DXT1, convert_x8r8g8b8_dxt1},
{WINED3DFMT_B5G5R5A1_UNORM, WINED3DFMT_DXT1, convert_a1r5g5b5_dxt1},
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 7a77003..eca8875 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -288,3 +288,10 @@
@ cdecl wined3d_volume_map(ptr ptr ptr long)
@ cdecl wined3d_volume_preload(ptr)
@ cdecl wined3d_volume_unmap(ptr)
+
+@ cdecl wined3d_dxt1_decode(ptr ptr long long long long long)
+@ cdecl wined3d_dxt1_encode(ptr ptr long long long long long)
+@ cdecl wined3d_dxt3_decode(ptr ptr long long long long long)
+@ cdecl wined3d_dxt3_encode(ptr ptr long long long long long)
+@ cdecl wined3d_dxt5_decode(ptr ptr long long long long long)
+@ cdecl wined3d_dxt5_encode(ptr ptr long long long long long)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 45c68b3..878ac3a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3133,11 +3133,6 @@ static inline void context_apply_state(struct wined3d_context *context,
state_table[rep].apply(context, state, rep);
}
-BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
-BOOL wined3d_dxt1_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
-BOOL wined3d_dxt3_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
-BOOL wined3d_dxt5_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
-
BOOL wined3d_dxtn_init(void);
void wined3d_dxtn_free(void);
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 8f563bb..1aa2446 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2547,4 +2547,11 @@ HRESULT __cdecl wined3d_volume_map(struct wined3d_volume *volume,
void __cdecl wined3d_volume_preload(struct wined3d_volume *volume);
HRESULT __cdecl wined3d_volume_unmap(struct wined3d_volume *volume);
+BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
+BOOL wined3d_dxt1_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
+BOOL wined3d_dxt3_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
+BOOL wined3d_dxt3_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
+BOOL wined3d_dxt5_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
+BOOL wined3d_dxt5_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
+
#endif /* __WINE_WINED3D_H */
--
2.1.3

View File

@ -1,5 +1,5 @@
Author: Michael Müller
Author: Michael Müller / Christian Costa
Subject: Add support for DXTn software decoding through libxtc_dxtn.
Revision: 2
Revision: 3
Fixes: [25486] Lego Stunt Rally requires DXTn software de/encoding support
Fixes: [29586] Tumblebugs 2 requires DXTn software encoding support