mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-12 06:45:16 +00:00
ast: Remove Variable constructor that doesn't take a source
set_source() will be removed, so sources will only be specifiable at construction time. Bug: tint:390 Change-Id: I5c79efd3fa501ebd9308f7f93cfb77bc12198047 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35009 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
b4b29639a1
commit
321e5a9d7e
@@ -52,7 +52,7 @@ Transform::Output EmitVertexPointSize::Run(ast::Module* in) {
|
||||
// Declare the pointsize builtin output variable.
|
||||
auto* pointsize_var =
|
||||
mod->create<ast::DecoratedVariable>(mod->create<ast::Variable>(
|
||||
kPointSizeVar, ast::StorageClass::kOutput, f32));
|
||||
Source{}, kPointSizeVar, ast::StorageClass::kOutput, f32));
|
||||
pointsize_var->set_decorations({
|
||||
mod->create<ast::BuiltinDecoration>(ast::Builtin::kPointSize, Source{}),
|
||||
});
|
||||
|
||||
@@ -159,7 +159,7 @@ void VertexPulling::State::FindOrInsertVertexIndexIfUsed() {
|
||||
vertex_index_name = kDefaultVertexIndexName;
|
||||
|
||||
auto* var = mod->create<ast::DecoratedVariable>(mod->create<ast::Variable>(
|
||||
vertex_index_name, ast::StorageClass::kInput, GetI32Type()));
|
||||
Source{}, vertex_index_name, ast::StorageClass::kInput, GetI32Type()));
|
||||
|
||||
ast::VariableDecorationList decorations;
|
||||
decorations.push_back(
|
||||
@@ -203,7 +203,7 @@ void VertexPulling::State::FindOrInsertInstanceIndexIfUsed() {
|
||||
instance_index_name = kDefaultInstanceIndexName;
|
||||
|
||||
auto* var = mod->create<ast::DecoratedVariable>(mod->create<ast::Variable>(
|
||||
instance_index_name, ast::StorageClass::kInput, GetI32Type()));
|
||||
Source{}, instance_index_name, ast::StorageClass::kInput, GetI32Type()));
|
||||
|
||||
ast::VariableDecorationList decorations;
|
||||
decorations.push_back(mod->create<ast::BuiltinDecoration>(
|
||||
@@ -226,8 +226,8 @@ void VertexPulling::State::ConvertVertexInputVariablesToPrivate() {
|
||||
// This is where the replacement happens. Expressions use identifier
|
||||
// strings instead of pointers, so we don't need to update any other
|
||||
// place in the AST.
|
||||
v = mod->create<ast::Variable>(v->name(), ast::StorageClass::kPrivate,
|
||||
v->type());
|
||||
v = mod->create<ast::Variable>(
|
||||
Source{}, v->name(), ast::StorageClass::kPrivate, v->type());
|
||||
location_to_var[location] = v;
|
||||
break;
|
||||
}
|
||||
@@ -265,7 +265,7 @@ void VertexPulling::State::AddVertexStorageBuffers() {
|
||||
for (uint32_t i = 0; i < cfg.vertex_state.size(); ++i) {
|
||||
// The decorated variable with struct type
|
||||
auto* var = mod->create<ast::DecoratedVariable>(mod->create<ast::Variable>(
|
||||
GetVertexBufferName(i), ast::StorageClass::kStorageBuffer,
|
||||
Source{}, GetVertexBufferName(i), ast::StorageClass::kStorageBuffer,
|
||||
struct_type));
|
||||
|
||||
// Add decorations
|
||||
@@ -289,9 +289,9 @@ void VertexPulling::State::AddVertexPullingPreamble(
|
||||
auto* block = mod->create<ast::BlockStatement>();
|
||||
|
||||
// Declare the |kPullingPosVarName| variable in the shader
|
||||
auto* pos_declaration =
|
||||
mod->create<ast::VariableDeclStatement>(mod->create<ast::Variable>(
|
||||
kPullingPosVarName, ast::StorageClass::kFunction, GetI32Type()));
|
||||
auto* pos_declaration = mod->create<ast::VariableDeclStatement>(
|
||||
mod->create<ast::Variable>(Source{}, kPullingPosVarName,
|
||||
ast::StorageClass::kFunction, GetI32Type()));
|
||||
|
||||
// |kPullingPosVarName| refers to the byte location of the current read. We
|
||||
// declare a variable in the shader to avoid having to reuse Expression
|
||||
|
||||
@@ -70,7 +70,7 @@ class VertexPullingHelper {
|
||||
std::string name,
|
||||
ast::type::Type* type) {
|
||||
auto* var = create<ast::DecoratedVariable>(
|
||||
create<ast::Variable>(name, ast::StorageClass::kInput, type));
|
||||
create<ast::Variable>(Source{}, name, ast::StorageClass::kInput, type));
|
||||
|
||||
ast::VariableDecorationList decorations;
|
||||
decorations.push_back(create<ast::LocationDecoration>(location, Source{}));
|
||||
@@ -419,7 +419,7 @@ TEST_F(VertexPullingTest, ExistingVertexIndexAndInstanceIndex) {
|
||||
{
|
||||
auto* vertex_index_var =
|
||||
create<ast::DecoratedVariable>(create<ast::Variable>(
|
||||
"custom_vertex_index", ast::StorageClass::kInput, &i32));
|
||||
Source{}, "custom_vertex_index", ast::StorageClass::kInput, &i32));
|
||||
|
||||
ast::VariableDecorationList decorations;
|
||||
decorations.push_back(
|
||||
@@ -430,9 +430,9 @@ TEST_F(VertexPullingTest, ExistingVertexIndexAndInstanceIndex) {
|
||||
}
|
||||
|
||||
{
|
||||
auto* instance_index_var =
|
||||
create<ast::DecoratedVariable>(create<ast::Variable>(
|
||||
"custom_instance_index", ast::StorageClass::kInput, &i32));
|
||||
auto* instance_index_var = create<ast::DecoratedVariable>(
|
||||
create<ast::Variable>(Source{}, "custom_instance_index",
|
||||
ast::StorageClass::kInput, &i32));
|
||||
|
||||
ast::VariableDecorationList decorations;
|
||||
decorations.push_back(
|
||||
|
||||
Reference in New Issue
Block a user