RHI: Remove无效的动态状态方法 - SetDepthStencilState/SetBlendState

重构原因:
- D3D12 PSO是不可变的,SetDepthStencilState/SetBlendState调用原本就是空实现(TODO)
- 这些方法在D3D12中完全无效,是死代码

移除的方法:
- SetDepthStencilState(const DepthStencilState&) - D3D12空实现,OpenGL直接调用GL函数
- SetBlendState(const BlendState&) - D3D12只设置BlendFactor其他忽略,OpenGL直接调用GL函数

保留的真正动态状态:
- SetViewport/SetViewports
- SetScissorRect/SetScissorRects
- SetStencilRef (D3D12动态状态)
- SetBlendFactor (D3D12动态状态)

注:PrimitiveTopology保留在CommandList,因为D3D12允许动态改变topology type

测试状态:150个RHI单元测试全部通过,8个集成测试全部通过
This commit is contained in:
2026-03-25 00:37:18 +08:00
parent f8a2507bdf
commit a2fc8eca02
8 changed files with 31 additions and 132 deletions

View File

@@ -104,8 +104,6 @@ public:
void SetGraphicsRootShaderResourceView(uint32_t rootParameterIndex, D3D12_GPU_VIRTUAL_ADDRESS shaderResource);
void SetStencilRef(uint8_t stencilRef) override;
void SetDepthStencilState(const DepthStencilState& state) override;
void SetBlendState(const BlendState& state) override;
void SetBlendFactor(const float blendFactor[4]);
void SetDepthBias(float depthBias, float slopeScaledDepthBias, float depthBiasClamp);

View File

@@ -191,9 +191,7 @@ public:
void SetScissorRect(const Rect& rect) override;
void SetScissorRects(uint32_t count, const Rect* rects) override;
void SetRenderTargets(uint32_t count, RHIResourceView** renderTargets, RHIResourceView* depthStencil = nullptr) override;
void SetDepthStencilState(const DepthStencilState& state) override;
void SetStencilRef(uint8_t ref) override;
void SetBlendState(const BlendState& state) override;
void SetBlendFactor(const float factor[4]) override;
void ClearRenderTarget(RHIResourceView* renderTarget, const float color[4]) override;
void ClearDepthStencil(RHIResourceView* depthStencil, float depth, uint8_t stencil) override;

View File

@@ -95,9 +95,7 @@ public:
virtual void SetScissorRects(uint32_t count, const Rect* rects) = 0;
virtual void SetRenderTargets(uint32_t count, RHIResourceView** renderTargets, RHIResourceView* depthStencil = nullptr) = 0;
virtual void SetDepthStencilState(const DepthStencilState& state) = 0;
virtual void SetStencilRef(uint8_t ref) = 0;
virtual void SetBlendState(const BlendState& state) = 0;
virtual void SetBlendFactor(const float factor[4]) = 0;
virtual void SetVertexBuffers(uint32_t startSlot, uint32_t count, RHIResourceView** buffers, const uint64_t* offsets, const uint32_t* strides) = 0;