From c6cbe3fda694caa2af2daab3d926469f6d7fadf1 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Tue, 27 Jul 2021 07:33:19 +0000 Subject: [PATCH] Remove InputStepMode (it was deprecated in favor of VertexStepMode) Bug: dawn:1023 Change-Id: Ie5bb84f34f62143f92b59a816c7976f358b5c102 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59665 Auto-Submit: Corentin Wallez Reviewed-by: Corentin Wallez Reviewed-by: Ben Clayton Kokoro: Kokoro Commit-Queue: Corentin Wallez --- fuzzers/tint_common_fuzzer.cc | 4 +-- src/transform/vertex_pulling.cc | 8 +++--- src/transform/vertex_pulling.h | 7 ++--- src/transform/vertex_pulling_test.cc | 38 ++++++++++++++-------------- 4 files changed, 27 insertions(+), 30 deletions(-) diff --git a/fuzzers/tint_common_fuzzer.cc b/fuzzers/tint_common_fuzzer.cc index 49e770eda4..8ea569fdde 100644 --- a/fuzzers/tint_common_fuzzer.cc +++ b/fuzzers/tint_common_fuzzer.cc @@ -63,8 +63,8 @@ transform::VertexBufferLayoutDescriptor ExtractVertexBufferLayoutDescriptor( Reader* r) { transform::VertexBufferLayoutDescriptor desc; desc.array_stride = r->read(); - desc.step_mode = r->enum_class( - static_cast(transform::InputStepMode::kLastEntry) + 1); + desc.step_mode = r->enum_class( + static_cast(transform::VertexStepMode::kLastEntry) + 1); desc.attributes = r->vector(ExtractVertexAttributeDescriptor); return desc; } diff --git a/src/transform/vertex_pulling.cc b/src/transform/vertex_pulling.cc index 11e5fb803a..d4a8d5e839 100644 --- a/src/transform/vertex_pulling.cc +++ b/src/transform/vertex_pulling.cc @@ -298,7 +298,7 @@ struct State { return nullptr; } - auto* index_expr = buffer_layout.step_mode == InputStepMode::kVertex + auto* index_expr = buffer_layout.step_mode == VertexStepMode::kVertex ? vertex_index_expr() : instance_index_expr(); @@ -860,7 +860,7 @@ struct State { // Insert new parameters for vertex_index and instance_index if needed. if (!vertex_index_expr) { for (const VertexBufferLayoutDescriptor& layout : cfg.vertex_state) { - if (layout.step_mode == InputStepMode::kVertex) { + if (layout.step_mode == VertexStepMode::kVertex) { auto name = ctx.dst->Symbols().New("tint_pulling_vertex_index"); new_function_parameters.push_back( ctx.dst->Param(name, ctx.dst->ty.u32(), @@ -872,7 +872,7 @@ struct State { } if (!instance_index_expr) { for (const VertexBufferLayoutDescriptor& layout : cfg.vertex_state) { - if (layout.step_mode == InputStepMode::kInstance) { + if (layout.step_mode == VertexStepMode::kInstance) { auto name = ctx.dst->Symbols().New("tint_pulling_instance_index"); new_function_parameters.push_back( ctx.dst->Param(name, ctx.dst->ty.u32(), @@ -945,7 +945,7 @@ VertexBufferLayoutDescriptor::VertexBufferLayoutDescriptor() = default; VertexBufferLayoutDescriptor::VertexBufferLayoutDescriptor( uint32_t in_array_stride, - InputStepMode in_step_mode, + VertexStepMode in_step_mode, std::vector in_attributes) : array_stride(in_array_stride), step_mode(in_step_mode), diff --git a/src/transform/vertex_pulling.h b/src/transform/vertex_pulling.h index b445db720c..c6250b716c 100644 --- a/src/transform/vertex_pulling.h +++ b/src/transform/vertex_pulling.h @@ -65,9 +65,6 @@ enum class VertexFormat { /// index enum class VertexStepMode { kVertex, kInstance, kLastEntry = kInstance }; -/// Deprecated -using InputStepMode = VertexStepMode; - /// Describes a vertex attribute within a buffer struct VertexAttributeDescriptor { /// The format of the attribute @@ -88,7 +85,7 @@ struct VertexBufferLayoutDescriptor { /// @param in_attributes the in attributes VertexBufferLayoutDescriptor( uint32_t in_array_stride, - InputStepMode in_step_mode, + VertexStepMode in_step_mode, std::vector in_attributes); /// Copy constructor /// @param other the struct to copy @@ -105,7 +102,7 @@ struct VertexBufferLayoutDescriptor { /// The array stride used in the in buffer uint32_t array_stride = 0u; /// The input step mode used - InputStepMode step_mode = InputStepMode::kVertex; + VertexStepMode step_mode = VertexStepMode::kVertex; /// The vertex attributes std::vector attributes; }; diff --git a/src/transform/vertex_pulling_test.cc b/src/transform/vertex_pulling_test.cc index 8be8da2bd9..20f7929ab5 100644 --- a/src/transform/vertex_pulling_test.cc +++ b/src/transform/vertex_pulling_test.cc @@ -88,7 +88,7 @@ fn main([[location(0)]] var_a : f32) -> [[builtin(position)]] vec4 { VertexPulling::Config cfg; cfg.vertex_state = { - {{15, InputStepMode::kVertex, {{VertexFormat::kFloat32, 0, 0}}}}}; + {{15, VertexStepMode::kVertex, {{VertexFormat::kFloat32, 0, 0}}}}}; cfg.entry_point_name = "main"; DataMap data; @@ -157,7 +157,7 @@ fn main([[builtin(vertex_index)]] tint_pulling_vertex_index : u32) -> [[builtin( VertexPulling::Config cfg; cfg.vertex_state = { - {{4, InputStepMode::kVertex, {{VertexFormat::kFloat32, 0, 0}}}}}; + {{4, VertexStepMode::kVertex, {{VertexFormat::kFloat32, 0, 0}}}}}; cfg.entry_point_name = "main"; DataMap data; @@ -196,7 +196,7 @@ fn main([[builtin(instance_index)]] tint_pulling_instance_index : u32) -> [[buil VertexPulling::Config cfg; cfg.vertex_state = { - {{4, InputStepMode::kInstance, {{VertexFormat::kFloat32, 0, 0}}}}}; + {{4, VertexStepMode::kInstance, {{VertexFormat::kFloat32, 0, 0}}}}}; cfg.entry_point_name = "main"; DataMap data; @@ -235,7 +235,7 @@ fn main([[builtin(vertex_index)]] tint_pulling_vertex_index : u32) -> [[builtin( VertexPulling::Config cfg; cfg.vertex_state = { - {{4, InputStepMode::kVertex, {{VertexFormat::kFloat32, 0, 0}}}}}; + {{4, VertexStepMode::kVertex, {{VertexFormat::kFloat32, 0, 0}}}}}; cfg.pulling_group = 5; cfg.entry_point_name = "main"; @@ -284,7 +284,7 @@ fn main([[builtin(vertex_index)]] tint_pulling_vertex_index : u32) -> [[builtin( VertexPulling::Config cfg; cfg.vertex_state = { - {{4, InputStepMode::kVertex, {{VertexFormat::kFloat32, 0, 0}}}}}; + {{4, VertexStepMode::kVertex, {{VertexFormat::kFloat32, 0, 0}}}}}; cfg.entry_point_name = "main"; DataMap data; @@ -335,12 +335,12 @@ fn main([[builtin(vertex_index)]] custom_vertex_index : u32, [[builtin(instance_ cfg.vertex_state = {{ { 4, - InputStepMode::kVertex, + VertexStepMode::kVertex, {{VertexFormat::kFloat32, 0, 0}}, }, { 4, - InputStepMode::kInstance, + VertexStepMode::kInstance, {{VertexFormat::kFloat32, 0, 1}}, }, }}; @@ -415,12 +415,12 @@ fn main(tint_symbol_1 : tint_symbol) -> [[builtin(position)]] vec4 { cfg.vertex_state = {{ { 4, - InputStepMode::kVertex, + VertexStepMode::kVertex, {{VertexFormat::kFloat32, 0, 0}}, }, { 4, - InputStepMode::kInstance, + VertexStepMode::kInstance, {{VertexFormat::kFloat32, 0, 1}}, }, }}; @@ -492,12 +492,12 @@ fn main(indices : Indices) -> [[builtin(position)]] vec4 { cfg.vertex_state = {{ { 4, - InputStepMode::kVertex, + VertexStepMode::kVertex, {{VertexFormat::kFloat32, 0, 0}}, }, { 4, - InputStepMode::kInstance, + VertexStepMode::kInstance, {{VertexFormat::kFloat32, 0, 1}}, }, }}; @@ -543,7 +543,7 @@ fn main([[builtin(vertex_index)]] tint_pulling_vertex_index : u32) -> [[builtin( VertexPulling::Config cfg; cfg.vertex_state = { {{16, - InputStepMode::kVertex, + VertexStepMode::kVertex, {{VertexFormat::kFloat32, 0, 0}, {VertexFormat::kFloat32x4, 0, 1}}}}}; cfg.entry_point_name = "main"; @@ -596,9 +596,9 @@ fn main([[builtin(vertex_index)]] tint_pulling_vertex_index : u32) -> [[builtin( VertexPulling::Config cfg; cfg.vertex_state = {{ - {8, InputStepMode::kVertex, {{VertexFormat::kFloat32x2, 0, 0}}}, - {12, InputStepMode::kVertex, {{VertexFormat::kFloat32x3, 0, 1}}}, - {16, InputStepMode::kVertex, {{VertexFormat::kFloat32x4, 0, 2}}}, + {8, VertexStepMode::kVertex, {{VertexFormat::kFloat32x2, 0, 0}}}, + {12, VertexStepMode::kVertex, {{VertexFormat::kFloat32x3, 0, 1}}}, + {16, VertexStepMode::kVertex, {{VertexFormat::kFloat32x4, 0, 2}}}, }}; cfg.entry_point_name = "main"; @@ -650,7 +650,7 @@ fn main([[builtin(vertex_index)]] tint_pulling_vertex_index_1 : u32) -> [[builti VertexPulling::Config cfg; cfg.vertex_state = { {{16, - InputStepMode::kVertex, + VertexStepMode::kVertex, {{VertexFormat::kFloat32, 0, 0}, {VertexFormat::kFloat32x4, 0, 1}}}}}; cfg.entry_point_name = "main"; @@ -779,7 +779,7 @@ fn main([[builtin(vertex_index)]] tint_pulling_vertex_index : u32) -> [[builtin( VertexPulling::Config cfg; cfg.vertex_state = {{{256, - InputStepMode::kVertex, + VertexStepMode::kVertex, { {VertexFormat::kUint8x2, 64, 0}, {VertexFormat::kUint8x4, 64, 1}, @@ -940,7 +940,7 @@ fn main([[builtin(vertex_index)]] tint_pulling_vertex_index : u32) -> [[builtin( VertexPulling::Config cfg; cfg.vertex_state = {{{256, - InputStepMode::kVertex, + VertexStepMode::kVertex, { {VertexFormat::kUint8x2, 63, 0}, {VertexFormat::kUint8x4, 63, 1}, @@ -1100,7 +1100,7 @@ fn main([[builtin(vertex_index)]] tint_pulling_vertex_index : u32) -> [[builtin( VertexPulling::Config cfg; cfg.vertex_state = {{{256, - InputStepMode::kVertex, + VertexStepMode::kVertex, { {VertexFormat::kUint8x2, 64, 0}, {VertexFormat::kUint8x4, 64, 1},