Commit 75b3719c authored by Neil Roberts's avatar Neil Roberts Committed by Alejandro Piñeiro

spirv: Don't use special semantics when counting vertex attribute size

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

Under OpenGL (ARB_gl_spirv), from GLSL 4.60 spec, section 4.3.9
Interface Blocks:

   "It is a compile-time error to have an input block in a vertex
    shader or an output block in a fragment shader. These uses are
    reserved for future use."

So we also don't need to check if it is an vertex input or not, and
use false in any case.

v2: (changes made by Alejandro Piñeiro)
    * Update required after "spirv: Handle location decorations on
      block interface members" own updates (original patch was sent
      several months ago)
    * After Neil suggesting it, confirm that this change can be also
      done for OpenGL (ARB_gl_spirv). Expand commit message.

v3: update after changing name of main method on a previous patch
Signed-off-by: Neil Roberts's avatarNeil Roberts <nroberts@igalia.com>
Signed-off-by: Alejandro Piñeiro's avatarAlejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Tapani Pälli's avatarTapani Pälli <tapani.palli@intel.com>
parent 5c797f73
......@@ -1912,8 +1912,7 @@ is_per_vertex_inout(const struct vtn_variable *var, gl_shader_stage stage)
}
static void
assign_missing_member_locations(struct vtn_variable *var,
bool is_vertex_input)
assign_missing_member_locations(struct vtn_variable *var)
{
unsigned length =
glsl_get_length(glsl_without_array(var->type->type));
......@@ -1950,7 +1949,8 @@ assign_missing_member_locations(struct vtn_variable *var,
glsl_get_struct_field(glsl_without_array(var->type->type), i);
location +=
glsl_count_attribute_slots(member_type, is_vertex_input);
glsl_count_attribute_slots(member_type,
false /* is_gl_vertex_input */);
}
}
......@@ -2181,9 +2181,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->var->members) {
bool is_vertex_input = (b->shader->info.stage == MESA_SHADER_VERTEX &&
var->mode == vtn_variable_mode_input);
assign_missing_member_locations(var, is_vertex_input);
assign_missing_member_locations(var);
}
if (var->mode == vtn_variable_mode_uniform) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment