[PATCH 1/5] wined3d: Don't declare more varyings than required by the shader model.
Henri Verbeet
hverbeet at codeweavers.com
Mon Dec 5 15:06:53 CST 2011
---
dlls/wined3d/glsl_shader.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index b746139..47d2e66 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -1129,16 +1129,15 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
*/
if (pshader && reg_maps->shader_version.major >= 3)
{
+ UINT in_count = min(vec4_varyings(reg_maps->shader_version.major, gl_info), shader->limits.packed_input);
+
if (use_vs(state))
- {
- shader_addline(buffer, "varying vec4 IN[%u];\n", vec4_varyings(reg_maps->shader_version.major, gl_info));
- } else {
+ shader_addline(buffer, "varying vec4 IN[%u];\n", in_count);
+ else
/* TODO: Write a replacement shader for the fixed function vertex pipeline, so this isn't needed.
* For fixed function vertex processing + 3.0 pixel shader we need a separate function in the
- * pixel shader that reads the fixed function color into the packed input registers.
- */
- shader_addline(buffer, "vec4 IN[%u];\n", vec4_varyings(reg_maps->shader_version.major, gl_info));
- }
+ * pixel shader that reads the fixed function color into the packed input registers. */
+ shader_addline(buffer, "vec4 IN[%u];\n", in_count);
}
/* Declare output register temporaries */
@@ -3916,8 +3915,9 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer
}
else
{
+ UINT in_count = min(vec4_varyings(ps_major, gl_info), ps->limits.packed_input);
/* This one is tricky: a 3.0 pixel shader reads from a 3.0 vertex shader */
- shader_addline(buffer, "varying vec4 IN[%u];\n", vec4_varyings(3, gl_info));
+ shader_addline(buffer, "varying vec4 IN[%u];\n", in_count);
shader_addline(buffer, "void order_ps_input(in vec4 OUT[%u]) {\n", MAX_REG_OUTPUT);
/* First, sort out position and point size. Those are not passed to the pixel shader */
--
1.7.3.4
More information about the wine-patches
mailing list