Closed dubiousconst282 closed 3 weeks ago
Not sure if it helps, but here's a similar GLSL repro:
#version 460
#extension GL_EXT_buffer_reference2 : require
struct MeshVertex {
vec3 Pos;
vec2 TexCoord;
};
layout(std430, buffer_reference) buffer float3_ptr {
vec3 value;
};
layout(std430, buffer_reference) buffer MeshData_ptr {
mat4 ModelMat;
MeshVertex Vertices[];
};
layout(push_constant, std430) uniform pc_t {
MeshData_ptr Mesh;
float3_ptr Dest;
} pc;
layout(local_size_x = 64) in;
void main() {
uint tid = gl_GlobalInvocationID.x;
pc.Dest[tid].value = pc.Mesh.Vertices[tid].Pos;
}
Relevant SPIRV:
// Slang
%27 = OpAccessChain %_ptr_PushConstant_13 %pc %int_0
%28 = OpLoad %_ptr_PhysicalStorageBuffer_MeshData_natural %27
%33 = OpAccessChain %_ptr_PhysicalStorageBuffer__runtimearr_MeshVertex %28 %int_1
%36 = OpAccessChain %_ptr_PhysicalStorageBuffer_MeshVertex_natural %33 %10
%37 = OpAccessChain %_ptr_PhysicalStorageBuffer_v3float %36 %int_0
%38 = OpLoad %v3float %37 Aligned 4
// glslang
%48 = OpAccessChain %_ptr_PushConstant__ptr_PhysicalStorageBuffer_MeshData_ptr %pc %int_0
%49 = OpLoad %_ptr_PhysicalStorageBuffer_MeshData_ptr %48
%50 = OpLoad %uint %tid
%52 = OpAccessChain %_ptr_PhysicalStorageBuffer_v3float %49 %int_1 %50 %int_0
%53 = OpLoad %v3float %52 Aligned 16
Thanks for raising this issue. @kaizhangNV can you help to take a look?
Another silly one :)
Simplified repro:
spirv-val output: