Skip to content

Commit e0070b4

Browse files
dj2Dawn LUCI CQ
authored andcommitted
[inspector] Remove unused entry point data.
Remove some reflected entry point information which is not accessed. Change-Id: Id4b3a16efb6f2b689f2a6cac143fe799d1d6e7ac Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/236835 Commit-Queue: dan sinclair <[email protected]> Reviewed-by: James Price <[email protected]>
1 parent 3d05050 commit e0070b4

File tree

4 files changed

+1
-49
lines changed

4 files changed

+1
-49
lines changed

src/tint/lang/wgsl/inspector/entry_point.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,10 @@
3030

3131
#include <optional>
3232
#include <string>
33-
#include <tuple>
3433
#include <vector>
3534

3635
#include "src/tint/api/common/override_id.h"
3736

38-
#include "src/tint/lang/wgsl/ast/interpolate_attribute.h"
39-
#include "src/tint/lang/wgsl/ast/pipeline_stage.h"
40-
4137
namespace tint::inspector {
4238

4339
/// Base component type of a stage variable.
@@ -165,13 +161,11 @@ struct EntryPoint {
165161

166162
/// The entry point name
167163
std::string name;
168-
/// Remapped entry point name in the backend
169-
std::string remapped_name;
170164
/// The entry point stage
171165
PipelineStage stage;
172166
/// The workgroup size. If PipelineStage is kCompute and this holds no value, then the workgroup
173167
/// size is derived from an override-expression. In this situation you first need to run the
174-
/// tint::ast::transform::SubstituteOverride transform before using the inspector.
168+
/// SubstituteOverride transform before using the inspector.
175169
std::optional<WorkgroupSize> workgroup_size;
176170
/// The total size in bytes of all Workgroup storage-class storage accessed via the entry point.
177171
uint32_t workgroup_storage_size = 0;
@@ -192,9 +186,6 @@ struct EntryPoint {
192186
/// Does the entry point use the sample_mask builtin as an output builtin
193187
/// variable.
194188
bool output_sample_mask_used = false;
195-
/// Does the entry point use the position builtin as an input builtin
196-
/// variable.
197-
bool input_position_used = false;
198189
/// Does the entry point use the front_facing builtin
199190
bool front_facing_used = false;
200191
/// Does the entry point use the sample_index builtin

src/tint/lang/wgsl/inspector/inspector.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ EntryPoint Inspector::GetEntryPoint(const tint::ast::Function* func) {
266266
auto* sem = program_.Sem().Get(func);
267267

268268
entry_point.name = func->name->symbol.Name();
269-
entry_point.remapped_name = func->name->symbol.Name();
270269

271270
switch (func->PipelineStage()) {
272271
case ast::PipelineStage::kCompute: {
@@ -306,8 +305,6 @@ EntryPoint Inspector::GetEntryPoint(const tint::ast::Function* func) {
306305
param->Type(), param->Declaration()->attributes, param->Attributes().location,
307306
param->Attributes().color, /* @blend_src */ std::nullopt, entry_point.input_variables);
308307

309-
entry_point.input_position_used |= ContainsBuiltin(
310-
core::BuiltinValue::kPosition, param->Type(), param->Declaration()->attributes);
311308
entry_point.front_facing_used |= ContainsBuiltin(
312309
core::BuiltinValue::kFrontFacing, param->Type(), param->Declaration()->attributes);
313310
entry_point.sample_index_used |= ContainsBuiltin(

src/tint/lang/wgsl/inspector/inspector.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
#include "src/tint/lang/core/builtin_value.h"
4141
#include "src/tint/lang/wgsl/inspector/entry_point.h"
4242
#include "src/tint/lang/wgsl/inspector/resource_binding.h"
43-
#include "src/tint/lang/wgsl/inspector/scalar.h"
4443
#include "src/tint/lang/wgsl/program/program.h"
4544
#include "src/tint/lang/wgsl/sem/sampler_texture_pair.h"
4645

src/tint/lang/wgsl/inspector/inspector_test.cc

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ TEST_F(InspectorGetEntryPointTest, OneEntryPoint) {
124124

125125
ASSERT_EQ(1u, result.size());
126126
EXPECT_EQ("foo", result[0].name);
127-
EXPECT_EQ("foo", result[0].remapped_name);
128127
EXPECT_EQ(PipelineStage::kFragment, result[0].stage);
129128
}
130129

@@ -140,10 +139,8 @@ TEST_F(InspectorGetEntryPointTest, MultipleEntryPoints) {
140139

141140
ASSERT_EQ(2u, result.size());
142141
EXPECT_EQ("foo", result[0].name);
143-
EXPECT_EQ("foo", result[0].remapped_name);
144142
EXPECT_EQ(PipelineStage::kFragment, result[0].stage);
145143
EXPECT_EQ("bar", result[1].name);
146-
EXPECT_EQ("bar", result[1].remapped_name);
147144
EXPECT_EQ(PipelineStage::kCompute, result[1].stage);
148145
}
149146

@@ -163,10 +160,8 @@ fn foo() { func(); }
163160

164161
ASSERT_EQ(2u, result.size());
165162
EXPECT_EQ("foo", result[0].name);
166-
EXPECT_EQ("foo", result[0].remapped_name);
167163
EXPECT_EQ(PipelineStage::kCompute, result[0].stage);
168164
EXPECT_EQ("bar", result[1].name);
169-
EXPECT_EQ("bar", result[1].remapped_name);
170165
EXPECT_EQ(PipelineStage::kFragment, result[1].stage);
171166
}
172167

@@ -1137,7 +1132,6 @@ fn ep_func() {}
11371132
ASSERT_EQ(1u, result.size());
11381133
EXPECT_FALSE(result[0].input_sample_mask_used);
11391134
EXPECT_FALSE(result[0].output_sample_mask_used);
1140-
EXPECT_FALSE(result[0].input_position_used);
11411135
EXPECT_FALSE(result[0].front_facing_used);
11421136
EXPECT_FALSE(result[0].sample_index_used);
11431137
EXPECT_FALSE(result[0].num_workgroups_used);
@@ -1209,35 +1203,6 @@ fn ep_func() -> out_struct {
12091203
EXPECT_TRUE(result[0].output_sample_mask_used);
12101204
}
12111205

1212-
TEST_F(InspectorGetEntryPointTest, InputPositionSimpleReferenced) {
1213-
auto* src = R"(
1214-
@fragment
1215-
fn ep_func(@builtin(position) in_var: vec4f) {}
1216-
)";
1217-
Inspector& inspector = Initialize(src);
1218-
1219-
auto result = inspector.GetEntryPoints();
1220-
1221-
ASSERT_EQ(1u, result.size());
1222-
EXPECT_TRUE(result[0].input_position_used);
1223-
}
1224-
1225-
TEST_F(InspectorGetEntryPointTest, InputPositionStructReferenced) {
1226-
auto* src = R"(
1227-
struct in_struct {
1228-
@builtin(position) inner_position: vec4f,
1229-
}
1230-
@fragment
1231-
fn ep_func(in_var: in_struct) {}
1232-
)";
1233-
Inspector& inspector = Initialize(src);
1234-
1235-
auto result = inspector.GetEntryPoints();
1236-
1237-
ASSERT_EQ(1u, result.size());
1238-
EXPECT_TRUE(result[0].input_position_used);
1239-
}
1240-
12411206
TEST_F(InspectorGetEntryPointTest, FrontFacingSimpleReferenced) {
12421207
auto* src = R"(
12431208
@fragment

0 commit comments

Comments
 (0)