1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-12 13:08:50 +01:00

[dxvk] Implement checks for pre-raster pipeline library compatibility

This commit is contained in:
Philip Rebohle 2023-01-09 15:04:03 +01:00 committed by Philip Rebohle
parent b916dc04e5
commit f9ff96d727
3 changed files with 29 additions and 15 deletions

View File

@ -466,7 +466,7 @@ namespace dxvk {
bool DxvkPipelineManager::canPrecompileShader( bool DxvkPipelineManager::canPrecompileShader(
const Rc<DxvkShader>& shader) const { const Rc<DxvkShader>& shader) const {
if (!shader->canUsePipelineLibrary()) if (!shader->canUsePipelineLibrary(true))
return false; return false;
if (shader->info().stage == VK_SHADER_STAGE_COMPUTE_BIT) if (shader->info().stage == VK_SHADER_STAGE_COMPUTE_BIT)

View File

@ -161,7 +161,7 @@ namespace dxvk {
// Don't set pipeline library flag if the shader // Don't set pipeline library flag if the shader
// doesn't actually support pipeline libraries // doesn't actually support pipeline libraries
m_needsLibraryCompile = canUsePipelineLibrary(); m_needsLibraryCompile = canUsePipelineLibrary(true);
} }
@ -209,19 +209,30 @@ namespace dxvk {
} }
bool DxvkShader::canUsePipelineLibrary() const { bool DxvkShader::canUsePipelineLibrary(bool standalone) const {
// Pipeline libraries are unsupported for geometry and if (standalone) {
// tessellation stages since we'd need to compile them // Standalone pipeline libraries are unsupported for geometry
// all into one library // and tessellation stages since we'd need to compile them
if (m_info.stage != VK_SHADER_STAGE_VERTEX_BIT // all into one library
&& m_info.stage != VK_SHADER_STAGE_FRAGMENT_BIT if (m_info.stage != VK_SHADER_STAGE_VERTEX_BIT
&& m_info.stage != VK_SHADER_STAGE_COMPUTE_BIT) && m_info.stage != VK_SHADER_STAGE_FRAGMENT_BIT
return false; && m_info.stage != VK_SHADER_STAGE_COMPUTE_BIT)
return false;
// Standalone vertex shaders must export vertex position // Standalone vertex shaders must export vertex position
if (m_info.stage == VK_SHADER_STAGE_VERTEX_BIT if (m_info.stage == VK_SHADER_STAGE_VERTEX_BIT
&& !m_flags.test(DxvkShaderFlag::ExportsPosition)) && !m_flags.test(DxvkShaderFlag::ExportsPosition))
return false; 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 // Spec constant selectors are only supported in graphics
if (m_specConstantMask & (1u << MaxNumSpecConstants)) if (m_specConstantMask & (1u << MaxNumSpecConstants))

View File

@ -178,9 +178,12 @@ namespace dxvk {
* *
* This is true for any vertex, fragment, or compute shader that does not * This is true for any vertex, fragment, or compute shader that does not
* require additional pipeline state to be compiled into something useful. * 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 * \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 * \brief Dumps SPIR-V shader