From e20c5ee9ffae4ceb8a1379e5f35e4481568818b6 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Fri, 14 Jul 2017 11:09:13 -0400 Subject: [PATCH] Split Pipeline in Render and Compute, test part --- src/tests/end2end/InputStateTests.cpp | 28 +++++++++---------- src/tests/unittests/WireTests.cpp | 26 ++++++++--------- .../validation/FramebufferValidationTests.cpp | 2 +- .../validation/InputStateValidationTests.cpp | 8 +++--- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/tests/end2end/InputStateTests.cpp b/src/tests/end2end/InputStateTests.cpp index 18f579b901..b8af66705c 100644 --- a/src/tests/end2end/InputStateTests.cpp +++ b/src/tests/end2end/InputStateTests.cpp @@ -83,7 +83,7 @@ class InputStateTest : public NXTTest { VertexFormat format; InputStepMode step; }; - nxt::Pipeline MakeTestPipeline(const nxt::InputState& inputState, int multiplier, std::vector testSpec) { + nxt::RenderPipeline MakeTestPipeline(const nxt::InputState& inputState, int multiplier, std::vector testSpec) { std::ostringstream vs; vs << "#version 450\n"; @@ -140,7 +140,7 @@ class InputStateTest : public NXTTest { })" ); - return device.CreatePipelineBuilder() + return device.CreateRenderPipelineBuilder() .SetSubpass(renderpass, 0) .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") @@ -182,7 +182,7 @@ class InputStateTest : public NXTTest { uint32_t location; nxt::Buffer* buffer; }; - void DoTestDraw(const nxt::Pipeline& pipeline, unsigned int triangles, unsigned int instances, std::vector vertexBuffers) { + void DoTestDraw(const nxt::RenderPipeline& pipeline, unsigned int triangles, unsigned int instances, std::vector vertexBuffers) { EXPECT_LE(triangles, 4u); EXPECT_LE(instances, 4u); @@ -191,7 +191,7 @@ class InputStateTest : public NXTTest { renderTarget.TransitionUsage(nxt::TextureUsageBit::OutputAttachment); builder.BeginRenderPass(renderpass, framebuffer) .BeginRenderSubpass() - .SetPipeline(pipeline); + .SetRenderPipeline(pipeline); uint32_t zeroOffset = 0; for (const auto& buffer : vertexBuffers) { @@ -235,7 +235,7 @@ TEST_P(InputStateTest, Basic) { {0, 0, 0, VertexFormat::FloatR32G32B32A32} } ); - nxt::Pipeline pipeline = MakeTestPipeline(inputState, 1, { + nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, { {0, VertexFormat::FloatR32G32B32A32, InputStepMode::Vertex} }); @@ -255,7 +255,7 @@ TEST_P(InputStateTest, ZeroStride) { {0, 0, 0, VertexFormat::FloatR32G32B32A32} } ); - nxt::Pipeline pipeline = MakeTestPipeline(inputState, 0, { + nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 0, { {0, VertexFormat::FloatR32G32B32A32, InputStepMode::Vertex} }); @@ -275,7 +275,7 @@ TEST_P(InputStateTest, AttributeExpanding) { {0, 0, 0, VertexFormat::FloatR32} } ); - nxt::Pipeline pipeline = MakeTestPipeline(inputState, 0, { + nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 0, { {0, VertexFormat::FloatR32, InputStepMode::Vertex} }); @@ -292,7 +292,7 @@ TEST_P(InputStateTest, AttributeExpanding) { {0, 0, 0, VertexFormat::FloatR32G32} } ); - nxt::Pipeline pipeline = MakeTestPipeline(inputState, 0, { + nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 0, { {0, VertexFormat::FloatR32G32, InputStepMode::Vertex} }); @@ -309,7 +309,7 @@ TEST_P(InputStateTest, AttributeExpanding) { {0, 0, 0, VertexFormat::FloatR32G32B32} } ); - nxt::Pipeline pipeline = MakeTestPipeline(inputState, 0, { + nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 0, { {0, VertexFormat::FloatR32G32B32, InputStepMode::Vertex} }); @@ -328,7 +328,7 @@ TEST_P(InputStateTest, StrideLargerThanAttributes) { {0, 0, 0, VertexFormat::FloatR32G32B32A32} } ); - nxt::Pipeline pipeline = MakeTestPipeline(inputState, 1, { + nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, { {0, VertexFormat::FloatR32G32B32A32, InputStepMode::Vertex} }); @@ -349,7 +349,7 @@ TEST_P(InputStateTest, TwoAttributesAtAnOffsetVertex) { {1, 0, 4 * sizeof(float), VertexFormat::FloatR32G32B32A32} } ); - nxt::Pipeline pipeline = MakeTestPipeline(inputState, 1, { + nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, { {0, VertexFormat::FloatR32G32B32A32, InputStepMode::Vertex} }); @@ -370,7 +370,7 @@ TEST_P(InputStateTest, TwoAttributesAtAnOffsetInstance) { {1, 0, 4 * sizeof(float), VertexFormat::FloatR32G32B32A32} } ); - nxt::Pipeline pipeline = MakeTestPipeline(inputState, 1, { + nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, { {0, VertexFormat::FloatR32G32B32A32, InputStepMode::Instance} }); @@ -395,7 +395,7 @@ TEST_P(InputStateTest, PureInstance) { {0, 0, 0, VertexFormat::FloatR32G32B32A32} } ); - nxt::Pipeline pipeline = MakeTestPipeline(inputState, 1, { + nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, { {0, VertexFormat::FloatR32G32B32A32, InputStepMode::Instance} }); @@ -421,7 +421,7 @@ TEST_P(InputStateTest, MixedEverything) { {3, 1, 5 * sizeof(float), VertexFormat::FloatR32G32B32A32} } ); - nxt::Pipeline pipeline = MakeTestPipeline(inputState, 1, { + nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, { {0, VertexFormat::FloatR32, InputStepMode::Vertex}, {1, VertexFormat::FloatR32G32, InputStepMode::Vertex}, {2, VertexFormat::FloatR32G32B32, InputStepMode::Instance}, diff --git a/src/tests/unittests/WireTests.cpp b/src/tests/unittests/WireTests.cpp index 5392854388..61a2e11938 100644 --- a/src/tests/unittests/WireTests.cpp +++ b/src/tests/unittests/WireTests.cpp @@ -242,14 +242,14 @@ TEST_F(WireTests, CStringArgument) { .WillOnce(Return(apiShaderModule)); // Create pipeline - nxtPipelineBuilder pipelineBuilder = nxtDeviceCreatePipelineBuilder(device); - nxtPipelineBuilderSetStage(pipelineBuilder, NXT_SHADER_STAGE_FRAGMENT, shaderModule, "my entry point"); + nxtRenderPipelineBuilder pipelineBuilder = nxtDeviceCreateRenderPipelineBuilder(device); + nxtRenderPipelineBuilderSetStage(pipelineBuilder, NXT_SHADER_STAGE_FRAGMENT, shaderModule, "my entry point"); - nxtPipelineBuilder apiPipelineBuilder = api.GetNewPipelineBuilder(); - EXPECT_CALL(api, DeviceCreatePipelineBuilder(apiDevice)) + nxtRenderPipelineBuilder apiPipelineBuilder = api.GetNewRenderPipelineBuilder(); + EXPECT_CALL(api, DeviceCreateRenderPipelineBuilder(apiDevice)) .WillOnce(Return(apiPipelineBuilder)); - EXPECT_CALL(api, PipelineBuilderSetStage(apiPipelineBuilder, NXT_SHADER_STAGE_FRAGMENT, apiShaderModule, StrEq("my entry point"))); + EXPECT_CALL(api, RenderPipelineBuilderSetStage(apiPipelineBuilder, NXT_SHADER_STAGE_FRAGMENT, apiShaderModule, StrEq("my entry point"))); FlushClient(); } @@ -257,26 +257,26 @@ TEST_F(WireTests, CStringArgument) { // Test that the wire is able to send objects as value arguments TEST_F(WireTests, ObjectAsValueArgument) { // Create pipeline - nxtPipelineBuilder pipelineBuilder = nxtDeviceCreatePipelineBuilder(device); - nxtPipeline pipeline = nxtPipelineBuilderGetResult(pipelineBuilder); + nxtRenderPipelineBuilder pipelineBuilder = nxtDeviceCreateRenderPipelineBuilder(device); + nxtRenderPipeline pipeline = nxtRenderPipelineBuilderGetResult(pipelineBuilder); - nxtPipelineBuilder apiPipelineBuilder = api.GetNewPipelineBuilder(); - EXPECT_CALL(api, DeviceCreatePipelineBuilder(apiDevice)) + nxtRenderPipelineBuilder apiPipelineBuilder = api.GetNewRenderPipelineBuilder(); + EXPECT_CALL(api, DeviceCreateRenderPipelineBuilder(apiDevice)) .WillOnce(Return(apiPipelineBuilder)); - nxtPipeline apiPipeline = api.GetNewPipeline(); - EXPECT_CALL(api, PipelineBuilderGetResult(apiPipelineBuilder)) + nxtRenderPipeline apiPipeline = api.GetNewRenderPipeline(); + EXPECT_CALL(api, RenderPipelineBuilderGetResult(apiPipelineBuilder)) .WillOnce(Return(apiPipeline)); // Create command buffer builder, setting pipeline nxtCommandBufferBuilder cmdBufBuilder = nxtDeviceCreateCommandBufferBuilder(device); - nxtCommandBufferBuilderSetPipeline(cmdBufBuilder, pipeline); + nxtCommandBufferBuilderSetRenderPipeline(cmdBufBuilder, pipeline); nxtCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder(); EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice)) .WillOnce(Return(apiCmdBufBuilder)); - EXPECT_CALL(api, CommandBufferBuilderSetPipeline(apiCmdBufBuilder, apiPipeline)); + EXPECT_CALL(api, CommandBufferBuilderSetRenderPipeline(apiCmdBufBuilder, apiPipeline)); FlushClient(); } diff --git a/src/tests/unittests/validation/FramebufferValidationTests.cpp b/src/tests/unittests/validation/FramebufferValidationTests.cpp index 5d5f203d5d..255c7904fe 100644 --- a/src/tests/unittests/validation/FramebufferValidationTests.cpp +++ b/src/tests/unittests/validation/FramebufferValidationTests.cpp @@ -120,4 +120,4 @@ TEST_F(FramebufferValidationTest, AttachmentSizeMatchFramebufferSize) { } // TODO(cwallez@chromium.org): also test with a mismatches depth / stencil -} \ No newline at end of file +} diff --git a/src/tests/unittests/validation/InputStateValidationTests.cpp b/src/tests/unittests/validation/InputStateValidationTests.cpp index 442e7f6256..0c8b8b4f3e 100644 --- a/src/tests/unittests/validation/InputStateValidationTests.cpp +++ b/src/tests/unittests/validation/InputStateValidationTests.cpp @@ -22,7 +22,7 @@ static constexpr uint32_t kMaxVertexInputs = 16u; class InputStateTest : public ValidationTest { protected: - nxt::Pipeline CreatePipeline(bool success, const nxt::InputState& inputState, std::string vertexSource) { + nxt::RenderPipeline CreatePipeline(bool success, const nxt::InputState& inputState, std::string vertexSource) { nxt::RenderPass renderPass = AssertWillBeSuccess(device.CreateRenderPassBuilder()) .SetAttachmentCount(1) .AttachmentSetFormat(0, nxt::TextureFormat::R8G8B8A8Unorm) @@ -44,11 +44,11 @@ class InputStateTest : public ValidationTest { )"); nxt::ShaderModule fsModule = fsModuleBuilder.GetResult(); - nxt::PipelineBuilder builder; + nxt::RenderPipelineBuilder builder; if (success) { - builder = AssertWillBeSuccess(device.CreatePipelineBuilder()); + builder = AssertWillBeSuccess(device.CreateRenderPipelineBuilder()); } else { - builder = AssertWillBeError(device.CreatePipelineBuilder()); + builder = AssertWillBeError(device.CreateRenderPipelineBuilder()); } return builder.SetSubpass(renderPass, 0)