mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 00:17:03 +00:00
Validate that in/out storage classes are not used
Use a DisableValidationDecoration to allow these storage classes only for variables generated by the SPIR-V sanitizer. This is also used in the Inspector tests, since the Inspector is currently run *after* the SPIR-V sanitizer. These tests will be removed when this is no longer the case. Also validate that builtin/location decorations are not used on variables (unless they have input/output storage class). Fix or delete all of the other tests that were wrongly using these storage classes and attributes. Bug: tint:697 Change-Id: I8be7fb16191f5e2bed9f7dfb700e51f3b97fd1fe Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/55862 Auto-Submit: James Price <jrprice@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
ffd28e2e1a
commit
14c0b8acbf
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "src/ast/call_statement.h"
|
||||
#include "src/ast/disable_validation_decoration.h"
|
||||
#include "src/ast/override_decoration.h"
|
||||
#include "src/ast/stage_decoration.h"
|
||||
#include "src/ast/struct_block_decoration.h"
|
||||
@@ -88,9 +89,15 @@ class InspectorHelper : public ProgramBuilder {
|
||||
std::tie(in, out) = inout;
|
||||
|
||||
Global(in, ty.u32(), ast::StorageClass::kInput, nullptr,
|
||||
ast::DecorationList{Location(location++)});
|
||||
ast::DecorationList{
|
||||
Location(location++),
|
||||
ASTNodes().Create<ast::DisableValidationDecoration>(
|
||||
ID(), ast::DisabledValidation::kIgnoreStorageClass)});
|
||||
Global(out, ty.u32(), ast::StorageClass::kOutput, nullptr,
|
||||
ast::DecorationList{Location(location++)});
|
||||
ast::DecorationList{
|
||||
Location(location++),
|
||||
ASTNodes().Create<ast::DisableValidationDecoration>(
|
||||
ID(), ast::DisabledValidation::kIgnoreStorageClass)});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1437,9 +1444,15 @@ TEST_F(InspectorGetEntryPointTest,
|
||||
// TODO(crbug.com/tint/697): Remove this.
|
||||
TEST_F(InspectorGetEntryPointTest, BuiltInsNotStageVariables_Legacy) {
|
||||
Global("in_var", ty.u32(), ast::StorageClass::kInput, nullptr,
|
||||
ast::DecorationList{Builtin(ast::Builtin::kPosition)});
|
||||
ast::DecorationList{
|
||||
Builtin(ast::Builtin::kPosition),
|
||||
ASTNodes().Create<ast::DisableValidationDecoration>(
|
||||
ID(), ast::DisabledValidation::kIgnoreStorageClass)});
|
||||
Global("out_var", ty.u32(), ast::StorageClass::kOutput, nullptr,
|
||||
ast::DecorationList{Location(0)});
|
||||
ast::DecorationList{
|
||||
Location(0),
|
||||
ASTNodes().Create<ast::DisableValidationDecoration>(
|
||||
ID(), ast::DisabledValidation::kIgnoreStorageClass)});
|
||||
|
||||
MakeInOutVariableBodyFunction("func", {{"in_var", "out_var"}}, {});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user