[PATCH 1/6] wined3d: Require just specific OpenGL extensions and SM4 support for SM5.
Józef Kucia
jkucia at codeweavers.com
Fri May 26 03:48:02 CDT 2017
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
dlls/wined3d/directx.c | 2 --
dlls/wined3d/glsl_shader.c | 38 ++++++++++++++++++++++----------------
dlls/wined3d/wined3d_gl.h | 1 -
3 files changed, 22 insertions(+), 19 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 7273d6c..6b5ef8a 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -4012,8 +4012,6 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
gl_info->supported[WINED3D_GL_VERSION_2_0] = TRUE;
if (gl_version >= MAKEDWORD_VERSION(3, 2))
gl_info->supported[WINED3D_GL_VERSION_3_2] = TRUE;
- if (gl_version >= MAKEDWORD_VERSION(4, 3))
- gl_info->supported[WINED3D_GL_VERSION_4_3] = TRUE;
/* All the points are actually point sprites in core contexts, the APIs from
* ARB_point_sprite are not supported anymore. */
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 73ab7a6..6a405ba 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -10511,15 +10511,15 @@ static void shader_glsl_init_context_state(struct wined3d_context *context)
checkGLcall("GL_PROGRAM_POINT_SIZE");
}
-static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct shader_caps *caps)
+static unsigned int shader_glsl_get_shader_model(const struct wined3d_gl_info *gl_info)
{
- unsigned int shader_model;
+ BOOL shader_model_4 = gl_info->glsl_version >= MAKEDWORD_VERSION(1, 50)
+ && gl_info->supported[WINED3D_GL_VERSION_3_2]
+ && gl_info->supported[ARB_SAMPLER_OBJECTS]
+ && gl_info->supported[ARB_SHADER_BIT_ENCODING]
+ && gl_info->supported[ARB_TEXTURE_SWIZZLE];
- /* FIXME: Check for the specific extensions required for SM5 support
- * (ARB_compute_shader, ARB_tessellation_shader, ARB_gpu_shader5, ...) as
- * soon as we introduce them, adjusting the GL / GLSL version checks
- * accordingly. */
- if (gl_info->glsl_version >= MAKEDWORD_VERSION(4, 30) && gl_info->supported[WINED3D_GL_VERSION_4_3]
+ if (shader_model_4
&& gl_info->supported[ARB_COMPUTE_SHADER]
&& gl_info->supported[ARB_DERIVATIVE_CONTROL]
&& gl_info->supported[ARB_GPU_SHADER5]
@@ -10530,17 +10530,23 @@ static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct s
&& gl_info->supported[ARB_TESSELLATION_SHADER]
&& gl_info->supported[ARB_TEXTURE_GATHER]
&& gl_info->supported[ARB_TRANSFORM_FEEDBACK3])
- shader_model = 5;
- else if (gl_info->glsl_version >= MAKEDWORD_VERSION(1, 50) && gl_info->supported[WINED3D_GL_VERSION_3_2]
- && gl_info->supported[ARB_SHADER_BIT_ENCODING] && gl_info->supported[ARB_SAMPLER_OBJECTS]
- && gl_info->supported[ARB_TEXTURE_SWIZZLE])
- shader_model = 4;
+ return 5;
+
+ if (shader_model_4)
+ return 4;
+
/* Support for texldd and texldl instructions in pixel shaders is required
* for SM3. */
- else if (shader_glsl_has_core_grad(gl_info) || gl_info->supported[ARB_SHADER_TEXTURE_LOD])
- shader_model = 3;
- else
- shader_model = 2;
+ if (shader_glsl_has_core_grad(gl_info) || gl_info->supported[ARB_SHADER_TEXTURE_LOD])
+ return 3;
+
+ return 2;
+}
+
+static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct shader_caps *caps)
+{
+ unsigned int shader_model = shader_glsl_get_shader_model(gl_info);
+
TRACE("Shader model %u.\n", shader_model);
caps->vs_version = min(wined3d_settings.max_sm_vs, shader_model);
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h
index 34599fd..3806869 100644
--- a/dlls/wined3d/wined3d_gl.h
+++ b/dlls/wined3d/wined3d_gl.h
@@ -206,7 +206,6 @@ enum wined3d_gl_extension
WINED3D_GL_PRIMITIVE_QUERY,
WINED3D_GL_VERSION_2_0,
WINED3D_GL_VERSION_3_2,
- WINED3D_GL_VERSION_4_3,
WINED3D_GLSL_130,
WINED3D_GL_EXT_COUNT,
--
2.10.2
More information about the wine-patches
mailing list