From b1c79134006b670ad079830f032413635ecfc635 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Thu, 9 Mar 2017 17:46:30 -0500 Subject: [PATCH 01/16] - fix compiling issue. It compiles. It runs. Beyond that - not 100% sure. (Used GZDoom's 3.0_work branch version of win32gliface.cpp) --- src/win32/win32gliface.cpp | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/win32/win32gliface.cpp b/src/win32/win32gliface.cpp index f110390d8d..14993c6150 100644 --- a/src/win32/win32gliface.cpp +++ b/src/win32/win32gliface.cpp @@ -61,15 +61,21 @@ EXTERN_CVAR(Int, vid_refreshrate) // //========================================================================== - EDisplayType GetDisplayType () { return DISPLAY_Both; } - void SetWindowedScale (float scale); - void StartModeIterator (int bits, bool fs); - bool NextMode (int *width, int *height, bool *letterbox); +class Win32GLVideo : public IVideo +{ +public: + Win32GLVideo(int parm); + virtual ~Win32GLVideo(); + + EDisplayType GetDisplayType() { return DISPLAY_Both; } + void SetWindowedScale(float scale); + void StartModeIterator(int bits, bool fs); + bool NextMode(int *width, int *height, bool *letterbox); bool GoFullscreen(bool yes); DFrameBuffer *CreateFrameBuffer (int width, int height, bool bgra, bool fs, DFrameBuffer *old); - virtual bool SetResolution (int width, int height, int bits); + virtual bool SetResolution(int width, int height, int bits); void DumpAdapters(); - bool InitHardware (HWND Window, int multisample); + bool InitHardware(HWND Window, int multisample); void Shutdown(); bool SetFullscreen(const char *devicename, int w, int h, int bits, int hz); @@ -78,13 +84,13 @@ EXTERN_CVAR(Int, vid_refreshrate) protected: struct ModeInfo { - ModeInfo (int inX, int inY, int inBits, int inRealY, int inRefresh) - : next (NULL), - width (inX), - height (inY), - bits (inBits), - refreshHz (inRefresh), - realheight (inRealY) + ModeInfo(int inX, int inY, int inBits, int inRealY, int inRefresh) + : next(NULL), + width(inX), + height(inY), + bits(inBits), + refreshHz(inRefresh), + realheight(inRealY) {} ModeInfo *next; int width, height, bits, refreshHz, realheight; @@ -119,7 +125,6 @@ EXTERN_CVAR(Int, vid_refreshrate) }; - //========================================================================== // // From 022d9b394905586e880676293a31b037f5d5c348 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Thu, 9 Mar 2017 18:08:09 -0500 Subject: [PATCH 02/16] - enable multiprocessor compilation with MSVC++ using /MP for MSBuild - Target NEON processors for ARM. --- src/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 732f53147c..6be0b40fb2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -413,6 +413,11 @@ else( X64 ) set( CMAKE_CXX_FLAGS ${SAFE_CMAKE_CXX_FLAGS} ) endif( X64 ) +# Set up flags for MSVC +if (MSVC) + set( CMAKE_CXX_FLAGS "/MP ${CMAKE_CXX_FLAGS}" ) +endif (MSVC) + # Set up flags for GCC if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) @@ -471,6 +476,11 @@ if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) set( CMAKE_C_FLAGS "-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-missing-field-initializers -ffp-contract=off ${CMAKE_C_FLAGS}" ) set( CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-missing-field-initializers -ffp-contract=off ${CMAKE_CXX_FLAGS}" ) + # ARM processors (Raspberry Pi, et al) - enable ARM NEON support. + if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") + set( CMAKE_CXX_FLAGS "-mfpu=neon ${CMAKE_CXX_FLAGS}" ) + endif () + # Use the highest C++ standard available since VS2015 compiles with C++14 # but we only require C++11. The recommended way to do this in CMake is to # probably to use target_compile_features, but I don't feel like maintaining From 62bd4a360b4ba0fdcbdc9408be5f0f92c387f5c5 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Thu, 9 Mar 2017 19:34:33 -0500 Subject: [PATCH 03/16] - Fixing r_voxel's license. --- src/swrenderer/things/r_voxel.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/swrenderer/things/r_voxel.cpp b/src/swrenderer/things/r_voxel.cpp index b337cd8578..842ddbde59 100644 --- a/src/swrenderer/things/r_voxel.cpp +++ b/src/swrenderer/things/r_voxel.cpp @@ -6,21 +6,13 @@ // Copyright(c) 1998 - 2016 Randy Heit // All rights reserved. // -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. +// Draw a voxel slab. This function is taken from the Build Engine. // -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this program. If not, see http://www.gnu.org/licenses/ -// -//-------------------------------------------------------------------------- +// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman +// Ken Silverman's official web site: "http://www.advsys.net/ken" // +// Permission has been obtained to use this code under the terms of +// the GNU General Public License v3.0. #include #include "templates.h" From cb9f2e2eb07196da13d2f290726bb7fe4c00015b Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Fri, 10 Mar 2017 00:18:20 -0500 Subject: [PATCH 04/16] - fixed: P_AlignFlat's y-offset data was ignored when calculating plane offsets for the final render --- src/swrenderer/plane/r_flatplane.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/swrenderer/plane/r_flatplane.cpp b/src/swrenderer/plane/r_flatplane.cpp index b3c695c78a..a086cd323e 100644 --- a/src/swrenderer/plane/r_flatplane.cpp +++ b/src/swrenderer/plane/r_flatplane.cpp @@ -69,7 +69,7 @@ namespace swrenderer { double cosine = cos(planeang), sine = sin(planeang); pviewx = pl->xform.xOffs + ViewPos.X * cosine - ViewPos.Y * sine; - pviewy = pl->xform.yOffs - ViewPos.X * sine - ViewPos.Y * cosine; + pviewy = pl->xform.yOffs + pl->xform.baseyOffs - ViewPos.X * sine - ViewPos.Y * cosine; } else { From 2f2dcaf5fee174c0caa555f7492cb8b4ca7d3bd5 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Fri, 10 Mar 2017 15:40:15 +0100 Subject: [PATCH 05/16] Fix crash when vid_hw2d is off --- src/swrenderer/r_swcanvas.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/swrenderer/r_swcanvas.cpp b/src/swrenderer/r_swcanvas.cpp index aa817e707d..82f34313fb 100644 --- a/src/swrenderer/r_swcanvas.cpp +++ b/src/swrenderer/r_swcanvas.cpp @@ -110,6 +110,13 @@ void SWCanvas::DrawTexture(DCanvas *canvas, FTexture *img, DrawParms &parms) double centeryback = viewport->CenterY; viewport->CenterY = 0; + int oldviewwindowx = 0; + int oldviewwindowy = 0; + oldviewwindowx = viewwindowx; + oldviewwindowy = viewwindowy; + viewwindowx = 0; + viewwindowy = 0; + // There is not enough precision in the drawing routines to keep the full // precision for y0. :( double sprtopscreen; @@ -187,6 +194,8 @@ void SWCanvas::DrawTexture(DCanvas *canvas, FTexture *img, DrawParms &parms) } viewport->CenterY = centeryback; + viewwindowx = oldviewwindowx; + viewwindowy = oldviewwindowy; } viewport->RenderTarget->Unlock(); From 1996c1bc0b61c0374d4123089bbcb80c6d6063d7 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Fri, 10 Mar 2017 15:40:33 +0100 Subject: [PATCH 06/16] Fix crash HOM effect when vid_hw2d is off --- src/gl/system/gl_swframebuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gl/system/gl_swframebuffer.cpp b/src/gl/system/gl_swframebuffer.cpp index a0fc6e716d..c721af6659 100644 --- a/src/gl/system/gl_swframebuffer.cpp +++ b/src/gl/system/gl_swframebuffer.cpp @@ -1076,7 +1076,7 @@ void OpenGLSWFrameBuffer::CalcFullscreenCoords(FBVERTEX verts[4], bool viewarea_ int OpenGLSWFrameBuffer::GetPageCount() { - return 1; + return 2; } //========================================================================== From d637ee5624f6c1c421afb515855b62a0dfc2deec Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Fri, 10 Mar 2017 16:23:16 +0100 Subject: [PATCH 07/16] Fix span dynamic light rendering glitch --- src/swrenderer/plane/r_flatplane.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/swrenderer/plane/r_flatplane.cpp b/src/swrenderer/plane/r_flatplane.cpp index a086cd323e..c7cadfbab0 100644 --- a/src/swrenderer/plane/r_flatplane.cpp +++ b/src/swrenderer/plane/r_flatplane.cpp @@ -209,19 +209,27 @@ namespace swrenderer drawerargs.dc_viewpos.Z = (float)((viewport->CenterY - y - 0.5) / viewport->InvZtoScale * zspan); drawerargs.dc_viewpos_step.X = (float)(zspan / viewport->CenterX); - static DrawerLight lightbuffer[64 * 1024]; - static int nextlightindex = 0; - // Plane normal drawerargs.dc_normal.X = 0.0f; drawerargs.dc_normal.Y = 0.0f; drawerargs.dc_normal.Z = (y >= viewport->CenterY) ? 1.0f : -1.0f; - // Setup lights for row - drawerargs.dc_num_lights = 0; - drawerargs.dc_lights = lightbuffer + nextlightindex; + // Calculate max lights that can touch the row so we can allocate memory for the list + int max_lights = 0; VisiblePlaneLight *cur_node = light_list; - while (cur_node && nextlightindex < 64 * 1024) + while (cur_node) + { + if (!(cur_node->lightsource->flags2&MF2_DORMANT)) + max_lights++; + cur_node = cur_node->next; + } + + drawerargs.dc_num_lights = 0; + drawerargs.dc_lights = Thread->FrameMemory->AllocMemory(max_lights); + + // Setup lights for row + cur_node = light_list; + while (cur_node) { double lightX = cur_node->lightsource->X() - ViewPos.X; double lightY = cur_node->lightsource->Y() - ViewPos.Y; @@ -244,7 +252,6 @@ namespace swrenderer uint32_t green = cur_node->lightsource->GetGreen(); uint32_t blue = cur_node->lightsource->GetBlue(); - nextlightindex++; auto &light = drawerargs.dc_lights[drawerargs.dc_num_lights++]; light.x = lx; light.y = lconstant; @@ -255,9 +262,6 @@ namespace swrenderer cur_node = cur_node->next; } - - if (nextlightindex == 64 * 1024) - nextlightindex = 0; } else { From 70e80c152b14c99f7ab1578937b0a6ee729b7469 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 11 Mar 2017 01:05:56 -0500 Subject: [PATCH 08/16] - fixed: enable shadow maps on Intel cards if it is otherwise supported. --- src/gl/dynlights/gl_shadowmap.cpp | 2 +- src/gl/shaders/gl_shader.cpp | 2 +- src/gl/system/gl_interface.cpp | 4 ++++ src/gl/system/gl_interface.h | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gl/dynlights/gl_shadowmap.cpp b/src/gl/dynlights/gl_shadowmap.cpp index 9a23e41145..a803f31354 100644 --- a/src/gl/dynlights/gl_shadowmap.cpp +++ b/src/gl/dynlights/gl_shadowmap.cpp @@ -109,7 +109,7 @@ bool FShadowMap::ShadowTest(ADynamicLight *light, const DVector3 &pos) bool FShadowMap::IsEnabled() const { - return gl_light_shadowmap && !!(gl.flags & RFL_SHADER_STORAGE_BUFFER); + return gl_light_shadowmap && (!!(gl.flags & RFL_SHADER_STORAGE_BUFFER) || gl.intelstoragebuffer); } int FShadowMap::ShadowMapIndex(ADynamicLight *light) diff --git a/src/gl/shaders/gl_shader.cpp b/src/gl/shaders/gl_shader.cpp index 9cb5e9aab3..623b573f26 100644 --- a/src/gl/shaders/gl_shader.cpp +++ b/src/gl/shaders/gl_shader.cpp @@ -105,7 +105,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char * vp_comb << "#define USE_QUAD_DRAWER\n"; } - if (!!(gl.flags & RFL_SHADER_STORAGE_BUFFER)) + if (!!(gl.flags & RFL_SHADER_STORAGE_BUFFER) || gl.intelstoragebuffer) { vp_comb << "#define SUPPORTS_SHADOWMAPS\n"; } diff --git a/src/gl/system/gl_interface.cpp b/src/gl/system/gl_interface.cpp index 485876e7a9..8d581dde74 100644 --- a/src/gl/system/gl_interface.cpp +++ b/src/gl/system/gl_interface.cpp @@ -238,6 +238,10 @@ void gl_LoadExtensions() { gl.flags |= RFL_SHADER_STORAGE_BUFFER; } + else + { // [SP] Shadowmaps support for intel + gl.intelstoragebuffer = true; + } } gl.flags |= RFL_BUFFER_STORAGE; gl.lightmethod = LM_DIRECT; diff --git a/src/gl/system/gl_interface.h b/src/gl/system/gl_interface.h index a839e13b46..d75cbd06cc 100644 --- a/src/gl/system/gl_interface.h +++ b/src/gl/system/gl_interface.h @@ -67,7 +67,7 @@ struct RenderContext char * vendorstring; bool legacyMode; bool es; - + bool intelstoragebuffer = false; // this card supports storage buffers, but it was disabled because it was Intel (used for shadowmaps) int MaxLights() const { return maxuniforms>=2048? 128:64; From b8ba2d20e55284d8c5797acc56e8fe4d2d190b07 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 11 Mar 2017 14:58:33 +0200 Subject: [PATCH 09/16] Do not draw crosshair on automap with alternative HUD enabled --- src/d_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 0b14a8cb08..7e268e11c3 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -810,7 +810,7 @@ void D_Display () { StatusBar->DrawBottomStuff (HUD_AltHud); if (DrawFSHUD || automapactive) DrawHUD(); - if (players[consoleplayer].camera && players[consoleplayer].camera->player) + if (players[consoleplayer].camera && players[consoleplayer].camera->player && !automapactive) { StatusBar->DrawCrosshair(); } From 355bbf48295847f1316d3d76d3008764847468cb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 11 Mar 2017 09:56:05 +0100 Subject: [PATCH 10/16] - removed debug output from recent translation additions. --- src/r_data/r_translate.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/r_data/r_translate.cpp b/src/r_data/r_translate.cpp index 64f00b5bc3..adcbc93fd8 100644 --- a/src/r_data/r_translate.cpp +++ b/src/r_data/r_translate.cpp @@ -561,7 +561,6 @@ void FRemapTable::AddToTranslation(const char *range) } sc.MustGetAnyToken(); - Printf(0, "token type: %d", sc.TokenType); if (sc.TokenType == '[') { From 38ad6ce6b77d640d97fb670a2bef83f6f8cb9ab8 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sat, 11 Mar 2017 17:20:06 +0100 Subject: [PATCH 11/16] Fix ssao being applied to skybox portals --- src/gl/renderer/gl_renderer.h | 3 ++- src/gl/scene/gl_portal.cpp | 2 +- src/gl/scene/gl_scene.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gl/renderer/gl_renderer.h b/src/gl/renderer/gl_renderer.h index ed2c523f28..b784e74fdb 100644 --- a/src/gl/renderer/gl_renderer.h +++ b/src/gl/renderer/gl_renderer.h @@ -79,7 +79,8 @@ enum { DM_MAINVIEW, DM_OFFSCREEN, - DM_PORTAL + DM_PORTAL, + DM_SKYPORTAL }; class FGLRenderer diff --git a/src/gl/scene/gl_portal.cpp b/src/gl/scene/gl_portal.cpp index 4cf8b9e7ba..967f6b3fc1 100644 --- a/src/gl/scene/gl_portal.cpp +++ b/src/gl/scene/gl_portal.cpp @@ -655,7 +655,7 @@ void GLSkyboxPortal::DrawContents() SaveMapSection(); currentmapsection[mapsection >> 3] |= 1 << (mapsection & 7); - GLRenderer->DrawScene(DM_PORTAL); + GLRenderer->DrawScene(DM_SKYPORTAL); portal->mFlags &= ~PORTSF_INSKYBOX; inskybox = false; gl_RenderState.SetDepthClamp(oldclamp); diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index a3c896b276..1e4b7ac585 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -491,7 +491,7 @@ void FGLRenderer::DrawScene(int drawmode) { ssao_portals_available = 0; } - else if (ssao_portals_available > 0) + else if (drawmode == DM_PORTAL && ssao_portals_available > 0) { applySSAO = true; ssao_portals_available--; From 684fbb22339dc2d146e0b831165a73614408a371 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 11 Mar 2017 14:19:32 -0500 Subject: [PATCH 12/16] Revert "- fixed: enable shadow maps on Intel cards if it is otherwise supported." This reverts commit 70e80c152b14c99f7ab1578937b0a6ee729b7469. --- src/gl/dynlights/gl_shadowmap.cpp | 2 +- src/gl/shaders/gl_shader.cpp | 2 +- src/gl/system/gl_interface.cpp | 4 ---- src/gl/system/gl_interface.h | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/gl/dynlights/gl_shadowmap.cpp b/src/gl/dynlights/gl_shadowmap.cpp index a803f31354..9a23e41145 100644 --- a/src/gl/dynlights/gl_shadowmap.cpp +++ b/src/gl/dynlights/gl_shadowmap.cpp @@ -109,7 +109,7 @@ bool FShadowMap::ShadowTest(ADynamicLight *light, const DVector3 &pos) bool FShadowMap::IsEnabled() const { - return gl_light_shadowmap && (!!(gl.flags & RFL_SHADER_STORAGE_BUFFER) || gl.intelstoragebuffer); + return gl_light_shadowmap && !!(gl.flags & RFL_SHADER_STORAGE_BUFFER); } int FShadowMap::ShadowMapIndex(ADynamicLight *light) diff --git a/src/gl/shaders/gl_shader.cpp b/src/gl/shaders/gl_shader.cpp index 623b573f26..9cb5e9aab3 100644 --- a/src/gl/shaders/gl_shader.cpp +++ b/src/gl/shaders/gl_shader.cpp @@ -105,7 +105,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char * vp_comb << "#define USE_QUAD_DRAWER\n"; } - if (!!(gl.flags & RFL_SHADER_STORAGE_BUFFER) || gl.intelstoragebuffer) + if (!!(gl.flags & RFL_SHADER_STORAGE_BUFFER)) { vp_comb << "#define SUPPORTS_SHADOWMAPS\n"; } diff --git a/src/gl/system/gl_interface.cpp b/src/gl/system/gl_interface.cpp index 8d581dde74..485876e7a9 100644 --- a/src/gl/system/gl_interface.cpp +++ b/src/gl/system/gl_interface.cpp @@ -238,10 +238,6 @@ void gl_LoadExtensions() { gl.flags |= RFL_SHADER_STORAGE_BUFFER; } - else - { // [SP] Shadowmaps support for intel - gl.intelstoragebuffer = true; - } } gl.flags |= RFL_BUFFER_STORAGE; gl.lightmethod = LM_DIRECT; diff --git a/src/gl/system/gl_interface.h b/src/gl/system/gl_interface.h index d75cbd06cc..a839e13b46 100644 --- a/src/gl/system/gl_interface.h +++ b/src/gl/system/gl_interface.h @@ -67,7 +67,7 @@ struct RenderContext char * vendorstring; bool legacyMode; bool es; - bool intelstoragebuffer = false; // this card supports storage buffers, but it was disabled because it was Intel (used for shadowmaps) + int MaxLights() const { return maxuniforms>=2048? 128:64; From 14e9c37a6f264bc6829bc5ed6bd5b43054a4bcdb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 11 Mar 2017 20:14:18 +0100 Subject: [PATCH 13/16] - Added a check to allow shader storage buffers on GL 4.3 Intel drivers. It doesn't work if GLSL version is set to 4.0 and the feature activated via extension. --- src/gl/shaders/gl_shader.cpp | 6 +++++- src/gl/system/gl_interface.cpp | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gl/shaders/gl_shader.cpp b/src/gl/shaders/gl_shader.cpp index 9cb5e9aab3..44be65ebe6 100644 --- a/src/gl/shaders/gl_shader.cpp +++ b/src/gl/shaders/gl_shader.cpp @@ -97,7 +97,11 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char * } else { - vp_comb = "#version 400 core\n#extension GL_ARB_shader_storage_buffer_object : require\n#define SHADER_STORAGE_LIGHTS\n"; + // This differentiation is for Intel which do not seem to expose the full extension, even if marked as required. + if (gl.glslversion < 4.3f) + vp_comb = "#version 400 core\n#extension GL_ARB_shader_storage_buffer_object : require\n#define SHADER_STORAGE_LIGHTS\n"; + else + vp_comb = "#version 430 core\n#define SHADER_STORAGE_LIGHTS\n"; } if (gl.buffermethod == BM_DEFERRED) diff --git a/src/gl/system/gl_interface.cpp b/src/gl/system/gl_interface.cpp index 485876e7a9..a0d16597f7 100644 --- a/src/gl/system/gl_interface.cpp +++ b/src/gl/system/gl_interface.cpp @@ -233,8 +233,8 @@ void gl_LoadExtensions() // Recent drivers, GL 4.4 don't have this problem, these can easily be recognized by also supporting the GL_ARB_buffer_storage extension. if (CheckExtension("GL_ARB_shader_storage_buffer_object")) { - // Shader storage buffer objects are broken on current Intel drivers. - if (strstr(gl.vendorstring, "Intel") == NULL) + // Intel's GLSL compiler is a bit broken with extensions, so unlock the feature only if not on Intel or having GL 4.3. + if (strstr(gl.vendorstring, "Intel") == NULL || gl_version >= 4.3f) { gl.flags |= RFL_SHADER_STORAGE_BUFFER; } From ca75777a70311595cca68adecad5ee4f47cff08d Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sat, 11 Mar 2017 18:31:53 +0100 Subject: [PATCH 14/16] Fix default palette for voxel BGRA slab data and support translated 8-bit slab data in true color mode --- src/r_data/voxels.cpp | 10 ++++++---- src/swrenderer/things/r_voxel.cpp | 3 +-- src/swrenderer/viewport/r_spritedrawer.h | 2 ++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/r_data/voxels.cpp b/src/r_data/voxels.cpp index 4b80812882..f15e927e73 100644 --- a/src/r_data/voxels.cpp +++ b/src/r_data/voxels.cpp @@ -400,7 +400,9 @@ FVoxel::~FVoxel() void FVoxel::CreateBgraSlabData() { - assert(Palette != NULL); + uint8_t *palette = Palette; + if (palette == nullptr) + palette = (uint8_t *)GPalette.BaseColors; for (int i = 0; i < NumMips; ++i) { @@ -423,9 +425,9 @@ void FVoxel::CreateBgraSlabData() { int colorIndex = src->col[j]; - uint32_t red = (Palette[colorIndex * 3 + 0] << 2) | (Palette[colorIndex * 3 + 0] >> 4); - uint32_t green = (Palette[colorIndex * 3 + 1] << 2) | (Palette[colorIndex * 3 + 1] >> 4); - uint32_t blue = (Palette[colorIndex * 3 + 2] << 2) | (Palette[colorIndex * 3 + 2] >> 4); + uint32_t red = (palette[colorIndex * 3 + 0] << 2) | (palette[colorIndex * 3 + 0] >> 4); + uint32_t green = (palette[colorIndex * 3 + 1] << 2) | (palette[colorIndex * 3 + 1] >> 4); + uint32_t blue = (palette[colorIndex * 3 + 2] << 2) | (palette[colorIndex * 3 + 2] >> 4); dest->col[j] = 0xff000000 | (red << 16) | (green << 8) | blue; } diff --git a/src/swrenderer/things/r_voxel.cpp b/src/swrenderer/things/r_voxel.cpp index 842ddbde59..eb6ec4e279 100644 --- a/src/swrenderer/things/r_voxel.cpp +++ b/src/swrenderer/things/r_voxel.cpp @@ -532,8 +532,7 @@ namespace swrenderer } const uint8_t *columnColors = col; - bool bgra = viewport->RenderTarget->IsBgra(); - if (bgra) + if (!drawerargs.DrawerNeedsPalInput() && viewport->RenderTarget->IsBgra()) { // The true color slab data array is identical, except its using uint32 instead of uint8. // diff --git a/src/swrenderer/viewport/r_spritedrawer.h b/src/swrenderer/viewport/r_spritedrawer.h index 31d3861d9c..eaee878059 100644 --- a/src/swrenderer/viewport/r_spritedrawer.h +++ b/src/swrenderer/viewport/r_spritedrawer.h @@ -53,6 +53,8 @@ namespace swrenderer uint32_t DynamicLight() const { return dynlightcolor; } + bool DrawerNeedsPalInput() const { return drawer_needs_pal_input; } + private: bool SetBlendFunc(int op, fixed_t fglevel, fixed_t bglevel, int flags); static fixed_t GetAlpha(int type, fixed_t alpha); From df5b685950749617ef8d02b34561b8f44df0e81c Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 11 Mar 2017 17:34:05 -0500 Subject: [PATCH 15/16] - Forbade return scripts from triggering on save load. --- src/g_level.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_level.cpp b/src/g_level.cpp index 734f03bb65..9c526f1846 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1080,7 +1080,7 @@ void G_DoLoadLevel (int position, bool autosave) } E_PlayerEntered(ii, finishstate == FINISH_SameHub); // ENTER scripts are being handled when the player gets spawned, this cannot be changed due to its effect on voodoo dolls. - if (level.FromSnapshot) FBehavior::StaticStartTypedScripts(SCRIPT_Return, players[ii].mo, true); + if (level.FromSnapshot && !savegamerestore) FBehavior::StaticStartTypedScripts(SCRIPT_Return, players[ii].mo, true); } } From bfc8c614a0102303f6edf02beeee65d778dae2a2 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 11 Mar 2017 17:34:05 -0500 Subject: [PATCH 16/16] - Forbade return scripts from triggering on save load. --- src/g_level.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_level.cpp b/src/g_level.cpp index 427e17278c..d64bbd081e 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1080,7 +1080,7 @@ void G_DoLoadLevel (int position, bool autosave) } E_PlayerEntered(ii, finishstate == FINISH_SameHub); // ENTER scripts are being handled when the player gets spawned, this cannot be changed due to its effect on voodoo dolls. - if (level.FromSnapshot) FBehavior::StaticStartTypedScripts(SCRIPT_Return, players[ii].mo, true); + if (level.FromSnapshot && !savegamerestore) FBehavior::StaticStartTypedScripts(SCRIPT_Return, players[ii].mo, true); } }