Skip to content

Commit

Permalink
[Vk] tessellationShader ... If not enabled, the ... VK_STRUCTURE_TYPE…
Browse files Browse the repository at this point in the history
…_PIPELINE_TESSELLATION_STATE_CREATE_INFO enum values must not be used.

VUID-VkPipelineTessellationStateCreateInfo-patchControlPoints-01214 - patchControlPoints must be greater than zero and less than or equal to VkPhysicalDeviceLimits::maxTessellationPatchSize
  • Loading branch information
eugenegff committed Sep 12, 2024
1 parent bc67f3e commit 4444e82
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion RenderSystems/Vulkan/src/OgreVulkanRenderSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3351,6 +3351,15 @@ namespace Ogre
debugLogPso( newPso );
#endif

if( ( newPso->geometryShader && !mActiveDevice->mDeviceFeatures.geometryShader ) ||
( newPso->tesselationHullShader && !mActiveDevice->mDeviceFeatures.tessellationShader ) ||
( newPso->tesselationDomainShader && !mActiveDevice->mDeviceFeatures.tessellationShader ) )
{
OGRE_EXCEPT( Exception::ERR_INVALIDPARAMS,
"Geometry or tesselation shaders are not supported",
"VulkanRenderSystem::_hlmsPipelineStateObjectCreated" );
}

size_t numShaderStages = 0u;
VkPipelineShaderStageCreateInfo shaderStages[NumShaderTypes];

Expand Down Expand Up @@ -3476,6 +3485,9 @@ namespace Ogre

VkPipelineTessellationStateCreateInfo tessStateCi;
makeVkStruct( tessStateCi, VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO );
tessStateCi.patchControlPoints = 1u;
bool useTesselationState = mActiveDevice->mDeviceFeatures.tessellationShader &&
( newPso->tesselationHullShader || newPso->tesselationDomainShader );

VkPipelineViewportStateCreateInfo viewportStateCi;
makeVkStruct( viewportStateCi, VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO );
Expand Down Expand Up @@ -3625,7 +3637,7 @@ namespace Ogre
pipeline.pStages = shaderStages;
pipeline.pVertexInputState = &vertexFormatCi;
pipeline.pInputAssemblyState = &inputAssemblyCi;
pipeline.pTessellationState = &tessStateCi;
pipeline.pTessellationState = useTesselationState ? &tessStateCi : nullptr;
pipeline.pViewportState = &viewportStateCi;
pipeline.pRasterizationState = &rasterState;
pipeline.pMultisampleState = &mssCi;
Expand Down

0 comments on commit 4444e82

Please sign in to comment.