mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 15:02:39 +00:00
- moved most of the OpenGL backend to 'common'.
A few things are yet to do, because they still need some changes.
This commit is contained in:
parent
763e9e0f35
commit
02832297ff
26 changed files with 216 additions and 220 deletions
|
@ -659,13 +659,9 @@ file( GLOB HEADER_FILES
|
|||
rendering/vulkan/renderer/*.h
|
||||
rendering/vulkan/shaders/*.h
|
||||
rendering/vulkan/textures/*.h
|
||||
rendering/gl/*.h
|
||||
rendering/gl/models/*.h
|
||||
rendering/gl/renderer/*.h
|
||||
rendering/gl/scene/*.h
|
||||
rendering/gl/shaders/*.h
|
||||
rendering/gl/system/*.h
|
||||
rendering/gl/textures/*.h
|
||||
*.h
|
||||
)
|
||||
|
||||
|
@ -943,18 +939,10 @@ set (PCH_SOURCES
|
|||
rendering/2d/f_wipe.cpp
|
||||
rendering/2d/v_blend.cpp
|
||||
rendering/gl/renderer/gl_renderer.cpp
|
||||
rendering/gl/renderer/gl_renderstate.cpp
|
||||
rendering/gl/renderer/gl_renderbuffers.cpp
|
||||
rendering/gl/renderer/gl_postprocess.cpp
|
||||
rendering/gl/renderer/gl_postprocessstate.cpp
|
||||
rendering/gl/renderer/gl_stereo3d.cpp
|
||||
rendering/gl/shaders/gl_shader.cpp
|
||||
rendering/gl/shaders/gl_shaderprogram.cpp
|
||||
rendering/gl/system/gl_framebuffer.cpp
|
||||
rendering/gl/system/gl_debug.cpp
|
||||
rendering/gl/system/gl_buffers.cpp
|
||||
rendering/gl/textures/gl_hwtexture.cpp
|
||||
rendering/gl/textures/gl_samplers.cpp
|
||||
rendering/hwrenderer/hw_entrypoint.cpp
|
||||
rendering/hwrenderer/data/hw_vertexbuilder.cpp
|
||||
rendering/hwrenderer/dynlights/hw_aabbtree.cpp
|
||||
|
@ -1149,6 +1137,14 @@ set (PCH_SOURCES
|
|||
common/rendering/hwrenderer/postprocessing/hw_postprocess.cpp
|
||||
common/rendering/hwrenderer/postprocessing/hw_postprocess_cvars.cpp
|
||||
common/rendering/gl_load/gl_interface.cpp
|
||||
common/rendering/gl/gl_renderstate.cpp
|
||||
common/rendering/gl/gl_renderbuffers.cpp
|
||||
common/rendering/gl/gl_postprocess.cpp
|
||||
common/rendering/gl/gl_postprocessstate.cpp
|
||||
common/rendering/gl/gl_debug.cpp
|
||||
common/rendering/gl/gl_buffers.cpp
|
||||
common/rendering/gl/gl_hwtexture.cpp
|
||||
common/rendering/gl/gl_samplers.cpp
|
||||
common/scripting/core/dictionary.cpp
|
||||
common/scripting/core/dynarrays.cpp
|
||||
common/scripting/core/symbols.cpp
|
||||
|
@ -1260,6 +1256,7 @@ include_directories( .
|
|||
common/rendering
|
||||
common/rendering/hwrenderer/data
|
||||
common/rendering/gl_load
|
||||
common/rendering/gl
|
||||
common/scripting/vm
|
||||
common/scripting/jit
|
||||
common/scripting/core
|
||||
|
@ -1479,6 +1476,7 @@ source_group("Common\\Rendering\\Hardware Renderer" REGULAR_EXPRESSION "^${CMAKE
|
|||
source_group("Common\\Rendering\\Hardware Renderer\\Data" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/hwrenderer/data/.+")
|
||||
source_group("Common\\Rendering\\Hardware Renderer\\Postprocessing" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/hwrenderer/postprocessing/.+")
|
||||
source_group("Common\\Rendering\\OpenGL Loader" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/gl_load/.+")
|
||||
source_group("Common\\Rendering\\OpenGL Backend" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/gl/.+")
|
||||
source_group("Common\\Textures" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/textures/.+")
|
||||
source_group("Common\\Textures\\Hires" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/textures/hires/.+")
|
||||
source_group("Common\\Textures\\Hires\\HQ Resize" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/textures/hires/hqnx/.+")
|
||||
|
|
|
@ -1,32 +1,41 @@
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright(C) 2018 Christoph Oelckers
|
||||
// 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.
|
||||
//
|
||||
// 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/
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
/*
|
||||
** gl_buffers.cpp
|
||||
** Low level vertex buffer class
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2018-2020 Christoph Oelckers
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions
|
||||
** are met:
|
||||
**
|
||||
** 1. Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** 2. Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in the
|
||||
** documentation and/or other materials provided with the distribution.
|
||||
** 3. The name of the author may not be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**---------------------------------------------------------------------------
|
||||
**
|
||||
**/
|
||||
|
||||
#include "gl_system.h"
|
||||
#include <algorithm>
|
||||
#include "gl_load.h"
|
||||
#include "gl_buffers.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
#include "gl_renderstate.h"
|
||||
#include "v_video.h"
|
||||
|
||||
namespace OpenGLRenderer
|
||||
|
@ -220,4 +229,9 @@ void GLDataBuffer::BindBase()
|
|||
glBindBufferBase(mUseType, mBindingPoint, mBufferId);
|
||||
}
|
||||
|
||||
|
||||
GLVertexBuffer::GLVertexBuffer() : GLBuffer(GL_ARRAY_BUFFER) {}
|
||||
GLIndexBuffer::GLIndexBuffer() : GLBuffer(GL_ELEMENT_ARRAY_BUFFER) {}
|
||||
GLDataBuffer::GLDataBuffer(int bindingpoint, bool is_ssbo) : GLBuffer(is_ssbo ? GL_SHADER_STORAGE_BUFFER : GL_UNIFORM_BUFFER), mBindingPoint(bindingpoint) {}
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "hwrenderer/data/buffers.h"
|
||||
#include "buffers.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// silence bogus warning C4250: 'GLVertexBuffer': inherits 'GLBuffer::GLBuffer::SetData' via dominance
|
||||
|
@ -50,7 +50,7 @@ class GLVertexBuffer : public IVertexBuffer, public GLBuffer
|
|||
size_t mStride = 0;
|
||||
|
||||
public:
|
||||
GLVertexBuffer() : GLBuffer(GL_ARRAY_BUFFER) {}
|
||||
GLVertexBuffer();
|
||||
void SetFormat(int numBindingPoints, int numAttributes, size_t stride, const FVertexBufferAttribute *attrs) override;
|
||||
void Bind(int *offsets);
|
||||
};
|
||||
|
@ -58,14 +58,14 @@ public:
|
|||
class GLIndexBuffer : public IIndexBuffer, public GLBuffer
|
||||
{
|
||||
public:
|
||||
GLIndexBuffer() : GLBuffer(GL_ELEMENT_ARRAY_BUFFER) {}
|
||||
GLIndexBuffer();
|
||||
};
|
||||
|
||||
class GLDataBuffer : public IDataBuffer, public GLBuffer
|
||||
{
|
||||
int mBindingPoint;
|
||||
public:
|
||||
GLDataBuffer(int bindingpoint, bool is_ssbo) : GLBuffer(is_ssbo? GL_SHADER_STORAGE_BUFFER : GL_UNIFORM_BUFFER), mBindingPoint(bindingpoint) {}
|
||||
GLDataBuffer(int bindingpoint, bool is_ssbo);
|
||||
void BindRange(FRenderState* state, size_t start, size_t length);
|
||||
void BindBase();
|
||||
};
|
|
@ -1,34 +1,29 @@
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright(C) 2016 Magnus Norddahl
|
||||
// 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.
|
||||
//
|
||||
// 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/
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
/*
|
||||
** gl_debig.cpp
|
||||
** OpenGL debugging support functions
|
||||
** OpenGL debugging support functions
|
||||
** Copyright (c) 2016-2020 Magnus Norddahl
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any damages
|
||||
** arising from the use of this software.
|
||||
**
|
||||
** Permission is granted to anyone to use this software for any purpose,
|
||||
** including commercial applications, and to alter it and redistribute it
|
||||
** freely, subject to the following restrictions:
|
||||
**
|
||||
** 1. The origin of this software must not be misrepresented; you must not
|
||||
** claim that you wrote the original software. If you use this software
|
||||
** in a product, an acknowledgment in the product documentation would be
|
||||
** appreciated but is not required.
|
||||
** 2. Altered source versions must be plainly marked as such, and must not be
|
||||
** misrepresented as being the original software.
|
||||
** 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "templates.h"
|
||||
#include "gl_system.h"
|
||||
#include "gl/system/gl_debug.h"
|
||||
#include "gl_debug.h"
|
||||
#include "stats.h"
|
||||
#include "printf.h"
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
|
@ -4,7 +4,6 @@
|
|||
#include <string.h>
|
||||
#include "gl_interface.h"
|
||||
#include "c_cvars.h"
|
||||
#include "r_defs.h"
|
||||
#include "v_video.h"
|
||||
|
||||
namespace OpenGLRenderer
|
|
@ -36,16 +36,14 @@
|
|||
#include "gl_system.h"
|
||||
#include "templates.h"
|
||||
#include "c_cvars.h"
|
||||
#include "doomtype.h"
|
||||
#include "r_data/colormaps.h"
|
||||
#include "hw_material.h"
|
||||
|
||||
#include "gl_interface.h"
|
||||
#include "hw_cvars.h"
|
||||
#include "gl/system/gl_debug.h"
|
||||
#include "gl_debug.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
#include "gl/textures/gl_samplers.h"
|
||||
#include "gl_renderstate.h"
|
||||
#include "gl_samplers.h"
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
|
@ -21,12 +21,12 @@
|
|||
|
||||
#include "gl_system.h"
|
||||
#include "m_png.h"
|
||||
#include "gl/system/gl_buffers.h"
|
||||
#include "gl_buffers.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl/system/gl_debug.h"
|
||||
#include "gl/renderer/gl_renderbuffers.h"
|
||||
#include "gl_debug.h"
|
||||
#include "gl_renderbuffers.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_postprocessstate.h"
|
||||
#include "gl_postprocessstate.h"
|
||||
#include "gl/shaders/gl_shaderprogram.h"
|
||||
#include "hwrenderer/postprocessing/hw_postprocess.h"
|
||||
#include "hwrenderer/postprocessing/hw_postprocess_cvars.h"
|
|
@ -22,7 +22,7 @@
|
|||
#include "templates.h"
|
||||
#include "gl_system.h"
|
||||
#include "gl_interface.h"
|
||||
#include "gl/renderer/gl_postprocessstate.h"
|
||||
#include "gl_postprocessstate.h"
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
|
@ -24,12 +24,12 @@
|
|||
#include "gl_interface.h"
|
||||
#include "printf.h"
|
||||
#include "hw_cvars.h"
|
||||
#include "gl/system/gl_debug.h"
|
||||
#include "gl_debug.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_renderbuffers.h"
|
||||
#include "gl/renderer/gl_postprocessstate.h"
|
||||
#include "gl_renderbuffers.h"
|
||||
#include "gl_postprocessstate.h"
|
||||
#include "gl/shaders/gl_shaderprogram.h"
|
||||
#include "gl/system/gl_buffers.h"
|
||||
#include "gl_buffers.h"
|
||||
#include "templates.h"
|
||||
#include <random>
|
||||
|
|
@ -36,9 +36,9 @@
|
|||
#include "gl/shaders/gl_shader.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "hw_lightbuffer.h"
|
||||
#include "gl/renderer/gl_renderbuffers.h"
|
||||
#include "gl/textures/gl_hwtexture.h"
|
||||
#include "gl/system/gl_buffers.h"
|
||||
#include "gl_renderbuffers.h"
|
||||
#include "gl_hwtexture.h"
|
||||
#include "gl_buffers.h"
|
||||
#include "hwrenderer/utility/hw_clock.h"
|
||||
#include "hwrenderer/data/hw_viewpointbuffer.h"
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
#include "gl_interface.h"
|
||||
#include "hw_cvars.h"
|
||||
#include "gl/system/gl_debug.h"
|
||||
#include "gl_debug.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl_samplers.h"
|
||||
#include "hw_material.h"
|
|
@ -109,7 +109,5 @@ FBaseCVar* G_GetUserCVar(int playernum, const char* cvarname);
|
|||
extern const AActor *SendItemUse, *SendItemDrop;
|
||||
extern int SendItemDropAmount;
|
||||
|
||||
const int SAVEPICWIDTH = 216;
|
||||
const int SAVEPICHEIGHT = 162;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,28 +1,35 @@
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright(C) 2005-2016 Christoph Oelckers
|
||||
// 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.
|
||||
//
|
||||
// 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/
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
/*
|
||||
** gl1_renderer.cpp
|
||||
** gl_renderer.cpp
|
||||
** Renderer interface
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2005-2020 Christoph Oelckers
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions
|
||||
** are met:
|
||||
**
|
||||
** 1. Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** 2. Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in the
|
||||
** documentation and/or other materials provided with the distribution.
|
||||
** 3. The name of the author may not be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**---------------------------------------------------------------------------
|
||||
**
|
||||
*/
|
||||
|
||||
#include "gl_system.h"
|
||||
|
@ -36,6 +43,7 @@
|
|||
#include "d_player.h"
|
||||
#include "a_dynlight.h"
|
||||
#include "cmdlib.h"
|
||||
#include "version.h"
|
||||
#include "g_game.h"
|
||||
#include "swrenderer/r_swscene.h"
|
||||
#include "hwrenderer/utility/hw_clock.h"
|
||||
|
@ -43,22 +51,22 @@
|
|||
#include "gl_interface.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "hw_cvars.h"
|
||||
#include "gl/system/gl_debug.h"
|
||||
#include "gl_debug.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
#include "gl/renderer/gl_renderbuffers.h"
|
||||
#include "gl_renderstate.h"
|
||||
#include "gl_renderbuffers.h"
|
||||
#include "gl/shaders/gl_shaderprogram.h"
|
||||
#include "hw_vrmodes.h"
|
||||
#include "flatvertices.h"
|
||||
#include "hwrenderer/scene/hw_skydome.h"
|
||||
#include "hwrenderer/scene/hw_fakeflat.h"
|
||||
#include "gl/textures/gl_samplers.h"
|
||||
#include "gl_samplers.h"
|
||||
#include "hw_lightbuffer.h"
|
||||
#include "hwrenderer/data/hw_viewpointbuffer.h"
|
||||
#include "r_videoscale.h"
|
||||
#include "r_data/models/models.h"
|
||||
#include "gl/renderer/gl_postprocessstate.h"
|
||||
#include "gl/system/gl_buffers.h"
|
||||
#include "gl_postprocessstate.h"
|
||||
#include "gl_buffers.h"
|
||||
#include "texturemanager.h"
|
||||
|
||||
EXTERN_CVAR(Int, screenblocks)
|
||||
|
@ -95,8 +103,6 @@ void FGLRenderer::Initialize(int width, int height)
|
|||
mShadowMapShader = new FShadowMapShader();
|
||||
|
||||
// needed for the core profile, because someone decided it was a good idea to remove the default VAO.
|
||||
glGenQueries(1, &PortalQueryObject);
|
||||
|
||||
glGenVertexArrays(1, &mVAOID);
|
||||
glBindVertexArray(mVAOID);
|
||||
FGLDebug::LabelObject(GL_VERTEX_ARRAY, mVAOID, "FGLRenderer.mVAOID");
|
||||
|
@ -120,8 +126,6 @@ FGLRenderer::~FGLRenderer()
|
|||
glBindVertexArray(0);
|
||||
glDeleteVertexArrays(1, &mVAOID);
|
||||
}
|
||||
if (PortalQueryObject != 0) glDeleteQueries(1, &PortalQueryObject);
|
||||
|
||||
if (mBuffers) delete mBuffers;
|
||||
if (mSaveBuffers) delete mSaveBuffers;
|
||||
if (mPresentShader) delete mPresentShader;
|
||||
|
@ -160,44 +164,6 @@ void FGLRenderer::EndOffscreen()
|
|||
glBindFramebuffer(GL_FRAMEBUFFER, mOldFBID);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void FGLRenderer::UpdateShadowMap()
|
||||
{
|
||||
if (screen->mShadowMap.PerformUpdate())
|
||||
{
|
||||
FGLDebug::PushGroup("ShadowMap");
|
||||
|
||||
FGLPostProcessState savedState;
|
||||
|
||||
static_cast<GLDataBuffer*>(screen->mShadowMap.mLightList)->BindBase();
|
||||
static_cast<GLDataBuffer*>(screen->mShadowMap.mNodesBuffer)->BindBase();
|
||||
static_cast<GLDataBuffer*>(screen->mShadowMap.mLinesBuffer)->BindBase();
|
||||
|
||||
mBuffers->BindShadowMapFB();
|
||||
|
||||
mShadowMapShader->Bind();
|
||||
mShadowMapShader->Uniforms->ShadowmapQuality = gl_shadowmap_quality;
|
||||
mShadowMapShader->Uniforms->NodesCount = screen->mShadowMap.NodesCount();
|
||||
mShadowMapShader->Uniforms.SetData();
|
||||
static_cast<GLDataBuffer*>(mShadowMapShader->Uniforms.GetBuffer())->BindBase();
|
||||
|
||||
glViewport(0, 0, gl_shadowmap_quality, 1024);
|
||||
RenderScreenQuad();
|
||||
|
||||
const auto &viewport = screen->mScreenViewport;
|
||||
glViewport(viewport.left, viewport.top, viewport.width, viewport.height);
|
||||
|
||||
mBuffers->BindShadowMapTexture(16);
|
||||
FGLDebug::PopGroup();
|
||||
screen->mShadowMap.FinishUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -207,14 +173,10 @@ void FGLRenderer::UpdateShadowMap()
|
|||
void FGLRenderer::BindToFrameBuffer(FTexture *tex)
|
||||
{
|
||||
auto BaseLayer = static_cast<FHardwareTexture*>(tex->GetHardwareTexture(0, 0));
|
||||
|
||||
if (BaseLayer == nullptr)
|
||||
{
|
||||
// must create the hardware texture first
|
||||
BaseLayer->BindOrCreate(tex, 0, 0, 0, 0);
|
||||
FHardwareTexture::Unbind(0);
|
||||
gl_RenderState.ClearLastMaterial();
|
||||
}
|
||||
// must create the hardware texture first
|
||||
BaseLayer->BindOrCreate(tex, 0, 0, 0, 0);
|
||||
FHardwareTexture::Unbind(0);
|
||||
gl_RenderState.ClearLastMaterial();
|
||||
BaseLayer->BindToFrameBuffer(tex->GetWidth(), tex->GetHeight());
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "vectors.h"
|
||||
#include "swrenderer/r_renderer.h"
|
||||
#include "matrix.h"
|
||||
#include "gl/renderer/gl_renderbuffers.h"
|
||||
#include "gl_renderbuffers.h"
|
||||
#include "hwrenderer/scene/hw_portal.h"
|
||||
#include "hwrenderer/dynlights/hw_shadowmap.h"
|
||||
#include <functional>
|
||||
|
@ -52,7 +52,6 @@ public:
|
|||
FSamplerManager *mSamplerManager = nullptr;
|
||||
unsigned int mFBID;
|
||||
unsigned int mVAOID;
|
||||
unsigned int PortalQueryObject;
|
||||
unsigned int mStencilValue = 0;
|
||||
|
||||
int mOldFBID;
|
||||
|
@ -89,7 +88,6 @@ public:
|
|||
|
||||
bool StartOffscreen();
|
||||
void EndOffscreen();
|
||||
void UpdateShadowMap();
|
||||
|
||||
void BindToFrameBuffer(FTexture *mat);
|
||||
|
||||
|
|
|
@ -27,13 +27,13 @@
|
|||
|
||||
#include "gl_system.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_renderbuffers.h"
|
||||
#include "gl_renderbuffers.h"
|
||||
#include "hw_vrmodes.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl/renderer/gl_postprocessstate.h"
|
||||
#include "gl_postprocessstate.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl/shaders/gl_shaderprogram.h"
|
||||
#include "gl/system/gl_buffers.h"
|
||||
#include "gl_buffers.h"
|
||||
#include "menu/menu.h"
|
||||
|
||||
EXTERN_CVAR(Int, vr_mode)
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "hw_lightbuffer.h"
|
||||
|
||||
#include "gl_interface.h"
|
||||
#include "gl/system/gl_debug.h"
|
||||
#include "gl_debug.h"
|
||||
#include "matrix.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/shaders/gl_shader.h"
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#ifndef __GL_SHADERS_H__
|
||||
#define __GL_SHADERS_H__
|
||||
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
#include "gl_renderstate.h"
|
||||
#include "name.h"
|
||||
|
||||
extern bool gl_shaderactive;
|
||||
|
|
|
@ -1,35 +1,29 @@
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright(C) 2016 Magnus Norddahl
|
||||
// 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.
|
||||
//
|
||||
// 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/
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
/*
|
||||
** gl_shaderprogram.cpp
|
||||
** GLSL shader program compile and link
|
||||
** Postprocessing framework
|
||||
** Copyright (c) 2016-2020 Magnus Norddahl
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any damages
|
||||
** arising from the use of this software.
|
||||
**
|
||||
** Permission is granted to anyone to use this software for any purpose,
|
||||
** including commercial applications, and to alter it and redistribute it
|
||||
** freely, subject to the following restrictions:
|
||||
**
|
||||
** 1. The origin of this software must not be misrepresented; you must not
|
||||
** claim that you wrote the original software. If you use this software
|
||||
** in a product, an acknowledgment in the product documentation would be
|
||||
** appreciated but is not required.
|
||||
** 2. Altered source versions must be plainly marked as such, and must not be
|
||||
** misrepresented as being the original software.
|
||||
** 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "gl_system.h"
|
||||
#include "v_video.h"
|
||||
#include "gl_interface.h"
|
||||
#include "hw_cvars.h"
|
||||
#include "gl/system/gl_debug.h"
|
||||
#include "gl_debug.h"
|
||||
#include "gl/shaders/gl_shaderprogram.h"
|
||||
#include "hwrenderer/utility/hw_shaderpatcher.h"
|
||||
#include "filesystem.h"
|
||||
|
@ -268,7 +262,7 @@ FString FShaderProgram::PatchShader(ShaderType type, const FString &code, const
|
|||
|
||||
// If we have 4.2, always use it because it adds important new syntax.
|
||||
if (maxGlslVersion < 420 && gl.glslversion >= 4.2f) maxGlslVersion = 420;
|
||||
int shaderVersion = MIN((int)round(gl.glslversion * 10) * 10, maxGlslVersion);
|
||||
int shaderVersion = std::min((int)round(gl.glslversion * 10) * 10, maxGlslVersion);
|
||||
patchedCode.AppendFormat("#version %d\n", shaderVersion);
|
||||
|
||||
// TODO: Find some way to add extension requirements to the patching
|
||||
|
|
|
@ -1,30 +1,37 @@
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright(C) 2010-2016 Christoph Oelckers
|
||||
// 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.
|
||||
//
|
||||
// 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/
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
/*
|
||||
** gl_framebuffer.cpp
|
||||
** Implementation of the non-hardware specific parts of the
|
||||
** OpenGL frame buffer
|
||||
**
|
||||
*/
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2010-2020 Christoph Oelckers
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions
|
||||
** are met:
|
||||
**
|
||||
** 1. Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** 2. Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in the
|
||||
** documentation and/or other materials provided with the distribution.
|
||||
** 3. The name of the author may not be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**---------------------------------------------------------------------------
|
||||
**
|
||||
*/
|
||||
|
||||
#include "gl_system.h"
|
||||
#include "v_video.h"
|
||||
|
@ -35,8 +42,8 @@
|
|||
#include "gl_interface.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_renderbuffers.h"
|
||||
#include "gl/textures/gl_samplers.h"
|
||||
#include "gl_renderbuffers.h"
|
||||
#include "gl_samplers.h"
|
||||
#include "hwrenderer/utility/hw_clock.h"
|
||||
#include "hw_vrmodes.h"
|
||||
#include "hwrenderer/models/hw_models.h"
|
||||
|
@ -49,8 +56,10 @@
|
|||
#include "r_videoscale.h"
|
||||
#include "gl_buffers.h"
|
||||
#include "swrenderer/r_swscene.h"
|
||||
#include "gl_postprocessstate.h"
|
||||
|
||||
#include "flatvertices.h"
|
||||
#include "hw_cvars.h"
|
||||
|
||||
EXTERN_CVAR (Bool, vid_vsync)
|
||||
EXTERN_CVAR(Bool, r_drawvoxels)
|
||||
|
@ -412,7 +421,34 @@ void OpenGLFrameBuffer::SetSceneRenderTarget(bool useSSAO)
|
|||
|
||||
void OpenGLFrameBuffer::UpdateShadowMap()
|
||||
{
|
||||
GLRenderer->UpdateShadowMap();
|
||||
if (mShadowMap.PerformUpdate())
|
||||
{
|
||||
FGLDebug::PushGroup("ShadowMap");
|
||||
|
||||
FGLPostProcessState savedState;
|
||||
|
||||
static_cast<GLDataBuffer*>(screen->mShadowMap.mLightList)->BindBase();
|
||||
static_cast<GLDataBuffer*>(screen->mShadowMap.mNodesBuffer)->BindBase();
|
||||
static_cast<GLDataBuffer*>(screen->mShadowMap.mLinesBuffer)->BindBase();
|
||||
|
||||
GLRenderer->mBuffers->BindShadowMapFB();
|
||||
|
||||
GLRenderer->mShadowMapShader->Bind();
|
||||
GLRenderer->mShadowMapShader->Uniforms->ShadowmapQuality = gl_shadowmap_quality;
|
||||
GLRenderer->mShadowMapShader->Uniforms->NodesCount = screen->mShadowMap.NodesCount();
|
||||
GLRenderer->mShadowMapShader->Uniforms.SetData();
|
||||
static_cast<GLDataBuffer*>(GLRenderer->mShadowMapShader->Uniforms.GetBuffer())->BindBase();
|
||||
|
||||
glViewport(0, 0, gl_shadowmap_quality, 1024);
|
||||
GLRenderer->RenderScreenQuad();
|
||||
|
||||
const auto& viewport = screen->mScreenViewport;
|
||||
glViewport(viewport.left, viewport.top, viewport.width, viewport.height);
|
||||
|
||||
GLRenderer->mBuffers->BindShadowMapTexture(16);
|
||||
FGLDebug::PopGroup();
|
||||
screen->mShadowMap.FinishUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
void OpenGLFrameBuffer::WaitForCommands(bool finish)
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "i_time.h"
|
||||
#include "g_game.h"
|
||||
#include "v_text.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "hwrenderer/utility/hw_clock.h"
|
||||
#include "hw_vrmodes.h"
|
||||
|
|
|
@ -110,5 +110,8 @@ const char *GetVersionString();
|
|||
#define GAME_DIR ".config/" GAMENAMELOWERCASE
|
||||
#endif
|
||||
|
||||
const int SAVEPICWIDTH = 216;
|
||||
const int SAVEPICHEIGHT = 162;
|
||||
|
||||
|
||||
#endif //__VERSION_H__
|
||||
|
|
Loading…
Reference in a new issue