1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-07 16:54:14 +01:00

[dxvk] Add DxvkBindingLayout to DxvkShader class

Supposed to replace the old descriptor model eventually.
This commit is contained in:
Philip Rebohle 2022-06-03 17:43:54 +02:00
parent 53519e2bd5
commit 70a95d9085
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 28 additions and 0 deletions

View File

@ -66,6 +66,7 @@ namespace dxvk {
: m_info(info), m_code(spirv) { : m_info(info), m_code(spirv) {
m_info.resourceSlots = nullptr; m_info.resourceSlots = nullptr;
m_info.uniformData = nullptr; m_info.uniformData = nullptr;
m_info.bindings = nullptr;
// Copy resource binding slot infos // Copy resource binding slot infos
if (info.resourceSlotCount) { if (info.resourceSlotCount) {
@ -75,6 +76,21 @@ namespace dxvk {
m_info.resourceSlots = m_slots.data(); m_info.resourceSlots = m_slots.data();
} }
for (uint32_t i = 0; i < info.bindingCount; i++) {
DxvkBindingInfo binding = info.bindings[i];
binding.stages = info.stage;
m_bindings.addBinding(binding);
}
if (info.pushConstSize) {
VkPushConstantRange pushConst;
pushConst.stageFlags = info.stage;
pushConst.offset = info.pushConstOffset;
pushConst.size = info.pushConstSize;
m_bindings.addPushConstantRange(pushConst);
}
// Copy uniform buffer data // Copy uniform buffer data
if (info.uniformSize) { if (info.uniformSize) {
m_uniformData.resize(info.uniformSize); m_uniformData.resize(info.uniformSize);

View File

@ -58,6 +58,8 @@ namespace dxvk {
/// Descriptor info /// Descriptor info
uint32_t resourceSlotCount = 0; uint32_t resourceSlotCount = 0;
const DxvkResourceSlot* resourceSlots = nullptr; const DxvkResourceSlot* resourceSlots = nullptr;
uint32_t bindingCount = 0;
const DxvkBindingInfo* bindings = nullptr;
/// Input and output register mask /// Input and output register mask
uint32_t inputMask = 0; uint32_t inputMask = 0;
uint32_t outputMask = 0; uint32_t outputMask = 0;
@ -116,6 +118,14 @@ namespace dxvk {
DxvkShaderFlags flags() const { DxvkShaderFlags flags() const {
return m_flags; return m_flags;
} }
/**
* \brief Retrieves binding layout
* \returns Binding layout
*/
const DxvkBindingLayout& getBindings() const {
return m_bindings;
}
/** /**
* \brief Adds resource slots definitions to a mapping * \brief Adds resource slots definitions to a mapping
@ -214,6 +224,8 @@ namespace dxvk {
std::vector<char> m_uniformData; std::vector<char> m_uniformData;
std::vector<size_t> m_idOffsets; std::vector<size_t> m_idOffsets;
DxvkBindingLayout m_bindings;
static void eliminateInput(SpirvCodeBuffer& code, uint32_t location); static void eliminateInput(SpirvCodeBuffer& code, uint32_t location);
}; };