diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 39f68abe..77d8d811 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -437,6 +437,7 @@ patch_enable_all () enable_wined3d_WINED3DFMT_R32G32_UINT="$1" enable_wined3d_buffer_create="$1" enable_wined3d_buffer_sync_apple="$1" + enable_wined3d_sample_c_lz="$1" enable_wined3d_wined3d_guess_gl_vendor="$1" enable_winedbg_Process_Arguments="$1" enable_winedevice_Default_Drivers="$1" @@ -1554,6 +1555,9 @@ patch_enable () wined3d-buffer_sync_apple) enable_wined3d_buffer_sync_apple="$2" ;; + wined3d-sample_c_lz) + enable_wined3d_sample_c_lz="$2" + ;; wined3d-wined3d_guess_gl_vendor) enable_wined3d_wined3d_guess_gl_vendor="$2" ;; @@ -9091,6 +9095,21 @@ if test "$enable_wined3d_buffer_sync_apple" -eq 1; then ) >> "$patchlist" fi +# Patchset wined3d-sample_c_lz +# | +# | This patchset fixes the following Wine bugs: +# | * [#42863] Emulate sample_c_lz using textureGradOffset for sampler2DArrayShadow +# | +# | Modified files: +# | * dlls/wined3d/glsl_shader.c +# | +if test "$enable_wined3d_sample_c_lz" -eq 1; then + patch_apply wined3d-sample_c_lz/0001-wined3d-Emulate-sample_c_lz-using-textureGradOffset-.patch + ( + printf '%s\n' '+ { "Michael Müller", "wined3d: Emulate sample_c_lz using textureGradOffset for sampler2DArrayShadow.", 1 },'; + ) >> "$patchlist" +fi + # Patchset wined3d-wined3d_guess_gl_vendor # | # | This patchset fixes the following Wine bugs: diff --git a/patches/wined3d-sample_c_lz/0001-wined3d-Emulate-sample_c_lz-using-textureGradOffset-.patch b/patches/wined3d-sample_c_lz/0001-wined3d-Emulate-sample_c_lz-using-textureGradOffset-.patch new file mode 100644 index 00000000..51172fda --- /dev/null +++ b/patches/wined3d-sample_c_lz/0001-wined3d-Emulate-sample_c_lz-using-textureGradOffset-.patch @@ -0,0 +1,66 @@ +From a48ac71b79ca398816a306e1fb455a773de17e45 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Sun, 25 Jun 2017 04:13:57 +0200 +Subject: wined3d: Emulate sample_c_lz using textureGradOffset for + sampler2DArrayShadow. + +--- + dlls/wined3d/glsl_shader.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c +index b813cf3aaf8..82cca841475 100644 +--- a/dlls/wined3d/glsl_shader.c ++++ b/dlls/wined3d/glsl_shader.c +@@ -91,6 +91,7 @@ struct glsl_sample_function + enum wined3d_data_type data_type; + BOOL output_single_component; + unsigned int offset_size; ++ BOOL emulate_lod; + }; + + enum heap_node_op +@@ -3439,6 +3440,18 @@ static void shader_glsl_get_sample_function(const struct wined3d_shader_context + if (resource_type == WINED3D_SHADER_RESOURCE_TEXTURE_CUBE) + projected = FALSE; + ++ /* emulate textureLod(sampler2DArrayShadow, ...) using textureGradOffset */ ++ if (shadow && lod && resource_type == WINED3D_SHADER_RESOURCE_TEXTURE_2DARRAY) ++ { ++ sample_function->emulate_lod = TRUE; ++ grad = offset = TRUE; ++ lod = FALSE; ++ } ++ else ++ { ++ sample_function->emulate_lod = FALSE; ++ } ++ + if (needs_legacy_glsl_syntax(gl_info)) + { + if (shadow) +@@ -3600,6 +3613,7 @@ static void PRINTF_ATTR(9, 10) shader_glsl_gen_sample_code(const struct wined3d_ + const char *dx, const char *dy, const char *bias, const struct wined3d_shader_texel_offset *offset, + const char *coord_reg_fmt, ...) + { ++ static const struct wined3d_shader_texel_offset dummy_offset = {0, 0, 0}; + const struct wined3d_shader_version *version = &ins->ctx->reg_maps->shader_version; + char dst_swizzle[6]; + struct color_fixup_desc fixup; +@@ -3668,6 +3682,13 @@ static void PRINTF_ATTR(9, 10) shader_glsl_gen_sample_code(const struct wined3d_ + break; + } + } ++ if (sample_function->emulate_lod) ++ { ++ if (strcmp(bias, "0")) FIXME("Don't know how to emulate lod level %s\n", bias); ++ if (!dx) dx = "vec2(0.0, 0.0)"; ++ if (!dy) dy = "vec2(0.0, 0.0)"; ++ if (!offset) offset = &dummy_offset; ++ } + if (dx && dy) + shader_addline(ins->ctx->buffer, ", %s, %s", dx, dy); + else if (bias) +-- +2.13.1 + diff --git a/patches/wined3d-sample_c_lz/definition b/patches/wined3d-sample_c_lz/definition new file mode 100644 index 00000000..e946a496 --- /dev/null +++ b/patches/wined3d-sample_c_lz/definition @@ -0,0 +1 @@ +Fixes: [42863] Emulate sample_c_lz using textureGradOffset for sampler2DArrayShadow