1.7 KiB
1.7 KiB
D3D12Shader
命名空间: XCEngine::RHI
类型: 类 (继承自 RHIShader)
描述: DirectX 12 着色器的 D3D12 实现,继承自 RHIShader。
公共方法
| 方法 | 描述 |
|---|---|
CompileFromFile |
从文件编译着色器 |
Compile |
从源码编译着色器 |
Shutdown |
关闭着色器 |
GetD3D12Bytecode |
获取 D3D12 字节码 |
GetBytecode |
获取字节码 |
GetBytecodeSize |
获取字节码大小 |
GetType |
获取着色器类型 |
GetInputLayout |
获取输入布局 |
GetNativeHandle |
获取原生句柄 |
IsValid |
检查是否有效 |
Bind |
绑定着色器 |
Unbind |
解绑着色器 |
SetInt |
设置整型 uniform |
SetFloat |
设置浮点型 uniform |
SetVec3 |
设置 Vec3 uniform |
SetVec4 |
设置 Vec4 uniform |
SetMat4 |
设置矩阵 uniform |
使用示例
#include "XCEngine/RHI/D3D12/D3D12Shader.h"
auto shader = std::make_unique<D3D12Shader>();
if (shader->CompileFromFile(L"shaders/vertex.hlsl", "VSMain", "vs_6_0")) {
D3D12_SHADER_BYTECODE bytecode = shader->GetD3D12Bytecode();
// 使用字节码创建 PSO...
}
相关文档
- D3D12 后端总览
- RHIShader - 抽象着色器接口