mirror of
https://github.com/Vita3K/Vita3K.git
synced 2026-07-11 01:34:23 +02:00
renderer: Improve depth buffer accuracy
Co-authored-by: SaturnSky <ikadro@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user