mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Updated wined3d-zero-inf-shaders patchset.
Avoid infinity resulting from overflow in POW with multiply_setting set to 1.
This commit is contained in:
parent
0c7512f5f5
commit
3d5bb83e05
@ -52,7 +52,7 @@ usage()
|
||||
# Get the upstream commit sha
|
||||
upstream_commit()
|
||||
{
|
||||
echo "65fba0987310e635f27468a5b4a448794b5871e5"
|
||||
echo "ceabad19b8f51308afb999c394584d212ef8b469"
|
||||
}
|
||||
|
||||
# Show version information
|
||||
@ -6883,6 +6883,7 @@ fi
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#34266] wined3d: Add a setting to workaround 0 * inf problem in shader models 1-3.
|
||||
# | * [#45375] Halo Online: Weird black display problems.
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/wined3d/glsl_shader.c, dlls/wined3d/wined3d_main.c, dlls/wined3d/wined3d_private.h
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 7b97835b41aa751196b87d1c2739e48312d4b899 Mon Sep 17 00:00:00 2001
|
||||
From dd729aeb54a82d85c8172a3043f55d463166aec6 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <gofmanp@gmail.com>
|
||||
Date: Mon, 9 Sep 2019 18:48:43 +0300
|
||||
Subject: [PATCH] wined3d: Add a setting to workaround 0 * inf problem in
|
||||
@ -9,13 +9,13 @@ https://bugs.winehq.org/show_bug.cgi?id=34266.
|
||||
|
||||
Signed-off-by: Paul Gofman <gofmanp@gmail.com>
|
||||
---
|
||||
dlls/wined3d/glsl_shader.c | 123 +++++++++++++++++++++++++++------
|
||||
dlls/wined3d/glsl_shader.c | 155 ++++++++++++++++++++++++++++-----
|
||||
dlls/wined3d/wined3d_main.c | 3 +
|
||||
dlls/wined3d/wined3d_private.h | 1 +
|
||||
3 files changed, 107 insertions(+), 20 deletions(-)
|
||||
3 files changed, 135 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
|
||||
index c0713527ba..1632fd6005 100644
|
||||
index 05de1d7932..cd3afa1b9f 100644
|
||||
--- a/dlls/wined3d/glsl_shader.c
|
||||
+++ b/dlls/wined3d/glsl_shader.c
|
||||
@@ -2298,6 +2298,19 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c
|
||||
@ -104,7 +104,60 @@ index c0713527ba..1632fd6005 100644
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4290,11 +4327,15 @@ static void shader_glsl_scalar_op(const struct wined3d_shader_instruction *ins)
|
||||
@@ -4096,10 +4133,14 @@ static void shader_glsl_cut(const struct wined3d_shader_instruction *ins)
|
||||
static void shader_glsl_pow(const struct wined3d_shader_instruction *ins)
|
||||
{
|
||||
struct wined3d_string_buffer *buffer = ins->ctx->buffer;
|
||||
+ static const float max_float = FLT_MAX;
|
||||
struct glsl_src_param src0_param;
|
||||
struct glsl_src_param src1_param;
|
||||
DWORD dst_write_mask;
|
||||
unsigned int dst_size;
|
||||
+ BOOL guard_inf;
|
||||
+
|
||||
+ guard_inf = wined3d_settings.multiply_special == 1 && ins->ctx->reg_maps->shader_version.major < 4;
|
||||
|
||||
dst_write_mask = shader_glsl_append_dst(buffer, ins);
|
||||
dst_size = shader_glsl_get_write_mask_size(dst_write_mask);
|
||||
@@ -4109,13 +4150,33 @@ static void shader_glsl_pow(const struct wined3d_shader_instruction *ins)
|
||||
|
||||
if (dst_size > 1)
|
||||
{
|
||||
- shader_addline(buffer, "vec%u(%s == 0.0 ? 1.0 : pow(abs(%s), %s)));\n",
|
||||
- dst_size, src1_param.param_str, src0_param.param_str, src1_param.param_str);
|
||||
+ if (guard_inf)
|
||||
+ {
|
||||
+ shader_addline(buffer, "vec%u(%s == 0.0 ? 1.0 : min(pow(abs(%s), %s), ",
|
||||
+ dst_size, src1_param.param_str, src0_param.param_str, src1_param.param_str);
|
||||
+ shader_glsl_append_imm_vec(buffer, &max_float, 1, ins->ctx->gl_info);
|
||||
+ shader_addline(buffer, "));\n");
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ shader_addline(buffer, "vec%u(%s == 0.0 ? 1.0 : pow(abs(%s), %s)));\n",
|
||||
+ dst_size, src1_param.param_str, src0_param.param_str, src1_param.param_str);
|
||||
+ }
|
||||
}
|
||||
else
|
||||
{
|
||||
- shader_addline(buffer, "%s == 0.0 ? 1.0 : pow(abs(%s), %s));\n",
|
||||
- src1_param.param_str, src0_param.param_str, src1_param.param_str);
|
||||
+ if (guard_inf)
|
||||
+ {
|
||||
+ shader_addline(buffer, "%s == 0.0 ? 1.0 : min(pow(abs(%s), %s), ",
|
||||
+ src1_param.param_str, src0_param.param_str, src1_param.param_str);
|
||||
+ shader_glsl_append_imm_vec(buffer, &max_float, 1, ins->ctx->gl_info);
|
||||
+ shader_addline(buffer, "));\n");
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ shader_addline(buffer, "%s == 0.0 ? 1.0 : pow(abs(%s), %s));\n",
|
||||
+ src1_param.param_str, src0_param.param_str, src1_param.param_str);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4290,11 +4351,15 @@ static void shader_glsl_scalar_op(const struct wined3d_shader_instruction *ins)
|
||||
{
|
||||
DWORD shader_version = WINED3D_SHADER_VERSION(ins->ctx->reg_maps->shader_version.major,
|
||||
ins->ctx->reg_maps->shader_version.minor);
|
||||
@ -121,7 +174,7 @@ index c0713527ba..1632fd6005 100644
|
||||
|
||||
dst_write_mask = shader_glsl_append_dst(buffer, ins);
|
||||
dst_size = shader_glsl_get_write_mask_size(dst_write_mask);
|
||||
@@ -4304,41 +4345,78 @@ static void shader_glsl_scalar_op(const struct wined3d_shader_instruction *ins)
|
||||
@@ -4304,41 +4369,78 @@ static void shader_glsl_scalar_op(const struct wined3d_shader_instruction *ins)
|
||||
|
||||
shader_glsl_add_src_param(ins, &ins->src[0], dst_write_mask, &src0_param);
|
||||
|
||||
@ -210,7 +263,7 @@ index c0713527ba..1632fd6005 100644
|
||||
}
|
||||
|
||||
/** Process the WINED3DSIO_EXPP instruction in GLSL:
|
||||
@@ -4655,8 +4733,13 @@ static void shader_glsl_mad(const struct wined3d_shader_instruction *ins)
|
||||
@@ -4655,8 +4757,13 @@ static void shader_glsl_mad(const struct wined3d_shader_instruction *ins)
|
||||
shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param);
|
||||
shader_glsl_add_src_param(ins, &ins->src[1], write_mask, &src1_param);
|
||||
shader_glsl_add_src_param(ins, &ins->src[2], write_mask, &src2_param);
|
||||
@ -248,7 +301,7 @@ index 5d60a44ef6..e9efbbf08a 100644
|
||||
TRACE("Limiting VS shader model to %u.\n", wined3d_settings.max_sm_vs);
|
||||
if (!get_config_key_dword(hkey, appkey, "MaxShaderModelHS", &wined3d_settings.max_sm_hs))
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index b786962a74..5bc0a1a0bd 100644
|
||||
index 5ec24e3823..ac6bb2da3b 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -427,6 +427,7 @@ struct wined3d_settings
|
||||
|
@ -1 +1,3 @@
|
||||
Fixes: [34266] wined3d: Add a setting to workaround 0 * inf problem in shader models 1-3.
|
||||
Fixes: [45375] Halo Online: Weird black display problems.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user