From cc62b92f5e7b13cca1a8af2d5fbc95634ce7138b Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Tue, 17 May 2016 14:51:17 +0200 Subject: [PATCH] Added patch to recognize bump luminance X8L8V8U8 when loading dds file. --- ...ze-bump-luminance-X8L8V8U8-when-load.patch | 51 +++++++++++++++++++ ...mat-description-for-X8L8V8U8-for-for.patch | 24 +++++++++ patches/d3dx9_36-BumpLuminance/definition | 1 + patches/patchinstall.sh | 18 +++++++ 4 files changed, 94 insertions(+) create mode 100644 patches/d3dx9_36-BumpLuminance/0001-d3dx9_36-Recognize-bump-luminance-X8L8V8U8-when-load.patch create mode 100644 patches/d3dx9_36-BumpLuminance/0002-d3dx9_36-Add-format-description-for-X8L8V8U8-for-for.patch create mode 100644 patches/d3dx9_36-BumpLuminance/definition diff --git a/patches/d3dx9_36-BumpLuminance/0001-d3dx9_36-Recognize-bump-luminance-X8L8V8U8-when-load.patch b/patches/d3dx9_36-BumpLuminance/0001-d3dx9_36-Recognize-bump-luminance-X8L8V8U8-when-load.patch new file mode 100644 index 00000000..5197ef2c --- /dev/null +++ b/patches/d3dx9_36-BumpLuminance/0001-d3dx9_36-Recognize-bump-luminance-X8L8V8U8-when-load.patch @@ -0,0 +1,51 @@ +From 5bd7e977e0145a8e222ab66676bed7c0ff4d5b44 Mon Sep 17 00:00:00 2001 +From: Christian Costa +Date: Mon, 16 May 2016 13:19:06 +0200 +Subject: d3dx9_36: Recognize bump luminance X8L8V8U8 when loading dds file. + +--- + dlls/d3dx9_36/surface.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c +index 1bfe75a..f670860 100644 +--- a/dlls/d3dx9_36/surface.c ++++ b/dlls/d3dx9_36/surface.c +@@ -110,6 +110,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 +@@ -265,6 +266,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, +@@ -282,6 +294,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, +-- +2.8.0 + diff --git a/patches/d3dx9_36-BumpLuminance/0002-d3dx9_36-Add-format-description-for-X8L8V8U8-for-for.patch b/patches/d3dx9_36-BumpLuminance/0002-d3dx9_36-Add-format-description-for-X8L8V8U8-for-for.patch new file mode 100644 index 00000000..d3171f52 --- /dev/null +++ b/patches/d3dx9_36-BumpLuminance/0002-d3dx9_36-Add-format-description-for-X8L8V8U8-for-for.patch @@ -0,0 +1,24 @@ +From 170a6d9df910f617585791df31aa72b79622ed0b Mon Sep 17 00:00:00 2001 +From: Christian Costa +Date: Mon, 16 May 2016 13:20:39 +0200 +Subject: d3dx9_36: Add format description for X8L8V8U8 for format conversions. + +--- + dlls/d3dx9_36/util.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/dlls/d3dx9_36/util.c b/dlls/d3dx9_36/util.c +index d8cd43a..12b9c2c 100644 +--- a/dlls/d3dx9_36/util.c ++++ b/dlls/d3dx9_36/util.c +@@ -90,6 +90,7 @@ static const struct pixel_format_desc formats[] = + {D3DFMT_G32R32F, { 0, 32, 32, 0}, { 0, 0, 32, 0}, 8, 1, 1, 8, FORMAT_ARGBF, NULL, NULL }, + {D3DFMT_A32B32G32R32F, {32, 32, 32, 32}, {96, 0, 32, 64}, 16, 1, 1, 16, FORMAT_ARGBF, NULL, NULL }, + {D3DFMT_P8, { 8, 8, 8, 8}, { 0, 0, 0, 0}, 1, 1, 1, 1, FORMAT_INDEX, NULL, index_to_rgba}, ++ {D3DFMT_X8L8V8U8, { 0, 8, 8, 8}, { 0, 0, 8, 16}, 4, 1, 1, 4, FORMAT_ARGB, NULL, NULL }, + /* marks last element */ + {D3DFMT_UNKNOWN, { 0, 0, 0, 0}, { 0, 0, 0, 0}, 0, 1, 1, 0, FORMAT_UNKNOWN, NULL, NULL }, + }; +-- +2.8.0 + diff --git a/patches/d3dx9_36-BumpLuminance/definition b/patches/d3dx9_36-BumpLuminance/definition new file mode 100644 index 00000000..c99a5b22 --- /dev/null +++ b/patches/d3dx9_36-BumpLuminance/definition @@ -0,0 +1 @@ +Fixes: Recognize bump luminance X8L8V8U8 when loading dds file diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index add7b423..974b839c 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -109,6 +109,7 @@ patch_enable_all () enable_d3dx9_25_ID3DXEffect="$1" enable_d3dx9_26_ID3DXEffect="$1" enable_d3dx9_33_Share_Source="$1" + enable_d3dx9_36_BumpLuminance="$1" enable_d3dx9_36_CloneEffect="$1" enable_d3dx9_36_D3DXCreateTeapot="$1" enable_d3dx9_36_D3DXDisassembleShader="$1" @@ -505,6 +506,9 @@ patch_enable () d3dx9_33-Share_Source) enable_d3dx9_33_Share_Source="$2" ;; + d3dx9_36-BumpLuminance) + enable_d3dx9_36_BumpLuminance="$2" + ;; d3dx9_36-CloneEffect) enable_d3dx9_36_CloneEffect="$2" ;; @@ -3046,6 +3050,20 @@ if test "$enable_d3dx9_33_Share_Source" -eq 1; then ) >> "$patchlist" fi +# Patchset d3dx9_36-BumpLuminance +# | +# | Modified files: +# | * dlls/d3dx9_36/surface.c, dlls/d3dx9_36/util.c +# | +if test "$enable_d3dx9_36_BumpLuminance" -eq 1; then + patch_apply d3dx9_36-BumpLuminance/0001-d3dx9_36-Recognize-bump-luminance-X8L8V8U8-when-load.patch + patch_apply d3dx9_36-BumpLuminance/0002-d3dx9_36-Add-format-description-for-X8L8V8U8-for-for.patch + ( + echo '+ { "Christian Costa", "d3dx9_36: Recognize bump luminance X8L8V8U8 when loading dds file.", 1 },'; + echo '+ { "Christian Costa", "d3dx9_36: Add format description for X8L8V8U8 for format conversions.", 1 },'; + ) >> "$patchlist" +fi + # Patchset d3dx9_36-CloneEffect # | # | Modified files: