=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Do not declare pixel shader inputs when they are not used.

Alexandre Julliard julliard at winehq.org
Tue Jun 13 16:14:50 CDT 2017

Module: wine
Branch: master
Commit: 2b77c00b8ffb0eb36c7e179740f360a9be056960
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2b77c00b8ffb0eb36c7e179740f360a9be056960

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Tue Jun 13 00:55:55 2017 +0200

wined3d: Do not declare pixel shader inputs when they are not used.

This is a workaround for a bug in Mesa GLSL linker. The bug is triggered
by GLSL generated for SM3 shaders when shader inputs are not read and
interface blocks are used for shader inputs/outputs (core profile code

Declarations for unused shader inputs are not generated for pixel
shaders. We still declare shader outputs in the previous shader stage,
but it's allowed by the GLSL 1.50 spec:

  "Only output variables that are read by the subsequent pipeline stage
  need to be written; it is allowed to have superfluous declarations of
  output variables."

The table in section 4.3.4 (Input Variables) of the GLSL 4.20 spec even
more explicitly allows shader output variables with no matching input
variables declared in the consuming shader.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>


 dlls/wined3d/glsl_shader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 81b338c..1bd3a66 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -7250,7 +7250,7 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
         unsigned int in_count = min(vec4_varyings(version->major, gl_info), shader->limits->packed_input);
-        if (args->vp_mode == vertexshader)
+        if (args->vp_mode == vertexshader && reg_maps->input_registers)
             shader_glsl_declare_shader_inputs(gl_info, buffer, in_count);
         shader_addline(buffer, "vec4 %s_in[%u];\n", prefix, in_count);

More information about the wine-cvs mailing list