From 3a9a9c6f904e5df54a2b25420d9811f3b15c6c9a Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Thu, 25 Feb 2021 00:56:10 +0100 Subject: [PATCH] early-access version 1483 --- README.md | 2 +- externals/glad/include/glad/glad.h | 3 +++ externals/glad/src/glad.c | 2 ++ src/video_core/renderer_opengl/gl_device.cpp | 2 ++ src/video_core/renderer_opengl/gl_device.h | 5 +++++ src/video_core/renderer_opengl/gl_rasterizer.cpp | 6 +++++- 6 files changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1488a92c7..7b5f41dc2 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 1482. +This is the source code for early-access 1483. ## Legal Notice diff --git a/externals/glad/include/glad/glad.h b/externals/glad/include/glad/glad.h index 6e16358ea..191bb9fcb 100755 --- a/externals/glad/include/glad/glad.h +++ b/externals/glad/include/glad/glad.h @@ -5156,6 +5156,9 @@ GLAPI PFNGLDEPTHRANGEARRAYVPROC glad_glDepthRangeArrayv; typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDPROC)(GLuint index, GLdouble n, GLdouble f); GLAPI PFNGLDEPTHRANGEINDEXEDPROC glad_glDepthRangeIndexed; #define glDepthRangeIndexed glad_glDepthRangeIndexed +typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDDNVPROC)(GLuint index, GLdouble n, GLdouble f); +GLAPI PFNGLDEPTHRANGEINDEXEDDNVPROC glad_glDepthRangeIndexeddNV; +#define glDepthRangeIndexeddNV glad_glDepthRangeIndexeddNV typedef void (APIENTRYP PFNGLGETFLOATI_VPROC)(GLenum target, GLuint index, GLfloat *data); GLAPI PFNGLGETFLOATI_VPROC glad_glGetFloati_v; #define glGetFloati_v glad_glGetFloati_v diff --git a/externals/glad/src/glad.c b/externals/glad/src/glad.c index d3e13163f..7b24cd68d 100755 --- a/externals/glad/src/glad.c +++ b/externals/glad/src/glad.c @@ -1044,6 +1044,7 @@ PFNGLDEPTHMASKPROC glad_glDepthMask = NULL; PFNGLDEPTHRANGEPROC glad_glDepthRange = NULL; PFNGLDEPTHRANGEARRAYVPROC glad_glDepthRangeArrayv = NULL; PFNGLDEPTHRANGEINDEXEDPROC glad_glDepthRangeIndexed = NULL; +PFNGLDEPTHRANGEINDEXEDDNVPROC glad_glDepthRangeIndexeddNV = NULL; PFNGLDEPTHRANGEFPROC glad_glDepthRangef = NULL; PFNGLDETACHSHADERPROC glad_glDetachShader = NULL; PFNGLDISABLEPROC glad_glDisable = NULL; @@ -7971,6 +7972,7 @@ static void load_GL_NV_depth_buffer_float(GLADloadproc load) { glad_glDepthRangedNV = (PFNGLDEPTHRANGEDNVPROC)load("glDepthRangedNV"); glad_glClearDepthdNV = (PFNGLCLEARDEPTHDNVPROC)load("glClearDepthdNV"); glad_glDepthBoundsdNV = (PFNGLDEPTHBOUNDSDNVPROC)load("glDepthBoundsdNV"); + glad_glDepthRangeIndexeddNV = (PFNGLDEPTHRANGEINDEXEDDNVPROC)load("glDepthRangeIndexeddNV"); } static void load_GL_NV_draw_texture(GLADloadproc load) { if(!GLAD_GL_NV_draw_texture) return; diff --git a/src/video_core/renderer_opengl/gl_device.cpp b/src/video_core/renderer_opengl/gl_device.cpp index 48d5c4a5e..1ae5f1d62 100755 --- a/src/video_core/renderer_opengl/gl_device.cpp +++ b/src/video_core/renderer_opengl/gl_device.cpp @@ -239,6 +239,7 @@ Device::Device() { has_nv_viewport_array2 = GLAD_GL_NV_viewport_array2; has_vertex_buffer_unified_memory = GLAD_GL_NV_vertex_buffer_unified_memory; has_debugging_tool_attached = IsDebugToolAttached(extensions); + has_depth_buffer_float = HasExtension(extensions, "GL_NV_depth_buffer_float"); // At the moment of writing this, only Nvidia's driver optimizes BufferSubData on exclusive // uniform buffers as "push constants" @@ -275,6 +276,7 @@ Device::Device(std::nullptr_t) { has_image_load_formatted = true; has_texture_shadow_lod = true; has_variable_aoffi = true; + has_depth_buffer_float = true; } bool Device::TestVariableAoffi() { diff --git a/src/video_core/renderer_opengl/gl_device.h b/src/video_core/renderer_opengl/gl_device.h index ee053776d..f24bd0c7b 100755 --- a/src/video_core/renderer_opengl/gl_device.h +++ b/src/video_core/renderer_opengl/gl_device.h @@ -122,6 +122,10 @@ public: return use_driver_cache; } + bool HasDepthBufferFloat() const { + return has_depth_buffer_float; + } + private: static bool TestVariableAoffi(); static bool TestPreciseBug(); @@ -150,6 +154,7 @@ private: bool use_assembly_shaders{}; bool use_asynchronous_shaders{}; bool use_driver_cache{}; + bool has_depth_buffer_float{}; }; } // namespace OpenGL diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 3a0ebd759..a7f7733eb 100755 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -909,7 +909,11 @@ void RasterizerOpenGL::SyncViewport() { const GLdouble reduce_z = regs.depth_mode == Maxwell::DepthMode::MinusOneToOne; const GLdouble near_depth = src.translate_z - src.scale_z * reduce_z; const GLdouble far_depth = src.translate_z + src.scale_z; - glDepthRangeIndexed(static_cast(i), near_depth, far_depth); + if (device.HasDepthBufferFloat()) { + glDepthRangeIndexeddNV(static_cast(i), near_depth, far_depth); + } else { + glDepthRangeIndexed(static_cast(i), near_depth, far_depth); + } if (!GLAD_GL_NV_viewport_swizzle) { continue;