Verified Commit 4a27ab19 authored by Tobias Frisch's avatar Tobias Frisch
Browse files

Added support for tessellation shader stages


Signed-off-by: Tobias Frisch's avatarTobias Frisch <tfrisch@uni-koblenz.de>
parent 40ec3566
Pipeline #28221 canceled with stages
......@@ -39,6 +39,7 @@ namespace vkcv {
DepthTest m_depthTest = DepthTest::LessEqual;
bool m_depthWrite = true;
bool m_alphaToCoverage = false;
uint32_t m_tessellationControlPoints = 0;
};
}
\ No newline at end of file
......@@ -195,6 +195,15 @@ namespace vkcv
return pipelineInputAssemblyStateCreateInfo;
}
vk::PipelineTessellationStateCreateInfo createPipelineTessellationStateCreateInfo(const GraphicsPipelineConfig &config) {
vk::PipelineTessellationStateCreateInfo pipelineTessellationStateCreateInfo(
{},
config.m_tessellationControlPoints
);
return pipelineTessellationStateCreateInfo;
}
/**
* Creates a Pipeline Viewport State Create Info Struct with default set viewport and scissor settings.
* @param config provides with and height of the output window
......@@ -424,7 +433,13 @@ namespace vkcv
const bool existsVertexShader = config.m_ShaderProgram.existsShader(ShaderStage::VERTEX);
const bool existsFragmentShader = config.m_ShaderProgram.existsShader(ShaderStage::FRAGMENT);
const bool existsGeometryShader = config.m_ShaderProgram.existsShader(ShaderStage::GEOMETRY);
const bool validGeometryStages = existsVertexShader || (existsTaskShader && existsMeshShader);
const bool existsTessellationControlShader = config.m_ShaderProgram.existsShader(ShaderStage::TESS_CONTROL);
const bool existsTessellationEvaluationShader = config.m_ShaderProgram.existsShader(ShaderStage::TESS_EVAL);
const bool validGeometryStages = (
(existsVertexShader && (existsTessellationControlShader == existsTessellationEvaluationShader)) ||
(existsTaskShader && existsMeshShader)
);
if (!validGeometryStages)
{
......@@ -530,6 +545,40 @@ namespace vkcv
}
}
if (existsTessellationControlShader) {
vk::PipelineShaderStageCreateInfo createInfo;
const bool success = createPipelineShaderStageCreateInfo(
config.m_ShaderProgram,
ShaderStage::TESS_CONTROL,
m_Device,
&createInfo);
if (success) {
shaderStages.push_back(createInfo);
}
else {
destroyShaderModules();
return GraphicsPipelineHandle();
}
}
if (existsTessellationEvaluationShader) {
vk::PipelineShaderStageCreateInfo createInfo;
const bool success = createPipelineShaderStageCreateInfo(
config.m_ShaderProgram,
ShaderStage::TESS_EVAL,
m_Device,
&createInfo);
if (success) {
shaderStages.push_back(createInfo);
}
else {
destroyShaderModules();
return GraphicsPipelineHandle();
}
}
// vertex input state
// Fill up VertexInputBindingDescription and VertexInputAttributeDescription Containers
std::vector<vk::VertexInputAttributeDescription> vertexAttributeDescriptions;
......@@ -545,6 +594,10 @@ namespace vkcv
vk::PipelineInputAssemblyStateCreateInfo pipelineInputAssemblyStateCreateInfo =
createPipelineInputAssemblyStateCreateInfo(config);
// tesselation state
vk::PipelineTessellationStateCreateInfo pipelineTessellationStateCreateInfo =
createPipelineTessellationStateCreateInfo(config);
// viewport state
vk::PipelineViewportStateCreateInfo pipelineViewportStateCreateInfo =
createPipelineViewportStateCreateInfo(config);
......@@ -601,7 +654,7 @@ namespace vkcv
shaderStages.data(),
&pipelineVertexInputStateCreateInfo,
&pipelineInputAssemblyStateCreateInfo,
nullptr,
&pipelineTessellationStateCreateInfo,
&pipelineViewportStateCreateInfo,
&pipelineRasterizationStateCreateInfo,
&pipelineMultisampleStateCreateInfo,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment