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:
@@ -537,6 +537,10 @@ RHIResourceView* D3D12Device::CreateRenderTargetView(RHITexture* texture, const
|
||||
}
|
||||
|
||||
RHIResourceView* D3D12Device::CreateDepthStencilView(RHITexture* texture, const ResourceViewDesc& desc) {
|
||||
{
|
||||
FILE* f = fopen("D:\\Xuanchi\\Main\\XCEngine\\debug_rhi.log", "a");
|
||||
if (f) { fprintf(f, "[CreateDepthStencilView] Start, desc.format=%d\n", desc.format); fclose(f); }
|
||||
}
|
||||
auto* view = new D3D12ResourceView();
|
||||
auto* d3d12Texture = static_cast<D3D12Texture*>(texture);
|
||||
ID3D12Resource* resource = d3d12Texture->GetResource();
|
||||
|
||||
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user