mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 08:27:05 +00:00
Migrate from using ast::Module to Program
Enforce all places where Dawn passes in or returns a ast::Module, now takes a `const Program* ` or returns a `Program`. As the end goal of all this is to have immutable Programs, all Program inputs take a pointer instead of moving the actual object. As consumers of a Program are now all const, we have to const_cast to work around all the places we've been incorrectly mutating a ast::Module. These const_casts are temporary, and will be fixed in the next set of changes. Depends on https://dawn-review.googlesource.com/c/dawn/+/38522 Bug: tint:390 Change-Id: Ie05b112b16134937d1b601e9b713ea4ec4e1c677 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38541 Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
@@ -16,8 +16,8 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "src/ast/module.h"
|
||||
#include "src/clone_context.h"
|
||||
#include "src/program.h"
|
||||
|
||||
TINT_INSTANTIATE_CLASS_ID(tint::type::AccessControl);
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "src/ast/module.h"
|
||||
#include "src/clone_context.h"
|
||||
#include "src/program.h"
|
||||
|
||||
TINT_INSTANTIATE_CLASS_ID(tint::type::Alias);
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
|
||||
#include "src/ast/module.h"
|
||||
#include "src/ast/stride_decoration.h"
|
||||
#include "src/clone_context.h"
|
||||
#include "src/program.h"
|
||||
#include "src/type/vector_type.h"
|
||||
|
||||
TINT_INSTANTIATE_CLASS_ID(tint::type::Array);
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
#include "src/type/bool_type.h"
|
||||
|
||||
#include "src/ast/module.h"
|
||||
#include "src/clone_context.h"
|
||||
#include "src/program.h"
|
||||
|
||||
TINT_INSTANTIATE_CLASS_ID(tint::type::Bool);
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
|
||||
#include "src/ast/module.h"
|
||||
#include "src/clone_context.h"
|
||||
#include "src/program.h"
|
||||
|
||||
TINT_INSTANTIATE_CLASS_ID(tint::type::DepthTexture);
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
#include "src/type/f32_type.h"
|
||||
|
||||
#include "src/ast/module.h"
|
||||
#include "src/clone_context.h"
|
||||
#include "src/program.h"
|
||||
|
||||
TINT_INSTANTIATE_CLASS_ID(tint::type::F32);
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
#include "src/type/i32_type.h"
|
||||
|
||||
#include "src/ast/module.h"
|
||||
#include "src/clone_context.h"
|
||||
#include "src/program.h"
|
||||
|
||||
TINT_INSTANTIATE_CLASS_ID(tint::type::I32);
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "src/ast/module.h"
|
||||
#include "src/clone_context.h"
|
||||
#include "src/program.h"
|
||||
#include "src/type/array_type.h"
|
||||
#include "src/type/vector_type.h"
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
|
||||
#include "src/ast/module.h"
|
||||
#include "src/clone_context.h"
|
||||
#include "src/program.h"
|
||||
|
||||
TINT_INSTANTIATE_CLASS_ID(tint::type::MultisampledTexture);
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
#include "src/type/pointer_type.h"
|
||||
|
||||
#include "src/ast/module.h"
|
||||
#include "src/clone_context.h"
|
||||
#include "src/program.h"
|
||||
|
||||
TINT_INSTANTIATE_CLASS_ID(tint::type::Pointer);
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
|
||||
#include "src/ast/module.h"
|
||||
#include "src/clone_context.h"
|
||||
#include "src/program.h"
|
||||
|
||||
TINT_INSTANTIATE_CLASS_ID(tint::type::SampledTexture);
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
#include "src/type/sampler_type.h"
|
||||
|
||||
#include "src/ast/module.h"
|
||||
#include "src/clone_context.h"
|
||||
#include "src/program.h"
|
||||
|
||||
TINT_INSTANTIATE_CLASS_ID(tint::type::Sampler);
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
|
||||
#include "src/ast/module.h"
|
||||
#include "src/clone_context.h"
|
||||
#include "src/program.h"
|
||||
|
||||
TINT_INSTANTIATE_CLASS_ID(tint::type::StorageTexture);
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
#include <cmath>
|
||||
#include <utility>
|
||||
|
||||
#include "src/ast/module.h"
|
||||
#include "src/clone_context.h"
|
||||
#include "src/program.h"
|
||||
#include "src/type/alias_type.h"
|
||||
#include "src/type/array_type.h"
|
||||
#include "src/type/matrix_type.h"
|
||||
|
||||
@@ -21,15 +21,15 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "src/ast/builder.h"
|
||||
#include "src/ast/module.h"
|
||||
#include "src/demangler.h"
|
||||
#include "src/program.h"
|
||||
|
||||
namespace tint {
|
||||
namespace type {
|
||||
|
||||
/// Helper class for testing
|
||||
template <typename BASE>
|
||||
class TestHelperBase : public BASE, public ast::BuilderWithModule {
|
||||
class TestHelperBase : public BASE, public ast::BuilderWithProgram {
|
||||
public:
|
||||
/// Demangles the given string
|
||||
/// @param s the string to demangle
|
||||
|
||||
@@ -23,9 +23,7 @@ namespace tint {
|
||||
|
||||
// Forward declarations
|
||||
class CloneContext;
|
||||
namespace ast {
|
||||
class Module;
|
||||
} // namespace ast
|
||||
class Program;
|
||||
|
||||
namespace type {
|
||||
|
||||
@@ -103,12 +101,12 @@ class Type : public Castable<Type> {
|
||||
|
||||
/// A helper method for cloning the `Type` `t` if it is not null.
|
||||
/// If `t` is null, then `Clone()` returns null.
|
||||
/// @param m the module to clone `n` into
|
||||
/// @param p the program to clone `n` into
|
||||
/// @param t the `Type` to clone (if not null)
|
||||
/// @return the cloned type
|
||||
template <typename T>
|
||||
static T* Clone(ast::Module* m, const T* t) {
|
||||
return (t != nullptr) ? static_cast<T*>(t->Clone(m)) : nullptr;
|
||||
static T* Clone(Program* p, const T* t) {
|
||||
return (t != nullptr) ? static_cast<T*>(t->Clone(p)) : nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
#include "src/type/u32_type.h"
|
||||
|
||||
#include "src/ast/module.h"
|
||||
#include "src/clone_context.h"
|
||||
#include "src/program.h"
|
||||
|
||||
TINT_INSTANTIATE_CLASS_ID(tint::type::U32);
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
#include <assert.h>
|
||||
#include <cmath>
|
||||
|
||||
#include "src/ast/module.h"
|
||||
#include "src/clone_context.h"
|
||||
#include "src/program.h"
|
||||
|
||||
TINT_INSTANTIATE_CLASS_ID(tint::type::Vector);
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
#include "src/type/void_type.h"
|
||||
|
||||
#include "src/ast/module.h"
|
||||
#include "src/clone_context.h"
|
||||
#include "src/program.h"
|
||||
|
||||
TINT_INSTANTIATE_CLASS_ID(tint::type::Void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user