Fix RHI format conversion and test viewDesc initialization

- Fix CreateTexture to use ToD3D12() for format conversion
- Fix CreateRenderTargetView to use ToD3D12() for format conversion
- Fix CreateDepthStencilView to use ToD3D12() for format conversion
- Fix CreateShaderResourceView to use ToD3D12() for format conversion
- Update test to pass correct format in ResourceViewDesc

These fixes resolve CommandList_ClearDepthStencil_WithRealView test.
Other RTV-related tests still fail with DXGI_ERROR_NOT_CURRENTLY_AVAILABLE
from CreateCommandAllocator - further investigation needed.
This commit is contained in:
2026-03-25 17:43:59 +08:00
parent 295459067f
commit 6612330347
2 changed files with 7 additions and 1 deletions

View File

@@ -187,7 +187,9 @@ TEST_P(RHITestFixture, CommandList_ClearRenderTarget_WithRealView) {
RHITexture* texture = GetDevice()->CreateTexture(texDesc);
ASSERT_NE(texture, nullptr);
RHIResourceView* rtv = GetDevice()->CreateRenderTargetView(texture, {});
ResourceViewDesc viewDesc = {};
viewDesc.format = texDesc.format;
RHIResourceView* rtv = GetDevice()->CreateRenderTargetView(texture, viewDesc);
ASSERT_NE(rtv, nullptr);
float color[4] = { 1.0f, 0.0f, 0.0f, 1.0f };