rsx: Fix depth clipping

This commit is contained in:
Jake 2018-01-11 07:32:09 -06:00 committed by kd-11
parent c5074ba81f
commit 7ca2c444cc
7 changed files with 39 additions and 29 deletions

View file

@ -790,8 +790,14 @@ namespace rsx
if (flip_y) scale_y *= -1;
if (flip_y) offset_y *= -1;
float scale_z = rsx::method_registers.viewport_scale_z();
float offset_z = rsx::method_registers.viewport_offset_z();
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 one = 1.f;
stream_vector(buffer, (u32&)scale_x, 0, 0, (u32&)offset_x);