feat: 实现 D3D12Shader 着色器类

- 添加 D3D12Shader.h/cpp
- 支持从文件编译着色器
- 支持从内存编译着色器
- 测试通过
This commit is contained in:
2026-03-15 18:51:38 +08:00
parent db8e8633c8
commit c3feeda5d4
3 changed files with 105 additions and 0 deletions

View 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