Shader parser - attribute location fix 08/317308/1
authorAdam Bialogonski <adam.b@samsung.com>
Fri, 6 Sep 2024 15:34:03 +0000 (16:34 +0100)
committerAdam Bialogonski <adam.b@samsung.com>
Fri, 6 Sep 2024 15:43:13 +0000 (16:43 +0100)
Attribute location wasn't incrementing for SPIRV-GLSL output. This patch fixes it.

Change-Id: If3f0adf770d0951855ac8413e29b50b40729d1e1

automated-tests/resources/shaders/canvas-view.vert
automated-tests/resources/shaders/canvas-view.vert.gles2
automated-tests/resources/shaders/canvas-view.vert.gles3
automated-tests/resources/shaders/canvas-view.vert.glsl-spirv
dali/internal/graphics/common/shader-parser.cpp
dali/internal/graphics/common/shader-parser.h

index c663ed5f1796063f1ae719d471c5607ee73dbc9d..63f6b5e5cdd32888ff78883fc3def2b81412b7c2 100644 (file)
@@ -7,6 +7,7 @@
 //@ignore:off
 
 INPUT mediump vec2 aPosition;
+INPUT mediump vec2 aTexCoord;
 OUTPUT mediump vec2 vTexCoord;
 UNIFORM_BLOCK VertBlock
 {
index 563f2c011b085b5bef439364407ba11452e6eb18..5e52f988dec7946840ca516586cb8bf1fb0f7f48 100644 (file)
@@ -3,6 +3,7 @@
 
 #define TEXTURE texture2D
 attribute mediump vec2 aPosition;
+attribute mediump vec2 aTexCoord;
 varying mediump vec2 vTexCoord;
 uniform  highp mat4 uMvpMatrix;
 uniform  highp vec3 uSize;
index 9566dedc3367913c79c8b2537a2608ae12010a6a..6f671fbb472b1e86e00ea7fee831f1483fb4e2e8 100644 (file)
@@ -3,6 +3,7 @@
 
 #define TEXTURE texture
 in mediump vec2 aPosition;
+in mediump vec2 aTexCoord;
 out mediump vec2 vTexCoord;
 layout(std140) uniform VertBlock
 {
index 366348814133a4559aeaf958a4a9b4a38cdd9650..75e7680d1525dc3d0140b37f45fc68bb53061505 100644 (file)
@@ -3,6 +3,7 @@
 
 #define TEXTURE texture
 layout(location = 0) in mediump vec2 aPosition;
+layout(location = 1) in mediump vec2 aTexCoord;
 layout(location=0) out mediump vec2 vTexCoord;
 layout(set=0, binding=0, std140) uniform VertBlock
 {
index 10832891ba22606a6436affc116503fab46180e1..1cb10c07e2182c04575011a848bcb911166be9d8 100644 (file)
@@ -135,7 +135,7 @@ void TokenizeSource(Program& program, ShaderStage stage, const std::string& sour
 template<class IT>
 bool ProcessTokenINPUT(IT& it, Program& program, OutputLanguage lang, ShaderStage stage)
 {
-  int               attributeLocation = 0;
+  int&              attributeLocation = program.attributeLocation;
   auto&             l                 = *it;
   std::string&      outString         = ((stage == ShaderStage::VERTEX) ? program.vertexShader.output : program.fragmentShader.output);
   std::stringstream ss;
index 058dcdc2b396adafd810af77d52d9d949c231782..5a21f7ddab8a8a61a936ca74d2dac4afa3ea9669 100644 (file)
@@ -71,6 +71,7 @@ struct Program
   std::map<std::string, int> varyings;
   int                        uboBinding{0};
   int&                       samplerBinding{uboBinding}; // sampler bindings and ubo bindings are the same
+  int                        attributeLocation{0};
 };
 
 struct ShaderParserInfo