Matteo Bruni : wined3d: Avoid the deprecated GLSL "attribute" keyword on core profile contexts.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Apr 1 10:04:30 CDT 2016


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

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Thu Mar 31 19:50:57 2016 +0200

wined3d: Avoid the deprecated GLSL "attribute" keyword on core profile contexts.

Signed-off-by: Matteo Bruni <mbruni 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 | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 3041eef..75c9109 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -1574,6 +1574,11 @@ static BOOL needs_legacy_glsl_syntax(const struct wined3d_gl_info *gl_info)
     return gl_info->supported[WINED3D_GL_LEGACY_CONTEXT];
 }
 
+static const char *get_attribute_keyword(const struct wined3d_gl_info *gl_info)
+{
+    return needs_legacy_glsl_syntax(gl_info) ? "attribute" : "in";
+}
+
 static void PRINTF_ATTR(4, 5) declare_in_varying(const struct wined3d_gl_info *gl_info,
         struct wined3d_string_buffer *buffer, BOOL flat, const char *format, ...)
 {
@@ -1902,7 +1907,8 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
                 shader_addline(buffer, "vec4 %s_in%u = vec4(intBitsToFloat(gl_InstanceID), 0.0, 0.0, 0.0);\n",
                         prefix, e->register_idx);
             else
-                shader_addline(buffer, "attribute vec4 %s_in%u;\n", prefix, e->register_idx);
+                shader_addline(buffer, "%s vec4 %s_in%u;\n",
+                        get_attribute_keyword(gl_info), prefix, e->register_idx);
         }
 
         if (vs_args->point_size && !vs_args->per_vertex_point_size)
@@ -6059,7 +6065,7 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
     {
         const char *type = i < ARRAY_SIZE(attrib_info) ? attrib_info[i].type : "vec4";
 
-        shader_addline(buffer, "attribute %s vs_in%u;\n", type, i);
+        shader_addline(buffer, "%s %s vs_in%u;\n", get_attribute_keyword(gl_info), type, i);
     }
     shader_addline(buffer, "\n");
 




More information about the wine-cvs mailing list