mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[dxvk] Remove old spec constant code
This commit is contained in:
parent
5714f18d15
commit
fc52c1720d
@ -1,65 +1,7 @@
|
|||||||
#include "dxvk_spec_const.h"
|
#include "dxvk_spec_const.h"
|
||||||
|
|
||||||
#define SET_CONSTANT_ENTRY(specId, member) \
|
|
||||||
this->setConstantEntry(specId, \
|
|
||||||
offsetof(DxvkSpecConstantData, member), \
|
|
||||||
sizeof(DxvkSpecConstantData::member))
|
|
||||||
|
|
||||||
namespace dxvk {
|
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() {
|
DxvkSpecConstants::DxvkSpecConstants() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,79 +5,6 @@
|
|||||||
|
|
||||||
namespace dxvk {
|
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<VkSpecializationMapEntry,
|
|
||||||
MaxNumSpecConstants +
|
|
||||||
MaxNumActiveBindings +
|
|
||||||
MaxNumRenderTargets * 4> 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
|
* \brief Specialization constant info
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user