From 8fdf973e66b60e50b3015ed4e61df005c720b941 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Wed, 19 Oct 2016 23:03:39 +0200 Subject: [PATCH] gsdx glsl: add basic support of GL_ARB_enhanced_layouts (GL4.4) Hardcode location of interface to the location 0. If I understand the spec correctly (unlikely), variable in interface will get successive location. Goal is to reduce driver work. Instead to compute some location based on name matching approach (and silly validation), the driver can now use static allocation. Tests on future Mesa 13 are welcome --- plugins/GSdx/res/glsl/tfx_fs.glsl | 3 +++ plugins/GSdx/res/glsl/tfx_vgs.glsl | 9 +++++++++ plugins/GSdx/res/glsl_source.h | 12 ++++++++++++ 3 files changed, 24 insertions(+) diff --git a/plugins/GSdx/res/glsl/tfx_fs.glsl b/plugins/GSdx/res/glsl/tfx_fs.glsl index 530b3d4f7..2a93599f8 100644 --- a/plugins/GSdx/res/glsl/tfx_fs.glsl +++ b/plugins/GSdx/res/glsl/tfx_fs.glsl @@ -26,6 +26,9 @@ #ifdef FRAGMENT_SHADER +#if defined(GL_ARB_enhanced_layouts) && GL_ARB_enhanced_layouts +layout(location = 0) +#endif in SHADER { vec4 t_float; diff --git a/plugins/GSdx/res/glsl/tfx_vgs.glsl b/plugins/GSdx/res/glsl/tfx_vgs.glsl index f4a43d81b..d83ee6ff8 100644 --- a/plugins/GSdx/res/glsl/tfx_vgs.glsl +++ b/plugins/GSdx/res/glsl/tfx_vgs.glsl @@ -9,6 +9,9 @@ layout(location = 5) in uint i_z; layout(location = 6) in uvec2 i_uv; layout(location = 7) in vec4 i_f; +#if defined(GL_ARB_enhanced_layouts) && GL_ARB_enhanced_layouts +layout(location = 0) +#endif out SHADER { vec4 t_float; @@ -61,6 +64,9 @@ void vs_main() #ifdef GEOMETRY_SHADER +#if defined(GL_ARB_enhanced_layouts) && GL_ARB_enhanced_layouts +layout(location = 0) +#endif in SHADER { vec4 t_float; @@ -69,6 +75,9 @@ in SHADER flat vec4 fc; } GSin[]; +#if defined(GL_ARB_enhanced_layouts) && GL_ARB_enhanced_layouts +layout(location = 0) +#endif out SHADER { vec4 t_float; diff --git a/plugins/GSdx/res/glsl_source.h b/plugins/GSdx/res/glsl_source.h index 6d1906702..d075a3a6b 100644 --- a/plugins/GSdx/res/glsl_source.h +++ b/plugins/GSdx/res/glsl_source.h @@ -749,6 +749,9 @@ static const char* const tfx_vgs_glsl = "layout(location = 6) in uvec2 i_uv;\n" "layout(location = 7) in vec4 i_f;\n" "\n" + "#if defined(GL_ARB_enhanced_layouts) && GL_ARB_enhanced_layouts\n" + "layout(location = 0)\n" + "#endif\n" "out SHADER\n" "{\n" " vec4 t_float;\n" @@ -801,6 +804,9 @@ static const char* const tfx_vgs_glsl = "\n" "#ifdef GEOMETRY_SHADER\n" "\n" + "#if defined(GL_ARB_enhanced_layouts) && GL_ARB_enhanced_layouts\n" + "layout(location = 0)\n" + "#endif\n" "in SHADER\n" "{\n" " vec4 t_float;\n" @@ -809,6 +815,9 @@ static const char* const tfx_vgs_glsl = " flat vec4 fc;\n" "} GSin[];\n" "\n" + "#if defined(GL_ARB_enhanced_layouts) && GL_ARB_enhanced_layouts\n" + "layout(location = 0)\n" + "#endif\n" "out SHADER\n" "{\n" " vec4 t_float;\n" @@ -1016,6 +1025,9 @@ static const char* const tfx_fs_all_glsl = "\n" "#ifdef FRAGMENT_SHADER\n" "\n" + "#if defined(GL_ARB_enhanced_layouts) && GL_ARB_enhanced_layouts\n" + "layout(location = 0)\n" + "#endif\n" "in SHADER\n" "{\n" " vec4 t_float;\n"