|
|
|
@ -62,7 +62,10 @@ struct PipelineVkTest: VulkanTester { |
|
|
|
void constructCompute(); |
|
|
|
void constructCompute(); |
|
|
|
void constructMove(); |
|
|
|
void constructMove(); |
|
|
|
|
|
|
|
|
|
|
|
void wrap(); |
|
|
|
void wrapRasterization(); |
|
|
|
|
|
|
|
void wrapCompute(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void dynamicRasterizationStatesNotRasterization(); |
|
|
|
|
|
|
|
|
|
|
|
void cmdBind(); |
|
|
|
void cmdBind(); |
|
|
|
|
|
|
|
|
|
|
|
@ -81,7 +84,10 @@ PipelineVkTest::PipelineVkTest() { |
|
|
|
&PipelineVkTest::constructCompute, |
|
|
|
&PipelineVkTest::constructCompute, |
|
|
|
&PipelineVkTest::constructMove, |
|
|
|
&PipelineVkTest::constructMove, |
|
|
|
|
|
|
|
|
|
|
|
&PipelineVkTest::wrap, |
|
|
|
&PipelineVkTest::wrapRasterization, |
|
|
|
|
|
|
|
&PipelineVkTest::wrapCompute, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
&PipelineVkTest::dynamicRasterizationStatesNotRasterization, |
|
|
|
|
|
|
|
|
|
|
|
&PipelineVkTest::cmdBind, |
|
|
|
&PipelineVkTest::cmdBind, |
|
|
|
|
|
|
|
|
|
|
|
@ -134,10 +140,12 @@ void PipelineVkTest::constructRasterization() { |
|
|
|
Pipeline pipeline{device(), RasterizationPipelineCreateInfo{ |
|
|
|
Pipeline pipeline{device(), RasterizationPipelineCreateInfo{ |
|
|
|
shaderSet, meshLayout, pipelineLayout, renderPass, 0, 1} |
|
|
|
shaderSet, meshLayout, pipelineLayout, renderPass, 0, 1} |
|
|
|
.setViewport({{}, {200, 200}}) |
|
|
|
.setViewport({{}, {200, 200}}) |
|
|
|
|
|
|
|
.setDynamicStates(DynamicRasterizationState::LineWidth|DynamicRasterizationState::DepthBias) |
|
|
|
}; |
|
|
|
}; |
|
|
|
CORRADE_VERIFY(pipeline.handle()); |
|
|
|
CORRADE_VERIFY(pipeline.handle()); |
|
|
|
CORRADE_COMPARE(pipeline.handleFlags(), HandleFlag::DestroyOnDestruction); |
|
|
|
CORRADE_COMPARE(pipeline.handleFlags(), HandleFlag::DestroyOnDestruction); |
|
|
|
CORRADE_COMPARE(pipeline.bindPoint(), PipelineBindPoint::Rasterization); |
|
|
|
CORRADE_COMPARE(pipeline.bindPoint(), PipelineBindPoint::Rasterization); |
|
|
|
|
|
|
|
CORRADE_COMPARE(pipeline.dynamicRasterizationStates(), DynamicRasterizationState::LineWidth|DynamicRasterizationState::DepthBias); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Shouldn't crash or anything */ |
|
|
|
/* Shouldn't crash or anything */ |
|
|
|
@ -241,16 +249,16 @@ void PipelineVkTest::constructRasterizationViewportNotSetDynamic() { |
|
|
|
RasterizationPipelineCreateInfo info{ |
|
|
|
RasterizationPipelineCreateInfo info{ |
|
|
|
shaderSet, meshLayout, pipelineLayout, renderPass, 0, 1}; |
|
|
|
shaderSet, meshLayout, pipelineLayout, renderPass, 0, 1}; |
|
|
|
info.setViewport(Range3D{}) /* Has to be set because the count is used */ |
|
|
|
info.setViewport(Range3D{}) /* Has to be set because the count is used */ |
|
|
|
.setDynamicStates(DynamicRasterizationState::Viewport| |
|
|
|
.setDynamicStates(DynamicRasterizationState::Viewport|DynamicRasterizationState::Scissor); |
|
|
|
DynamicRasterizationState::Scissor); |
|
|
|
|
|
|
|
/* But the data don't have to be there */ |
|
|
|
/* But the data don't have to be there */ |
|
|
|
const_cast<VkPipelineViewportStateCreateInfo*>(info->pViewportState)->pViewports = nullptr; |
|
|
|
const_cast<VkPipelineViewportStateCreateInfo*>(info->pViewportState)->pViewports = nullptr; |
|
|
|
const_cast<VkPipelineViewportStateCreateInfo*>(info->pViewportState)->pScissors = nullptr; |
|
|
|
const_cast<VkPipelineViewportStateCreateInfo*>(info->pViewportState)->pScissors = nullptr; |
|
|
|
|
|
|
|
|
|
|
|
Pipeline pipeline{device(), info}; |
|
|
|
Pipeline pipeline{device(), info}; |
|
|
|
|
|
|
|
|
|
|
|
/* The only thing I want to verify is that this doesn't crash or assert */ |
|
|
|
/* The main thing I want to verify is that this doesn't crash or assert */ |
|
|
|
CORRADE_VERIFY(pipeline.handle()); |
|
|
|
CORRADE_VERIFY(pipeline.handle()); |
|
|
|
|
|
|
|
CORRADE_COMPARE(pipeline.dynamicRasterizationStates(), DynamicRasterizationState::Viewport|DynamicRasterizationState::Scissor); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void PipelineVkTest::constructCompute() { |
|
|
|
void PipelineVkTest::constructCompute() { |
|
|
|
@ -311,6 +319,7 @@ void PipelineVkTest::constructMove() { |
|
|
|
Pipeline a{device(), RasterizationPipelineCreateInfo{ |
|
|
|
Pipeline a{device(), RasterizationPipelineCreateInfo{ |
|
|
|
shaderSet, meshLayout, pipelineLayout, renderPass, 0, 1} |
|
|
|
shaderSet, meshLayout, pipelineLayout, renderPass, 0, 1} |
|
|
|
.setViewport({{}, {200, 200}}) |
|
|
|
.setViewport({{}, {200, 200}}) |
|
|
|
|
|
|
|
.setDynamicStates(DynamicRasterizationState::LineWidth|DynamicRasterizationState::DepthBias) |
|
|
|
}; |
|
|
|
}; |
|
|
|
VkPipeline handle = a.handle(); |
|
|
|
VkPipeline handle = a.handle(); |
|
|
|
|
|
|
|
|
|
|
|
@ -319,6 +328,7 @@ void PipelineVkTest::constructMove() { |
|
|
|
CORRADE_COMPARE(b.handle(), handle); |
|
|
|
CORRADE_COMPARE(b.handle(), handle); |
|
|
|
CORRADE_COMPARE(b.handleFlags(), HandleFlag::DestroyOnDestruction); |
|
|
|
CORRADE_COMPARE(b.handleFlags(), HandleFlag::DestroyOnDestruction); |
|
|
|
CORRADE_COMPARE(b.bindPoint(), PipelineBindPoint::Rasterization); |
|
|
|
CORRADE_COMPARE(b.bindPoint(), PipelineBindPoint::Rasterization); |
|
|
|
|
|
|
|
CORRADE_COMPARE(b.dynamicRasterizationStates(), DynamicRasterizationState::LineWidth|DynamicRasterizationState::DepthBias); |
|
|
|
|
|
|
|
|
|
|
|
Pipeline c{NoCreate}; |
|
|
|
Pipeline c{NoCreate}; |
|
|
|
c = std::move(b); |
|
|
|
c = std::move(b); |
|
|
|
@ -327,12 +337,13 @@ void PipelineVkTest::constructMove() { |
|
|
|
CORRADE_COMPARE(c.handle(), handle); |
|
|
|
CORRADE_COMPARE(c.handle(), handle); |
|
|
|
CORRADE_COMPARE(c.handleFlags(), HandleFlag::DestroyOnDestruction); |
|
|
|
CORRADE_COMPARE(c.handleFlags(), HandleFlag::DestroyOnDestruction); |
|
|
|
CORRADE_COMPARE(c.bindPoint(), PipelineBindPoint::Rasterization); |
|
|
|
CORRADE_COMPARE(c.bindPoint(), PipelineBindPoint::Rasterization); |
|
|
|
|
|
|
|
CORRADE_COMPARE(c.dynamicRasterizationStates(), DynamicRasterizationState::LineWidth|DynamicRasterizationState::DepthBias); |
|
|
|
|
|
|
|
|
|
|
|
CORRADE_VERIFY(std::is_nothrow_move_constructible<Pipeline>::value); |
|
|
|
CORRADE_VERIFY(std::is_nothrow_move_constructible<Pipeline>::value); |
|
|
|
CORRADE_VERIFY(std::is_nothrow_move_assignable<Pipeline>::value); |
|
|
|
CORRADE_VERIFY(std::is_nothrow_move_assignable<Pipeline>::value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void PipelineVkTest::wrap() { |
|
|
|
void PipelineVkTest::wrapRasterization() { |
|
|
|
RenderPass renderPass{device(), RenderPassCreateInfo{} |
|
|
|
RenderPass renderPass{device(), RenderPassCreateInfo{} |
|
|
|
.setAttachments({ |
|
|
|
.setAttachments({ |
|
|
|
AttachmentDescription{PixelFormat::RGBA8Unorm, |
|
|
|
AttachmentDescription{PixelFormat::RGBA8Unorm, |
|
|
|
@ -368,12 +379,39 @@ void PipelineVkTest::wrap() { |
|
|
|
VkPipeline pipeline{}; |
|
|
|
VkPipeline pipeline{}; |
|
|
|
CORRADE_COMPARE(Result(device()->CreateGraphicsPipelines(device(), {}, 1, |
|
|
|
CORRADE_COMPARE(Result(device()->CreateGraphicsPipelines(device(), {}, 1, |
|
|
|
RasterizationPipelineCreateInfo{shaderSet, meshLayout, pipelineLayout, renderPass, 0, 1} |
|
|
|
RasterizationPipelineCreateInfo{shaderSet, meshLayout, pipelineLayout, renderPass, 0, 1} |
|
|
|
.setViewport({{}, {200, 200}}), |
|
|
|
.setViewport({{}, {200, 200}}) |
|
|
|
|
|
|
|
.setDynamicStates(DynamicRasterizationState::LineWidth|DynamicRasterizationState::DepthBias), |
|
|
|
nullptr, &pipeline)), Result::Success); |
|
|
|
nullptr, &pipeline)), Result::Success); |
|
|
|
|
|
|
|
|
|
|
|
auto wrapped = Pipeline::wrap(device(), PipelineBindPoint::Rasterization, pipeline, HandleFlag::DestroyOnDestruction); |
|
|
|
auto wrapped = Pipeline::wrap(device(), PipelineBindPoint::Rasterization, pipeline, DynamicRasterizationState::LineWidth|DynamicRasterizationState::DepthBias, HandleFlag::DestroyOnDestruction); |
|
|
|
CORRADE_COMPARE(wrapped.handle(), pipeline); |
|
|
|
CORRADE_COMPARE(wrapped.handle(), pipeline); |
|
|
|
CORRADE_COMPARE(wrapped.bindPoint(), PipelineBindPoint::Rasterization); |
|
|
|
CORRADE_COMPARE(wrapped.bindPoint(), PipelineBindPoint::Rasterization); |
|
|
|
|
|
|
|
CORRADE_COMPARE(wrapped.dynamicRasterizationStates(), DynamicRasterizationState::LineWidth|DynamicRasterizationState::DepthBias); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Release the handle again, destroy by hand */ |
|
|
|
|
|
|
|
CORRADE_COMPARE(wrapped.release(), pipeline); |
|
|
|
|
|
|
|
CORRADE_VERIFY(!wrapped.handle()); |
|
|
|
|
|
|
|
device()->DestroyPipeline(device(), pipeline, nullptr); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void PipelineVkTest::wrapCompute() { |
|
|
|
|
|
|
|
PipelineLayout pipelineLayout{device(), PipelineLayoutCreateInfo{}}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Shader shader{device(), ShaderCreateInfo{ |
|
|
|
|
|
|
|
Utility::Directory::read(Utility::Directory::join(VK_TEST_DIR, "compute-noop.spv")) |
|
|
|
|
|
|
|
}}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ShaderSet shaderSet; |
|
|
|
|
|
|
|
shaderSet.addShader(ShaderStage::Compute, shader, "main"_s); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VkPipeline pipeline{}; |
|
|
|
|
|
|
|
CORRADE_COMPARE(Result(device()->CreateComputePipelines(device(), {}, 1, |
|
|
|
|
|
|
|
ComputePipelineCreateInfo{shaderSet, pipelineLayout}, |
|
|
|
|
|
|
|
nullptr, &pipeline)), Result::Success); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto wrapped = Pipeline::wrap(device(), PipelineBindPoint::Compute, pipeline, HandleFlag::DestroyOnDestruction); |
|
|
|
|
|
|
|
CORRADE_COMPARE(wrapped.handle(), pipeline); |
|
|
|
|
|
|
|
CORRADE_COMPARE(wrapped.bindPoint(), PipelineBindPoint::Compute); |
|
|
|
|
|
|
|
|
|
|
|
/* Release the handle again, destroy by hand */ |
|
|
|
/* Release the handle again, destroy by hand */ |
|
|
|
CORRADE_COMPARE(wrapped.release(), pipeline); |
|
|
|
CORRADE_COMPARE(wrapped.release(), pipeline); |
|
|
|
@ -381,6 +419,30 @@ void PipelineVkTest::wrap() { |
|
|
|
device()->DestroyPipeline(device(), pipeline, nullptr); |
|
|
|
device()->DestroyPipeline(device(), pipeline, nullptr); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void PipelineVkTest::dynamicRasterizationStatesNotRasterization() { |
|
|
|
|
|
|
|
#ifdef CORRADE_NO_ASSERT |
|
|
|
|
|
|
|
CORRADE_SKIP("CORRADE_NO_ASSERT defined, can't test assertions"); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PipelineLayout pipelineLayout{device(), PipelineLayoutCreateInfo{}}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Shader shader{device(), ShaderCreateInfo{ |
|
|
|
|
|
|
|
Utility::Directory::read(Utility::Directory::join(VK_TEST_DIR, "compute-noop.spv")) |
|
|
|
|
|
|
|
}}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ShaderSet shaderSet; |
|
|
|
|
|
|
|
shaderSet.addShader(ShaderStage::Compute, shader, "main"_s); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Pipeline pipeline{device(), ComputePipelineCreateInfo{ |
|
|
|
|
|
|
|
shaderSet, pipelineLayout |
|
|
|
|
|
|
|
}}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::ostringstream out; |
|
|
|
|
|
|
|
Error redirectError{&out}; |
|
|
|
|
|
|
|
pipeline.dynamicRasterizationStates(); |
|
|
|
|
|
|
|
CORRADE_COMPARE(out.str(), "Vk::Pipeline::dynamicRasterizationStates(): not a rasterization pipeline\n"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void PipelineVkTest::cmdBind() { |
|
|
|
void PipelineVkTest::cmdBind() { |
|
|
|
CommandPool pool{device(), CommandPoolCreateInfo{ |
|
|
|
CommandPool pool{device(), CommandPoolCreateInfo{ |
|
|
|
/* This might blow up if queue() isn't the one matching this family */ |
|
|
|
/* This might blow up if queue() isn't the one matching this family */ |
|
|
|
|