From ff6c9ca6f0d3605076d3a19fb1b52374a78ea2b3 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Sun, 25 Jul 2021 18:40:19 +0000 Subject: [PATCH] wgpu::InputStepMode -> VertexStepMode See https://github.com/gpuweb/gpuweb/pull/1927 Adds a typedef to make a gradual deprecation. Bug: dawn:1023 Change-Id: Ic81a933a95556fbf5726056530788dde017a1449 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/59442 Reviewed-by: Austin Eng Reviewed-by: Stephen White Commit-Queue: Corentin Wallez --- dawn.json | 6 +- examples/ComputeBoids.cpp | 2 +- .../templates/dawn_native/wgpu_structs.h | 2 +- generator/templates/webgpu.h | 7 +- src/dawn_native/RenderPipeline.cpp | 6 +- src/dawn_native/RenderPipeline.h | 2 +- src/dawn_native/ShaderModule.cpp | 8 +- src/dawn_native/d3d12/RenderPipelineD3D12.cpp | 8 +- src/dawn_native/metal/RenderPipelineMTL.mm | 8 +- src/dawn_native/opengl/RenderPipelineGL.cpp | 4 +- src/dawn_native/vulkan/RenderPipelineVk.cpp | 6 +- src/tests/end2end/VertexStateTests.cpp | 91 ++++++++++--------- ...VertexAndIndexBufferOOBValidationTests.cpp | 8 +- src/utils/ComboRenderPipelineDescriptor.cpp | 4 +- 14 files changed, 87 insertions(+), 75 deletions(-) diff --git a/dawn.json b/dawn.json index 0fd7be873e..074f51f7b1 100644 --- a/dawn.json +++ b/dawn.json @@ -1032,7 +1032,7 @@ "extensible": false, "members": [ {"name": "array stride", "type": "uint64_t"}, - {"name": "step mode", "type": "input step mode", "default": "vertex"}, + {"name": "step mode", "type": "vertex step mode", "default": "vertex"}, {"name": "attribute count", "type": "uint32_t"}, {"name": "attributes", "type": "vertex attribute", "annotation": "const*", "length": "attribute count"} ] @@ -1042,6 +1042,10 @@ "type": "vertex buffer layout" }, "input step mode": { + "category": "typedef", + "type": "vertex step mode" + }, + "vertex step mode": { "category": "enum", "values": [ {"value": 0, "name": "vertex"}, diff --git a/examples/ComputeBoids.cpp b/examples/ComputeBoids.cpp index 55ad9b7e26..72fff826bc 100644 --- a/examples/ComputeBoids.cpp +++ b/examples/ComputeBoids.cpp @@ -127,7 +127,7 @@ void initRender() { descriptor.vertex.module = vsModule; descriptor.vertex.bufferCount = 2; descriptor.cBuffers[0].arrayStride = sizeof(Particle); - descriptor.cBuffers[0].stepMode = wgpu::InputStepMode::Instance; + descriptor.cBuffers[0].stepMode = wgpu::VertexStepMode::Instance; descriptor.cBuffers[0].attributeCount = 2; descriptor.cAttributes[0].offset = offsetof(Particle, pos); descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x2; diff --git a/generator/templates/dawn_native/wgpu_structs.h b/generator/templates/dawn_native/wgpu_structs.h index 0bffebb73f..5291d83b73 100644 --- a/generator/templates/dawn_native/wgpu_structs.h +++ b/generator/templates/dawn_native/wgpu_structs.h @@ -64,7 +64,7 @@ namespace dawn_native { {% endfor %} - {% for typeDef in by_category["typedef"] %} + {% for typeDef in by_category["typedef"] if typeDef.type.category == "structure" %} using {{as_cppType(typeDef.name)}} = {{as_cppType(typeDef.type.name)}}; {% endfor %} diff --git a/generator/templates/webgpu.h b/generator/templates/webgpu.h index c44fa391be..b001d83aa8 100644 --- a/generator/templates/webgpu.h +++ b/generator/templates/webgpu.h @@ -74,7 +74,7 @@ #include #define WGPU_WHOLE_SIZE (0xffffffffffffffffULL) -// TODO(crbug.com/520): Remove WGPU_STRIDE_UNDEFINED in favor of WGPU_COPY_STRIDE_UNDEFINED. +// TODO(crbug.com/dawn/520): Remove WGPU_STRIDE_UNDEFINED in favor of WGPU_COPY_STRIDE_UNDEFINED. #define WGPU_STRIDE_UNDEFINED (0xffffffffUL) #define WGPU_COPY_STRIDE_UNDEFINED (0xffffffffUL) @@ -124,6 +124,11 @@ typedef struct WGPUChainedStruct { {% endfor %} +// TODO(crbug.com/dawn/1023): Remove after the deprecation period. +#define WGPUInputStepMode_Vertex WGPUVertexStepMode_Vertex +#define WGPUInputStepMode_Instance WGPUVertexStepMode_Instance +#define WGPUInputStepMode_Force32 WGPUVertexStepMode_Force32 + #ifdef __cplusplus extern "C" { #endif diff --git a/src/dawn_native/RenderPipeline.cpp b/src/dawn_native/RenderPipeline.cpp index da78253aad..cb9eac79fa 100644 --- a/src/dawn_native/RenderPipeline.cpp +++ b/src/dawn_native/RenderPipeline.cpp @@ -81,7 +81,7 @@ namespace dawn_native { const VertexBufferLayout* buffer, const EntryPointMetadata& metadata, ityp::bitset* attributesSetMask) { - DAWN_TRY(ValidateInputStepMode(buffer->stepMode)); + DAWN_TRY(ValidateVertexStepMode(buffer->stepMode)); if (buffer->arrayStride > kMaxVertexBufferArrayStride) { return DAWN_VALIDATION_ERROR("Setting arrayStride out of bounds"); } @@ -411,10 +411,10 @@ namespace dawn_native { mVertexBufferInfos[typedSlot].arrayStride = buffers[slot].arrayStride; mVertexBufferInfos[typedSlot].stepMode = buffers[slot].stepMode; switch (buffers[slot].stepMode) { - case wgpu::InputStepMode::Vertex: + case wgpu::VertexStepMode::Vertex: mVertexBufferSlotsUsedAsVertexBuffer.set(typedSlot); break; - case wgpu::InputStepMode::Instance: + case wgpu::VertexStepMode::Instance: mVertexBufferSlotsUsedAsInstanceBuffer.set(typedSlot); break; default: diff --git a/src/dawn_native/RenderPipeline.h b/src/dawn_native/RenderPipeline.h index 10a643340d..a379cd651d 100644 --- a/src/dawn_native/RenderPipeline.h +++ b/src/dawn_native/RenderPipeline.h @@ -49,7 +49,7 @@ namespace dawn_native { struct VertexBufferInfo { uint64_t arrayStride; - wgpu::InputStepMode stepMode; + wgpu::VertexStepMode stepMode; }; class RenderPipelineBase : public PipelineBase { diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp index 55b771dad8..619a398cca 100644 --- a/src/dawn_native/ShaderModule.cpp +++ b/src/dawn_native/ShaderModule.cpp @@ -119,11 +119,11 @@ namespace dawn_native { UNREACHABLE(); } - tint::transform::InputStepMode ToTintInputStepMode(wgpu::InputStepMode mode) { + tint::transform::InputStepMode ToTintVertexStepMode(wgpu::VertexStepMode mode) { switch (mode) { - case wgpu::InputStepMode::Vertex: + case wgpu::VertexStepMode::Vertex: return tint::transform::InputStepMode::kVertex; - case wgpu::InputStepMode::Instance: + case wgpu::VertexStepMode::Instance: return tint::transform::InputStepMode::kInstance; } } @@ -1286,7 +1286,7 @@ namespace dawn_native { const auto& vertexBuffer = vertexState.buffers[i]; tint::transform::VertexBufferLayoutDescriptor layout; layout.array_stride = vertexBuffer.arrayStride; - layout.step_mode = ToTintInputStepMode(vertexBuffer.stepMode); + layout.step_mode = ToTintVertexStepMode(vertexBuffer.stepMode); for (uint32_t j = 0; j < vertexBuffer.attributeCount; ++j) { const auto& attribute = vertexBuffer.attributes[j]; diff --git a/src/dawn_native/d3d12/RenderPipelineD3D12.cpp b/src/dawn_native/d3d12/RenderPipelineD3D12.cpp index fdfa123d58..a5efaaeb75 100644 --- a/src/dawn_native/d3d12/RenderPipelineD3D12.cpp +++ b/src/dawn_native/d3d12/RenderPipelineD3D12.cpp @@ -96,11 +96,11 @@ namespace dawn_native { namespace d3d12 { } } - D3D12_INPUT_CLASSIFICATION InputStepModeFunction(wgpu::InputStepMode mode) { + D3D12_INPUT_CLASSIFICATION VertexStepModeFunction(wgpu::VertexStepMode mode) { switch (mode) { - case wgpu::InputStepMode::Vertex: + case wgpu::VertexStepMode::Vertex: return D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA; - case wgpu::InputStepMode::Instance: + case wgpu::VertexStepMode::Instance: return D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA; } } @@ -463,7 +463,7 @@ namespace dawn_native { namespace d3d12 { const VertexBufferInfo& input = GetVertexBuffer(attribute.vertexBufferSlot); inputElementDescriptor.AlignedByteOffset = attribute.offset; - inputElementDescriptor.InputSlotClass = InputStepModeFunction(input.stepMode); + inputElementDescriptor.InputSlotClass = VertexStepModeFunction(input.stepMode); if (inputElementDescriptor.InputSlotClass == D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA) { inputElementDescriptor.InstanceDataStepRate = 0; diff --git a/src/dawn_native/metal/RenderPipelineMTL.mm b/src/dawn_native/metal/RenderPipelineMTL.mm index 4ddaa59135..0910db1661 100644 --- a/src/dawn_native/metal/RenderPipelineMTL.mm +++ b/src/dawn_native/metal/RenderPipelineMTL.mm @@ -91,11 +91,11 @@ namespace dawn_native { namespace metal { } } - MTLVertexStepFunction InputStepModeFunction(wgpu::InputStepMode mode) { + MTLVertexStepFunction VertexStepModeFunction(wgpu::VertexStepMode mode) { switch (mode) { - case wgpu::InputStepMode::Vertex: + case wgpu::VertexStepMode::Vertex: return MTLVertexStepFunctionPerVertex; - case wgpu::InputStepMode::Instance: + case wgpu::VertexStepMode::Instance: return MTLVertexStepFunctionPerInstance; } } @@ -488,7 +488,7 @@ namespace dawn_native { namespace metal { // multiple of 4 if it's not. layoutDesc.stride = Align(maxArrayStride, 4); } else { - layoutDesc.stepFunction = InputStepModeFunction(info.stepMode); + layoutDesc.stepFunction = VertexStepModeFunction(info.stepMode); layoutDesc.stepRate = 1; layoutDesc.stride = info.arrayStride; } diff --git a/src/dawn_native/opengl/RenderPipelineGL.cpp b/src/dawn_native/opengl/RenderPipelineGL.cpp index 4cd55dda54..aed8c019e4 100644 --- a/src/dawn_native/opengl/RenderPipelineGL.cpp +++ b/src/dawn_native/opengl/RenderPipelineGL.cpp @@ -267,9 +267,9 @@ namespace dawn_native { namespace opengl { gl.VertexAttribDivisor(glAttrib, 0xffffffff); } else { switch (vertexBuffer.stepMode) { - case wgpu::InputStepMode::Vertex: + case wgpu::VertexStepMode::Vertex: break; - case wgpu::InputStepMode::Instance: + case wgpu::VertexStepMode::Instance: gl.VertexAttribDivisor(glAttrib, 1); break; } diff --git a/src/dawn_native/vulkan/RenderPipelineVk.cpp b/src/dawn_native/vulkan/RenderPipelineVk.cpp index 1a2c84e0e8..3eb2e126c5 100644 --- a/src/dawn_native/vulkan/RenderPipelineVk.cpp +++ b/src/dawn_native/vulkan/RenderPipelineVk.cpp @@ -27,11 +27,11 @@ namespace dawn_native { namespace vulkan { namespace { - VkVertexInputRate VulkanInputRate(wgpu::InputStepMode stepMode) { + VkVertexInputRate VulkanInputRate(wgpu::VertexStepMode stepMode) { switch (stepMode) { - case wgpu::InputStepMode::Vertex: + case wgpu::VertexStepMode::Vertex: return VK_VERTEX_INPUT_RATE_VERTEX; - case wgpu::InputStepMode::Instance: + case wgpu::VertexStepMode::Instance: return VK_VERTEX_INPUT_RATE_INSTANCE; } } diff --git a/src/tests/end2end/VertexStateTests.cpp b/src/tests/end2end/VertexStateTests.cpp index b13f0c7261..51b4b2537f 100644 --- a/src/tests/end2end/VertexStateTests.cpp +++ b/src/tests/end2end/VertexStateTests.cpp @@ -19,8 +19,8 @@ #include "utils/ComboRenderPipelineDescriptor.h" #include "utils/WGPUHelpers.h" -using wgpu::InputStepMode; using wgpu::VertexFormat; +using wgpu::VertexStepMode; // Input state tests all work the same way: the test will render triangles in a grid up to 4x4. Each // triangle is position in the grid such that X will correspond to the "triangle number" and the Y @@ -64,7 +64,7 @@ class VertexStateTest : public DawnTest { struct ShaderTestSpec { uint32_t location; VertexFormat format; - InputStepMode step; + VertexStepMode step; }; wgpu::RenderPipeline MakeTestPipeline(const utils::ComboVertexStateDescriptor& vertexState, int multiplier, @@ -114,7 +114,7 @@ class VertexStateTest : public DawnTest { if (ShouldComponentBeDefault(input.format, component)) { vs << (component == 3 ? "1.0" : "0.0"); } else { - if (input.step == InputStepMode::Vertex) { + if (input.step == VertexStepMode::Vertex) { vs << "f32(" << multiplier << "u * input.VertexIndex) + " << component << ".0"; } else { @@ -161,7 +161,7 @@ class VertexStateTest : public DawnTest { }; struct VertexBufferSpec { uint64_t arrayStride; - InputStepMode step; + VertexStepMode step; std::vector attributes; }; @@ -249,10 +249,11 @@ class VertexStateTest : public DawnTest { // Test compilation and usage of the fixture :) TEST_P(VertexStateTest, Basic) { utils::ComboVertexStateDescriptor vertexState; - MakeVertexState({{4 * sizeof(float), InputStepMode::Vertex, {{0, 0, VertexFormat::Float32x4}}}}, - &vertexState); + MakeVertexState( + {{4 * sizeof(float), VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32x4}}}}, + &vertexState); wgpu::RenderPipeline pipeline = - MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float32x4, InputStepMode::Vertex}}); + MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float32x4, VertexStepMode::Vertex}}); // clang-format off wgpu::Buffer buffer0 = MakeVertexBuffer({ @@ -270,9 +271,9 @@ TEST_P(VertexStateTest, ZeroStride) { DAWN_SUPPRESS_TEST_IF(IsLinux() && IsOpenGL()); utils::ComboVertexStateDescriptor vertexState; - MakeVertexState({{0, InputStepMode::Vertex, {{0, 0, VertexFormat::Float32x4}}}}, &vertexState); + MakeVertexState({{0, VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32x4}}}}, &vertexState); wgpu::RenderPipeline pipeline = - MakeTestPipeline(vertexState, 0, {{0, VertexFormat::Float32x4, InputStepMode::Vertex}}); + MakeTestPipeline(vertexState, 0, {{0, VertexFormat::Float32x4, VertexStepMode::Vertex}}); wgpu::Buffer buffer0 = MakeVertexBuffer({ 0, @@ -291,10 +292,10 @@ TEST_P(VertexStateTest, AttributeExpanding) { // R32F case { utils::ComboVertexStateDescriptor vertexState; - MakeVertexState({{0, InputStepMode::Vertex, {{0, 0, VertexFormat::Float32}}}}, + MakeVertexState({{0, VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32}}}}, &vertexState); wgpu::RenderPipeline pipeline = - MakeTestPipeline(vertexState, 0, {{0, VertexFormat::Float32, InputStepMode::Vertex}}); + MakeTestPipeline(vertexState, 0, {{0, VertexFormat::Float32, VertexStepMode::Vertex}}); wgpu::Buffer buffer0 = MakeVertexBuffer({0, 1, 2, 3}); DoTestDraw(pipeline, 1, 1, {DrawVertexBuffer{0, &buffer0}}); @@ -302,10 +303,10 @@ TEST_P(VertexStateTest, AttributeExpanding) { // RG32F case { utils::ComboVertexStateDescriptor vertexState; - MakeVertexState({{0, InputStepMode::Vertex, {{0, 0, VertexFormat::Float32x2}}}}, + MakeVertexState({{0, VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32x2}}}}, &vertexState); - wgpu::RenderPipeline pipeline = - MakeTestPipeline(vertexState, 0, {{0, VertexFormat::Float32x2, InputStepMode::Vertex}}); + wgpu::RenderPipeline pipeline = MakeTestPipeline( + vertexState, 0, {{0, VertexFormat::Float32x2, VertexStepMode::Vertex}}); wgpu::Buffer buffer0 = MakeVertexBuffer({0, 1, 2, 3}); DoTestDraw(pipeline, 1, 1, {DrawVertexBuffer{0, &buffer0}}); @@ -313,10 +314,10 @@ TEST_P(VertexStateTest, AttributeExpanding) { // RGB32F case { utils::ComboVertexStateDescriptor vertexState; - MakeVertexState({{0, InputStepMode::Vertex, {{0, 0, VertexFormat::Float32x3}}}}, + MakeVertexState({{0, VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32x3}}}}, &vertexState); - wgpu::RenderPipeline pipeline = - MakeTestPipeline(vertexState, 0, {{0, VertexFormat::Float32x3, InputStepMode::Vertex}}); + wgpu::RenderPipeline pipeline = MakeTestPipeline( + vertexState, 0, {{0, VertexFormat::Float32x3, VertexStepMode::Vertex}}); wgpu::Buffer buffer0 = MakeVertexBuffer({0, 1, 2, 3}); DoTestDraw(pipeline, 1, 1, {DrawVertexBuffer{0, &buffer0}}); @@ -329,10 +330,11 @@ TEST_P(VertexStateTest, StrideLargerThanAttributes) { DAWN_SUPPRESS_TEST_IF(IsLinux() && IsOpenGL()); utils::ComboVertexStateDescriptor vertexState; - MakeVertexState({{8 * sizeof(float), InputStepMode::Vertex, {{0, 0, VertexFormat::Float32x4}}}}, - &vertexState); + MakeVertexState( + {{8 * sizeof(float), VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32x4}}}}, + &vertexState); wgpu::RenderPipeline pipeline = - MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float32x4, InputStepMode::Vertex}}); + MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float32x4, VertexStepMode::Vertex}}); // clang-format off wgpu::Buffer buffer0 = MakeVertexBuffer({ @@ -349,11 +351,11 @@ TEST_P(VertexStateTest, TwoAttributesAtAnOffsetVertex) { utils::ComboVertexStateDescriptor vertexState; MakeVertexState( {{8 * sizeof(float), - InputStepMode::Vertex, + VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32x4}, {1, 4 * sizeof(float), VertexFormat::Float32x4}}}}, &vertexState); wgpu::RenderPipeline pipeline = - MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float32x4, InputStepMode::Vertex}}); + MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float32x4, VertexStepMode::Vertex}}); // clang-format off wgpu::Buffer buffer0 = MakeVertexBuffer({ @@ -370,11 +372,11 @@ TEST_P(VertexStateTest, TwoAttributesAtAnOffsetInstance) { utils::ComboVertexStateDescriptor vertexState; MakeVertexState( {{8 * sizeof(float), - InputStepMode::Instance, + VertexStepMode::Instance, {{0, 0, VertexFormat::Float32x4}, {1, 4 * sizeof(float), VertexFormat::Float32x4}}}}, &vertexState); wgpu::RenderPipeline pipeline = - MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float32x4, InputStepMode::Instance}}); + MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float32x4, VertexStepMode::Instance}}); // clang-format off wgpu::Buffer buffer0 = MakeVertexBuffer({ @@ -390,10 +392,10 @@ TEST_P(VertexStateTest, TwoAttributesAtAnOffsetInstance) { TEST_P(VertexStateTest, PureInstance) { utils::ComboVertexStateDescriptor vertexState; MakeVertexState( - {{4 * sizeof(float), InputStepMode::Instance, {{0, 0, VertexFormat::Float32x4}}}}, + {{4 * sizeof(float), VertexStepMode::Instance, {{0, 0, VertexFormat::Float32x4}}}}, &vertexState); wgpu::RenderPipeline pipeline = - MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float32x4, InputStepMode::Instance}}); + MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float32x4, VertexStepMode::Instance}}); // clang-format off wgpu::Buffer buffer0 = MakeVertexBuffer({ @@ -412,18 +414,18 @@ TEST_P(VertexStateTest, MixedEverything) { utils::ComboVertexStateDescriptor vertexState; MakeVertexState( {{12 * sizeof(float), - InputStepMode::Vertex, + VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32}, {1, 6 * sizeof(float), VertexFormat::Float32x2}}}, {10 * sizeof(float), - InputStepMode::Instance, + VertexStepMode::Instance, {{2, 0, VertexFormat::Float32x3}, {3, 5 * sizeof(float), VertexFormat::Float32x4}}}}, &vertexState); wgpu::RenderPipeline pipeline = MakeTestPipeline(vertexState, 1, - {{0, VertexFormat::Float32, InputStepMode::Vertex}, - {1, VertexFormat::Float32x2, InputStepMode::Vertex}, - {2, VertexFormat::Float32x3, InputStepMode::Instance}, - {3, VertexFormat::Float32x4, InputStepMode::Instance}}); + {{0, VertexFormat::Float32, VertexStepMode::Vertex}, + {1, VertexFormat::Float32x2, VertexStepMode::Vertex}, + {2, VertexFormat::Float32x3, VertexStepMode::Instance}, + {3, VertexFormat::Float32x4, VertexStepMode::Instance}}); // clang-format off wgpu::Buffer buffer0 = MakeVertexBuffer({ @@ -447,11 +449,11 @@ TEST_P(VertexStateTest, UnusedVertexSlot) { // Instance input state, using slot 1 utils::ComboVertexStateDescriptor instanceVertexState; MakeVertexState( - {{0, InputStepMode::Vertex, {}}, - {4 * sizeof(float), InputStepMode::Instance, {{0, 0, VertexFormat::Float32x4}}}}, + {{0, VertexStepMode::Vertex, {}}, + {4 * sizeof(float), VertexStepMode::Instance, {{0, 0, VertexFormat::Float32x4}}}}, &instanceVertexState); wgpu::RenderPipeline instancePipeline = MakeTestPipeline( - instanceVertexState, 1, {{0, VertexFormat::Float32x4, InputStepMode::Instance}}); + instanceVertexState, 1, {{0, VertexFormat::Float32x4, VertexStepMode::Instance}}); // clang-format off wgpu::Buffer buffer = MakeVertexBuffer({ @@ -487,19 +489,20 @@ TEST_P(VertexStateTest, UnusedVertexSlot) { TEST_P(VertexStateTest, MultiplePipelinesMixedVertexState) { // Basic input state, using slot 0 utils::ComboVertexStateDescriptor vertexVertexState; - MakeVertexState({{4 * sizeof(float), InputStepMode::Vertex, {{0, 0, VertexFormat::Float32x4}}}}, - &vertexVertexState); + MakeVertexState( + {{4 * sizeof(float), VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32x4}}}}, + &vertexVertexState); wgpu::RenderPipeline vertexPipeline = MakeTestPipeline( - vertexVertexState, 1, {{0, VertexFormat::Float32x4, InputStepMode::Vertex}}); + vertexVertexState, 1, {{0, VertexFormat::Float32x4, VertexStepMode::Vertex}}); // Instance input state, using slot 1 utils::ComboVertexStateDescriptor instanceVertexState; MakeVertexState( - {{0, InputStepMode::Instance, {}}, - {4 * sizeof(float), InputStepMode::Instance, {{0, 0, VertexFormat::Float32x4}}}}, + {{0, VertexStepMode::Instance, {}}, + {4 * sizeof(float), VertexStepMode::Instance, {{0, 0, VertexFormat::Float32x4}}}}, &instanceVertexState); wgpu::RenderPipeline instancePipeline = MakeTestPipeline( - instanceVertexState, 1, {{0, VertexFormat::Float32x4, InputStepMode::Instance}}); + instanceVertexState, 1, {{0, VertexFormat::Float32x4, VertexStepMode::Instance}}); // clang-format off wgpu::Buffer buffer = MakeVertexBuffer({ @@ -539,7 +542,7 @@ TEST_P(VertexStateTest, LastAllowedVertexBuffer) { // All the other vertex buffers default to no attributes vertexState.vertexBufferCount = kMaxVertexBuffers; vertexState.cVertexBuffers[kBufferIndex].arrayStride = 4 * sizeof(float); - vertexState.cVertexBuffers[kBufferIndex].stepMode = InputStepMode::Vertex; + vertexState.cVertexBuffers[kBufferIndex].stepMode = VertexStepMode::Vertex; vertexState.cVertexBuffers[kBufferIndex].attributeCount = 1; vertexState.cVertexBuffers[kBufferIndex].attributes = &vertexState.cAttributes[0]; vertexState.cAttributes[0].shaderLocation = 0; @@ -547,7 +550,7 @@ TEST_P(VertexStateTest, LastAllowedVertexBuffer) { vertexState.cAttributes[0].format = VertexFormat::Float32x4; wgpu::RenderPipeline pipeline = - MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float32x4, InputStepMode::Vertex}}); + MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float32x4, VertexStepMode::Vertex}}); wgpu::Buffer buffer0 = MakeVertexBuffer({0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5}); DoTestDraw(pipeline, 1, 1, {DrawVertexBuffer{kMaxVertexBuffers - 1, &buffer0}}); @@ -559,7 +562,7 @@ TEST_P(VertexStateTest, OverlappingVertexAttributes) { utils::ComboVertexStateDescriptor vertexState; MakeVertexState({{16, - InputStepMode::Vertex, + VertexStepMode::Vertex, { // "****" represents the bytes we'll actually read in the shader. {0, 0 /* offset */, VertexFormat::Float32x4}, // |****|----|----|----| diff --git a/src/tests/unittests/validation/DrawVertexAndIndexBufferOOBValidationTests.cpp b/src/tests/unittests/validation/DrawVertexAndIndexBufferOOBValidationTests.cpp index c1a427716a..fa45e01974 100644 --- a/src/tests/unittests/validation/DrawVertexAndIndexBufferOOBValidationTests.cpp +++ b/src/tests/unittests/validation/DrawVertexAndIndexBufferOOBValidationTests.cpp @@ -72,7 +72,7 @@ namespace { }; struct PipelineVertexBufferDesc { uint64_t arrayStride; - wgpu::InputStepMode stepMode; + wgpu::VertexStepMode stepMode; std::vector attributes = {}; }; @@ -171,7 +171,7 @@ namespace { DAWN_ASSERT(bufferStride >= kFloat32x4Stride); std::vector bufferDescList = { - {bufferStride, wgpu::InputStepMode::Vertex, {{0, wgpu::VertexFormat::Float32x4}}}, + {bufferStride, wgpu::VertexStepMode::Vertex, {{0, wgpu::VertexFormat::Float32x4}}}, }; return CreateRenderPipelineWithBufferDesc(bufferDescList); @@ -186,9 +186,9 @@ namespace { DAWN_ASSERT(bufferStride2 >= kFloat32x2Stride); std::vector bufferDescList = { - {bufferStride1, wgpu::InputStepMode::Vertex, {{0, wgpu::VertexFormat::Float32x4}}}, + {bufferStride1, wgpu::VertexStepMode::Vertex, {{0, wgpu::VertexFormat::Float32x4}}}, {bufferStride2, - wgpu::InputStepMode::Instance, + wgpu::VertexStepMode::Instance, {{3, wgpu::VertexFormat::Float32x2}}}, }; diff --git a/src/utils/ComboRenderPipelineDescriptor.cpp b/src/utils/ComboRenderPipelineDescriptor.cpp index 6b48bb223a..4bb6948157 100644 --- a/src/utils/ComboRenderPipelineDescriptor.cpp +++ b/src/utils/ComboRenderPipelineDescriptor.cpp @@ -33,7 +33,7 @@ namespace utils { } for (uint32_t i = 0; i < kMaxVertexBuffers; ++i) { cVertexBuffers[i].arrayStride = 0; - cVertexBuffers[i].stepMode = wgpu::InputStepMode::Vertex; + cVertexBuffers[i].stepMode = wgpu::VertexStepMode::Vertex; cVertexBuffers[i].attributeCount = 0; cVertexBuffers[i].attributes = nullptr; } @@ -63,7 +63,7 @@ namespace utils { } for (uint32_t i = 0; i < kMaxVertexBuffers; ++i) { cBuffers[i].arrayStride = 0; - cBuffers[i].stepMode = wgpu::InputStepMode::Vertex; + cBuffers[i].stepMode = wgpu::VertexStepMode::Vertex; cBuffers[i].attributeCount = 0; cBuffers[i].attributes = nullptr; }