Skip to content

gl_InstanceID-based array-access in SPIR-V #87

Description

@Apprentice-Alchemist

The following shader

#version 450
in vec3 pos;
in vec2 uv;
in vec4 col;
out vec2 frag_uv;
uniform mat4 m[4];

void main() {
  gl_Position = m[gl_InstanceID] * vec4(pos, 1.0f);
  frag_uv = uv;
}

results in the following error:

Vulkan ERROR: Code 7060244 : Validation Error: [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object 0: handle = 0x55a824ad8180, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6bbb14 | SPIR-V module not valid: The result pointer storage class and base pointer storage class in OpAccessChain do not match.
  %25 = OpAccessChain %_ptr_UniformConstant_mat4v4float %59 %23

and if I remove the array access it gives:

Vulkan ERROR: Code 7060244 : Validation Error: [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object 0: handle = 0x55ae7ee40290, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6bbb14 | SPIR-V module not valid: Structure id 43 decorated as Block must be explicitly laid out with ArrayStride decorations.
  %_k_global_uniform_buffer_type = OpTypeStruct %_arr_mat4v4float_uint_4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions