https://git.reactos.org/?p=reactos.git;a=commitdiff;h=44db8b970bd910f0f4a6027ab6acaaab2dcc9e78

commit 44db8b970bd910f0f4a6027ab6acaaab2dcc9e78
Author:     winesync <[email protected]>
AuthorDate: Mon Sep 21 23:03:26 2020 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Thu Feb 4 16:37:05 2021 +0100

    [WINESYNC] d3dx9: Support D3DFMT_X8L8V8U8 in DDS files.
    
    Signed-off-by: Zebediah Figura <[email protected]>
    Signed-off-by: Matteo Bruni <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 06918ba76bdc109e59fdc1d8ee00c46f6857bbd2 by Christian Costa 
<[email protected]>
---
 dll/directx/wine/d3dx9_36/surface.c           | 14 ++++++++++++++
 modules/rostests/winetests/d3dx9_36/surface.c |  2 ++
 sdk/tools/winesync/d3dx9.cfg                  |  2 +-
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/dll/directx/wine/d3dx9_36/surface.c 
b/dll/directx/wine/d3dx9_36/surface.c
index eaaca8ca252..0417e0e0ab6 100644
--- a/dll/directx/wine/d3dx9_36/surface.c
+++ b/dll/directx/wine/d3dx9_36/surface.c
@@ -115,6 +115,7 @@ static const GUID *d3dformat_to_wic_guid(D3DFORMAT format)
 #define DDS_PF_RGB 0x40
 #define DDS_PF_YUV 0x200
 #define DDS_PF_LUMINANCE 0x20000
+#define DDS_PF_BUMPLUMINANCE 0x40000
 #define DDS_PF_BUMPDUDV 0x80000
 
 struct dds_pixel_format
@@ -364,6 +365,17 @@ static D3DFORMAT dds_bump_to_d3dformat(const struct 
dds_pixel_format *pixel_form
     return D3DFMT_UNKNOWN;
 }
 
+static D3DFORMAT dds_bump_luminance_to_d3dformat(const struct dds_pixel_format 
*pixel_format)
+{
+    if (pixel_format->bpp == 32 && pixel_format->rmask == 0x000000ff && 
pixel_format->gmask == 0x0000ff00
+            && pixel_format->bmask == 0x00ff0000)
+        return D3DFMT_X8L8V8U8;
+
+    WARN("Unknown bump pixel format (%u, %#x, %#x, %#x, %#x).\n", 
pixel_format->bpp,
+        pixel_format->rmask, pixel_format->gmask, pixel_format->bmask, 
pixel_format->amask);
+    return D3DFMT_UNKNOWN;
+}
+
 static D3DFORMAT dds_pixel_format_to_d3dformat(const struct dds_pixel_format 
*pixel_format)
 {
     TRACE("pixel_format: size %u, flags %#x, fourcc %#x, bpp %u.\n", 
pixel_format->size,
@@ -381,6 +393,8 @@ static D3DFORMAT dds_pixel_format_to_d3dformat(const struct 
dds_pixel_format *pi
         return dds_alpha_to_d3dformat(pixel_format);
     if (pixel_format->flags & DDS_PF_BUMPDUDV)
         return dds_bump_to_d3dformat(pixel_format);
+    if (pixel_format->flags & DDS_PF_BUMPLUMINANCE)
+        return dds_bump_luminance_to_d3dformat(pixel_format);
 
     WARN("Unknown pixel format (flags %#x, fourcc %#x, bpp %u, r %#x, g %#x, b 
%#x, a %#x)\n",
         pixel_format->flags, pixel_format->fourcc, pixel_format->bpp,
diff --git a/modules/rostests/winetests/d3dx9_36/surface.c 
b/modules/rostests/winetests/d3dx9_36/surface.c
index 1a39d82961d..d5d3d6d2112 100644
--- a/modules/rostests/winetests/d3dx9_36/surface.c
+++ b/modules/rostests/winetests/d3dx9_36/surface.c
@@ -235,6 +235,7 @@ static HRESULT create_file(const char *filename, const 
unsigned char *data, cons
 #define DDS_PF_FOURCC 0x00000004
 #define DDS_PF_RGB 0x00000040
 #define DDS_PF_LUMINANCE 0x00020000
+#define DDS_PF_BUMPLUMINANCE 0x00040000
 #define DDS_PF_BUMPDUDV 0x00080000
 
 struct dds_pixel_format
@@ -703,6 +704,7 @@ static void test_D3DXGetImageInfo(void)
     check_dds_pixel_format(DDS_PF_LUMINANCE | DDS_PF_ALPHA, 0, 8, 0x0f, 0, 0, 
0xf0, D3DFMT_A4L4);
     check_dds_pixel_format(DDS_PF_BUMPDUDV, 0, 16, 0x00ff, 0xff00, 0, 0, 
D3DFMT_V8U8);
     check_dds_pixel_format(DDS_PF_BUMPDUDV, 0, 32, 0x0000ffff, 0xffff0000, 0, 
0, D3DFMT_V16U16);
+    check_dds_pixel_format(DDS_PF_BUMPLUMINANCE, 0, 32, 0x0000ff, 0x00ff00, 
0xff0000, 0, D3DFMT_X8L8V8U8);
 
     test_dds_header_handling();
 
diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg
index 0d1597fd121..a14ba7b49d4 100644
--- a/sdk/tools/winesync/d3dx9.cfg
+++ b/sdk/tools/winesync/d3dx9.cfg
@@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, 
include/d3dx9anim.h: sdk/inc
   include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: 
sdk/include/dxsdk/d3dx9of.h,
   include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, 
include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h,
   include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: 
sdk/include/dxsdk/d3dx9xof.h}
-tags: {wine: ef889fe654e8bef81c009b93501b6c0411cd8354}
+tags: {wine: 06918ba76bdc109e59fdc1d8ee00c46f6857bbd2}

Reply via email to