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 { ...@@ -39,6 +39,7 @@ namespace vkcv {
DepthTest m_depthTest = DepthTest::LessEqual; DepthTest m_depthTest = DepthTest::LessEqual;
bool m_depthWrite = true; bool m_depthWrite = true;
bool m_alphaToCoverage = false; bool m_alphaToCoverage = false;
uint32_t m_tessellationControlPoints = 0;
}; };
} }
\ No newline at end of file
...@@ -195,6 +195,15 @@ namespace vkcv ...@@ -195,6 +195,15 @@ namespace vkcv
return pipelineInputAssemblyStateCreateInfo; 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. * 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 * @param config provides with and height of the output window
...@@ -424,7 +433,13 @@ namespace vkcv ...@@ -424,7 +433,13 @@ namespace vkcv
const bool existsVertexShader = config.m_ShaderProgram.existsShader(ShaderStage::VERTEX); const bool existsVertexShader = config.m_ShaderProgram.existsShader(ShaderStage::VERTEX);
const bool existsFragmentShader = config.m_ShaderProgram.existsShader(ShaderStage::FRAGMENT); const bool existsFragmentShader = config.m_ShaderProgram.existsShader(ShaderStage::FRAGMENT);
const bool existsGeometryShader = config.m_ShaderProgram.existsShader(ShaderStage::GEOMETRY); 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) if (!validGeometryStages)
{ {
...@@ -529,6 +544,40 @@ namespace vkcv ...@@ -529,6 +544,40 @@ namespace vkcv
return GraphicsPipelineHandle(); return GraphicsPipelineHandle();
} }
} }
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 // vertex input state
// Fill up VertexInputBindingDescription and VertexInputAttributeDescription Containers // Fill up VertexInputBindingDescription and VertexInputAttributeDescription Containers
...@@ -545,6 +594,10 @@ namespace vkcv ...@@ -545,6 +594,10 @@ namespace vkcv
vk::PipelineInputAssemblyStateCreateInfo pipelineInputAssemblyStateCreateInfo = vk::PipelineInputAssemblyStateCreateInfo pipelineInputAssemblyStateCreateInfo =
createPipelineInputAssemblyStateCreateInfo(config); createPipelineInputAssemblyStateCreateInfo(config);
// tesselation state
vk::PipelineTessellationStateCreateInfo pipelineTessellationStateCreateInfo =
createPipelineTessellationStateCreateInfo(config);
// viewport state // viewport state
vk::PipelineViewportStateCreateInfo pipelineViewportStateCreateInfo = vk::PipelineViewportStateCreateInfo pipelineViewportStateCreateInfo =
createPipelineViewportStateCreateInfo(config); createPipelineViewportStateCreateInfo(config);
...@@ -601,7 +654,7 @@ namespace vkcv ...@@ -601,7 +654,7 @@ namespace vkcv
shaderStages.data(), shaderStages.data(),
&pipelineVertexInputStateCreateInfo, &pipelineVertexInputStateCreateInfo,
&pipelineInputAssemblyStateCreateInfo, &pipelineInputAssemblyStateCreateInfo,
nullptr, &pipelineTessellationStateCreateInfo,
&pipelineViewportStateCreateInfo, &pipelineViewportStateCreateInfo,
&pipelineRasterizationStateCreateInfo, &pipelineRasterizationStateCreateInfo,
&pipelineMultisampleStateCreateInfo, &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