2017-09-08 09:42:56 +00:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include <d3d11.h>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include "VideoCommon/AbstractShader.h"
|
|
|
|
|
|
|
|
namespace DX11
|
|
|
|
{
|
|
|
|
class DXShader final : public AbstractShader
|
|
|
|
{
|
|
|
|
public:
|
2019-02-15 01:59:50 +00:00
|
|
|
DXShader(ShaderStage stage, BinaryData bytecode, ID3D11DeviceChild* shader);
|
2017-09-08 09:42:56 +00:00
|
|
|
~DXShader() override;
|
|
|
|
|
2019-02-15 01:59:50 +00:00
|
|
|
const BinaryData& GetByteCode() const { return m_bytecode; }
|
|
|
|
|
2017-09-08 09:42:56 +00:00
|
|
|
ID3D11VertexShader* GetD3DVertexShader() const;
|
|
|
|
ID3D11GeometryShader* GetD3DGeometryShader() const;
|
|
|
|
ID3D11PixelShader* GetD3DPixelShader() const;
|
|
|
|
ID3D11ComputeShader* GetD3DComputeShader() const;
|
|
|
|
|
|
|
|
bool HasBinary() const override;
|
|
|
|
BinaryData GetBinary() const override;
|
|
|
|
|
2019-02-15 01:59:50 +00:00
|
|
|
// Creates a new shader object.
|
|
|
|
static std::unique_ptr<DXShader> CreateFromBytecode(ShaderStage stage, BinaryData bytecode);
|
|
|
|
static bool CompileShader(BinaryData* out_bytecode, ShaderStage stage, const char* source,
|
|
|
|
size_t length);
|
|
|
|
|
2017-09-08 09:42:56 +00:00
|
|
|
static std::unique_ptr<DXShader> CreateFromBinary(ShaderStage stage, const void* data,
|
|
|
|
size_t length);
|
|
|
|
static std::unique_ptr<DXShader> CreateFromSource(ShaderStage stage, const char* source,
|
|
|
|
size_t length);
|
|
|
|
|
|
|
|
private:
|
|
|
|
ID3D11DeviceChild* m_shader;
|
2019-02-15 01:59:50 +00:00
|
|
|
BinaryData m_bytecode;
|
2017-09-08 09:42:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace DX11
|