tint: Remove public include of ast include

ast::PipelineStage is private API. Duplicate the enum for the inspector.
Change-Id: Ib79600d2ef86cc13f409c7c800f98ea42bb3ace4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95943
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
Ben Clayton 2022-07-11 17:17:23 +00:00 committed by Dawn LUCI CQ
parent a5988a3058
commit 8ce7183e68
5 changed files with 30 additions and 14 deletions

View File

@ -18,7 +18,6 @@
// TODO(tint:88): When implementing support for an install target, all of these // TODO(tint:88): When implementing support for an install target, all of these
// headers will need to be moved to include/tint/. // headers will need to be moved to include/tint/.
#include "src/tint/ast/pipeline_stage.h"
#include "src/tint/demangler.h" #include "src/tint/demangler.h"
#include "src/tint/diagnostic/printer.h" #include "src/tint/diagnostic/printer.h"
#include "src/tint/inspector/inspector.h" #include "src/tint/inspector/inspector.h"

View File

@ -118,16 +118,15 @@ tint::transform::VertexStepMode ToTintVertexStepMode(wgpu::VertexStepMode mode)
UNREACHABLE(); UNREACHABLE();
} }
ResultOrError<SingleShaderStage> TintPipelineStageToShaderStage(tint::ast::PipelineStage stage) { ResultOrError<SingleShaderStage> TintPipelineStageToShaderStage(
tint::inspector::PipelineStage stage) {
switch (stage) { switch (stage) {
case tint::ast::PipelineStage::kVertex: case tint::inspector::PipelineStage::kVertex:
return SingleShaderStage::Vertex; return SingleShaderStage::Vertex;
case tint::ast::PipelineStage::kFragment: case tint::inspector::PipelineStage::kFragment:
return SingleShaderStage::Fragment; return SingleShaderStage::Fragment;
case tint::ast::PipelineStage::kCompute: case tint::inspector::PipelineStage::kCompute:
return SingleShaderStage::Compute; return SingleShaderStage::Compute;
case tint::ast::PipelineStage::kNone:
break;
} }
UNREACHABLE(); UNREACHABLE();
} }

View File

@ -120,6 +120,9 @@ struct OverridableConstant {
bool is_numeric_id_specified = false; bool is_numeric_id_specified = false;
}; };
/// The pipeline stage
enum class PipelineStage { kVertex, kFragment, kCompute };
/// Reflection data for an entry point in the shader. /// Reflection data for an entry point in the shader.
struct EntryPoint { struct EntryPoint {
/// Constructors /// Constructors
@ -135,7 +138,7 @@ struct EntryPoint {
/// Remapped entry point name in the backend /// Remapped entry point name in the backend
std::string remapped_name; std::string remapped_name;
/// The entry point stage /// The entry point stage
ast::PipelineStage stage = ast::PipelineStage::kNone; PipelineStage stage;
/// The workgroup x size /// The workgroup x size
uint32_t workgroup_size_x = 0; uint32_t workgroup_size_x = 0;
/// The workgroup y size /// The workgroup y size

View File

@ -145,7 +145,22 @@ std::vector<EntryPoint> Inspector::GetEntryPoints() {
EntryPoint entry_point; EntryPoint entry_point;
entry_point.name = program_->Symbols().NameFor(func->symbol); entry_point.name = program_->Symbols().NameFor(func->symbol);
entry_point.remapped_name = program_->Symbols().NameFor(func->symbol); entry_point.remapped_name = program_->Symbols().NameFor(func->symbol);
entry_point.stage = func->PipelineStage();
switch (func->PipelineStage()) {
case ast::PipelineStage::kCompute:
entry_point.stage = PipelineStage::kCompute;
break;
case ast::PipelineStage::kFragment:
entry_point.stage = PipelineStage::kFragment;
break;
case ast::PipelineStage::kVertex:
entry_point.stage = PipelineStage::kVertex;
break;
default:
TINT_UNREACHABLE(Inspector, diagnostics_)
<< "invalid pipeline stage for entry point '" << entry_point.name << "'";
break;
}
auto wgsize = sem->WorkgroupSize(); auto wgsize = sem->WorkgroupSize();
entry_point.workgroup_size_x = wgsize[0].value; entry_point.workgroup_size_x = wgsize[0].value;

View File

@ -168,7 +168,7 @@ TEST_F(InspectorGetEntryPointTest, OneEntryPoint) {
ASSERT_EQ(1u, result.size()); ASSERT_EQ(1u, result.size());
EXPECT_EQ("foo", result[0].name); EXPECT_EQ("foo", result[0].name);
EXPECT_EQ("foo", result[0].remapped_name); EXPECT_EQ("foo", result[0].remapped_name);
EXPECT_EQ(ast::PipelineStage::kFragment, result[0].stage); EXPECT_EQ(PipelineStage::kFragment, result[0].stage);
} }
TEST_F(InspectorGetEntryPointTest, MultipleEntryPoints) { TEST_F(InspectorGetEntryPointTest, MultipleEntryPoints) {
@ -191,10 +191,10 @@ TEST_F(InspectorGetEntryPointTest, MultipleEntryPoints) {
ASSERT_EQ(2u, result.size()); ASSERT_EQ(2u, result.size());
EXPECT_EQ("foo", result[0].name); EXPECT_EQ("foo", result[0].name);
EXPECT_EQ("foo", result[0].remapped_name); EXPECT_EQ("foo", result[0].remapped_name);
EXPECT_EQ(ast::PipelineStage::kFragment, result[0].stage); EXPECT_EQ(PipelineStage::kFragment, result[0].stage);
EXPECT_EQ("bar", result[1].name); EXPECT_EQ("bar", result[1].name);
EXPECT_EQ("bar", result[1].remapped_name); EXPECT_EQ("bar", result[1].remapped_name);
EXPECT_EQ(ast::PipelineStage::kCompute, result[1].stage); EXPECT_EQ(PipelineStage::kCompute, result[1].stage);
} }
TEST_F(InspectorGetEntryPointTest, MixFunctionsAndEntryPoints) { TEST_F(InspectorGetEntryPointTest, MixFunctionsAndEntryPoints) {
@ -221,10 +221,10 @@ TEST_F(InspectorGetEntryPointTest, MixFunctionsAndEntryPoints) {
ASSERT_EQ(2u, result.size()); ASSERT_EQ(2u, result.size());
EXPECT_EQ("foo", result[0].name); EXPECT_EQ("foo", result[0].name);
EXPECT_EQ("foo", result[0].remapped_name); EXPECT_EQ("foo", result[0].remapped_name);
EXPECT_EQ(ast::PipelineStage::kCompute, result[0].stage); EXPECT_EQ(PipelineStage::kCompute, result[0].stage);
EXPECT_EQ("bar", result[1].name); EXPECT_EQ("bar", result[1].name);
EXPECT_EQ("bar", result[1].remapped_name); EXPECT_EQ("bar", result[1].remapped_name);
EXPECT_EQ(ast::PipelineStage::kFragment, result[1].stage); EXPECT_EQ(PipelineStage::kFragment, result[1].stage);
} }
TEST_F(InspectorGetEntryPointTest, DefaultWorkgroupSize) { TEST_F(InspectorGetEntryPointTest, DefaultWorkgroupSize) {