| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <cstddef> |
| 7 |
#include <memory> |
| 8 |
#include <string> |
| 9 |
#include <string_view> |
| 10 |
#include <vector> |
| 11 |
|
| 12 |
#include "Common/CommonTypes.h" |
| 13 |
#include "VideoBackends/Vulkan/VulkanLoader.h" |
| 14 |
#include "VideoCommon/AbstractShader.h" |
| 15 |
|
| 16 |
namespace Vulkan |
| 17 |
{ |
| 18 |
class VKShader final : public AbstractShader |
| 19 |
{ |
| 20 |
public: |
| 21 |
VKShader(ShaderStage stage, std::vector<u32> spv, VkShaderModule mod, std::string_view name); |
| 22 |
VKShader(std::vector<u32> spv, VkPipeline compute_pipeline, std::string_view name); |
| 23 |
~VKShader() override; |
| 24 |
|
| 25 |
VkShaderModule GetShaderModule() const { return m_module; } |
| 26 |
VkPipeline GetComputePipeline() const { return m_compute_pipeline; } |
| 27 |
BinaryData GetBinary() const override; |
| 28 |
|
| 29 |
static std::unique_ptr<VKShader> CreateFromSource(ShaderStage stage, std::string_view source, |
| 30 |
VideoCommon::ShaderIncluder* shader_includer, |
| 31 |
std::string_view name); |
| 32 |
static std::unique_ptr<VKShader> CreateFromBinary(ShaderStage stage, const void* data, |
| 33 |
size_t length, std::string_view name); |
| 34 |
|
| 35 |
private: |
| 36 |
std::vector<u32> m_spv; |
| 37 |
VkShaderModule m_module; |
| 38 |
VkPipeline m_compute_pipeline; |
| 39 |
std::string m_name; |
| 40 |
}; |
| 41 |
|
| 42 |
} |