diff --git a/src/dxvk/dxvk_pipemanager.cpp b/src/dxvk/dxvk_pipemanager.cpp index c8889ac6..39551d09 100644 --- a/src/dxvk/dxvk_pipemanager.cpp +++ b/src/dxvk/dxvk_pipemanager.cpp @@ -466,7 +466,7 @@ namespace dxvk { bool DxvkPipelineManager::canPrecompileShader( const Rc& shader) const { - if (!shader->canUsePipelineLibrary()) + if (!shader->canUsePipelineLibrary(true)) return false; if (shader->info().stage == VK_SHADER_STAGE_COMPUTE_BIT) diff --git a/src/dxvk/dxvk_shader.cpp b/src/dxvk/dxvk_shader.cpp index 7a51eda8..5dec0a7d 100644 --- a/src/dxvk/dxvk_shader.cpp +++ b/src/dxvk/dxvk_shader.cpp @@ -161,7 +161,7 @@ namespace dxvk { // Don't set pipeline library flag if the shader // doesn't actually support pipeline libraries - m_needsLibraryCompile = canUsePipelineLibrary(); + m_needsLibraryCompile = canUsePipelineLibrary(true); } @@ -209,19 +209,30 @@ namespace dxvk { } - bool DxvkShader::canUsePipelineLibrary() const { - // Pipeline libraries are unsupported for geometry and - // tessellation stages since we'd need to compile them - // all into one library - if (m_info.stage != VK_SHADER_STAGE_VERTEX_BIT - && m_info.stage != VK_SHADER_STAGE_FRAGMENT_BIT - && m_info.stage != VK_SHADER_STAGE_COMPUTE_BIT) - return false; + bool DxvkShader::canUsePipelineLibrary(bool standalone) const { + if (standalone) { + // Standalone pipeline libraries are unsupported for geometry + // and tessellation stages since we'd need to compile them + // all into one library + if (m_info.stage != VK_SHADER_STAGE_VERTEX_BIT + && m_info.stage != VK_SHADER_STAGE_FRAGMENT_BIT + && m_info.stage != VK_SHADER_STAGE_COMPUTE_BIT) + return false; - // Standalone vertex shaders must export vertex position - if (m_info.stage == VK_SHADER_STAGE_VERTEX_BIT - && !m_flags.test(DxvkShaderFlag::ExportsPosition)) - return false; + // Standalone vertex shaders must export vertex position + if (m_info.stage == VK_SHADER_STAGE_VERTEX_BIT + && !m_flags.test(DxvkShaderFlag::ExportsPosition)) + return false; + } else { + // Tessellation control shaders must define a valid vertex count + if (m_info.stage == VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT + && (m_info.patchVertexCount < 1 || m_info.patchVertexCount > 32)) + return false; + + // We don't support GPL with transform feedback right now + if (m_flags.test(DxvkShaderFlag::HasTransformFeedback)) + return false; + } // Spec constant selectors are only supported in graphics if (m_specConstantMask & (1u << MaxNumSpecConstants)) diff --git a/src/dxvk/dxvk_shader.h b/src/dxvk/dxvk_shader.h index b3f6123a..245f96f6 100644 --- a/src/dxvk/dxvk_shader.h +++ b/src/dxvk/dxvk_shader.h @@ -178,9 +178,12 @@ namespace dxvk { * * This is true for any vertex, fragment, or compute shader that does not * require additional pipeline state to be compiled into something useful. + * \param [in] standalone Set to \c true to evaluate this in the context + * of a single-shader pipeline library, or \c false for a pre-raster + * shader library consisting of multiple shader stages. * \returns \c true if this shader can be used with pipeline libraries */ - bool canUsePipelineLibrary() const; + bool canUsePipelineLibrary(bool standalone) const; /** * \brief Dumps SPIR-V shader