Henri Verbeet : wined3d: Add a conversion function for WINED3DFMT_X8D24_UNORM.
Alexandre Julliard
julliard at winehq.org
Wed May 24 17:17:33 CDT 2017
Module: wine
Branch: master
Commit: 2ed609f15da7c7f8bde54f6d4d895c72f96dd950
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2ed609f15da7c7f8bde54f6d4d895c72f96dd950
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Wed May 24 11:22:09 2017 +0200
wined3d: Add a conversion function for WINED3DFMT_X8D24_UNORM.
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wined3d/utils.c | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 78ada57..2bdc9e2 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -828,6 +828,26 @@ static void convert_s8_uint_d24_float(const BYTE *src, BYTE *dst, UINT src_row_p
}
}
+static void convert_x8_d24_unorm(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch,
+ UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
+{
+ unsigned int x, y, z;
+
+ for (z = 0; z < depth; ++z)
+ {
+ for (y = 0; y < height; ++y)
+ {
+ const DWORD *source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
+ DWORD *dest = (DWORD *)(dst + z * dst_slice_pitch + y * dst_row_pitch);
+
+ for (x = 0; x < width; ++x)
+ {
+ dest[x] = source[x] << 8 | source[x] >> 16;
+ }
+ }
+ }
+}
+
static BOOL color_in_range(const struct wined3d_color_key *color_key, DWORD color)
{
/* FIXME: Is this really how color keys are supposed to work? I think it
@@ -1571,14 +1591,14 @@ static const struct wined3d_format_texture_info format_texture_info[] =
| WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL | WINED3DFMT_FLAG_SHADOW,
ARB_FRAMEBUFFER_OBJECT, NULL},
{WINED3DFMT_X8D24_UNORM, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, 0,
- GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0,
+ GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 4,
WINED3DFMT_FLAG_DEPTH,
- WINED3D_GL_EXT_NONE, NULL},
+ WINED3D_GL_EXT_NONE, convert_x8_d24_unorm},
{WINED3DFMT_X8D24_UNORM, GL_DEPTH_COMPONENT24_ARB, GL_DEPTH_COMPONENT24_ARB, 0,
- GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0,
+ GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 4,
WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING
| WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_SHADOW,
- ARB_DEPTH_TEXTURE, NULL},
+ ARB_DEPTH_TEXTURE, convert_x8_d24_unorm},
{WINED3DFMT_S4X4_UINT_D24_UNORM, GL_DEPTH_COMPONENT24_ARB, GL_DEPTH_COMPONENT24_ARB, 0,
GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0,
WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_SHADOW,
More information about the wine-cvs
mailing list