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;
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;
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<DrawVertexBuffer> vertexBuffers) {
void DoTestDraw(const nxt::RenderPipeline& pipeline, unsigned int triangles, unsigned int instances, std::vector<DrawVertexBuffer> 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},

View File

@ -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();
}

View File

@ -120,4 +120,4 @@ TEST_F(FramebufferValidationTest, AttachmentSizeMatchFramebufferSize) {
}
// TODO(cwallez@chromium.org): also test with a mismatches depth / stencil
}
}

View File

@ -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)