feat: 实现 D3D12Shader 着色器类
- 添加 D3D12Shader.h/cpp - 支持从文件编译着色器 - 支持从内存编译着色器 - 测试通过
This commit is contained in:
33
engine/include/XCEngine/RHI/D3D12/D3D12Shader.h
Normal file
33
engine/include/XCEngine/RHI/D3D12/D3D12Shader.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include <d3d12.h>
|
||||
#include <wrl/client.h>
|
||||
#include <string>
|
||||
|
||||
#include "D3D12Enum.h"
|
||||
|
||||
using Microsoft::WRL::ComPtr;
|
||||
|
||||
namespace XCEngine {
|
||||
namespace RHI {
|
||||
|
||||
class D3D12Shader {
|
||||
public:
|
||||
D3D12Shader();
|
||||
~D3D12Shader();
|
||||
|
||||
bool CompileFromFile(const wchar_t* filePath, const char* entryPoint, const char* target);
|
||||
bool Compile(const void* sourceData, size_t sourceSize, const char* entryPoint, const char* target);
|
||||
void Shutdown();
|
||||
|
||||
const D3D12_SHADER_BYTECODE GetBytecode() const;
|
||||
ShaderType GetType() const { return m_type; }
|
||||
|
||||
private:
|
||||
ComPtr<ID3DBlob> m_bytecode;
|
||||
ComPtr<ID3DBlob> m_error;
|
||||
ShaderType m_type;
|
||||
};
|
||||
|
||||
} // namespace RHI
|
||||
} // namespace XCEngine
|
||||
Reference in New Issue
Block a user