[Mesa-dev] [PATCH 3/3] spirv: Don’t use special semantics when counting vertex attribute size

Neil Roberts nroberts at igalia.com
Wed Mar 28 09:00:29 UTC 2018


Under Vulkan, the double vertex attributes take up the same size
regardless of whether they are vertex inputs or any other stage
interface.
---

There is a test for this on the tests branch of VkRunner:

https://github.com/Igalia/vkrunner/tree/tests

./src/vkrunner examples/double-vertex-input-block.shader_test

 src/compiler/spirv/vtn_variables.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 29e9838d5d2..269228d486e 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1749,8 +1749,7 @@ is_per_vertex_inout(const struct vtn_variable *var, gl_shader_stage stage)
 }
 
 static void
-add_missing_member_locations(struct vtn_variable *var,
-                             bool is_vertex_input)
+add_missing_member_locations(struct vtn_variable *var)
 {
    unsigned length =
       glsl_get_length(glsl_without_array(var->type->type));
@@ -1778,7 +1777,7 @@ add_missing_member_locations(struct vtn_variable *var,
 
       location +=
          glsl_count_attribute_slots(var->members[i]->interface_type,
-                                    is_vertex_input);
+                                    false /* is_gl_vertex_input */);
    }
 }
 
@@ -1975,9 +1974,7 @@ vtn_create_variable(struct vtn_builder *b, struct vtn_value *val,
    if ((var->mode == vtn_variable_mode_input ||
         var->mode == vtn_variable_mode_output) &&
        var->members) {
-      bool is_vertex_input = (b->shader->info.stage == MESA_SHADER_VERTEX &&
-                              var->mode == vtn_variable_mode_input);
-      add_missing_member_locations(var, is_vertex_input);
+      add_missing_member_locations(var);
    }
 
    if (var->mode == vtn_variable_mode_image ||
-- 
2.14.3



More information about the mesa-dev mailing list