[PATCH 1/5] wined3d: Use round() on core profile.
Matteo Bruni
mbruni at codeweavers.com
Thu Sep 22 13:39:35 CDT 2016
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
Testing seems to show that Nvidia rounds to even but AMD doesn't, so no
point in using a specific round function.
dlls/wined3d/directx.c | 5 +++++
dlls/wined3d/glsl_shader.c | 4 ++--
dlls/wined3d/wined3d_gl.h | 1 +
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 6b019b6..4ff7ddc 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -3687,6 +3687,11 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, DWORD
if (gl_info->supported[EXT_BLEND_MINMAX] || gl_info->supported[EXT_BLEND_SUBTRACT])
gl_info->supported[WINED3D_GL_BLEND_EQUATION] = TRUE;
+ /* GLSL 1.30 would be enough but we generally use #version 120 shaders
+ * with legacy contexts (mostly to avoid deprecation warnings). */
+ if (!gl_info->supported[WINED3D_GL_LEGACY_CONTEXT] || gl_info->supported[EXT_GPU_SHADER4])
+ gl_info->supported[WINED3D_GL_GLSL_ROUND] = TRUE;
+
if (gl_version >= MAKEDWORD_VERSION(2, 0))
gl_info->supported[WINED3D_GL_VERSION_2_0] = TRUE;
if (gl_version >= MAKEDWORD_VERSION(3, 2))
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index fbba284..d9a0ca6 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -3400,12 +3400,12 @@ static void shader_glsl_mov(const struct wined3d_shader_instruction *ins)
shader_addline(buffer, "int(floor(%s)));\n", src0_param.param_str);
}
}
- else if(ins->handler_idx == WINED3DSIH_MOVA)
+ else if (ins->handler_idx == WINED3DSIH_MOVA)
{
/* We need to *round* to the nearest int here. */
unsigned int mask_size = shader_glsl_get_write_mask_size(write_mask);
- if (gl_info->supported[EXT_GPU_SHADER4])
+ if (gl_info->supported[WINED3D_GL_GLSL_ROUND])
{
if (mask_size > 1)
shader_addline(buffer, "ivec%d(round(%s)));\n", mask_size, src0_param.param_str);
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h
index 67ab6f7..b947caa 100644
--- a/dlls/wined3d/wined3d_gl.h
+++ b/dlls/wined3d/wined3d_gl.h
@@ -176,6 +176,7 @@ enum wined3d_gl_extension
WGL_WINE_QUERY_RENDERER,
/* Internally used */
WINED3D_GL_BLEND_EQUATION,
+ WINED3D_GL_GLSL_ROUND,
WINED3D_GL_NORMALIZED_TEXRECT,
WINED3D_GL_LEGACY_CONTEXT,
WINED3D_GL_VERSION_2_0,
--
2.7.3
More information about the wine-patches
mailing list