Split Pipeline in Render and Compute, test part

This commit is contained in:
Corentin Wallez 2017-07-14 11:09:13 -04:00 committed by Corentin Wallez
parent 29ced285d4
commit e20c5ee9ff
4 changed files with 32 additions and 32 deletions

View File

@ -83,7 +83,7 @@ class InputStateTest : public NXTTest {
VertexFormat format; VertexFormat format;
InputStepMode step; InputStepMode step;
}; };
nxt::Pipeline MakeTestPipeline(const nxt::InputState& inputState, int multiplier, std::vector<ShaderTestSpec> testSpec) { nxt::RenderPipeline MakeTestPipeline(const nxt::InputState& inputState, int multiplier, std::vector<ShaderTestSpec> testSpec) {
std::ostringstream vs; std::ostringstream vs;
vs << "#version 450\n"; vs << "#version 450\n";
@ -140,7 +140,7 @@ class InputStateTest : public NXTTest {
})" })"
); );
return device.CreatePipelineBuilder() return device.CreateRenderPipelineBuilder()
.SetSubpass(renderpass, 0) .SetSubpass(renderpass, 0)
.SetStage(nxt::ShaderStage::Vertex, vsModule, "main") .SetStage(nxt::ShaderStage::Vertex, vsModule, "main")
.SetStage(nxt::ShaderStage::Fragment, fsModule, "main") .SetStage(nxt::ShaderStage::Fragment, fsModule, "main")
@ -182,7 +182,7 @@ class InputStateTest : public NXTTest {
uint32_t location; uint32_t location;
nxt::Buffer* buffer; nxt::Buffer* buffer;
}; };
void DoTestDraw(const nxt::Pipeline& pipeline, unsigned int triangles, unsigned int instances, std::vector<DrawVertexBuffer> vertexBuffers) { void DoTestDraw(const nxt::RenderPipeline& pipeline, unsigned int triangles, unsigned int instances, std::vector<DrawVertexBuffer> vertexBuffers) {
EXPECT_LE(triangles, 4u); EXPECT_LE(triangles, 4u);
EXPECT_LE(instances, 4u); EXPECT_LE(instances, 4u);
@ -191,7 +191,7 @@ class InputStateTest : public NXTTest {
renderTarget.TransitionUsage(nxt::TextureUsageBit::OutputAttachment); renderTarget.TransitionUsage(nxt::TextureUsageBit::OutputAttachment);
builder.BeginRenderPass(renderpass, framebuffer) builder.BeginRenderPass(renderpass, framebuffer)
.BeginRenderSubpass() .BeginRenderSubpass()
.SetPipeline(pipeline); .SetRenderPipeline(pipeline);
uint32_t zeroOffset = 0; uint32_t zeroOffset = 0;
for (const auto& buffer : vertexBuffers) { for (const auto& buffer : vertexBuffers) {
@ -235,7 +235,7 @@ TEST_P(InputStateTest, Basic) {
{0, 0, 0, VertexFormat::FloatR32G32B32A32} {0, 0, 0, VertexFormat::FloatR32G32B32A32}
} }
); );
nxt::Pipeline pipeline = MakeTestPipeline(inputState, 1, { nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, {
{0, VertexFormat::FloatR32G32B32A32, InputStepMode::Vertex} {0, VertexFormat::FloatR32G32B32A32, InputStepMode::Vertex}
}); });
@ -255,7 +255,7 @@ TEST_P(InputStateTest, ZeroStride) {
{0, 0, 0, VertexFormat::FloatR32G32B32A32} {0, 0, 0, VertexFormat::FloatR32G32B32A32}
} }
); );
nxt::Pipeline pipeline = MakeTestPipeline(inputState, 0, { nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 0, {
{0, VertexFormat::FloatR32G32B32A32, InputStepMode::Vertex} {0, VertexFormat::FloatR32G32B32A32, InputStepMode::Vertex}
}); });
@ -275,7 +275,7 @@ TEST_P(InputStateTest, AttributeExpanding) {
{0, 0, 0, VertexFormat::FloatR32} {0, 0, 0, VertexFormat::FloatR32}
} }
); );
nxt::Pipeline pipeline = MakeTestPipeline(inputState, 0, { nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 0, {
{0, VertexFormat::FloatR32, InputStepMode::Vertex} {0, VertexFormat::FloatR32, InputStepMode::Vertex}
}); });
@ -292,7 +292,7 @@ TEST_P(InputStateTest, AttributeExpanding) {
{0, 0, 0, VertexFormat::FloatR32G32} {0, 0, 0, VertexFormat::FloatR32G32}
} }
); );
nxt::Pipeline pipeline = MakeTestPipeline(inputState, 0, { nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 0, {
{0, VertexFormat::FloatR32G32, InputStepMode::Vertex} {0, VertexFormat::FloatR32G32, InputStepMode::Vertex}
}); });
@ -309,7 +309,7 @@ TEST_P(InputStateTest, AttributeExpanding) {
{0, 0, 0, VertexFormat::FloatR32G32B32} {0, 0, 0, VertexFormat::FloatR32G32B32}
} }
); );
nxt::Pipeline pipeline = MakeTestPipeline(inputState, 0, { nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 0, {
{0, VertexFormat::FloatR32G32B32, InputStepMode::Vertex} {0, VertexFormat::FloatR32G32B32, InputStepMode::Vertex}
}); });
@ -328,7 +328,7 @@ TEST_P(InputStateTest, StrideLargerThanAttributes) {
{0, 0, 0, VertexFormat::FloatR32G32B32A32} {0, 0, 0, VertexFormat::FloatR32G32B32A32}
} }
); );
nxt::Pipeline pipeline = MakeTestPipeline(inputState, 1, { nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, {
{0, VertexFormat::FloatR32G32B32A32, InputStepMode::Vertex} {0, VertexFormat::FloatR32G32B32A32, InputStepMode::Vertex}
}); });
@ -349,7 +349,7 @@ TEST_P(InputStateTest, TwoAttributesAtAnOffsetVertex) {
{1, 0, 4 * sizeof(float), VertexFormat::FloatR32G32B32A32} {1, 0, 4 * sizeof(float), VertexFormat::FloatR32G32B32A32}
} }
); );
nxt::Pipeline pipeline = MakeTestPipeline(inputState, 1, { nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, {
{0, VertexFormat::FloatR32G32B32A32, InputStepMode::Vertex} {0, VertexFormat::FloatR32G32B32A32, InputStepMode::Vertex}
}); });
@ -370,7 +370,7 @@ TEST_P(InputStateTest, TwoAttributesAtAnOffsetInstance) {
{1, 0, 4 * sizeof(float), VertexFormat::FloatR32G32B32A32} {1, 0, 4 * sizeof(float), VertexFormat::FloatR32G32B32A32}
} }
); );
nxt::Pipeline pipeline = MakeTestPipeline(inputState, 1, { nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, {
{0, VertexFormat::FloatR32G32B32A32, InputStepMode::Instance} {0, VertexFormat::FloatR32G32B32A32, InputStepMode::Instance}
}); });
@ -395,7 +395,7 @@ TEST_P(InputStateTest, PureInstance) {
{0, 0, 0, VertexFormat::FloatR32G32B32A32} {0, 0, 0, VertexFormat::FloatR32G32B32A32}
} }
); );
nxt::Pipeline pipeline = MakeTestPipeline(inputState, 1, { nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, {
{0, VertexFormat::FloatR32G32B32A32, InputStepMode::Instance} {0, VertexFormat::FloatR32G32B32A32, InputStepMode::Instance}
}); });
@ -421,7 +421,7 @@ TEST_P(InputStateTest, MixedEverything) {
{3, 1, 5 * sizeof(float), VertexFormat::FloatR32G32B32A32} {3, 1, 5 * sizeof(float), VertexFormat::FloatR32G32B32A32}
} }
); );
nxt::Pipeline pipeline = MakeTestPipeline(inputState, 1, { nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, {
{0, VertexFormat::FloatR32, InputStepMode::Vertex}, {0, VertexFormat::FloatR32, InputStepMode::Vertex},
{1, VertexFormat::FloatR32G32, InputStepMode::Vertex}, {1, VertexFormat::FloatR32G32, InputStepMode::Vertex},
{2, VertexFormat::FloatR32G32B32, InputStepMode::Instance}, {2, VertexFormat::FloatR32G32B32, InputStepMode::Instance},

View File

@ -242,14 +242,14 @@ TEST_F(WireTests, CStringArgument) {
.WillOnce(Return(apiShaderModule)); .WillOnce(Return(apiShaderModule));
// Create pipeline // Create pipeline
nxtPipelineBuilder pipelineBuilder = nxtDeviceCreatePipelineBuilder(device); nxtRenderPipelineBuilder pipelineBuilder = nxtDeviceCreateRenderPipelineBuilder(device);
nxtPipelineBuilderSetStage(pipelineBuilder, NXT_SHADER_STAGE_FRAGMENT, shaderModule, "my entry point"); nxtRenderPipelineBuilderSetStage(pipelineBuilder, NXT_SHADER_STAGE_FRAGMENT, shaderModule, "my entry point");
nxtPipelineBuilder apiPipelineBuilder = api.GetNewPipelineBuilder(); nxtRenderPipelineBuilder apiPipelineBuilder = api.GetNewRenderPipelineBuilder();
EXPECT_CALL(api, DeviceCreatePipelineBuilder(apiDevice)) EXPECT_CALL(api, DeviceCreateRenderPipelineBuilder(apiDevice))
.WillOnce(Return(apiPipelineBuilder)); .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(); FlushClient();
} }
@ -257,26 +257,26 @@ TEST_F(WireTests, CStringArgument) {
// Test that the wire is able to send objects as value arguments // Test that the wire is able to send objects as value arguments
TEST_F(WireTests, ObjectAsValueArgument) { TEST_F(WireTests, ObjectAsValueArgument) {
// Create pipeline // Create pipeline
nxtPipelineBuilder pipelineBuilder = nxtDeviceCreatePipelineBuilder(device); nxtRenderPipelineBuilder pipelineBuilder = nxtDeviceCreateRenderPipelineBuilder(device);
nxtPipeline pipeline = nxtPipelineBuilderGetResult(pipelineBuilder); nxtRenderPipeline pipeline = nxtRenderPipelineBuilderGetResult(pipelineBuilder);
nxtPipelineBuilder apiPipelineBuilder = api.GetNewPipelineBuilder(); nxtRenderPipelineBuilder apiPipelineBuilder = api.GetNewRenderPipelineBuilder();
EXPECT_CALL(api, DeviceCreatePipelineBuilder(apiDevice)) EXPECT_CALL(api, DeviceCreateRenderPipelineBuilder(apiDevice))
.WillOnce(Return(apiPipelineBuilder)); .WillOnce(Return(apiPipelineBuilder));
nxtPipeline apiPipeline = api.GetNewPipeline(); nxtRenderPipeline apiPipeline = api.GetNewRenderPipeline();
EXPECT_CALL(api, PipelineBuilderGetResult(apiPipelineBuilder)) EXPECT_CALL(api, RenderPipelineBuilderGetResult(apiPipelineBuilder))
.WillOnce(Return(apiPipeline)); .WillOnce(Return(apiPipeline));
// Create command buffer builder, setting pipeline // Create command buffer builder, setting pipeline
nxtCommandBufferBuilder cmdBufBuilder = nxtDeviceCreateCommandBufferBuilder(device); nxtCommandBufferBuilder cmdBufBuilder = nxtDeviceCreateCommandBufferBuilder(device);
nxtCommandBufferBuilderSetPipeline(cmdBufBuilder, pipeline); nxtCommandBufferBuilderSetRenderPipeline(cmdBufBuilder, pipeline);
nxtCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder(); nxtCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder();
EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice)) EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice))
.WillOnce(Return(apiCmdBufBuilder)); .WillOnce(Return(apiCmdBufBuilder));
EXPECT_CALL(api, CommandBufferBuilderSetPipeline(apiCmdBufBuilder, apiPipeline)); EXPECT_CALL(api, CommandBufferBuilderSetRenderPipeline(apiCmdBufBuilder, apiPipeline));
FlushClient(); FlushClient();
} }

View File

@ -22,7 +22,7 @@ static constexpr uint32_t kMaxVertexInputs = 16u;
class InputStateTest : public ValidationTest { class InputStateTest : public ValidationTest {
protected: 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()) nxt::RenderPass renderPass = AssertWillBeSuccess(device.CreateRenderPassBuilder())
.SetAttachmentCount(1) .SetAttachmentCount(1)
.AttachmentSetFormat(0, nxt::TextureFormat::R8G8B8A8Unorm) .AttachmentSetFormat(0, nxt::TextureFormat::R8G8B8A8Unorm)
@ -44,11 +44,11 @@ class InputStateTest : public ValidationTest {
)"); )");
nxt::ShaderModule fsModule = fsModuleBuilder.GetResult(); nxt::ShaderModule fsModule = fsModuleBuilder.GetResult();
nxt::PipelineBuilder builder; nxt::RenderPipelineBuilder builder;
if (success) { if (success) {
builder = AssertWillBeSuccess(device.CreatePipelineBuilder()); builder = AssertWillBeSuccess(device.CreateRenderPipelineBuilder());
} else { } else {
builder = AssertWillBeError(device.CreatePipelineBuilder()); builder = AssertWillBeError(device.CreateRenderPipelineBuilder());
} }
return builder.SetSubpass(renderPass, 0) return builder.SetSubpass(renderPass, 0)