Merge branch 'master' of https://github.com/xenia-project/xenia into canary_experimental

This commit is contained in:
Gliniak
2022-06-22 21:05:45 +02:00
3 changed files with 110 additions and 33 deletions

View File

@@ -1435,16 +1435,8 @@ bool PipelineCache::GetCurrentStateDescription(
float polygon_offset, polygon_offset_scale;
draw_util::GetPreferredFacePolygonOffset(
regs, primitive_polygonal, polygon_offset_scale, polygon_offset);
float polygon_offset_host_scale = draw_util::GetD3D10PolygonOffsetFactor(
regs.Get<reg::RB_DEPTH_INFO>().depth_format, true);
// Using ceil here just in case a game wants the offset but passes a value
// that is too small - it's better to apply more offset than to make depth
// fighting worse or to disable the offset completely (Direct3D 12 takes an
// integer value).
description_out.depth_bias =
int32_t(
std::ceil(std::abs(polygon_offset * polygon_offset_host_scale))) *
(polygon_offset < 0.0f ? -1 : 1);
description_out.depth_bias = draw_util::GetD3D10IntegerPolygonOffset(
regs.Get<reg::RB_DEPTH_INFO>().depth_format, polygon_offset);
description_out.depth_bias_slope_scaled =
polygon_offset_scale * xenos::kPolygonOffsetScaleSubpixelUnit;
}