libretro-dolphin/Source/Core/VideoBackends/D3D12/DXShader.h
Lioncash e60268bd42 VideoCommon/RenderBase: Use a std::string_view with CreateShaderFromSource()
Greatly simplifies the overall interface when it comes to compiling
shaders. Also allows getting rid of a std::string overload of the same
name. Now std::string and const char* both go through the same function.
2019-05-30 03:29:35 -04:00

34 lines
851 B
C++

// Copyright 2019 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <memory>
#include <string_view>
#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;
static std::unique_ptr<DXShader> CreateFromBytecode(ShaderStage stage, BinaryData bytecode);
static std::unique_ptr<DXShader> CreateFromSource(ShaderStage stage, std::string_view source);
private:
DXShader(ShaderStage stage, BinaryData bytecode);
bool CreateComputePipeline();
ComPtr<ID3D12PipelineState> m_compute_pipeline;
};
} // namespace DX12