[Vulkan] Float24 depth range remapping fixes

This commit is contained in:
Triang3l 2022-06-29 13:14:00 +03:00
parent 05ef7a273a
commit d5815d9e6a
2 changed files with 6 additions and 2 deletions

View File

@ -296,7 +296,7 @@ spv::Id SpirvShaderTranslator::PreClampedDepthTo20e4(
// normal_biased_f32 = f32 - (112 << 23)
spv::Id normal_biased_f32 = builder.createBinOp(
spv::OpISub, type_uint, f32_scalar,
builder.makeUintConstant((UINT32_C(112) + remap_bias) << 23));
builder.makeUintConstant((UINT32_C(112) - remap_bias) << 23));
// Select the needed conversion depending on whether the number is too small
// to be represented as normalized 20e4.

View File

@ -2397,6 +2397,9 @@ bool VulkanCommandProcessor::IssueDraw(xenos::PrimitiveType prim_type,
const VkPhysicalDeviceLimits& device_limits =
provider.device_properties().limits;
bool host_render_targets_used = render_target_cache_->GetPath() ==
RenderTargetCache::Path::kHostRenderTargets;
// Get dynamic rasterizer state.
draw_util::ViewportInfo viewport_info;
// Just handling maxViewportDimensions is enough - viewportBoundsRange[1] must
@ -2418,7 +2421,8 @@ bool VulkanCommandProcessor::IssueDraw(xenos::PrimitiveType prim_type,
draw_util::GetHostViewportInfo(
regs, 1, 1, false, device_limits.maxViewportDimensions[0],
device_limits.maxViewportDimensions[1], true, normalized_depth_control,
false, false, false, viewport_info);
false, host_render_targets_used,
pixel_shader && pixel_shader->writes_depth(), viewport_info);
// Update dynamic graphics pipeline state.
UpdateDynamicState(viewport_info, primitive_polygonal,