mirror of https://github.com/RPCS3/rpcs3.git
d3d12: Fix depth readback format
This commit is contained in:
parent
fa845fa5c0
commit
984f5c6914
|
@ -353,7 +353,7 @@ DXGI_FORMAT get_depth_stencil_surface_clear_format(u8 format) noexcept
|
|||
unreachable("Wrong depth stencil surface format");
|
||||
}
|
||||
|
||||
DXGI_FORMAT get_depth_typeless_surface_format(u8 format) noexcept
|
||||
DXGI_FORMAT get_depth_stencil_typeless_surface_format(u8 format) noexcept
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
|
@ -363,6 +363,16 @@ DXGI_FORMAT get_depth_typeless_surface_format(u8 format) noexcept
|
|||
unreachable("Wrong depth stencil surface format");
|
||||
}
|
||||
|
||||
DXGI_FORMAT get_depth_samplable_surface_format(u8 format) noexcept
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case CELL_GCM_SURFACE_Z16: return DXGI_FORMAT_R16_FLOAT;
|
||||
case CELL_GCM_SURFACE_Z24S8: return DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
|
||||
}
|
||||
unreachable("Wrong depth stencil surface format");
|
||||
}
|
||||
|
||||
BOOL get_front_face_ccw(u32 set_front_face_value) noexcept
|
||||
{
|
||||
switch (set_front_face_value)
|
||||
|
|
|
@ -79,9 +79,14 @@ DXGI_FORMAT get_depth_stencil_surface_format(u8 format) noexcept;
|
|||
DXGI_FORMAT get_depth_stencil_surface_clear_format(u8 format) noexcept;
|
||||
|
||||
/**
|
||||
* Convert depth surface format to DXGI_FORMAT using typeless for stencil
|
||||
* Convert depth surface format to a typeless DXGI_FORMAT
|
||||
*/
|
||||
DXGI_FORMAT get_depth_typeless_surface_format(u8 format) noexcept;
|
||||
DXGI_FORMAT get_depth_stencil_typeless_surface_format(u8 format) noexcept;
|
||||
|
||||
/**
|
||||
* Convert depth surface format to a DXGI_FORMAT that can be depth sampled
|
||||
*/
|
||||
DXGI_FORMAT get_depth_samplable_surface_format(u8 format) noexcept;
|
||||
|
||||
/**
|
||||
* Convert front face value to bool value telling wheter front face is counterclockwise or not
|
||||
|
|
|
@ -327,7 +327,7 @@ ID3D12Resource * render_targets::bind_address_as_depth_stencil(ID3D12Device * de
|
|||
D3D12_CLEAR_VALUE clear_depth_value = {};
|
||||
clear_depth_value.DepthStencil.Depth = depthClear;
|
||||
|
||||
DXGI_FORMAT dxgi_format = get_depth_typeless_surface_format(surfaceDepthFormat);
|
||||
DXGI_FORMAT dxgi_format = get_depth_stencil_typeless_surface_format(surfaceDepthFormat);
|
||||
clear_depth_value.Format = get_depth_stencil_surface_clear_format(surfaceDepthFormat);
|
||||
|
||||
ComPtr<ID3D12Resource> new_depth_stencil;
|
||||
|
@ -468,7 +468,7 @@ void D3D12GSRender::copy_render_target_to_dma_location()
|
|||
m_device->CreateDescriptorHeap(&descriptor_heap_desc, IID_PPV_ARGS(descriptor_heap.GetAddressOf()))
|
||||
);
|
||||
D3D12_SHADER_RESOURCE_VIEW_DESC shader_resource_view_desc = {};
|
||||
m_surface.depth_format = get_depth_typeless_surface_format(m_surface.depth_format);
|
||||
shader_resource_view_desc.Format = get_depth_samplable_surface_format(m_surface.depth_format);
|
||||
shader_resource_view_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
|
||||
shader_resource_view_desc.Texture2D.MipLevels = 1;
|
||||
shader_resource_view_desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
|
||||
|
|
Loading…
Reference in New Issue