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:
@@ -147,36 +147,6 @@ TEST_F(OpenGLTestFixture, CommandList_SetPrimitiveTopology) {
|
||||
EXPECT_EQ(error, GL_NO_ERROR);
|
||||
}
|
||||
|
||||
TEST_F(OpenGLTestFixture, CommandList_SetDepthStencilState) {
|
||||
OpenGLCommandList cmdList;
|
||||
|
||||
DepthStencilState state = {};
|
||||
state.depthEnable = true;
|
||||
state.depthWriteMask = true;
|
||||
state.depthFunc = ComparisonFunc::Less;
|
||||
|
||||
cmdList.SetDepthStencilState(state);
|
||||
|
||||
GLint depthTest = 0;
|
||||
glGetIntegerv(GL_DEPTH_TEST, &depthTest);
|
||||
EXPECT_EQ(depthTest, 1);
|
||||
}
|
||||
|
||||
TEST_F(OpenGLTestFixture, CommandList_SetBlendState) {
|
||||
OpenGLCommandList cmdList;
|
||||
|
||||
BlendState state = {};
|
||||
state.renderTargets[0].blendEnable = true;
|
||||
state.renderTargets[0].srcBlend = BlendFactor::SrcAlpha;
|
||||
state.renderTargets[0].dstBlend = BlendFactor::InvSrcAlpha;
|
||||
|
||||
cmdList.SetBlendState(state);
|
||||
|
||||
GLint blend = 0;
|
||||
glGetIntegerv(GL_BLEND, &blend);
|
||||
EXPECT_EQ(blend, 1);
|
||||
}
|
||||
|
||||
TEST_F(OpenGLTestFixture, CommandList_SetBlendFactor) {
|
||||
OpenGLCommandList cmdList;
|
||||
|
||||
|
||||
@@ -147,45 +147,6 @@ TEST_P(RHITestFixture, CommandList_ClearRenderTarget) {
|
||||
delete cmdList;
|
||||
}
|
||||
|
||||
TEST_P(RHITestFixture, CommandList_SetDepthStencilState) {
|
||||
CommandListDesc cmdDesc = {};
|
||||
cmdDesc.commandListType = static_cast<uint32_t>(CommandQueueType::Direct);
|
||||
|
||||
RHICommandList* cmdList = GetDevice()->CreateCommandList(cmdDesc);
|
||||
ASSERT_NE(cmdList, nullptr);
|
||||
|
||||
DepthStencilState dsState = {};
|
||||
dsState.depthEnable = true;
|
||||
dsState.depthWriteMask = true;
|
||||
dsState.depthFunc = ComparisonFunc::Less;
|
||||
|
||||
cmdList->Reset();
|
||||
cmdList->SetDepthStencilState(dsState);
|
||||
cmdList->Close();
|
||||
|
||||
cmdList->Shutdown();
|
||||
delete cmdList;
|
||||
}
|
||||
|
||||
TEST_P(RHITestFixture, CommandList_SetBlendState) {
|
||||
CommandListDesc cmdDesc = {};
|
||||
cmdDesc.commandListType = static_cast<uint32_t>(CommandQueueType::Direct);
|
||||
|
||||
RHICommandList* cmdList = GetDevice()->CreateCommandList(cmdDesc);
|
||||
ASSERT_NE(cmdList, nullptr);
|
||||
|
||||
BlendState blendState = {};
|
||||
blendState.alphaToCoverageEnable = false;
|
||||
blendState.independentBlendEnable = false;
|
||||
|
||||
cmdList->Reset();
|
||||
cmdList->SetBlendState(blendState);
|
||||
cmdList->Close();
|
||||
|
||||
cmdList->Shutdown();
|
||||
delete cmdList;
|
||||
}
|
||||
|
||||
TEST_P(RHITestFixture, CommandList_SetStencilRef) {
|
||||
CommandListDesc cmdDesc = {};
|
||||
cmdDesc.commandListType = static_cast<uint32_t>(CommandQueueType::Direct);
|
||||
|
||||
Reference in New Issue
Block a user