From 3567544ade21946ae8fdf408bae321a938244870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Tue, 14 Mar 2017 13:15:54 +0100 Subject: [PATCH] wined3d: Use layout qualifiers to bind GLSL images. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/glsl_shader.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 5d738b87c6..543acda774 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -558,6 +558,11 @@ void shader_glsl_validate_link(const struct wined3d_gl_info *gl_info, GLuint pro print_glsl_info_log(gl_info, program, TRUE); } +static BOOL shader_glsl_use_layout_binding_qualifier(const struct wined3d_gl_info *gl_info) +{ + return !gl_info->supported[WINED3D_GL_LEGACY_CONTEXT] && gl_info->supported[ARB_SHADING_LANGUAGE_420PACK]; +} + static void shader_glsl_init_uniform_block_bindings(const struct wined3d_gl_info *gl_info, struct shader_glsl_priv *priv, GLuint program_id, const struct wined3d_shader_reg_maps *reg_maps) @@ -650,11 +655,15 @@ static void shader_glsl_load_icb(const struct wined3d_gl_info *gl_info, struct s static void shader_glsl_load_images(const struct wined3d_gl_info *gl_info, struct shader_glsl_priv *priv, GLuint program_id, const struct wined3d_shader_reg_maps *reg_maps) { - struct wined3d_string_buffer *name = string_buffer_get(&priv->string_buffers); const char *prefix = shader_glsl_get_prefix(reg_maps->shader_version.type); + struct wined3d_string_buffer *name; GLint location; unsigned int i; + if (shader_glsl_use_layout_binding_qualifier(gl_info)) + return; + + name = string_buffer_get(&priv->string_buffers); for (i = 0; i < MAX_UNORDERED_ACCESS_VIEWS; ++i) { if (!reg_maps->uav_resource_info[i].type) @@ -2243,6 +2252,8 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont break; } + if (shader_glsl_use_layout_binding_qualifier(gl_info)) + shader_addline(buffer, "layout(binding = %u)\n", i); if (reg_maps->uav_read_mask & (1u << i)) shader_addline(buffer, "layout(%s) uniform %s%s %s_image%u;\n", read_format, image_type_prefix, image_type, prefix, i);