[dxvk] Added shader interface

This commit is contained in:
Philip Rebohle 2017-10-14 13:44:38 +02:00
parent 921abce1b3
commit 5c932f14d6
2 changed files with 64 additions and 1 deletions

View File

@ -2,10 +2,20 @@
namespace dxvk {
DxvkShaderInterface:: DxvkShaderInterface() { }
DxvkShaderInterface::~DxvkShaderInterface() { }
void DxvkShaderInterface::enableResourceSlot(
const DxvkResourceSlot& slot) {
m_slots.push_back(slot);
}
DxvkShader::DxvkShader(
const Rc<vk::DeviceFn>& vkd,
const DxvkShaderInterface& iface,
const SpirvCodeBuffer& code)
: m_vkd(vkd) {
: m_vkd(vkd), m_iface(iface) {
TRACE(this);
VkShaderModuleCreateInfo info;

View File

@ -1,11 +1,62 @@
#pragma once
#include <vector>
#include "dxvk_include.h"
#include "./spirv/dxvk_spirv_code_buffer.h"
namespace dxvk {
/**
* \brief Shader resource type
*
* Enumerates the types of resources
* that can be accessed by shaders.
*/
enum class DxvkResourceType : uint32_t {
UniformBuffer = 0x00,
ImageSampler = 0x01,
SampledImage = 0x02,
StorageBuffer = 0x03,
};
/**
* \brief Resource slot
*/
struct DxvkResourceSlot{
DxvkResourceType type;
uint32_t slot;
};
/**
* \brief Shader interface
*
* Stores a list of resource bindings in the
* order they are defined in the shader module.
*/
class DxvkShaderInterface {
public:
DxvkShaderInterface();
~DxvkShaderInterface();
auto size() const { return m_slots.size(); }
auto data() const { return m_slots.data(); }
void enableResourceSlot(
const DxvkResourceSlot& slot);
private:
std::vector<DxvkResourceSlot> m_slots;
};
/**
* \brief Shader module
*
@ -20,6 +71,7 @@ namespace dxvk {
DxvkShader(
const Rc<vk::DeviceFn>& vkd,
const DxvkShaderInterface& iface,
const SpirvCodeBuffer& code);
~DxvkShader();
@ -34,6 +86,7 @@ namespace dxvk {
private:
Rc<vk::DeviceFn> m_vkd;
DxvkShaderInterface m_iface;
VkShaderModule m_shader;
};