spirv: Use runtime array for ssbos

* ssbos can be large and typically their size will vary, especially in generic copy/clear cs shaders
This commit is contained in:
IndecisiveTurtle 2024-08-12 16:34:54 +03:00
parent 6ef31ef6ea
commit 27e9026f5d
1 changed files with 2 additions and 1 deletions

View File

@ -331,7 +331,8 @@ void EmitContext::DefineBuffers() {
for (u32 i = 0; const auto& buffer : info.buffers) {
const auto* data_types = True(buffer.used_types & IR::Type::F32) ? &F32 : &U32;
const Id data_type = (*data_types)[1];
const Id record_array_type{TypeArray(data_type, ConstU32(buffer.length))};
const Id record_array_type{buffer.is_storage ? TypeRuntimeArray(data_type) :
TypeArray(data_type, ConstU32(buffer.length))};
const Id struct_type{TypeStruct(record_array_type)};
if (std::ranges::find(type_ids, record_array_type.value, &Id::value) == type_ids.end()) {
Decorate(record_array_type, spv::Decoration::ArrayStride, 4);