1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00
OpenDX/src/dxvk/dxvk_shader.cpp

57 lines
1.4 KiB
C++
Raw Normal View History

2017-10-11 23:28:06 +02:00
#include "dxvk_shader.h"
namespace dxvk {
DxvkShader::DxvkShader(
2017-10-14 23:52:47 +02:00
VkShaderStageFlagBits stage,
DxvkSpirvCodeBuffer&& code,
uint32_t numResourceSlots,
const DxvkResourceSlot* resourceSlots)
: m_stage (stage),
m_code (std::move(code)) {
TRACE(this, stage, numResourceSlots);
2017-10-11 23:28:06 +02:00
2017-10-14 23:52:47 +02:00
for (uint32_t i = 0; i < numResourceSlots; i++)
m_slots.push_back(resourceSlots[i]);
2017-10-11 23:28:06 +02:00
}
DxvkShader::~DxvkShader() {
TRACE(this);
2017-10-14 23:52:47 +02:00
}
DxvkSpirvCodeBuffer DxvkShader::code(
uint32_t bindingOffset) const {
// TODO implement properly
if (bindingOffset != 0)
Logger::warn("DxvkShader::code: bindingOffset != 0 not yet supported");
return m_code;
}
uint32_t DxvkShader::slotCount() const {
return m_slots.size();
}
DxvkResourceSlot DxvkShader::slot(uint32_t slotId) const {
return m_slots.at(slotId);
}
VkDescriptorSetLayoutBinding DxvkShader::slotBinding(
uint32_t slotId,
uint32_t bindingOffset) const {
auto dtype = static_cast<VkDescriptorType>(m_slots.at(slotId).type);
VkDescriptorSetLayoutBinding info;
info.binding = bindingOffset + slotId;
info.descriptorType = dtype;
info.descriptorCount = 1;
info.stageFlags = m_stage;
info.pImmutableSamplers = nullptr;
return info;
2017-10-11 23:28:06 +02:00
}
}