[PATCH 2/5] wined3d: Enable lod and grad texture lookups on core profile.
Matteo Bruni
mbruni at codeweavers.com
Thu Sep 22 13:39:36 CDT 2016
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
I'm open to using a single flag for this and round() support, I just
couldn't find a decent name (not that I'm particularly happy with
WINED3D_GL_CORE_GRAD_TEXLOOKUP either...).
dlls/wined3d/directx.c | 3 +++
dlls/wined3d/glsl_shader.c | 12 ++++++------
dlls/wined3d/wined3d_gl.h | 1 +
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 4ff7ddc..b79a963 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -3690,7 +3690,10 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, DWORD
/* 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_CORE_GRAD_TEXLOOKUP] = TRUE;
gl_info->supported[WINED3D_GL_GLSL_ROUND] = TRUE;
+ }
if (gl_version >= MAKEDWORD_VERSION(2, 0))
gl_info->supported[WINED3D_GL_VERSION_2_0] = TRUE;
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index d9a0ca6..dd01b33 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -2923,7 +2923,7 @@ static void shader_glsl_get_sample_function(const struct wined3d_shader_context
if (!type_part[0])
FIXME("Unhandled resource type %#x.\n", resource_type);
- if (!lod && grad && !gl_info->supported[EXT_GPU_SHADER4])
+ if (!lod && grad && !gl_info->supported[WINED3D_GL_CORE_GRAD_TEXLOOKUP])
{
if (gl_info->supported[ARB_SHADER_TEXTURE_LOD])
suffix = "ARB";
@@ -4539,7 +4539,7 @@ static void shader_glsl_texldd(const struct wined3d_shader_instruction *ins)
DWORD sampler_idx;
DWORD swizzle = ins->src[1].swizzle;
- if (!gl_info->supported[ARB_SHADER_TEXTURE_LOD] && !gl_info->supported[EXT_GPU_SHADER4])
+ if (!gl_info->supported[ARB_SHADER_TEXTURE_LOD] && !gl_info->supported[WINED3D_GL_CORE_GRAD_TEXLOOKUP])
{
FIXME("texldd used, but not supported by hardware. Falling back to regular tex\n");
shader_glsl_tex(ins);
@@ -4573,7 +4573,7 @@ static void shader_glsl_texldl(const struct wined3d_shader_instruction *ins)
shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_3, &lod_param);
- if (!gl_info->supported[ARB_SHADER_TEXTURE_LOD] && !gl_info->supported[EXT_GPU_SHADER4]
+ if (!gl_info->supported[ARB_SHADER_TEXTURE_LOD] && !gl_info->supported[WINED3D_GL_CORE_GRAD_TEXLOOKUP]
&& ins->ctx->reg_maps->shader_version.type == WINED3D_SHADER_TYPE_PIXEL)
{
/* Plain GLSL only supports Lod sampling functions in vertex shaders.
@@ -8562,9 +8562,9 @@ static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct s
&& gl_info->supported[ARB_SHADER_BIT_ENCODING] && gl_info->supported[ARB_SAMPLER_OBJECTS]
&& gl_info->supported[ARB_TEXTURE_SWIZZLE])
shader_model = 4;
- /* ARB_shader_texture_lod or EXT_gpu_shader4 is required for the SM3
- * texldd and texldl instructions. */
- else if (gl_info->supported[ARB_SHADER_TEXTURE_LOD] || gl_info->supported[EXT_GPU_SHADER4])
+ /* Support for texldd and texldl instructions in pixel shaders is required
+ * for SM3. */
+ else if (gl_info->supported[ARB_SHADER_TEXTURE_LOD] || gl_info->supported[WINED3D_GL_CORE_GRAD_TEXLOOKUP])
shader_model = 3;
else
shader_model = 2;
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h
index b947caa..9263d1f 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_CORE_GRAD_TEXLOOKUP,
WINED3D_GL_GLSL_ROUND,
WINED3D_GL_NORMALIZED_TEXRECT,
WINED3D_GL_LEGACY_CONTEXT,
--
2.7.3
More information about the wine-patches
mailing list