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

Submitted by Neil Roberts on March 28, 2018, 9 a.m.

Details

Message ID 20180328090029.24723-3-nroberts@igalia.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Neil Roberts March 28, 2018, 9 a.m.
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(-)

Patch hide | download patch | download mbox

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 ||