From fc52c1720db6cfd0897dec709ae97ad54a68f361 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Wed, 1 May 2019 00:36:16 +0200 Subject: [PATCH] [dxvk] Remove old spec constant code --- src/dxvk/dxvk_spec_const.cpp | 58 ---------------------------- src/dxvk/dxvk_spec_const.h | 73 ------------------------------------ 2 files changed, 131 deletions(-) diff --git a/src/dxvk/dxvk_spec_const.cpp b/src/dxvk/dxvk_spec_const.cpp index b85d57c41..eec6d8ae5 100644 --- a/src/dxvk/dxvk_spec_const.cpp +++ b/src/dxvk/dxvk_spec_const.cpp @@ -1,65 +1,7 @@ #include "dxvk_spec_const.h" -#define SET_CONSTANT_ENTRY(specId, member) \ - this->setConstantEntry(specId, \ - offsetof(DxvkSpecConstantData, member), \ - sizeof(DxvkSpecConstantData::member)) - namespace dxvk { - DxvkSpecConstantMap g_specConstantMap; - - DxvkSpecConstantMap::DxvkSpecConstantMap() { - SET_CONSTANT_ENTRY(DxvkSpecConstantId::RasterizerSampleCount, rasterizerSampleCount); - SET_CONSTANT_ENTRY(DxvkSpecConstantId::AlphaTestEnable, alphaTestEnable); - SET_CONSTANT_ENTRY(DxvkSpecConstantId::AlphaCompareOp, alphaCompareOp); - - for (uint32_t i = 0; i < MaxNumActiveBindings; i++) - this->setBindingEntry(i); - - for (uint32_t i = 0; i < MaxNumRenderTargets; i++) - this->setOutputMappingEntry(i); - } - - - void DxvkSpecConstantMap::setConstantEntry( - DxvkSpecConstantId specId, - uint32_t offset, - uint32_t size) { - VkSpecializationMapEntry entry; - entry.constantID = uint32_t(specId); - entry.offset = offset; - entry.size = size; - m_mapEntries[uint32_t(specId) - uint32_t(DxvkSpecConstantId::SpecConstantIdMin)] = entry; - } - - - void DxvkSpecConstantMap::setBindingEntry( - uint32_t binding) { - VkSpecializationMapEntry entry; - entry.constantID = binding; - entry.offset = sizeof(VkBool32) * binding + offsetof(DxvkSpecConstantData, activeBindings); - entry.size = sizeof(VkBool32); - m_mapEntries[MaxNumSpecConstants + binding] = entry; - } - - - void DxvkSpecConstantMap::setOutputMappingEntry( - uint32_t output) { - for (uint32_t i = 0; i < 4; i++) { - uint32_t constId = 4 * output + i; - - VkSpecializationMapEntry entry; - entry.constantID = uint32_t(DxvkSpecConstantId::ColorComponentMappings) + constId; - entry.offset = sizeof(uint32_t) * constId + offsetof(DxvkSpecConstantData, outputMappings); - entry.size = sizeof(uint32_t); - m_mapEntries[MaxNumSpecConstants + MaxNumActiveBindings + constId] = entry; - } - } - - - - DxvkSpecConstants::DxvkSpecConstants() { } diff --git a/src/dxvk/dxvk_spec_const.h b/src/dxvk/dxvk_spec_const.h index 563f80767..8c0f42f44 100644 --- a/src/dxvk/dxvk_spec_const.h +++ b/src/dxvk/dxvk_spec_const.h @@ -5,79 +5,6 @@ namespace dxvk { - constexpr uint32_t MaxNumSpecConstants = 1 - + uint32_t(DxvkSpecConstantId::SpecConstantIdMax) - - uint32_t(DxvkSpecConstantId::SpecConstantIdMin); - - /** - * \brief Spec costant data - * - * The values are derived from the pipeline - * state vector so that they can be used by - * the shaders. - */ - struct DxvkSpecConstantData { - uint32_t rasterizerSampleCount; - VkBool32 alphaTestEnable; - VkCompareOp alphaCompareOp; - uint32_t outputMappings[MaxNumRenderTargets * 4]; - VkBool32 activeBindings[MaxNumActiveBindings]; - }; - - - /** - * \brief Spec constant map - * - * Stores the specialization constant map. - * This can be passed to Vulkan when compiling - * both graphics and compute pipelines. - */ - class DxvkSpecConstantMap { - - public: - - DxvkSpecConstantMap(); - - /** - * \brief Map entry count - * - * \param [in] bindingCount Number of active bindings - * \returns The number of map entries to read - */ - uint32_t mapEntryCount() const { - return m_mapEntries.size(); - } - - /** - * \brief Map entry data - * \returns Map entries - */ - const VkSpecializationMapEntry* mapEntryData() const { - return m_mapEntries.data(); - } - - private: - - std::array m_mapEntries; - - void setConstantEntry( - DxvkSpecConstantId specId, - uint32_t offset, - uint32_t size); - - void setBindingEntry( - uint32_t binding); - - void setOutputMappingEntry( - uint32_t output); - - }; - - extern DxvkSpecConstantMap g_specConstantMap; - /** * \brief Specialization constant info *