mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-01 07:13:36 +00:00
d3d12: Fix scissor
This commit is contained in:
parent
c152c20d70
commit
039e729881
@ -465,4 +465,14 @@ DXGI_FORMAT get_vertex_attribute_format(u8 type, u8 size) noexcept
|
||||
}
|
||||
unreachable("Wrong type");
|
||||
}
|
||||
|
||||
D3D12_RECT get_scissor(u32 horizontal, u32 vertical) noexcept
|
||||
{
|
||||
return{
|
||||
horizontal & 0xFFFF,
|
||||
vertical & 0xFFFF,
|
||||
(horizontal & 0xFFFF) + (horizontal >> 16),
|
||||
(vertical & 0xFFFF) + (vertical >> 16)
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
@ -97,3 +97,8 @@ DXGI_FORMAT get_index_type(u8 index_type) noexcept;
|
||||
* Convert vertex attribute format and size to DXGI_FORMAT
|
||||
*/
|
||||
DXGI_FORMAT get_vertex_attribute_format(u8 type, u8 size) noexcept;
|
||||
|
||||
/**
|
||||
* Convert scissor register value to D3D12_RECT
|
||||
*/
|
||||
D3D12_RECT get_scissor(u32 horizontal, u32 vertical) noexcept;
|
||||
|
@ -351,14 +351,7 @@ void D3D12GSRender::end()
|
||||
};
|
||||
getCurrentResourceStorage().command_list->RSSetViewports(1, &viewport);
|
||||
|
||||
D3D12_RECT box =
|
||||
{
|
||||
0,
|
||||
0,
|
||||
(LONG)clip_w,
|
||||
(LONG)clip_h,
|
||||
};
|
||||
getCurrentResourceStorage().command_list->RSSetScissorRects(1, &box);
|
||||
getCurrentResourceStorage().command_list->RSSetScissorRects(1, &get_scissor(rsx::method_registers[NV4097_SET_SCISSOR_HORIZONTAL], rsx::method_registers[NV4097_SET_SCISSOR_VERTICAL]));
|
||||
|
||||
getCurrentResourceStorage().command_list->IASetPrimitiveTopology(get_primitive_topology(draw_mode));
|
||||
|
||||
|
@ -86,12 +86,13 @@ void D3D12GSRender::clear_surface(u32 arg)
|
||||
{
|
||||
u32 clear_depth = rsx::method_registers[NV4097_SET_ZSTENCIL_CLEAR_VALUE] >> 8;
|
||||
u32 max_depth_value = m_surface.depth_format == CELL_GCM_SURFACE_Z16 ? 0x0000ffff : 0x00ffffff;
|
||||
getCurrentResourceStorage().command_list->ClearDepthStencilView(handle, D3D12_CLEAR_FLAG_DEPTH, clear_depth / (float)max_depth_value, 0, 0, nullptr);
|
||||
getCurrentResourceStorage().command_list->ClearDepthStencilView(handle, D3D12_CLEAR_FLAG_DEPTH, clear_depth / (float)max_depth_value, 0,
|
||||
1, &get_scissor(rsx::method_registers[NV4097_SET_SCISSOR_HORIZONTAL], rsx::method_registers[NV4097_SET_SCISSOR_VERTICAL]));
|
||||
}
|
||||
|
||||
if (arg & 0x2)
|
||||
getCurrentResourceStorage().command_list->ClearDepthStencilView(handle, D3D12_CLEAR_FLAG_STENCIL, 0.f,
|
||||
get_clear_stencil(rsx::method_registers[NV4097_SET_ZSTENCIL_CLEAR_VALUE]), 0, nullptr);
|
||||
getCurrentResourceStorage().command_list->ClearDepthStencilView(handle, D3D12_CLEAR_FLAG_STENCIL, 0.f, get_clear_stencil(rsx::method_registers[NV4097_SET_ZSTENCIL_CLEAR_VALUE]),
|
||||
1, &get_scissor(rsx::method_registers[NV4097_SET_SCISSOR_HORIZONTAL], rsx::method_registers[NV4097_SET_SCISSOR_VERTICAL]));
|
||||
}
|
||||
|
||||
if (arg & 0xF0)
|
||||
@ -101,8 +102,8 @@ void D3D12GSRender::clear_surface(u32 arg)
|
||||
size_t rtt_index = m_rtts.bind_render_targets(m_device.Get(), m_surface.color_format, handle);
|
||||
getCurrentResourceStorage().render_targets_descriptors_heap_index += rtt_index;
|
||||
for (unsigned i = 0; i < rtt_index; i++)
|
||||
getCurrentResourceStorage().command_list->ClearRenderTargetView(handle.Offset(i, g_descriptorStrideRTV),
|
||||
get_clear_color(rsx::method_registers[NV4097_SET_COLOR_CLEAR_VALUE]).data(), 0, nullptr);
|
||||
getCurrentResourceStorage().command_list->ClearRenderTargetView(handle.Offset(i, g_descriptorStrideRTV), get_clear_color(rsx::method_registers[NV4097_SET_COLOR_CLEAR_VALUE]).data(),
|
||||
1, &get_scissor(rsx::method_registers[NV4097_SET_SCISSOR_HORIZONTAL], rsx::method_registers[NV4097_SET_SCISSOR_VERTICAL]));
|
||||
}
|
||||
|
||||
std::chrono::time_point<std::chrono::system_clock> end_duration = std::chrono::system_clock::now();
|
||||
|
Loading…
x
Reference in New Issue
Block a user