renderer: Improve depth buffer accuracy

Co-authored-by: SaturnSky <ikadro@gmail.com>
This commit is contained in:
Macdu
2024-09-21 13:59:52 +02:00
committed by Gamid
parent 63aaa5051e
commit f52b3af7b4
3 changed files with 3 additions and 2 deletions
@@ -840,7 +840,6 @@ vk::Pipeline PipelineCache::compile_pipeline(SceGxmPrimitiveType type, vk::Rende
const bool use_shader_interlock = state.features.support_shader_interlock && gxm_fragment_shader->is_frag_color_used();
const vk::PipelineRasterizationStateCreateInfo rasterizer{
.depthClampEnable = state.physical_device_features.depthClamp,
.polygonMode = translate_polygon_mode(record.front_polygon_mode),
.cullMode = translate_cull_mode(record.cull_mode),
// front face is always counter clockwise
-1
View File
@@ -616,7 +616,6 @@ bool VKState::create(std::unique_ptr<renderer::State> &state, const Config &conf
// use these features (because they are used by the vita GPU) if they are available
vk::PhysicalDeviceFeatures enabled_features{
.depthClamp = physical_device_features.depthClamp,
.fillModeNonSolid = physical_device_features.fillModeNonSolid,
.wideLines = physical_device_features.wideLines,
.samplerAnisotropy = physical_device_features.samplerAnisotropy,
+3
View File
@@ -1743,6 +1743,9 @@ static spv::Function *make_vert_finalize_function(spv::Builder &b, const SpirvSh
z = b.createBinOp(spv::OpFMul, f32, z, z_scale);
z = b.createBinOp(spv::OpFAdd, f32, z, z_offset);
// z values below 0 get clamped
z = b.createBuiltinCall(f32, utils.std_builtins, GLSLstd450FMax, { z, zero });
if (!translation_state.is_vulkan) {
// convert [0,1] depth range (gxp, vulkan) to [-1,1] depth range (opengl)
z = b.createBinOp(spv::OpFMul, f32, z, b.makeFloatConstant(2.0f));