2019-03-28 10:35:46 +00:00
|
|
|
// Copyright 2019 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2019-03-28 10:35:46 +00:00
|
|
|
|
|
|
|
#pragma once
|
2019-05-30 07:07:40 +00:00
|
|
|
|
2019-03-28 10:35:46 +00:00
|
|
|
#include <memory>
|
2021-08-28 05:30:05 +00:00
|
|
|
#include <string>
|
2019-05-30 07:07:40 +00:00
|
|
|
#include <string_view>
|
2019-03-28 10:35:46 +00:00
|
|
|
#include "VideoBackends/D3D12/Common.h"
|
|
|
|
#include "VideoBackends/D3DCommon/Shader.h"
|
|
|
|
|
|
|
|
namespace DX12
|
|
|
|
{
|
|
|
|
class DXShader final : public D3DCommon::Shader
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
~DXShader() override;
|
|
|
|
|
|
|
|
ID3D12PipelineState* GetComputePipeline() const { return m_compute_pipeline.Get(); }
|
|
|
|
D3D12_SHADER_BYTECODE GetD3DByteCode() const;
|
|
|
|
|
2021-08-28 05:30:05 +00:00
|
|
|
static std::unique_ptr<DXShader> CreateFromBytecode(ShaderStage stage, BinaryData bytecode,
|
|
|
|
std::string_view name);
|
|
|
|
static std::unique_ptr<DXShader> CreateFromSource(ShaderStage stage, std::string_view source,
|
|
|
|
std::string_view name);
|
2019-03-28 10:35:46 +00:00
|
|
|
|
|
|
|
private:
|
2021-08-28 05:30:05 +00:00
|
|
|
DXShader(ShaderStage stage, BinaryData bytecode, std::string_view name);
|
2019-03-28 10:35:46 +00:00
|
|
|
|
|
|
|
bool CreateComputePipeline();
|
|
|
|
|
|
|
|
ComPtr<ID3D12PipelineState> m_compute_pipeline;
|
2021-08-28 05:30:05 +00:00
|
|
|
|
|
|
|
std::wstring m_name;
|
2019-03-28 10:35:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace DX12
|