sem::Type: Replace GetDefaultAlignAndSize() with Size() and Align()

This is a cleaner API, and the implementation doesn't have to know a bunch of information about all the derived types.

Change-Id: I96bebcb9f3ceda86fa34bd8e70961dee63fd7e13
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59301
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Ben Clayton
2021-07-22 18:56:54 +00:00
committed by Tint LUCI CQ
parent f5ed2ba906
commit fced350b3d
26 changed files with 205 additions and 107 deletions

View File

@@ -546,9 +546,9 @@ uint32_t Inspector::GetWorkgroupStorageSize(const std::string& entry_point) {
auto* func_sem = program_->Sem().Get(func);
for (const sem::Variable* var : func_sem->ReferencedModuleVariables()) {
if (var->StorageClass() == ast::StorageClass::kWorkgroup) {
uint32_t align = 0;
uint32_t size = 0;
var->Type()->UnwrapRef()->GetDefaultAlignAndSize(align, size);
auto* ty = var->Type()->UnwrapRef();
uint32_t align = ty->Align();
uint32_t size = ty->Size();
// This essentially matches std430 layout rules from GLSL, which are in
// turn specified as an upper bound for Vulkan layout sizing. Since D3D