From 0104e28fe4215468b8c444500e24b62d1ec0cc56 Mon Sep 17 00:00:00 2001 From: FernandoS27 Date: Thu, 25 Nov 2021 11:42:20 +0100 Subject: Vulkan: Add support for VK_EXT_depth_clip_control. --- src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp | 2 +- src/shader_recompiler/backend/spirv/emit_spirv_special.cpp | 5 +++-- src/shader_recompiler/profile.h | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/shader_recompiler') diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp index 01f6ec9b5..73b67f0af 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp @@ -461,7 +461,7 @@ void EmitSetSampleMask(EmitContext& ctx, Id value) { } void EmitSetFragDepth(EmitContext& ctx, Id value) { - if (!ctx.runtime_info.convert_depth_mode) { + if (!ctx.runtime_info.convert_depth_mode || ctx.profile.support_native_ndc) { ctx.OpStore(ctx.frag_depth, value); return; } diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_special.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_special.cpp index 00be1f127..9f7b6bb4b 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_special.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_special.cpp @@ -116,7 +116,8 @@ void EmitPrologue(EmitContext& ctx) { } void EmitEpilogue(EmitContext& ctx) { - if (ctx.stage == Stage::VertexB && ctx.runtime_info.convert_depth_mode) { + if (ctx.stage == Stage::VertexB && ctx.runtime_info.convert_depth_mode && + !ctx.profile.support_native_ndc) { ConvertDepthMode(ctx); } if (ctx.stage == Stage::Fragment) { @@ -125,7 +126,7 @@ void EmitEpilogue(EmitContext& ctx) { } void EmitEmitVertex(EmitContext& ctx, const IR::Value& stream) { - if (ctx.runtime_info.convert_depth_mode) { + if (ctx.runtime_info.convert_depth_mode && !ctx.profile.support_native_ndc) { ConvertDepthMode(ctx); } if (stream.IsImmediate()) { diff --git a/src/shader_recompiler/profile.h b/src/shader_recompiler/profile.h index 21d3d236b..b8841a536 100644 --- a/src/shader_recompiler/profile.h +++ b/src/shader_recompiler/profile.h @@ -35,6 +35,7 @@ struct Profile { bool support_int64_atomics{}; bool support_derivative_control{}; bool support_geometry_shader_passthrough{}; + bool support_native_ndc{}; bool support_gl_nv_gpu_shader_5{}; bool support_gl_amd_gpu_shader_half_float{}; bool support_gl_texture_shadow_lod{}; -- cgit v1.2.3