You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
Updated d3dx9_36-DXTn patchset
Make dxtn library internal.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
1693
patches/wined3d-DXTn/0001-wined3d-add-DXTn-support.patch
Normal file
1693
patches/wined3d-DXTn/0001-wined3d-add-DXTn-support.patch
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,269 +0,0 @@
|
||||
From 3887fb8fe306cce71cd026c060346083659bf20b 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 | 108 +++++++++++++++++++++++++++++++++++++++++
|
||||
dlls/wined3d/surface.c | 31 ++++++++++++
|
||||
dlls/wined3d/wined3d.spec | 8 +++
|
||||
dlls/wined3d/wined3d_private.h | 10 ----
|
||||
include/wine/wined3d.h | 14 ++++++
|
||||
5 files changed, 161 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/dxtn.c b/dlls/wined3d/dxtn.c
|
||||
index ce989490ef..77f7d550a5 100644
|
||||
--- a/dlls/wined3d/dxtn.c
|
||||
+++ b/dlls/wined3d/dxtn.c
|
||||
@@ -25,6 +25,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);
|
||||
|
||||
@@ -60,6 +62,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)
|
||||
{
|
||||
@@ -172,6 +238,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 (!txc_dxtn_handle)
|
||||
+ 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 (!txc_dxtn_handle)
|
||||
+ 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)
|
||||
{
|
||||
@@ -276,6 +382,8 @@ BOOL wined3d_dxtn_init(void)
|
||||
}
|
||||
|
||||
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
|
||||
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
|
||||
index 3a91e98e98..a694de41d2 100644
|
||||
--- a/dlls/wined3d/surface.c
|
||||
+++ b/dlls/wined3d/surface.c
|
||||
@@ -1227,6 +1227,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)
|
||||
{
|
||||
@@ -1293,8 +1317,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},
|
||||
+ {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 12246122f0..ed943dcf69 100644
|
||||
--- a/dlls/wined3d/wined3d.spec
|
||||
+++ b/dlls/wined3d/wined3d.spec
|
||||
@@ -295,3 +295,11 @@
|
||||
@ cdecl wined3d_vertex_declaration_decref(ptr)
|
||||
@ cdecl wined3d_vertex_declaration_get_parent(ptr)
|
||||
@ cdecl wined3d_vertex_declaration_incref(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)
|
||||
+@ 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 e6f9ebc79a..a5eeb31f3e 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -4062,17 +4062,7 @@ static inline void wined3d_not_from_cs(struct wined3d_cs *cs)
|
||||
assert(cs->thread_id != GetCurrentThreadId());
|
||||
}
|
||||
|
||||
-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) 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 2831357c6e..bbd5be95bf 100644
|
||||
--- a/include/wine/wined3d.h
|
||||
+++ b/include/wine/wined3d.h
|
||||
@@ -2680,4 +2680,18 @@ static inline void wined3d_box_set(struct wined3d_box *box, unsigned int left, u
|
||||
box->back = back;
|
||||
}
|
||||
|
||||
+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 */
|
||||
--
|
||||
2.11.0
|
||||
|
@@ -1,223 +0,0 @@
|
||||
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
|
||||
conversion.
|
||||
|
||||
---
|
||||
dlls/wined3d/dxtn.c | 108 +++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
dlls/wined3d/surface.c | 42 +++++++++++++++++++
|
||||
2 files changed, 150 insertions(+)
|
||||
|
||||
diff --git a/dlls/wined3d/dxtn.c b/dlls/wined3d/dxtn.c
|
||||
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,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+static inline BOOL dxt1_to_x4r4g4b4(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)
|
||||
+ {
|
||||
+ WORD *dst_line = (WORD *)(dst + y * pitch_out);
|
||||
+ for (x = 0; x < w; ++x)
|
||||
+ {
|
||||
+ /* pfetch_2d_texel_rgba_dxt1 doesn't correctly handle pitch */
|
||||
+ pfetch_2d_texel_rgba_dxt1(0, src + (y / 4) * pitch_in + (x / 4) * 16,
|
||||
+ x & 3, y & 3, &color);
|
||||
+ if (alpha)
|
||||
+ {
|
||||
+ dst_line[x] = ((color & 0xf0000000) >> 16) | ((color & 0xf00000) >> 20) |
|
||||
+ ((color & 0xf000) >> 8) | ((color & 0xf0) << 4);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ dst_line[x] = 0xf000 | ((color & 0xf00000) >> 20) |
|
||||
+ ((color & 0xf000) >> 8) | ((color & 0xf0) << 4);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
+static inline BOOL dxt1_to_x1r5g5b5(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)
|
||||
+ {
|
||||
+ WORD *dst_line = (WORD *)(dst + y * pitch_out);
|
||||
+ for (x = 0; x < w; ++x)
|
||||
+ {
|
||||
+ /* pfetch_2d_texel_rgba_dxt1 doesn't correctly handle pitch */
|
||||
+ pfetch_2d_texel_rgba_dxt1(0, src + (y / 4) * pitch_in + (x / 4) * 16,
|
||||
+ x & 3, y & 3, &color);
|
||||
+ if (alpha)
|
||||
+ {
|
||||
+ dst_line[x] = ((color & 0x80000000) >> 16) | ((color & 0xf80000) >> 19) |
|
||||
+ ((color & 0xf800) >> 6) | ((color & 0xf8) << 7);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ dst_line[x] = 0x8000 | ((color & 0xf80000) >> 19) |
|
||||
+ ((color & 0xf800) >> 6) | ((color & 0xf8) << 7);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ 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)
|
||||
{
|
||||
@@ -96,6 +160,38 @@ static inline BOOL dxt3_to_x8r8g8b8(const BYTE *src, BYTE *dst, DWORD pitch_in,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+static inline BOOL dxt3_to_x4r4g4b4(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)
|
||||
+ {
|
||||
+ WORD *dst_line = (WORD *)(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 & 0xf0000000) >> 16) | ((color & 0xf00000) >> 20) |
|
||||
+ ((color & 0xf000) >> 8) | ((color & 0xf0) << 4);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ dst_line[x] = 0xf000 | ((color & 0xf00000) >> 20) |
|
||||
+ ((color & 0xf000) >> 8) | ((color & 0xf0) << 4);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ 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)
|
||||
{
|
||||
@@ -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);
|
||||
+ case WINED3DFMT_B4G4R4A4_UNORM:
|
||||
+ return dxt1_to_x4r4g4b4(src, dst, pitch_in, pitch_out, w, h, TRUE);
|
||||
+ case WINED3DFMT_B4G4R4X4_UNORM:
|
||||
+ return dxt1_to_x4r4g4b4(src, dst, pitch_in, pitch_out, w, h, FALSE);
|
||||
+ case WINED3DFMT_B5G5R5A1_UNORM:
|
||||
+ return dxt1_to_x1r5g5b5(src, dst, pitch_in, pitch_out, w, h, TRUE);
|
||||
+ case WINED3DFMT_B5G5R5X1_UNORM:
|
||||
+ return dxt1_to_x1r5g5b5(src, dst, pitch_in, pitch_out, w, h, FALSE);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -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);
|
||||
+ case WINED3DFMT_B4G4R4A4_UNORM:
|
||||
+ return dxt3_to_x4r4g4b4(src, dst, pitch_in, pitch_out, w, h, TRUE);
|
||||
+ case WINED3DFMT_B4G4R4X4_UNORM:
|
||||
+ return dxt3_to_x4r4g4b4(src, dst, pitch_in, pitch_out, w, h, FALSE);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
|
||||
index 4fc917d..689fc0e 100644
|
||||
--- a/dlls/wined3d/surface.c
|
||||
+++ b/dlls/wined3d/surface.c
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
+static void convert_dxt1_a4r4g4b4(const BYTE *src, BYTE *dst,
|
||||
+ DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
|
||||
+{
|
||||
+ wined3d_dxt1_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B4G4R4A4_UNORM, w, h);
|
||||
+}
|
||||
+
|
||||
+static void convert_dxt1_x4r4g4b4(const BYTE *src, BYTE *dst,
|
||||
+ DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
|
||||
+{
|
||||
+ wined3d_dxt1_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B4G4R4X4_UNORM, w, h);
|
||||
+}
|
||||
+
|
||||
+static void convert_dxt1_a1r5g5b5(const BYTE *src, BYTE *dst,
|
||||
+ DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
|
||||
+{
|
||||
+ wined3d_dxt1_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B5G5R5A1_UNORM, w, h);
|
||||
+}
|
||||
+
|
||||
+static void convert_dxt1_x1r5g5b5(const BYTE *src, BYTE *dst,
|
||||
+ DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
|
||||
+{
|
||||
+ wined3d_dxt1_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B5G5R5X1_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)
|
||||
{
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
+static void convert_dxt3_a4r4g4b4(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_B4G4R4A4_UNORM, w, h);
|
||||
+}
|
||||
+
|
||||
+static void convert_dxt3_x4r4g4b4(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_B4G4R4X4_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)
|
||||
{
|
||||
@@ -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},
|
||||
+ {WINED3DFMT_DXT1, WINED3DFMT_B4G4R4A4_UNORM, convert_dxt1_a4r4g4b4},
|
||||
+ {WINED3DFMT_DXT1, WINED3DFMT_B4G4R4X4_UNORM, convert_dxt1_x4r4g4b4},
|
||||
+ {WINED3DFMT_DXT1, WINED3DFMT_B5G5R5A1_UNORM, convert_dxt1_a1r5g5b5},
|
||||
+ {WINED3DFMT_DXT1, WINED3DFMT_B5G5R5X1_UNORM, convert_dxt1_x1r5g5b5},
|
||||
{WINED3DFMT_DXT3, WINED3DFMT_B8G8R8A8_UNORM, convert_dxt3_a8r8g8b8},
|
||||
{WINED3DFMT_DXT3, WINED3DFMT_B8G8R8X8_UNORM, convert_dxt3_x8r8g8b8},
|
||||
+ {WINED3DFMT_DXT3, WINED3DFMT_B4G4R4A4_UNORM, convert_dxt3_a4r4g4b4},
|
||||
+ {WINED3DFMT_DXT3, WINED3DFMT_B4G4R4X4_UNORM, convert_dxt3_x4r4g4b4},
|
||||
{WINED3DFMT_DXT5, WINED3DFMT_B8G8R8A8_UNORM, convert_dxt5_a8r8g8b8},
|
||||
{WINED3DFMT_DXT5, WINED3DFMT_B8G8R8X8_UNORM, convert_dxt5_x8r8g8b8},
|
||||
|
||||
--
|
||||
2.2.1
|
||||
|
@@ -1,27 +0,0 @@
|
||||
From d8452914d07d7a24aa2647bf7c98383d962693f9 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sat, 27 Jun 2015 22:26:14 +0200
|
||||
Subject: wined3d: Load dxtn dylib library on Mac OS X.
|
||||
|
||||
---
|
||||
dlls/wined3d/dxtn.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/dlls/wined3d/dxtn.c b/dlls/wined3d/dxtn.c
|
||||
index 2639788..03e4b26 100644
|
||||
--- a/dlls/wined3d/dxtn.c
|
||||
+++ b/dlls/wined3d/dxtn.c
|
||||
@@ -465,6 +465,10 @@ BOOL wined3d_dxtn_init(void)
|
||||
#ifdef SONAME_LIBTXC_DXTN
|
||||
SONAME_LIBTXC_DXTN,
|
||||
#endif
|
||||
+#ifdef __APPLE__
|
||||
+ "libtxc_dxtn.dylib",
|
||||
+ "libtxc_dxtn_s2tc.dylib",
|
||||
+#endif
|
||||
"libtxc_dxtn.so",
|
||||
"libtxc_dxtn_s2tc.so.0"
|
||||
};
|
||||
--
|
||||
2.4.3
|
||||
|
Reference in New Issue
Block a user