mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-14 10:48:36 +12:00
rsx/gl/vk: Simulate z clipping with selective depth clamp
- The scale offset matrix is fine but on real hardware the z results seem to be independent of near/far clipping distances -- If depth falls within near/far, clamp depth value to [0,1]
This commit is contained in:
parent
1a6e53ec98
commit
0a2992839b
6 changed files with 30 additions and 12 deletions
|
@ -799,14 +799,8 @@ namespace rsx
|
|||
if (flip_y) scale_y *= -1;
|
||||
if (flip_y) offset_y *= -1;
|
||||
|
||||
float clip_min = rsx::method_registers.clip_min();
|
||||
float clip_max = rsx::method_registers.clip_max();
|
||||
|
||||
float z_clip_scale = (clip_max + clip_min) == 0.f ? 1.f : (clip_max + clip_min);
|
||||
float z_offset_scale = (clip_max - clip_min) == 0.f ? 1.f : (clip_max - clip_min);
|
||||
|
||||
float scale_z = rsx::method_registers.viewport_scale_z() / z_clip_scale;
|
||||
float offset_z = rsx::method_registers.viewport_offset_z() / z_offset_scale;
|
||||
float scale_z = rsx::method_registers.viewport_scale_z();
|
||||
float offset_z = rsx::method_registers.viewport_offset_z();
|
||||
float one = 1.f;
|
||||
|
||||
stream_vector(buffer, (u32&)scale_x, 0, 0, (u32&)offset_x);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue