| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <memory> |
| 7 |
#include <string> |
| 8 |
#include <string_view> |
| 9 |
|
| 10 |
#include "VideoBackends/D3D12/Common.h" |
| 11 |
#include "VideoBackends/D3DCommon/Shader.h" |
| 12 |
|
| 13 |
namespace DX12 |
| 14 |
{ |
| 15 |
class DXShader final : public D3DCommon::Shader |
| 16 |
{ |
| 17 |
public: |
| 18 |
~DXShader() override; |
| 19 |
|
| 20 |
ID3D12PipelineState* GetComputePipeline() const { return m_compute_pipeline.Get(); } |
| 21 |
D3D12_SHADER_BYTECODE GetD3DByteCode() const; |
| 22 |
|
| 23 |
static std::unique_ptr<DXShader> CreateFromBytecode(ShaderStage stage, BinaryData bytecode, |
| 24 |
std::string_view name); |
| 25 |
static std::unique_ptr<DXShader> CreateFromSource(ShaderStage stage, std::string_view source, |
| 26 |
VideoCommon::ShaderIncluder* shader_includer, |
| 27 |
std::string_view name); |
| 28 |
|
| 29 |
private: |
| 30 |
DXShader(ShaderStage stage, BinaryData bytecode, std::string_view name); |
| 31 |
|
| 32 |
bool CreateComputePipeline(); |
| 33 |
|
| 34 |
ComPtr<ID3D12PipelineState> m_compute_pipeline; |
| 35 |
|
| 36 |
std::wstring m_name; |
| 37 |
}; |
| 38 |
|
| 39 |
} |