[dxvk] Add patch vertex count to shader info struct

This commit is contained in:
Philip Rebohle 2023-01-09 14:54:55 +01:00 committed by Philip Rebohle
parent f76a7c285c
commit 5e42230b95
3 changed files with 16 additions and 0 deletions

View File

@ -1093,6 +1093,13 @@ namespace dxvk {
|| state.rs.conservativeMode() != VK_CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT)
return false;
if (m_shaders.tcs != nullptr) {
// If tessellation shaders are present, the input patch
// vertex count must match the shader's definition.
if (m_shaders.tcs->info().patchVertexCount != state.ia.patchVertexCount())
return false;
}
if (m_shaders.fs != nullptr) {
// If the fragment shader has inputs not produced by the last
// pre-rasterization stage, we need to patch the fragment shader

View File

@ -1107,6 +1107,12 @@ namespace dxvk {
dyInfo.dynamicStateCount = dynamicStateCount;
dyInfo.pDynamicStates = dynamicStates.data();
// If a tessellation control shader is present, grab the patch vertex count
VkPipelineTessellationStateCreateInfo tsInfo = { VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO };
if (m_shaders.tcs)
tsInfo.patchControlPoints = m_shaders.tcs->info().patchVertexCount;
// All viewport state is dynamic, so we do not need to initialize this.
VkPipelineViewportStateCreateInfo vpInfo = { VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO };
@ -1140,6 +1146,7 @@ namespace dxvk {
info.flags = VK_PIPELINE_CREATE_LIBRARY_BIT_KHR | flags;
info.stageCount = stageInfo.getStageCount();
info.pStages = stageInfo.getStageInfos();
info.pTessellationState = m_shaders.tcs ? &tsInfo : nullptr;
info.pViewportState = &vpInfo;
info.pRasterizationState = &rsInfo;
info.pDynamicState = &dyInfo;

View File

@ -58,6 +58,8 @@ namespace dxvk {
const char* uniformData = nullptr;
/// Rasterized stream, or -1
int32_t xfbRasterizedStream = 0;
/// Tess control patch vertex count
uint32_t patchVertexCount = 0;
/// Transform feedback vertex strides
uint32_t xfbStrides[MaxNumXfbBuffers] = { };
};