mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 18:59:21 +00:00
tint/ast: Clean up StorageClass enum
Remove unused enum entries. Add a ParseStorageClass() function. Have the WGSL parser use this. First step to standardizing the way we parse enum-backed token sets. Change-Id: I31c02816493beeabda740ff43946edce097f5fd1 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97148 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
ce8876074f
commit
48085845bd
@@ -22,6 +22,7 @@
|
||||
#include "src/tint/program_builder.h"
|
||||
#include "src/tint/sem/function.h"
|
||||
#include "src/tint/sem/variable.h"
|
||||
#include "src/tint/utils/string.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::BindingRemapper);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::BindingRemapper::Remappings);
|
||||
@@ -125,7 +126,7 @@ void BindingRemapper::Run(CloneContext& ctx, const DataMap& inputs, DataMap&) co
|
||||
ctx.dst->Diagnostics().add_error(
|
||||
diag::System::Transform,
|
||||
"cannot apply access control to variable with storage class " +
|
||||
std::string(ast::ToString(sem->StorageClass())));
|
||||
std::string(utils::ToString(sem->StorageClass())));
|
||||
return;
|
||||
}
|
||||
auto* ty = sem->Type()->UnwrapRef();
|
||||
|
||||
@@ -181,7 +181,7 @@ struct CanonicalizeEntryPointIO::State {
|
||||
auto* builtin = ast::GetAttribute<ast::BuiltinAttribute>(attributes);
|
||||
if (cfg.shader_style == ShaderStyle::kGlsl && builtin) {
|
||||
name = GLSLBuiltinToString(builtin->builtin, func_ast->PipelineStage(),
|
||||
ast::StorageClass::kInput);
|
||||
ast::StorageClass::kIn);
|
||||
}
|
||||
auto symbol = ctx.dst->Symbols().New(name);
|
||||
|
||||
@@ -198,7 +198,7 @@ struct CanonicalizeEntryPointIO::State {
|
||||
value = ctx.dst->IndexAccessor(value, 0_i);
|
||||
}
|
||||
}
|
||||
ctx.dst->GlobalVar(symbol, ast_type, ast::StorageClass::kInput, std::move(attributes));
|
||||
ctx.dst->GlobalVar(symbol, ast_type, ast::StorageClass::kIn, std::move(attributes));
|
||||
return value;
|
||||
} else if (cfg.shader_style == ShaderStyle::kMsl &&
|
||||
ast::HasAttribute<ast::BuiltinAttribute>(attributes)) {
|
||||
@@ -246,7 +246,7 @@ struct CanonicalizeEntryPointIO::State {
|
||||
if (cfg.shader_style == ShaderStyle::kGlsl) {
|
||||
if (auto* b = ast::GetAttribute<ast::BuiltinAttribute>(attributes)) {
|
||||
name = GLSLBuiltinToString(b->builtin, func_ast->PipelineStage(),
|
||||
ast::StorageClass::kOutput);
|
||||
ast::StorageClass::kOut);
|
||||
value = ToGLSLBuiltin(b->builtin, value, type);
|
||||
}
|
||||
}
|
||||
@@ -463,7 +463,7 @@ struct CanonicalizeEntryPointIO::State {
|
||||
type = ctx.dst->ty.array(type, 1_u);
|
||||
lhs = ctx.dst->IndexAccessor(lhs, 0_i);
|
||||
}
|
||||
ctx.dst->GlobalVar(name, type, ast::StorageClass::kOutput, std::move(attributes));
|
||||
ctx.dst->GlobalVar(name, type, ast::StorageClass::kOut, std::move(attributes));
|
||||
wrapper_body.push_back(ctx.dst->Assign(lhs, outval.value));
|
||||
}
|
||||
}
|
||||
@@ -640,7 +640,7 @@ struct CanonicalizeEntryPointIO::State {
|
||||
case ast::Builtin::kSampleIndex:
|
||||
return "gl_SampleID";
|
||||
case ast::Builtin::kSampleMask:
|
||||
if (storage_class == ast::StorageClass::kInput) {
|
||||
if (storage_class == ast::StorageClass::kIn) {
|
||||
return "gl_SampleMaskIn";
|
||||
} else {
|
||||
return "gl_SampleMask";
|
||||
|
||||
Reference in New Issue
Block a user