From ad2d3386a6de362813e617e3d40eebdd78d05493 Mon Sep 17 00:00:00 2001 From: myT Date: Sun, 11 Oct 2020 18:24:35 +0200 Subject: [PATCH] D3D11 now does depth clipping and the near clip plane distance is now 1 --- changelog.txt | 2 ++ code/renderer/tr_backend_d3d11.cpp | 5 +---- code/renderer/tr_backend_gl2.cpp | 2 ++ code/renderer/tr_backend_gl3.cpp | 1 + code/renderer/tr_main.cpp | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/changelog.txt b/changelog.txt index 8cd31f9..a4a2ff3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -7,6 +7,8 @@ DD Mmm 20 - 1.53 add: r_alphaToCoverageMipBoost <0.0 to 0.5> (default: 0.125) boosts the alpha value of higher mip levels with A2C enabled, it prevents alpha-tested surfaces from fading (too much) in the distance +chg: all rendering backends use depth clipping, near clip plane distance is 1 instead of 4 + chg: cl_aviFrameRate now defaults to 60 chg: the Windows audio output now has a sampling rate of 44.1 kHz diff --git a/code/renderer/tr_backend_d3d11.cpp b/code/renderer/tr_backend_d3d11.cpp index 57fbade..838e178 100644 --- a/code/renderer/tr_backend_d3d11.cpp +++ b/code/renderer/tr_backend_d3d11.cpp @@ -111,9 +111,6 @@ Current info: - shader target 4.1 for graphics (SV_VertexID, unsized Texture2DMS) - shader target 5.0 for compute (typed UAVs) -To look at: -- near clip plane seems to be further in the GL2 back-end in 3D land - Known issues: - device re-creation isn't handled by OBS' capture plug-in */ @@ -1613,7 +1610,7 @@ static qbool GAL_Init() rasterDesc.CullMode = GetCullMode((cullType_t)cullType); rasterDesc.FrontCounterClockwise = TRUE; rasterDesc.ScissorEnable = TRUE; - rasterDesc.DepthClipEnable = FALSE; + rasterDesc.DepthClipEnable = TRUE; rasterDesc.DepthBiasClamp = 0.0f; rasterDesc.DepthBias = polygonOffset ? -1 : 0; rasterDesc.SlopeScaledDepthBias = polygonOffset ? -1.0f : 0.0f; diff --git a/code/renderer/tr_backend_gl2.cpp b/code/renderer/tr_backend_gl2.cpp index 3056383..3ff5c23 100644 --- a/code/renderer/tr_backend_gl2.cpp +++ b/code/renderer/tr_backend_gl2.cpp @@ -1424,6 +1424,8 @@ static void GL_SetDefaultState() // The default alignment is 4. // RGB with width 1366 -> not a multiple of 4! glPixelStorei( GL_PACK_ALIGNMENT, 1 ); + + glDisable( GL_DEPTH_CLAMP ); } diff --git a/code/renderer/tr_backend_gl3.cpp b/code/renderer/tr_backend_gl3.cpp index 6d78ced..3a1f8dc 100644 --- a/code/renderer/tr_backend_gl3.cpp +++ b/code/renderer/tr_backend_gl3.cpp @@ -1750,6 +1750,7 @@ static void SetDefaultState() glDisable(GL_CLIP_DISTANCE0); glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE); glPixelStorei(GL_PACK_ALIGNMENT, 1); + glDisable(GL_DEPTH_CLAMP); gl.boundTextures[0] = GLuint(-1); gl.boundTextures[1] = GLuint(-1); diff --git a/code/renderer/tr_main.cpp b/code/renderer/tr_main.cpp index 1b53cd1..3cb05ef 100644 --- a/code/renderer/tr_main.cpp +++ b/code/renderer/tr_main.cpp @@ -419,7 +419,7 @@ static void R_SetupProjection() // // set up projection matrix // - zNear = 4.0f; + zNear = 1.0f; zFar = tr.viewParms.zFar; height = 2.0f * zNear * tan( tr.refdef.fov_y * M_PI / 360.0f );