mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 19:54:19 +01:00
[dxvk] Only pass required spec constants when compiling graphics pipelines
This commit is contained in:
parent
80a58f000a
commit
b90f8819c6
@ -514,6 +514,7 @@ namespace dxvk {
|
||||
m_fsLibrary (fsLibrary) {
|
||||
m_vsIn = m_shaders.vs != nullptr ? m_shaders.vs->info().inputMask : 0;
|
||||
m_fsOut = m_shaders.fs != nullptr ? m_shaders.fs->info().outputMask : 0;
|
||||
m_specConstantMask = this->computeSpecConstantMask();
|
||||
|
||||
if (m_shaders.gs != nullptr) {
|
||||
if (m_shaders.gs->flags().test(DxvkShaderFlag::HasTransformFeedback)) {
|
||||
@ -814,8 +815,13 @@ namespace dxvk {
|
||||
// Set up some specialization constants
|
||||
DxvkSpecConstants specData;
|
||||
|
||||
for (uint32_t i = 0; i < MaxNumSpecConstants; i++)
|
||||
specData.set(i, state.sc.specConstants[i], 0u);
|
||||
for (uint32_t i = 0; i < MaxNumSpecConstants; i++) {
|
||||
if (m_specConstantMask & (1u << i))
|
||||
specData.set(i, state.sc.specConstants[i], 0u);
|
||||
}
|
||||
|
||||
if (m_specConstantMask & (1u << MaxNumSpecConstants))
|
||||
specData.set(MaxNumSpecConstants, 1u, 0u);
|
||||
|
||||
VkSpecializationInfo specInfo = specData.getSpecInfo();
|
||||
|
||||
@ -969,6 +975,22 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
uint32_t DxvkGraphicsPipeline::computeSpecConstantMask() const {
|
||||
uint32_t mask = m_shaders.vs->getSpecConstantMask();
|
||||
|
||||
if (m_shaders.tcs != nullptr)
|
||||
mask |= m_shaders.tcs->getSpecConstantMask();
|
||||
if (m_shaders.tes != nullptr)
|
||||
mask |= m_shaders.tes->getSpecConstantMask();
|
||||
if (m_shaders.gs != nullptr)
|
||||
mask |= m_shaders.gs->getSpecConstantMask();
|
||||
if (m_shaders.fs != nullptr)
|
||||
mask |= m_shaders.fs->getSpecConstantMask();
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
|
||||
bool DxvkGraphicsPipeline::validatePipelineState(
|
||||
const DxvkGraphicsPipelineStateInfo& state,
|
||||
bool trusted) const {
|
||||
|
@ -395,7 +395,9 @@ namespace dxvk {
|
||||
|
||||
uint32_t m_vsIn = 0;
|
||||
uint32_t m_fsOut = 0;
|
||||
|
||||
|
||||
uint32_t m_specConstantMask = 0;
|
||||
|
||||
// List of pipeline instances, shared between threads
|
||||
alignas(CACHE_LINE_SIZE)
|
||||
dxvk::mutex m_mutex;
|
||||
@ -436,6 +438,8 @@ namespace dxvk {
|
||||
const DxvkGraphicsPipelineStateInfo& state,
|
||||
uint32_t target) const;
|
||||
|
||||
uint32_t computeSpecConstantMask() const;
|
||||
|
||||
bool validatePipelineState(
|
||||
const DxvkGraphicsPipelineStateInfo& state,
|
||||
bool trusted) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user