mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-19 09:55:26 +00:00
Implement Default Struct Layout
Implements https://github.com/gpuweb/gpuweb/pull/1447 SPIR-V Reader is still TODO, but continues to function as the offset decoration is still supported. Bug: tint:626 Bug: tint:629 Change-Id: Id574eb3a5c6729559382812de37b23f0c68fd406 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/43640 Commit-Queue: Ben Clayton <bclayton@chromium.org> Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
717fbbf183
commit
d614dd5d12
@@ -23,6 +23,7 @@
|
||||
#include "src/ast/sint_literal.h"
|
||||
#include "src/ast/uint_literal.h"
|
||||
#include "src/semantic/function.h"
|
||||
#include "src/semantic/struct.h"
|
||||
#include "src/semantic/variable.h"
|
||||
#include "src/type/access_control_type.h"
|
||||
#include "src/type/array_type.h"
|
||||
@@ -379,12 +380,18 @@ std::vector<ResourceBinding> Inspector::GetUniformBufferResourceBindings(
|
||||
continue;
|
||||
}
|
||||
|
||||
auto* sem = program_->Sem().Get(str);
|
||||
if (!sem) {
|
||||
error_ = "Missing semantic information for structure " +
|
||||
program_->Symbols().NameFor(str->symbol());
|
||||
continue;
|
||||
}
|
||||
|
||||
ResourceBinding entry;
|
||||
entry.resource_type = ResourceBinding::ResourceType::kUniformBuffer;
|
||||
entry.bind_group = binding_info.group->value();
|
||||
entry.binding = binding_info.binding->value();
|
||||
entry.min_buffer_binding_size =
|
||||
decl->type()->MinBufferBindingSize(type::MemoryLayout::kUniformBuffer);
|
||||
entry.size = sem->Size();
|
||||
|
||||
result.push_back(entry);
|
||||
}
|
||||
@@ -541,7 +548,15 @@ std::vector<ResourceBinding> Inspector::GetStorageBufferResourceBindingsImpl(
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!decl->type()->UnwrapIfNeeded()->Is<type::Struct>()) {
|
||||
auto* str = decl->type()->UnwrapIfNeeded()->As<type::Struct>();
|
||||
if (!str) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto* sem = program_->Sem().Get(str);
|
||||
if (!sem) {
|
||||
error_ = "Missing semantic information for structure " +
|
||||
program_->Symbols().NameFor(str->symbol());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -551,8 +566,7 @@ std::vector<ResourceBinding> Inspector::GetStorageBufferResourceBindingsImpl(
|
||||
: ResourceBinding::ResourceType::kStorageBuffer;
|
||||
entry.bind_group = binding_info.group->value();
|
||||
entry.binding = binding_info.binding->value();
|
||||
entry.min_buffer_binding_size =
|
||||
decl->type()->MinBufferBindingSize(type::MemoryLayout::kStorageBuffer);
|
||||
entry.size = sem->Size();
|
||||
|
||||
result.push_back(entry);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user