2017-09-08 09:42:56 +00:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2017-09-08 09:42:56 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
#include <memory>
|
2019-05-30 07:07:40 +00:00
|
|
|
#include <string_view>
|
2017-09-08 09:42:56 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
#include "VideoBackends/Vulkan/VulkanLoader.h"
|
|
|
|
#include "VideoCommon/AbstractShader.h"
|
|
|
|
|
|
|
|
namespace Vulkan
|
|
|
|
{
|
|
|
|
class VKShader final : public AbstractShader
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
VKShader(ShaderStage stage, std::vector<u32> spv, VkShaderModule mod);
|
|
|
|
VKShader(std::vector<u32> spv, VkPipeline compute_pipeline);
|
|
|
|
~VKShader() override;
|
|
|
|
|
|
|
|
VkShaderModule GetShaderModule() const { return m_module; }
|
|
|
|
VkPipeline GetComputePipeline() const { return m_compute_pipeline; }
|
|
|
|
BinaryData GetBinary() const override;
|
|
|
|
|
2019-05-30 07:07:40 +00:00
|
|
|
static std::unique_ptr<VKShader> CreateFromSource(ShaderStage stage, std::string_view source);
|
2017-09-08 09:42:56 +00:00
|
|
|
static std::unique_ptr<VKShader> CreateFromBinary(ShaderStage stage, const void* data,
|
|
|
|
size_t length);
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<u32> m_spv;
|
|
|
|
VkShaderModule m_module;
|
|
|
|
VkPipeline m_compute_pipeline;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Vulkan
|