diff --git a/dawn.json b/dawn.json index 1a076eef7c..617e2c0458 100644 --- a/dawn.json +++ b/dawn.json @@ -797,7 +797,7 @@ ] }, { - "name": "draw arrays", + "name": "draw", "args": [ {"name": "vertex count", "type": "uint32_t"}, {"name": "instance count", "type": "uint32_t"}, @@ -806,7 +806,7 @@ ] }, { - "name": "draw elements", + "name": "draw indexed", "args": [ {"name": "index count", "type": "uint32_t"}, {"name": "instance count", "type": "uint32_t"}, diff --git a/examples/Animometer.cpp b/examples/Animometer.cpp index 9e0eff9073..afe3853113 100644 --- a/examples/Animometer.cpp +++ b/examples/Animometer.cpp @@ -145,7 +145,7 @@ void frame() { for (int k = 0; k < 10000; k++) { shaderData[i].time = f / 60.0f; pass.SetPushConstants(dawn::ShaderStageBit::Vertex, 0, 6, reinterpret_cast(&shaderData[i])); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); i++; } diff --git a/examples/CHelloTriangle.cpp b/examples/CHelloTriangle.cpp index 1d87073d16..8fc4ceed58 100644 --- a/examples/CHelloTriangle.cpp +++ b/examples/CHelloTriangle.cpp @@ -87,7 +87,7 @@ void frame() { dawnRenderPassEncoder pass = dawnCommandBufferBuilderBeginRenderPass(builder, renderpassInfo); dawnRenderPassEncoderSetRenderPipeline(pass, pipeline); - dawnRenderPassEncoderDrawArrays(pass, 3, 1, 0, 0); + dawnRenderPassEncoderDraw(pass, 3, 1, 0, 0); dawnRenderPassEncoderEndPass(pass); dawnRenderPassEncoderRelease(pass); diff --git a/examples/ComputeBoids.cpp b/examples/ComputeBoids.cpp index 9c5f2fce88..a6a032e301 100644 --- a/examples/ComputeBoids.cpp +++ b/examples/ComputeBoids.cpp @@ -264,7 +264,7 @@ dawn::CommandBuffer createCommandBuffer(const dawn::RenderPassDescriptor& render pass.SetRenderPipeline(renderPipeline); pass.SetVertexBuffers(0, 1, &bufferDst, zeroOffsets); pass.SetVertexBuffers(1, 1, &modelBuffer, zeroOffsets); - pass.DrawArrays(3, kNumParticles, 0, 0); + pass.Draw(3, kNumParticles, 0, 0); pass.EndPass(); } diff --git a/examples/CppHelloTriangle.cpp b/examples/CppHelloTriangle.cpp index bf14e1aae7..5bd7d67a1f 100644 --- a/examples/CppHelloTriangle.cpp +++ b/examples/CppHelloTriangle.cpp @@ -161,7 +161,7 @@ void frame() { pass.SetBindGroup(0, bindGroup); pass.SetVertexBuffers(0, 1, &vertexBuffer, vertexBufferOffsets); pass.SetIndexBuffer(indexBuffer, 0); - pass.DrawElements(3, 1, 0, 0); + pass.DrawIndexed(3, 1, 0, 0); pass.EndPass(); } diff --git a/examples/CubeReflection.cpp b/examples/CubeReflection.cpp index 45348aafe6..c9df4016b4 100644 --- a/examples/CubeReflection.cpp +++ b/examples/CubeReflection.cpp @@ -269,18 +269,18 @@ void frame() { pass.SetBindGroup(0, bindGroup[0]); pass.SetVertexBuffers(0, 1, &vertexBuffer, vertexBufferOffsets); pass.SetIndexBuffer(indexBuffer, 0); - pass.DrawElements(36, 1, 0, 0); + pass.DrawIndexed(36, 1, 0, 0); pass.SetStencilReference(0x1); pass.SetRenderPipeline(planePipeline); pass.SetBindGroup(0, bindGroup[0]); pass.SetVertexBuffers(0, 1, &planeBuffer, vertexBufferOffsets); - pass.DrawElements(6, 1, 0, 0); + pass.DrawIndexed(6, 1, 0, 0); pass.SetRenderPipeline(reflectionPipeline); pass.SetVertexBuffers(0, 1, &vertexBuffer, vertexBufferOffsets); pass.SetBindGroup(0, bindGroup[1]); - pass.DrawElements(36, 1, 0, 0); + pass.DrawIndexed(36, 1, 0, 0); pass.EndPass(); } diff --git a/examples/glTFViewer/glTFViewer.cpp b/examples/glTFViewer/glTFViewer.cpp index 9b02bb31b5..389305b03d 100644 --- a/examples/glTFViewer/glTFViewer.cpp +++ b/examples/glTFViewer/glTFViewer.cpp @@ -531,10 +531,10 @@ namespace { } const auto& oIndicesBuffer = buffers.at(iIndices.bufferView); pass.SetIndexBuffer(oIndicesBuffer, static_cast(iIndices.byteOffset)); - pass.DrawElements(static_cast(iIndices.count), 1, 0, 0); + pass.DrawIndexed(static_cast(iIndices.count), 1, 0, 0); } else { // DrawArrays - pass.DrawArrays(vertexCount, 1, 0, 0); + pass.Draw(vertexCount, 1, 0, 0); } } } diff --git a/src/dawn_native/CommandBuffer.cpp b/src/dawn_native/CommandBuffer.cpp index 6fdfb71dda..88a013e15a 100644 --- a/src/dawn_native/CommandBuffer.cpp +++ b/src/dawn_native/CommandBuffer.cpp @@ -515,14 +515,14 @@ namespace dawn_native { return {}; } break; - case Command::DrawArrays: { - mIterator.NextCommand(); - DAWN_TRY(persistentState.ValidateCanDrawArrays()); + case Command::Draw: { + mIterator.NextCommand(); + DAWN_TRY(persistentState.ValidateCanDraw()); } break; - case Command::DrawElements: { - mIterator.NextCommand(); - DAWN_TRY(persistentState.ValidateCanDrawElements()); + case Command::DrawIndexed: { + mIterator.NextCommand(); + DAWN_TRY(persistentState.ValidateCanDrawIndexed()); } break; case Command::SetRenderPipeline: { diff --git a/src/dawn_native/CommandBufferStateTracker.cpp b/src/dawn_native/CommandBufferStateTracker.cpp index 44799ac109..9a7fdd988e 100644 --- a/src/dawn_native/CommandBufferStateTracker.cpp +++ b/src/dawn_native/CommandBufferStateTracker.cpp @@ -38,11 +38,11 @@ namespace dawn_native { static constexpr CommandBufferStateTracker::ValidationAspects kDispatchAspects = 1 << VALIDATION_ASPECT_PIPELINE | 1 << VALIDATION_ASPECT_BIND_GROUPS; - static constexpr CommandBufferStateTracker::ValidationAspects kDrawArraysAspects = + static constexpr CommandBufferStateTracker::ValidationAspects kDrawAspects = 1 << VALIDATION_ASPECT_PIPELINE | 1 << VALIDATION_ASPECT_BIND_GROUPS | 1 << VALIDATION_ASPECT_VERTEX_BUFFERS; - static constexpr CommandBufferStateTracker::ValidationAspects kDrawElementsAspects = + static constexpr CommandBufferStateTracker::ValidationAspects kDrawIndexedAspects = 1 << VALIDATION_ASPECT_PIPELINE | 1 << VALIDATION_ASPECT_BIND_GROUPS | 1 << VALIDATION_ASPECT_VERTEX_BUFFERS | 1 << VALIDATION_ASPECT_INDEX_BUFFER; @@ -53,12 +53,12 @@ namespace dawn_native { return ValidateOperation(kDispatchAspects); } - MaybeError CommandBufferStateTracker::ValidateCanDrawArrays() { - return ValidateOperation(kDrawArraysAspects); + MaybeError CommandBufferStateTracker::ValidateCanDraw() { + return ValidateOperation(kDrawAspects); } - MaybeError CommandBufferStateTracker::ValidateCanDrawElements() { - return ValidateOperation(kDrawElementsAspects); + MaybeError CommandBufferStateTracker::ValidateCanDrawIndexed() { + return ValidateOperation(kDrawIndexedAspects); } MaybeError CommandBufferStateTracker::ValidateOperation(ValidationAspects requiredAspects) { diff --git a/src/dawn_native/CommandBufferStateTracker.h b/src/dawn_native/CommandBufferStateTracker.h index 9dd1edbac6..2419dede9d 100644 --- a/src/dawn_native/CommandBufferStateTracker.h +++ b/src/dawn_native/CommandBufferStateTracker.h @@ -29,8 +29,8 @@ namespace dawn_native { public: // Non-state-modifying validation functions MaybeError ValidateCanDispatch(); - MaybeError ValidateCanDrawArrays(); - MaybeError ValidateCanDrawElements(); + MaybeError ValidateCanDraw(); + MaybeError ValidateCanDrawIndexed(); // State-modifying methods void SetComputePipeline(ComputePipelineBase* pipeline); diff --git a/src/dawn_native/Commands.cpp b/src/dawn_native/Commands.cpp index 455675a5b6..6443fc8abc 100644 --- a/src/dawn_native/Commands.cpp +++ b/src/dawn_native/Commands.cpp @@ -53,13 +53,13 @@ namespace dawn_native { DispatchCmd* dispatch = commands->NextCommand(); dispatch->~DispatchCmd(); } break; - case Command::DrawArrays: { - DrawArraysCmd* draw = commands->NextCommand(); - draw->~DrawArraysCmd(); + case Command::Draw: { + DrawCmd* draw = commands->NextCommand(); + draw->~DrawCmd(); } break; - case Command::DrawElements: { - DrawElementsCmd* draw = commands->NextCommand(); - draw->~DrawElementsCmd(); + case Command::DrawIndexed: { + DrawIndexedCmd* draw = commands->NextCommand(); + draw->~DrawIndexedCmd(); } break; case Command::EndComputePass: { EndComputePassCmd* cmd = commands->NextCommand(); @@ -142,12 +142,12 @@ namespace dawn_native { commands->NextCommand(); break; - case Command::DrawArrays: - commands->NextCommand(); + case Command::Draw: + commands->NextCommand(); break; - case Command::DrawElements: - commands->NextCommand(); + case Command::DrawIndexed: + commands->NextCommand(); break; case Command::EndComputePass: diff --git a/src/dawn_native/Commands.h b/src/dawn_native/Commands.h index 6ddf58ddc7..4625774966 100644 --- a/src/dawn_native/Commands.h +++ b/src/dawn_native/Commands.h @@ -33,8 +33,8 @@ namespace dawn_native { CopyBufferToTexture, CopyTextureToBuffer, Dispatch, - DrawArrays, - DrawElements, + Draw, + DrawIndexed, EndComputePass, EndRenderPass, SetComputePipeline, @@ -93,14 +93,14 @@ namespace dawn_native { uint32_t z; }; - struct DrawArraysCmd { + struct DrawCmd { uint32_t vertexCount; uint32_t instanceCount; uint32_t firstVertex; uint32_t firstInstance; }; - struct DrawElementsCmd { + struct DrawIndexedCmd { uint32_t indexCount; uint32_t instanceCount; uint32_t firstIndex; diff --git a/src/dawn_native/RenderPassEncoder.cpp b/src/dawn_native/RenderPassEncoder.cpp index e8f8ac501b..ad94bc1bc4 100644 --- a/src/dawn_native/RenderPassEncoder.cpp +++ b/src/dawn_native/RenderPassEncoder.cpp @@ -29,32 +29,32 @@ namespace dawn_native { : ProgrammablePassEncoder(device, topLevelBuilder, allocator) { } - void RenderPassEncoderBase::DrawArrays(uint32_t vertexCount, - uint32_t instanceCount, - uint32_t firstVertex, - uint32_t firstInstance) { + void RenderPassEncoderBase::Draw(uint32_t vertexCount, + uint32_t instanceCount, + uint32_t firstVertex, + uint32_t firstInstance) { if (mTopLevelBuilder->ConsumedError(ValidateCanRecordCommands())) { return; } - DrawArraysCmd* draw = mAllocator->Allocate(Command::DrawArrays); - new (draw) DrawArraysCmd; + DrawCmd* draw = mAllocator->Allocate(Command::Draw); + new (draw) DrawCmd; draw->vertexCount = vertexCount; draw->instanceCount = instanceCount; draw->firstVertex = firstVertex; draw->firstInstance = firstInstance; } - void RenderPassEncoderBase::DrawElements(uint32_t indexCount, - uint32_t instanceCount, - uint32_t firstIndex, - uint32_t firstInstance) { + void RenderPassEncoderBase::DrawIndexed(uint32_t indexCount, + uint32_t instanceCount, + uint32_t firstIndex, + uint32_t firstInstance) { if (mTopLevelBuilder->ConsumedError(ValidateCanRecordCommands())) { return; } - DrawElementsCmd* draw = mAllocator->Allocate(Command::DrawElements); - new (draw) DrawElementsCmd; + DrawIndexedCmd* draw = mAllocator->Allocate(Command::DrawIndexed); + new (draw) DrawIndexedCmd; draw->indexCount = indexCount; draw->instanceCount = instanceCount; draw->firstIndex = firstIndex; diff --git a/src/dawn_native/RenderPassEncoder.h b/src/dawn_native/RenderPassEncoder.h index c2bdad8a9a..d8b618f407 100644 --- a/src/dawn_native/RenderPassEncoder.h +++ b/src/dawn_native/RenderPassEncoder.h @@ -30,14 +30,14 @@ namespace dawn_native { CommandBufferBuilder* topLevelBuilder, CommandAllocator* allocator); - void DrawArrays(uint32_t vertexCount, - uint32_t instanceCount, - uint32_t firstVertex, - uint32_t firstInstance); - void DrawElements(uint32_t vertexCount, - uint32_t instanceCount, - uint32_t firstIndex, - uint32_t firstInstance); + void Draw(uint32_t vertexCount, + uint32_t instanceCount, + uint32_t firstVertex, + uint32_t firstInstance); + void DrawIndexed(uint32_t vertexCount, + uint32_t instanceCount, + uint32_t firstIndex, + uint32_t firstInstance); void SetRenderPipeline(RenderPipelineBase* pipeline); diff --git a/src/dawn_native/d3d12/CommandBufferD3D12.cpp b/src/dawn_native/d3d12/CommandBufferD3D12.cpp index 8b90046971..20440974dc 100644 --- a/src/dawn_native/d3d12/CommandBufferD3D12.cpp +++ b/src/dawn_native/d3d12/CommandBufferD3D12.cpp @@ -540,14 +540,14 @@ namespace dawn_native { namespace d3d12 { return; } break; - case Command::DrawArrays: { - DrawArraysCmd* draw = mCommands.NextCommand(); + case Command::Draw: { + DrawCmd* draw = mCommands.NextCommand(); commandList->DrawInstanced(draw->vertexCount, draw->instanceCount, draw->firstVertex, draw->firstInstance); } break; - case Command::DrawElements: { - DrawElementsCmd* draw = mCommands.NextCommand(); + case Command::DrawIndexed: { + DrawIndexedCmd* draw = mCommands.NextCommand(); commandList->DrawIndexedInstanced(draw->indexCount, draw->instanceCount, draw->firstIndex, 0, draw->firstInstance); } break; diff --git a/src/dawn_native/metal/CommandBufferMTL.mm b/src/dawn_native/metal/CommandBufferMTL.mm index 472277fdd8..03066ede61 100644 --- a/src/dawn_native/metal/CommandBufferMTL.mm +++ b/src/dawn_native/metal/CommandBufferMTL.mm @@ -403,8 +403,8 @@ namespace dawn_native { namespace metal { return; } break; - case Command::DrawArrays: { - DrawArraysCmd* draw = mCommands.NextCommand(); + case Command::Draw: { + DrawCmd* draw = mCommands.NextCommand(); [encoder drawPrimitives:lastPipeline->GetMTLPrimitiveTopology() vertexStart:draw->firstVertex @@ -413,8 +413,8 @@ namespace dawn_native { namespace metal { baseInstance:draw->firstInstance]; } break; - case Command::DrawElements: { - DrawElementsCmd* draw = mCommands.NextCommand(); + case Command::DrawIndexed: { + DrawIndexedCmd* draw = mCommands.NextCommand(); size_t formatSize = IndexFormatSize(lastPipeline->GetIndexFormat()); [encoder diff --git a/src/dawn_native/opengl/CommandBufferGL.cpp b/src/dawn_native/opengl/CommandBufferGL.cpp index 080c4a4d7b..7ac7bdff19 100644 --- a/src/dawn_native/opengl/CommandBufferGL.cpp +++ b/src/dawn_native/opengl/CommandBufferGL.cpp @@ -583,8 +583,8 @@ namespace dawn_native { namespace opengl { return; } break; - case Command::DrawArrays: { - DrawArraysCmd* draw = mCommands.NextCommand(); + case Command::Draw: { + DrawCmd* draw = mCommands.NextCommand(); pushConstants.Apply(lastPipeline, lastPipeline); inputBuffers.Apply(); @@ -600,8 +600,8 @@ namespace dawn_native { namespace opengl { } } break; - case Command::DrawElements: { - DrawElementsCmd* draw = mCommands.NextCommand(); + case Command::DrawIndexed: { + DrawIndexedCmd* draw = mCommands.NextCommand(); pushConstants.Apply(lastPipeline, lastPipeline); inputBuffers.Apply(); diff --git a/src/dawn_native/vulkan/CommandBufferVk.cpp b/src/dawn_native/vulkan/CommandBufferVk.cpp index 23dfd55f00..9ebdb70dc7 100644 --- a/src/dawn_native/vulkan/CommandBufferVk.cpp +++ b/src/dawn_native/vulkan/CommandBufferVk.cpp @@ -320,16 +320,16 @@ namespace dawn_native { namespace vulkan { return; } break; - case Command::DrawArrays: { - DrawArraysCmd* draw = mCommands.NextCommand(); + case Command::Draw: { + DrawCmd* draw = mCommands.NextCommand(); descriptorSets.Flush(device, commands, VK_PIPELINE_BIND_POINT_GRAPHICS); device->fn.CmdDraw(commands, draw->vertexCount, draw->instanceCount, draw->firstVertex, draw->firstInstance); } break; - case Command::DrawElements: { - DrawElementsCmd* draw = mCommands.NextCommand(); + case Command::DrawIndexed: { + DrawIndexedCmd* draw = mCommands.NextCommand(); descriptorSets.Flush(device, commands, VK_PIPELINE_BIND_POINT_GRAPHICS); uint32_t vertexOffset = 0; diff --git a/src/tests/end2end/BindGroupTests.cpp b/src/tests/end2end/BindGroupTests.cpp index 06b2af0f90..706cb9cf43 100644 --- a/src/tests/end2end/BindGroupTests.cpp +++ b/src/tests/end2end/BindGroupTests.cpp @@ -143,7 +143,7 @@ TEST_P(BindGroupTests, ReusedUBO) { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass.renderPassInfo); pass.SetRenderPipeline(pipeline); pass.SetBindGroup(0, bindGroup); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); pass.EndPass(); dawn::CommandBuffer commands = builder.GetResult(); @@ -257,7 +257,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass.renderPassInfo); pass.SetRenderPipeline(pipeline); pass.SetBindGroup(0, bindGroup); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); pass.EndPass(); dawn::CommandBuffer commands = builder.GetResult(); diff --git a/src/tests/end2end/BlendStateTests.cpp b/src/tests/end2end/BlendStateTests.cpp index e93fec4fca..09d4f6291f 100644 --- a/src/tests/end2end/BlendStateTests.cpp +++ b/src/tests/end2end/BlendStateTests.cpp @@ -107,13 +107,13 @@ class BlendStateTest : public DawnTest { // First use the base pipeline to draw a triangle with no blending pass.SetRenderPipeline(basePipeline); pass.SetBindGroup(0, MakeBindGroupForColors(std::array({ { base } }))); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); // Then use the test pipeline to draw the test triangle with blending pass.SetRenderPipeline(testPipeline); pass.SetBindGroup(0, MakeBindGroupForColors(std::array({ { triangle.color } }))); pass.SetBlendColor(triangle.blendFactor[0], triangle.blendFactor[1], triangle.blendFactor[2], triangle.blendFactor[3]); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); pass.EndPass(); } @@ -690,7 +690,7 @@ TEST_P(BlendStateTest, ColorWriteMaskBlendingDisabled) { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass.renderPassInfo); pass.SetRenderPipeline(testPipeline); pass.SetBindGroup(0, MakeBindGroupForColors(std::array({ { base } }))); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); pass.EndPass(); } @@ -826,11 +826,11 @@ TEST_P(BlendStateTest, IndependentBlendState) { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderpass); pass.SetRenderPipeline(basePipeline); pass.SetBindGroup(0, MakeBindGroupForColors(std::array({ { base, base, base, base } }))); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); pass.SetRenderPipeline(testPipeline); pass.SetBindGroup(0, MakeBindGroupForColors(std::array({ { color0, color1, color2, color3 } }))); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); pass.EndPass(); } @@ -892,10 +892,10 @@ TEST_P(BlendStateTest, DefaultBlendColor) { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass.renderPassInfo); pass.SetRenderPipeline(basePipeline); pass.SetBindGroup(0, MakeBindGroupForColors(std::array({ { RGBA8(0, 0, 0, 0) } }))); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); pass.SetRenderPipeline(testPipeline); pass.SetBindGroup(0, MakeBindGroupForColors(std::array({ { RGBA8(255, 255, 255, 255) } }))); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); pass.EndPass(); } @@ -912,11 +912,11 @@ TEST_P(BlendStateTest, DefaultBlendColor) { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass.renderPassInfo); pass.SetRenderPipeline(basePipeline); pass.SetBindGroup(0, MakeBindGroupForColors(std::array({ { RGBA8(0, 0, 0, 0) } }))); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); pass.SetRenderPipeline(testPipeline); pass.SetBlendColor(1, 1, 1, 1); pass.SetBindGroup(0, MakeBindGroupForColors(std::array({ { RGBA8(255, 255, 255, 255) } }))); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); pass.EndPass(); } @@ -933,21 +933,21 @@ TEST_P(BlendStateTest, DefaultBlendColor) { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass.renderPassInfo); pass.SetRenderPipeline(basePipeline); pass.SetBindGroup(0, MakeBindGroupForColors(std::array({ { RGBA8(0, 0, 0, 0) } }))); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); pass.SetRenderPipeline(testPipeline); pass.SetBlendColor(1, 1, 1, 1); pass.SetBindGroup(0, MakeBindGroupForColors(std::array({ { RGBA8(255, 255, 255, 255) } }))); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); pass.EndPass(); } { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass.renderPassInfo); pass.SetRenderPipeline(basePipeline); pass.SetBindGroup(0, MakeBindGroupForColors(std::array({ { RGBA8(0, 0, 0, 0) } }))); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); pass.SetRenderPipeline(testPipeline); pass.SetBindGroup(0, MakeBindGroupForColors(std::array({ { RGBA8(255, 255, 255, 255) } }))); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); pass.EndPass(); } diff --git a/src/tests/end2end/DepthStencilStateTests.cpp b/src/tests/end2end/DepthStencilStateTests.cpp index 4a7260020b..e6a339c3d1 100644 --- a/src/tests/end2end/DepthStencilStateTests.cpp +++ b/src/tests/end2end/DepthStencilStateTests.cpp @@ -225,7 +225,7 @@ class DepthStencilStateTest : public DawnTest { pass.SetRenderPipeline(pipeline); pass.SetStencilReference(test.stencil); // Set the stencil reference pass.SetBindGroup(0, bindGroup); // Set the bind group which contains color and depth data - pass.DrawArrays(6, 1, 0, 0); + pass.Draw(6, 1, 0, 0); } pass.EndPass(); diff --git a/src/tests/end2end/DrawElementsTests.cpp b/src/tests/end2end/DrawElementsTests.cpp index c26b44c772..69f7538ea3 100644 --- a/src/tests/end2end/DrawElementsTests.cpp +++ b/src/tests/end2end/DrawElementsTests.cpp @@ -80,7 +80,7 @@ class DrawElementsTest : public DawnTest { pass.SetRenderPipeline(pipeline); pass.SetVertexBuffers(0, 1, &vertexBuffer, &zeroOffset); pass.SetIndexBuffer(indexBuffer, 0); - pass.DrawElements(indexCount, instanceCount, firstIndex, firstInstance); + pass.DrawIndexed(indexCount, instanceCount, firstIndex, firstInstance); pass.EndPass(); } diff --git a/src/tests/end2end/IndexFormatTests.cpp b/src/tests/end2end/IndexFormatTests.cpp index ae6066397a..2dbfb45840 100644 --- a/src/tests/end2end/IndexFormatTests.cpp +++ b/src/tests/end2end/IndexFormatTests.cpp @@ -84,7 +84,7 @@ TEST_P(IndexFormatTest, Uint32) { pass.SetRenderPipeline(pipeline); pass.SetVertexBuffers(0, 1, &vertexBuffer, &zeroOffset); pass.SetIndexBuffer(indexBuffer, 0); - pass.DrawElements(3, 1, 0, 0); + pass.DrawIndexed(3, 1, 0, 0); pass.EndPass(); } @@ -115,7 +115,7 @@ TEST_P(IndexFormatTest, Uint16) { pass.SetRenderPipeline(pipeline); pass.SetVertexBuffers(0, 1, &vertexBuffer, &zeroOffset); pass.SetIndexBuffer(indexBuffer, 0); - pass.DrawElements(3, 1, 0, 0); + pass.DrawIndexed(3, 1, 0, 0); pass.EndPass(); } @@ -159,7 +159,7 @@ TEST_P(IndexFormatTest, Uint32PrimitiveRestart) { pass.SetRenderPipeline(pipeline); pass.SetVertexBuffers(0, 1, &vertexBuffer, &zeroOffset); pass.SetIndexBuffer(indexBuffer, 0); - pass.DrawElements(7, 1, 0, 0); + pass.DrawIndexed(7, 1, 0, 0); pass.EndPass(); } @@ -193,7 +193,7 @@ TEST_P(IndexFormatTest, Uint16PrimitiveRestart) { pass.SetRenderPipeline(pipeline); pass.SetVertexBuffers(0, 1, &vertexBuffer, &zeroOffset); pass.SetIndexBuffer(indexBuffer, 0); - pass.DrawElements(7, 1, 0, 0); + pass.DrawIndexed(7, 1, 0, 0); pass.EndPass(); } @@ -233,7 +233,7 @@ TEST_P(IndexFormatTest, ChangePipelineAfterSetIndexBuffer) { pass.SetVertexBuffers(0, 1, &vertexBuffer, &zeroOffset); pass.SetIndexBuffer(indexBuffer, 0); pass.SetRenderPipeline(pipeline32); - pass.DrawElements(3, 1, 0, 0); + pass.DrawIndexed(3, 1, 0, 0); pass.EndPass(); } @@ -267,7 +267,7 @@ TEST_P(IndexFormatTest, DISABLED_SetIndexBufferBeforeSetPipeline) { pass.SetIndexBuffer(indexBuffer, 0); pass.SetRenderPipeline(pipeline); pass.SetVertexBuffers(0, 1, &vertexBuffer, &zeroOffset); - pass.DrawElements(3, 1, 0, 0); + pass.DrawIndexed(3, 1, 0, 0); pass.EndPass(); } diff --git a/src/tests/end2end/InputStateTests.cpp b/src/tests/end2end/InputStateTests.cpp index 5abe632c49..5454220cf4 100644 --- a/src/tests/end2end/InputStateTests.cpp +++ b/src/tests/end2end/InputStateTests.cpp @@ -176,7 +176,7 @@ class InputStateTest : public DawnTest { pass.SetVertexBuffers(buffer.location, 1, buffer.buffer, &zeroOffset); } - pass.DrawArrays(triangles * 3, instances, 0, 0); + pass.Draw(triangles * 3, instances, 0, 0); pass.EndPass(); dawn::CommandBuffer commands = builder.GetResult(); diff --git a/src/tests/end2end/PrimitiveTopologyTests.cpp b/src/tests/end2end/PrimitiveTopologyTests.cpp index 696077b6dc..e71e43ea05 100644 --- a/src/tests/end2end/PrimitiveTopologyTests.cpp +++ b/src/tests/end2end/PrimitiveTopologyTests.cpp @@ -199,7 +199,7 @@ class PrimitiveTopologyTest : public DawnTest { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass.renderPassInfo); pass.SetRenderPipeline(pipeline); pass.SetVertexBuffers(0, 1, &vertexBuffer, &zeroOffset); - pass.DrawArrays(6, 1, 0, 0); + pass.Draw(6, 1, 0, 0); pass.EndPass(); } diff --git a/src/tests/end2end/PushConstantTests.cpp b/src/tests/end2end/PushConstantTests.cpp index e101fcdf87..668dbdb17a 100644 --- a/src/tests/end2end/PushConstantTests.cpp +++ b/src/tests/end2end/PushConstantTests.cpp @@ -258,7 +258,7 @@ TEST_P(PushConstantTest, RenderPassDefaultsToZero) { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass.renderPassInfo); // Test render push constants are set to zero by default. pass.SetRenderPipeline(pipeline); - pass.DrawArrays(1, 1, 0, 0); + pass.Draw(1, 1, 0, 0); pass.EndPass(); } @@ -386,7 +386,7 @@ TEST_P(PushConstantTest, SeparateVertexAndFragmentConstants) { pass.SetPushConstants(dawn::ShaderStageBit::Vertex, 0, 1, &one); pass.SetPushConstants(dawn::ShaderStageBit::Fragment, 0, 1, &two); pass.SetRenderPipeline(pipeline); - pass.DrawArrays(1, 1, 0, 0); + pass.Draw(1, 1, 0, 0); pass.EndPass(); } @@ -411,7 +411,7 @@ TEST_P(PushConstantTest, SimultaneousVertexAndFragmentConstants) { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass.renderPassInfo); pass.SetPushConstants(dawn::ShaderStageBit::Vertex | dawn::ShaderStageBit::Fragment, 0, 1, &two); pass.SetRenderPipeline(pipeline); - pass.DrawArrays(1, 1, 0, 0); + pass.Draw(1, 1, 0, 0); pass.EndPass(); } diff --git a/src/tests/end2end/RenderPassLoadOpTests.cpp b/src/tests/end2end/RenderPassLoadOpTests.cpp index d8efd8edd8..a4f25ae594 100644 --- a/src/tests/end2end/RenderPassLoadOpTests.cpp +++ b/src/tests/end2end/RenderPassLoadOpTests.cpp @@ -40,7 +40,7 @@ class DrawQuad { .GetResult(); pass->SetRenderPipeline(renderPipeline); - pass->DrawArrays(6, 1, 0, 0); + pass->Draw(6, 1, 0, 0); } private: diff --git a/src/tests/end2end/SamplerTests.cpp b/src/tests/end2end/SamplerTests.cpp index 2bdad063dc..1d93783ac0 100644 --- a/src/tests/end2end/SamplerTests.cpp +++ b/src/tests/end2end/SamplerTests.cpp @@ -136,7 +136,7 @@ protected: dawn::RenderPassEncoder pass = builder.BeginRenderPass(mRenderPass.renderPassInfo); pass.SetRenderPipeline(mPipeline); pass.SetBindGroup(0, bindGroup); - pass.DrawArrays(6, 1, 0, 0); + pass.Draw(6, 1, 0, 0); pass.EndPass(); } diff --git a/src/tests/end2end/ScissorTests.cpp b/src/tests/end2end/ScissorTests.cpp index 5052c4c465..f75eb4fb38 100644 --- a/src/tests/end2end/ScissorTests.cpp +++ b/src/tests/end2end/ScissorTests.cpp @@ -55,7 +55,7 @@ TEST_P(ScissorTest, DefaultsToWholeRenderTarget) { { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass.renderPassInfo); pass.SetRenderPipeline(pipeline); - pass.DrawArrays(6, 1, 0, 0); + pass.Draw(6, 1, 0, 0); pass.EndPass(); } @@ -78,7 +78,7 @@ TEST_P(ScissorTest, LargerThanAttachment) { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass.renderPassInfo); pass.SetRenderPipeline(pipeline); pass.SetScissorRect(0, 0, 200, 200); - pass.DrawArrays(6, 1, 0, 0); + pass.Draw(6, 1, 0, 0); pass.EndPass(); } @@ -104,7 +104,7 @@ TEST_P(ScissorTest, EmptyRect) { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass.renderPassInfo); pass.SetRenderPipeline(pipeline); pass.SetScissorRect(0, 0, 0, 0); - pass.DrawArrays(6, 1, 0, 0); + pass.Draw(6, 1, 0, 0); pass.EndPass(); } @@ -132,7 +132,7 @@ TEST_P(ScissorTest, PartialRect) { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass.renderPassInfo); pass.SetRenderPipeline(pipeline); pass.SetScissorRect(kX, kY, kW, kH); - pass.DrawArrays(6, 1, 0, 0); + pass.Draw(6, 1, 0, 0); pass.EndPass(); } @@ -163,7 +163,7 @@ TEST_P(ScissorTest, NoInheritanceBetweenRenderPass) { { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass.renderPassInfo); pass.SetRenderPipeline(pipeline); - pass.DrawArrays(6, 1, 0, 0); + pass.Draw(6, 1, 0, 0); pass.EndPass(); } diff --git a/src/tests/end2end/TextureViewTests.cpp b/src/tests/end2end/TextureViewTests.cpp index 01f2a00846..7485c4fbe0 100644 --- a/src/tests/end2end/TextureViewTests.cpp +++ b/src/tests/end2end/TextureViewTests.cpp @@ -175,7 +175,7 @@ protected: dawn::RenderPassEncoder pass = builder.BeginRenderPass(mRenderPass.renderPassInfo); pass.SetRenderPipeline(pipeline); pass.SetBindGroup(0, bindGroup); - pass.DrawArrays(6, 1, 0, 0); + pass.Draw(6, 1, 0, 0); pass.EndPass(); } @@ -512,7 +512,7 @@ class TextureViewRenderingTest : public DawnTest { dawn::RenderPassEncoder pass = commandBufferBuilder.BeginRenderPass(renderPassInfo); pass.SetRenderPipeline(oneColorPipeline); - pass.DrawArrays(6, 1, 0, 0); + pass.Draw(6, 1, 0, 0); pass.EndPass(); } diff --git a/src/tests/end2end/ViewportOrientationTests.cpp b/src/tests/end2end/ViewportOrientationTests.cpp index e85f5ac6d6..366763d19f 100644 --- a/src/tests/end2end/ViewportOrientationTests.cpp +++ b/src/tests/end2end/ViewportOrientationTests.cpp @@ -46,7 +46,7 @@ TEST_P(ViewportOrientationTests, OriginAt0x0) { { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass.renderPassInfo); pass.SetRenderPipeline(pipeline); - pass.DrawArrays(1, 1, 0, 0); + pass.Draw(1, 1, 0, 0); pass.EndPass(); } diff --git a/src/tests/unittests/validation/VertexBufferValidationTests.cpp b/src/tests/unittests/validation/VertexBufferValidationTests.cpp index 014e7b0cbc..63b9a56199 100644 --- a/src/tests/unittests/validation/VertexBufferValidationTests.cpp +++ b/src/tests/unittests/validation/VertexBufferValidationTests.cpp @@ -108,7 +108,7 @@ TEST_F(VertexBufferValidationTest, VertexInputsInheritedBetweenPipelines) { { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderpass); pass.SetRenderPipeline(pipeline1); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); pass.EndPass(); } builder.GetResult(); @@ -119,9 +119,9 @@ TEST_F(VertexBufferValidationTest, VertexInputsInheritedBetweenPipelines) { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderpass); pass.SetRenderPipeline(pipeline2); pass.SetVertexBuffers(0, 2, vertexBuffers.data(), offsets); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); pass.SetRenderPipeline(pipeline1); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); pass.EndPass(); } builder.GetResult(); @@ -146,14 +146,14 @@ TEST_F(VertexBufferValidationTest, VertexInputsNotInheritedBetweenRendePasses) { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderpass); pass.SetRenderPipeline(pipeline2); pass.SetVertexBuffers(0, 2, vertexBuffers.data(), offsets); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); pass.EndPass(); } { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderpass); pass.SetRenderPipeline(pipeline1); pass.SetVertexBuffers(0, 1, vertexBuffers.data(), offsets); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); pass.EndPass(); } builder.GetResult(); @@ -164,13 +164,13 @@ TEST_F(VertexBufferValidationTest, VertexInputsNotInheritedBetweenRendePasses) { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderpass); pass.SetRenderPipeline(pipeline2); pass.SetVertexBuffers(0, 2, vertexBuffers.data(), offsets); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); pass.EndPass(); } { dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderpass); pass.SetRenderPipeline(pipeline1); - pass.DrawArrays(3, 1, 0, 0); + pass.Draw(3, 1, 0, 0); pass.EndPass(); } builder.GetResult();