Update DXTn patches to better handle when libtxc_dxtn is missing or support is not compiled in.

This commit is contained in:
Sebastian Lackner 2015-01-10 03:28:30 +01:00
parent ec40c1c8d0
commit 87fd17de51
7 changed files with 264 additions and 211 deletions

1
debian/changelog vendored
View File

@ -6,6 +6,7 @@ wine-staging (1.7.34) UNRELEASED; urgency=low
* Fix issue in user32-WndProc patch which caused crashes for some 16-bit apps.
* Fix issue in ws2_32-WriteWatches patch which can cause exceptions on the signal stack.
* Fix issue with invalid handles being incorrect when a new process is created.
* Update DXTn patches to better handle when libtxc_dxtn is missing or support is not compiled in.
* Added patch for WSARecv to call SetLastError on success.
* Added patch for CreateProcess to prioritize the working directory over the system search path.
* Added patch with stubs for WinSqm[Start|End]Session.

View File

@ -1,12 +1,12 @@
From 0808d72ca1d94c68fcf07379195e086d24383d43 Mon Sep 17 00:00:00 2001
From 5dc54490906f945778a858ecb757cf39500d0b40 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 | 101 ++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 95 insertions(+), 8 deletions(-)
dlls/d3dx9_36/surface.c | 104 ++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 98 insertions(+), 8 deletions(-)
diff --git a/dlls/d3dx9_36/Makefile.in b/dlls/d3dx9_36/Makefile.in
index 5958c57..aa387b5 100644
@ -21,7 +21,7 @@ index 5958c57..aa387b5 100644
C_SRCS = \
core.c \
diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c
index f187031..9a1e1cb 100644
index f187031..70dc0cd 100644
--- a/dlls/d3dx9_36/surface.c
+++ b/dlls/d3dx9_36/surface.c
@@ -18,6 +18,7 @@
@ -41,22 +41,25 @@ index f187031..9a1e1cb 100644
WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
@@ -1716,6 +1719,24 @@ void point_filter_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slic
@@ -1716,6 +1719,27 @@ 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);
+ 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:
+ if (!wined3d_dxtn_supported()) return NULL;
+ return encode ? wined3d_dxt1_encode : wined3d_dxt1_decode;
+ case D3DFMT_DXT3:
+ if (!wined3d_dxtn_supported()) return NULL;
+ return encode ? wined3d_dxt3_encode : wined3d_dxt3_decode;
+ case D3DFMT_DXT5:
+ if (!wined3d_dxtn_supported()) return NULL;
+ return encode ? wined3d_dxt5_encode : wined3d_dxt5_decode;
+ default:
+ return NULL;
@ -66,7 +69,7 @@ index f187031..9a1e1cb 100644
/************************************************************
* D3DXLoadSurfaceFromMemory
*
@@ -1757,6 +1778,7 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
@@ -1757,6 +1781,7 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
D3DSURFACE_DESC surfdesc;
D3DLOCKED_RECT lockrect;
struct volume src_size, dst_size;
@ -74,7 +77,7 @@ index f187031..9a1e1cb 100644
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,
@@ -1838,8 +1860,15 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
@@ -1838,8 +1863,15 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
}
else /* Stretching or format conversion. */
{
@ -92,7 +95,7 @@ index f187031..9a1e1cb 100644
{
FIXME("Format conversion missing %#x -> %#x\n", src_format, surfdesc.Format);
return E_NOTIMPL;
@@ -1848,10 +1877,52 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
@@ -1848,10 +1880,52 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
if (FAILED(IDirect3DSurface9_LockRect(dst_surface, &lockrect, dst_rect, 0)))
return D3DXERR_INVALIDDATA;
@ -147,7 +150,7 @@ index f187031..9a1e1cb 100644
}
else /* if ((filter & 0xf) == D3DX_FILTER_POINT) */
{
@@ -1860,14 +1931,30 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
@@ -1860,14 +1934,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. */
@ -182,5 +185,5 @@ index f187031..9a1e1cb 100644
/************************************************************
--
2.1.3
2.2.1

View File

@ -1081,7 +1081,7 @@ if [ "$enable_wined3d_DXTn" -eq 1 ]; then
patch_apply wined3d-DXTn/0002-wined3d-Improve-DXTn-support-and-export-conversion-f.patch
patch_apply wined3d-DXTn/0003-wined3d-add-DXT1-to-B4G4R4A4-DXT1-to-B5G5R5A1-and-DX.patch
(
echo '+ { "Michael Müller", "wined3d: Add support for DXTn software decoding through libtxc_dxtn.", 1 },';
echo '+ { "Michael Müller", "wined3d: Add support for DXTn software decoding through libtxc_dxtn.", 2 },';
echo '+ { "Christian Costa", "wined3d: Improve DXTn support and export conversion functions for d3dx9_36.", 1 },';
echo '+ { "Michael Müller", "wined3d: add DXT1 to B4G4R4A4, DXT1 to B5G5R5A1 and DXT3 to B4G4R4A4 conversion.", 1 },';
) >> "$patchlist"

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +1,35 @@
From fe8ff690267d0e3dbc4d7731dce1276bee2f037e Mon Sep 17 00:00:00 2001
From 6d4d989e34576a46c5b513b92bd8dbc84aaf199a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 20 Sep 2014 02:48:07 +0200
Subject: wined3d: Add support for DXTn software decoding through libtxc_dxtn.
(rev 2)
Changes in rev 2:
* Do not use dxtn library when some imports are missing.
* Do not advertise dxtn converter functions when they are not supported (because
of missing library or support not compiled in).
---
configure.ac | 9 ++
dlls/wined3d/Makefile.in | 1 +
dlls/wined3d/dxtn.c | 325 +++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/surface.c | 70 +++++++++
dlls/wined3d/dxtn.c | 332 +++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/surface.c | 80 ++++++++++
dlls/wined3d/wined3d_main.c | 5 +
dlls/wined3d/wined3d_private.h | 8 +
6 files changed, 418 insertions(+)
dlls/wined3d/wined3d_private.h | 13 ++
6 files changed, 440 insertions(+)
create mode 100644 dlls/wined3d/dxtn.c
diff --git a/configure.ac b/configure.ac
index ea016b1..c982f39 100644
index 8263c66..dd89c17 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,2 +76,3 @@ AC_ARG_WITH(sane, AS_HELP_STRING([--without-sane],[do not use SANE (scanner
@@ -74,6 +74,7 @@ AC_ARG_WITH(pthread, AS_HELP_STRING([--without-pthread],[do not use the pthrea
[if test "x$withval" = "xno"; then ac_cv_header_pthread_h=no; fi])
AC_ARG_WITH(sane, AS_HELP_STRING([--without-sane],[do not use SANE (scanner support)]))
AC_ARG_WITH(tiff, AS_HELP_STRING([--without-tiff],[do not use TIFF]))
+AC_ARG_WITH(txc_dxtn, AS_HELP_STRING([--without-txc_dxtn],[do not use txc_dxtn lib (DXTn software support)]))
AC_ARG_WITH(v4l, AS_HELP_STRING([--without-v4l],[do not use v4l1 (v4l support)]))
AC_ARG_WITH(xcomposite,AS_HELP_STRING([--without-xcomposite],[do not use the Xcomposite extension]),
[if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi])
@@ -1698,6 +1699,14 @@ fi
WINE_NOTICE_WITH(tiff,[test "x$ac_cv_lib_soname_tiff" = "x"],
[libtiff ${notice_platform}development files not found, TIFF won't be supported.])
@ -50,10 +59,10 @@ index 655800b..ee0615f 100644
nvidia_texture_shader.c \
diff --git a/dlls/wined3d/dxtn.c b/dlls/wined3d/dxtn.c
new file mode 100644
index 0000000..91b0c3d
index 0000000..eccce4e
--- /dev/null
+++ b/dlls/wined3d/dxtn.c
@@ -0,0 +1,325 @@
@@ -0,0 +1,332 @@
+/*
+ * Copyright 2014 Michael Müller
+ *
@ -213,11 +222,8 @@ index 0000000..91b0c3d
+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)
+{
+ if (!pfetch_2d_texel_rgba_dxt1)
+ {
+ FIXME("Failed to decode DXT1 image, there is a problem with %s.\n", SONAME_LIBTXC_DXTN);
+ if (!txc_dxtn_handle)
+ return FALSE;
+ }
+
+ switch (format)
+ {
@ -236,11 +242,8 @@ index 0000000..91b0c3d
+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)
+{
+ if (!ptx_compress_dxtn)
+ {
+ FIXME("Failed to encode DXT1 image, there is a problem with %s.\n", SONAME_LIBTXC_DXTN);
+ if (!txc_dxtn_handle)
+ return FALSE;
+ }
+
+ switch (format)
+ {
@ -267,11 +270,8 @@ index 0000000..91b0c3d
+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)
+{
+ if (!ptx_compress_dxtn)
+ {
+ FIXME("Failed to encode DXT3 image, there is a problem with %s.\n", SONAME_LIBTXC_DXTN);
+ if (!txc_dxtn_handle)
+ return FALSE;
+ }
+
+ switch (format)
+ {
@ -292,11 +292,8 @@ index 0000000..91b0c3d
+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)
+{
+ if (!ptx_compress_dxtn)
+ {
+ FIXME("Failed to encode DXT5 image, there is a problem with %s.\n", SONAME_LIBTXC_DXTN);
+ if (!txc_dxtn_handle)
+ return FALSE;
+ }
+
+ switch (format)
+ {
@ -323,12 +320,28 @@ index 0000000..91b0c3d
+ return FALSE;
+ }
+
+ #define LOAD_FUNCPTR(f) if((p##f = wine_dlsym(txc_dxtn_handle, #f, NULL, 0)) == NULL){WARN("Can't find symbol %s\n", #f);}
+ #define LOAD_FUNCPTR(f) \
+ if (!(p##f = wine_dlsym(txc_dxtn_handle, #f, NULL, 0))) \
+ { \
+ ERR("Can't find symbol %s in %s, DXTn software support unavailable.\n", #f, SONAME_LIBTXC_DXTN); \
+ goto error; \
+ }
+
+ LOAD_FUNCPTR(fetch_2d_texel_rgba_dxt1);
+ LOAD_FUNCPTR(tx_compress_dxtn);
+ #undef LOAD_FUNCPTR
+
+ #undef LOAD_FUNCPTR
+ return TRUE;
+
+error:
+ wine_dlclose(txc_dxtn_handle, NULL, 0);
+ txc_dxtn_handle = NULL;
+ return FALSE;
+}
+
+BOOL wined3d_dxtn_supported(void)
+{
+ return (txc_dxtn_handle != NULL);
+}
+
+void wined3d_dxtn_free(void)
@ -342,7 +355,6 @@ index 0000000..91b0c3d
+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)
+{
+ FIXME("Failed to convert DXT1 texture. Wine is compiled without DXT1 support.\n");
+ return FALSE;
+}
+
@ -350,21 +362,18 @@ index 0000000..91b0c3d
+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)
+{
+ FIXME("Failed to convert to DXT1 texture. Wine is compiled without DXT1 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)
+{
+ FIXME("Failed to convert to DXT3 texture. Wine is compiled without DXT3 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)
+{
+ FIXME("Failed to convert to DXT5 texture. Wine is compiled without DXT5 support.\n");
+ return FALSE;
+}
+
@ -373,6 +382,13 @@ index 0000000..91b0c3d
+ return FALSE;
+}
+
+BOOL wined3d_dxtn_supported(void)
+{
+ static int once;
+ if (!once++) FIXME("Wine is compiled without DXTn support, expect texture problems.\n");
+ return FALSE;
+}
+
+void wined3d_dxtn_free(void)
+{
+ /* nothing to do */
@ -381,10 +397,10 @@ index 0000000..91b0c3d
+#endif
\ No newline at end of file
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 092cbe6..2f9d323 100644
index fb27c8a..b9f6a12 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2415,6 +2415,66 @@ static void convert_yuy2_r5g6b5(const BYTE *src, BYTE *dst,
@@ -2416,6 +2416,66 @@ static void convert_yuy2_r5g6b5(const BYTE *src, BYTE *dst,
}
}
@ -451,10 +467,12 @@ index 092cbe6..2f9d323 100644
struct d3dfmt_converter_desc
{
enum wined3d_format_id from, to;
@@ -2429,6 +2489,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},
@@ -2432,6 +2492,20 @@ static const struct d3dfmt_converter_desc converters[] =
{WINED3DFMT_YUY2, WINED3DFMT_B5G6R5_UNORM, convert_yuy2_r5g6b5},
};
+static const struct d3dfmt_converter_desc dxtn_converters[] =
+{
+ {WINED3DFMT_DXT1, WINED3DFMT_B8G8R8A8_UNORM, convert_dxt1_a8r8g8b8},
+ {WINED3DFMT_DXT1, WINED3DFMT_B8G8R8X8_UNORM, convert_dxt1_x8r8g8b8},
+ {WINED3DFMT_B8G8R8A8_UNORM, WINED3DFMT_DXT1, convert_a8r8g8b8_dxt1},
@ -465,9 +483,24 @@ index 092cbe6..2f9d323 100644
+ {WINED3DFMT_B8G8R8X8_UNORM, WINED3DFMT_DXT3, convert_x8r8g8b8_dxt3},
+ {WINED3DFMT_B8G8R8A8_UNORM, WINED3DFMT_DXT5, convert_a8r8g8b8_dxt5},
+ {WINED3DFMT_B8G8R8X8_UNORM, WINED3DFMT_DXT5, convert_x8r8g8b8_dxt5}
};
+};
+
static inline const struct d3dfmt_converter_desc *find_converter(enum wined3d_format_id from,
enum wined3d_format_id to)
{
@@ -2443,6 +2517,12 @@ static inline const struct d3dfmt_converter_desc *find_converter(enum wined3d_fo
return &converters[i];
}
+ for (i = 0; i < (sizeof(dxtn_converters) / sizeof(*dxtn_converters)); ++i)
+ {
+ if (dxtn_converters[i].from == from && dxtn_converters[i].to == to)
+ return wined3d_dxtn_supported() ? &dxtn_converters[i] : NULL;
+ }
+
return NULL;
}
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
index 758ba43..08021a2 100644
--- a/dlls/wined3d/wined3d_main.c
@ -492,24 +525,29 @@ index 758ba43..08021a2 100644
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index f4ded4f..c1df04c 100644
index 047946b..75ec61d 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3120,6 +3120,14 @@ static inline void context_apply_state(struct wined3d_context *context,
@@ -3170,6 +3170,19 @@ 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_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h) DECLSPEC_HIDDEN;
+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) DECLSPEC_HIDDEN;
+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) DECLSPEC_HIDDEN;
+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) DECLSPEC_HIDDEN;
+
+BOOL wined3d_dxtn_init(void);
+void wined3d_dxtn_free(void);
+BOOL wined3d_dxtn_init(void) DECLSPEC_HIDDEN;
+BOOL wined3d_dxtn_supported(void) DECLSPEC_HIDDEN;
+void wined3d_dxtn_free(void) DECLSPEC_HIDDEN;
+
/* The WNDCLASS-Name for the fake window which we use to retrieve the GL capabilities */
#define WINED3D_OPENGL_WINDOW_CLASS_NAME "WineD3D_OpenGL"
--
1.9.1
2.2.1

View File

@ -1,19 +1,19 @@
From 4222334f4c1f6107fc323149456c8684ace91a86 Mon Sep 17 00:00:00 2001
From 417bd12edc493639c12f1e0199e55609fc1f7711 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(-)
dlls/wined3d/dxtn.c | 121 ++++++++++++++++++++++++++++++++++++++++-
dlls/wined3d/surface.c | 31 +++++++++++
dlls/wined3d/wined3d.spec | 8 +++
dlls/wined3d/wined3d_private.h | 10 ----
include/wine/wined3d.h | 14 +++++
5 files changed, 173 insertions(+), 11 deletions(-)
diff --git a/dlls/wined3d/dxtn.c b/dlls/wined3d/dxtn.c
index 9c5eef9..c9889cc 100644
index eccce4e..6623e64 100644
--- a/dlls/wined3d/dxtn.c
+++ b/dlls/wined3d/dxtn.c
@@ -27,6 +27,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
@ -96,18 +96,15 @@ index 9c5eef9..c9889cc 100644
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
@@ -174,6 +240,46 @@ 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);
+ if (!txc_dxtn_handle)
+ return FALSE;
+ }
+
+ switch (format)
+ {
@ -126,11 +123,8 @@ index 9c5eef9..c9889cc 100644
+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);
+ if (!txc_dxtn_handle)
+ return FALSE;
+ }
+
+ switch (format)
+ {
@ -149,37 +143,41 @@ index 9c5eef9..c9889cc 100644
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)
@@ -263,6 +369,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
#undef LOAD_FUNCPTR
@@ -293,19 +401,30 @@ BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch
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)
{
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;
+}
+
@ -187,10 +185,10 @@ index 9c5eef9..c9889cc 100644
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
index c91ba74..4fc917d 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,
@@ -2428,6 +2428,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);
}
@ -221,11 +219,10 @@ index 2f9d323..e224df4 100644
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},
+
@@ -2494,8 +2518,15 @@ static const struct d3dfmt_converter_desc converters[] =
static const struct d3dfmt_converter_desc dxtn_converters[] =
{
+ /* decode DXT */
{WINED3DFMT_DXT1, WINED3DFMT_B8G8R8A8_UNORM, convert_dxt1_a8r8g8b8},
{WINED3DFMT_DXT1, WINED3DFMT_B8G8R8X8_UNORM, convert_dxt1_x8r8g8b8},
@ -239,14 +236,15 @@ index 2f9d323..e224df4 100644
{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
index 7a77003..9ce4981 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -288,3 +288,10 @@
@@ -288,3 +288,11 @@
@ cdecl wined3d_volume_map(ptr ptr ptr long)
@ cdecl wined3d_volume_preload(ptr)
@ cdecl wined3d_volume_unmap(ptr)
+
+@ cdecl wined3d_dxtn_supported()
+@ 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)
@ -254,37 +252,50 @@ index 7a77003..eca8875 100644
+@ 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 e47f5ce..8112cbc 100644
index 75ec61d..6ebb210 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3151,11 +3151,6 @@ static inline void context_apply_state(struct wined3d_context *context,
@@ -3170,17 +3170,7 @@ 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_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
- enum wined3d_format_id format, unsigned int w, unsigned int h) DECLSPEC_HIDDEN;
-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) DECLSPEC_HIDDEN;
-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) DECLSPEC_HIDDEN;
-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) DECLSPEC_HIDDEN;
-
BOOL wined3d_dxtn_init(void);
void wined3d_dxtn_free(void);
BOOL wined3d_dxtn_init(void) DECLSPEC_HIDDEN;
-BOOL wined3d_dxtn_supported(void) DECLSPEC_HIDDEN;
void wined3d_dxtn_free(void) DECLSPEC_HIDDEN;
/* The WNDCLASS-Name for the fake window which we use to retrieve the GL capabilities */
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 0cf26e1..3e3ac86 100644
index 6e06388..92e8169 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2590,4 +2590,11 @@ static inline unsigned int wined3d_log2i(unsigned int x)
@@ -2597,4 +2597,18 @@ static inline unsigned int wined3d_log2i(unsigned int x)
#endif
}
+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);
+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);
+BOOL wined3d_dxtn_supported(void);
+
#endif /* __WINE_WINED3D_H */
--
1.9.1
2.2.1

View File

@ -1,4 +1,4 @@
From 845cd7d5bb57a9d54987de39073f2efd2de5ccc4 Mon Sep 17 00:00:00 2001
From 69d910d52fb2c6a98a6658faa2efa9b95982e68b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Wed, 26 Nov 2014 14:24:57 +0100
Subject: wined3d: add DXT1 to B4G4R4A4, DXT1 to B5G5R5A1 and DXT3 to B4G4R4A4
@ -10,7 +10,7 @@ Subject: wined3d: add DXT1 to B4G4R4A4, DXT1 to B5G5R5A1 and DXT3 to B4G4R4A4
2 files changed, 150 insertions(+)
diff --git a/dlls/wined3d/dxtn.c b/dlls/wined3d/dxtn.c
index c9889cc..fa8c789 100644
index 6623e64..57da0df 100644
--- a/dlls/wined3d/dxtn.c
+++ b/dlls/wined3d/dxtn.c
@@ -64,6 +64,70 @@ static inline BOOL dxt1_to_x8r8g8b8(const BYTE *src, BYTE *dst, DWORD pitch_in,
@ -123,7 +123,7 @@ index c9889cc..fa8c789 100644
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)
{
@@ -235,6 +331,14 @@ BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch
@@ -232,6 +328,14 @@ BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch
return dxt1_to_x8r8g8b8(src, dst, pitch_in, pitch_out, w, h, TRUE);
case WINED3DFMT_B8G8R8X8_UNORM:
return dxt1_to_x8r8g8b8(src, dst, pitch_in, pitch_out, w, h, FALSE);
@ -138,7 +138,7 @@ index c9889cc..fa8c789 100644
default:
break;
}
@@ -258,6 +362,10 @@ BOOL wined3d_dxt3_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch
@@ -252,6 +356,10 @@ BOOL wined3d_dxt3_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch
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);
@ -150,10 +150,10 @@ index c9889cc..fa8c789 100644
break;
}
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index e224df4..a123ffd 100644
index 4fc917d..689fc0e 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,
@@ -2428,6 +2428,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);
}
@ -184,7 +184,7 @@ index e224df4..a123ffd 100644
static void convert_dxt3_a8r8g8b8(const BYTE *src, BYTE *dst,
DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
{
@@ -2439,6 +2463,18 @@ static void convert_dxt3_x8r8g8b8(const BYTE *src, BYTE *dst,
@@ -2440,6 +2464,18 @@ static void convert_dxt3_x8r8g8b8(const BYTE *src, BYTE *dst,
wined3d_dxt3_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8X8_UNORM, w, h);
}
@ -203,7 +203,7 @@ index e224df4..a123ffd 100644
static void convert_dxt5_a8r8g8b8(const BYTE *src, BYTE *dst,
DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
{
@@ -2517,8 +2553,14 @@ static const struct d3dfmt_converter_desc converters[] =
@@ -2521,8 +2557,14 @@ static const struct d3dfmt_converter_desc dxtn_converters[] =
/* decode DXT */
{WINED3DFMT_DXT1, WINED3DFMT_B8G8R8A8_UNORM, convert_dxt1_a8r8g8b8},
{WINED3DFMT_DXT1, WINED3DFMT_B8G8R8X8_UNORM, convert_dxt1_x8r8g8b8},
@ -219,5 +219,5 @@ index e224df4..a123ffd 100644
{WINED3DFMT_DXT5, WINED3DFMT_B8G8R8X8_UNORM, convert_dxt5_x8r8g8b8},
--
1.9.1
2.2.1