mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-12 14:46:08 +00:00
Move workgroup_size property into sem::Function
The workgroup size should not be a property of the function in the AST, and this lays the groundwork for allowing both literals and module-scope constants to be used for this attribute. Bug: tint:713 Change-Id: I014be879e2adb81cfc5b0ea0e221035fae626223 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51261 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
Commit Bot service account
parent
594075a2f0
commit
ce8f868815
@@ -58,13 +58,6 @@ Function::Function(Function&&) = default;
|
||||
|
||||
Function::~Function() = default;
|
||||
|
||||
std::tuple<uint32_t, uint32_t, uint32_t> Function::workgroup_size() const {
|
||||
if (auto* workgroup = GetDecoration<WorkgroupDecoration>(decorations_)) {
|
||||
return workgroup->values();
|
||||
}
|
||||
return {1, 1, 1};
|
||||
}
|
||||
|
||||
PipelineStage Function::pipeline_stage() const {
|
||||
if (auto* stage = GetDecoration<StageDecoration>(decorations_)) {
|
||||
return stage->value();
|
||||
|
||||
@@ -66,10 +66,6 @@ class Function : public Castable<Function, Node> {
|
||||
/// @returns the decorations attached to this function
|
||||
const DecorationList& decorations() const { return decorations_; }
|
||||
|
||||
/// @returns the workgroup size {x, y, z} for the function. {1, 1, 1} will be
|
||||
/// return if no workgroup size was set.
|
||||
std::tuple<uint32_t, uint32_t, uint32_t> workgroup_size() const;
|
||||
|
||||
/// @returns the functions pipeline stage or None if not set
|
||||
PipelineStage pipeline_stage() const;
|
||||
|
||||
|
||||
@@ -225,31 +225,6 @@ TEST_F(FunctionTest, GetLastStatement_nullptr) {
|
||||
EXPECT_EQ(f->get_last_statement(), nullptr);
|
||||
}
|
||||
|
||||
TEST_F(FunctionTest, WorkgroupSize_NoneSet) {
|
||||
auto* f = Func("func", VariableList{}, ty.void_(), StatementList{},
|
||||
DecorationList{});
|
||||
uint32_t x = 0;
|
||||
uint32_t y = 0;
|
||||
uint32_t z = 0;
|
||||
std::tie(x, y, z) = f->workgroup_size();
|
||||
EXPECT_EQ(x, 1u);
|
||||
EXPECT_EQ(y, 1u);
|
||||
EXPECT_EQ(z, 1u);
|
||||
}
|
||||
|
||||
TEST_F(FunctionTest, WorkgroupSize) {
|
||||
auto* f = Func("func", VariableList{}, ty.void_(), StatementList{},
|
||||
DecorationList{create<WorkgroupDecoration>(2u, 4u, 6u)});
|
||||
|
||||
uint32_t x = 0;
|
||||
uint32_t y = 0;
|
||||
uint32_t z = 0;
|
||||
std::tie(x, y, z) = f->workgroup_size();
|
||||
EXPECT_EQ(x, 2u);
|
||||
EXPECT_EQ(y, 4u);
|
||||
EXPECT_EQ(z, 6u);
|
||||
}
|
||||
|
||||
using FunctionListTest = TestHelper;
|
||||
|
||||
TEST_F(FunctionListTest, FindSymbol) {
|
||||
|
||||
Reference in New Issue
Block a user