mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-27 04:54:15 +01:00
[dxvk] Added shader interface
This commit is contained in:
parent
921abce1b3
commit
5c932f14d6
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user