mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-29 19:50:37 +00:00
- moved code around, got a few more utilities from GZDoom.
This commit is contained in:
parent
1d15fe63a6
commit
2841154683
16 changed files with 357 additions and 131 deletions
|
@ -614,13 +614,6 @@ file( GLOB HEADER_FILES
|
|||
core/music/*.h
|
||||
core/menu/*.h
|
||||
core/input/*.h
|
||||
core/rendering/*.h
|
||||
core/rendering/gl/system/*.h
|
||||
core/rendering/gl/renderer/*.h
|
||||
core/rendering/gl/shaders/*.h
|
||||
core/rendering/hwrenderer/data/*.h
|
||||
core/rendering/hwrenderer/postprocessing/*.h
|
||||
core/rendering/hwrenderer/utility/*.h
|
||||
|
||||
common/audio/sound/thirdparty/*.h
|
||||
common/audio/sound/*.h
|
||||
|
@ -876,6 +869,8 @@ set (PCH_SOURCES
|
|||
common/rendering/v_framebuffer.cpp
|
||||
common/rendering/v_video.cpp
|
||||
common/rendering/r_videoscale.cpp
|
||||
common/rendering/hwrenderer/data/hw_clock.cpp
|
||||
common/rendering/hwrenderer/data/hw_skydome.cpp
|
||||
common/rendering/hwrenderer/data/flatvertices.cpp
|
||||
common/rendering/hwrenderer/data/hw_viewpointbuffer.cpp
|
||||
common/rendering/hwrenderer/data/hw_modelvertexbuffer.cpp
|
||||
|
@ -883,12 +878,14 @@ set (PCH_SOURCES
|
|||
common/rendering/hwrenderer/data/hw_vrmodes.cpp
|
||||
common/rendering/hwrenderer/data/hw_lightbuffer.cpp
|
||||
common/rendering/hwrenderer/data/hw_aabbtree.cpp
|
||||
common/rendering/hwrenderer/data/hw_skydome.cpp
|
||||
common/rendering/hwrenderer/data/hw_shadowmap.cpp
|
||||
common/rendering/hwrenderer/data/hw_shaderpatcher.cpp
|
||||
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_renderer.cpp
|
||||
common/rendering/gl/gl_stereo3d.cpp
|
||||
common/rendering/gl/gl_framebuffer.cpp
|
||||
common/rendering/gl/gl_renderstate.cpp
|
||||
common/rendering/gl/gl_renderbuffers.cpp
|
||||
common/rendering/gl/gl_postprocess.cpp
|
||||
|
@ -937,10 +934,6 @@ set (PCH_SOURCES
|
|||
#core/input/i_joystick.cpp
|
||||
#core/input/i_input.cpp
|
||||
core/input/m_joy.cpp
|
||||
|
||||
core/rendering/gl/renderer/gl_renderer.cpp
|
||||
core/rendering/gl/renderer/gl_stereo3d.cpp
|
||||
core/rendering/gl/system/gl_framebuffer.cpp
|
||||
)
|
||||
|
||||
if( ${HAVE_VM_JIT} )
|
||||
|
@ -1032,13 +1025,6 @@ include_directories(
|
|||
core/dobject
|
||||
core/menu
|
||||
core/input
|
||||
core/rendering/gl/system
|
||||
core/rendering/gl/renderer
|
||||
core/rendering/gl/shaders
|
||||
core/rendering/hwrenderer/data
|
||||
core/rendering/hwrenderer/postprocessing
|
||||
core/rendering/hwrenderer/utility
|
||||
core/rendering
|
||||
platform
|
||||
common/audio/sound
|
||||
common/audio/music
|
||||
|
@ -1162,8 +1148,6 @@ source_group("Core\\2D" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/core/2d
|
|||
source_group("Core\\Console" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/core/console/.+")
|
||||
source_group("Core\\DObject" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/core/dobject/.+")
|
||||
source_group("Core\\Menu" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/core/menu/.+")
|
||||
source_group("Core\\Rendering" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/core/rendering/.+")
|
||||
source_group("Core\\Rendering\\GL\\System" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/core/rendering/gl/system.+")
|
||||
source_group("Platform" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/platform/.+")
|
||||
source_group("Platform\\Win32" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/platform/win32/.+")
|
||||
source_group("Platform\\POSIX" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/platform/posix/.+")
|
||||
|
@ -1192,12 +1176,6 @@ source_group("Common\\Platforms\\OS X Files" REGULAR_EXPRESSION "^${CMAKE_CURREN
|
|||
source_group("Common\\Platforms\\Unix Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/platform/posix/unix/.+")
|
||||
source_group("Common\\Platforms\\SDL Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/platform/posix/sdl/.+")
|
||||
source_group("Common\\Platforms\\Win32 Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/platform/win32/.+")
|
||||
source_group("Common\\Rendering" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/.+")
|
||||
source_group("Common\\Rendering\\Hardware Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/hwrenderer/.+")
|
||||
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\\Models" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/models/.+")
|
||||
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/.+")
|
||||
|
|
|
@ -33,48 +33,45 @@
|
|||
**
|
||||
*/
|
||||
|
||||
|
||||
#include "gl_load/gl_system.h"
|
||||
#include "gl_system.h"
|
||||
#include "v_video.h"
|
||||
#include "m_png.h"
|
||||
#include "printf.h"
|
||||
#include "templates.h"
|
||||
#include "palette.h"
|
||||
#include "build.h"
|
||||
#include "hw_viewpointbuffer.h"
|
||||
#include "glbackend/glbackend.h"
|
||||
#include "i_time.h"
|
||||
|
||||
#include "gl_load/gl_interface.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl_renderstate.h"
|
||||
#include "gl_interface.h"
|
||||
#include "gl_framebuffer.h"
|
||||
#include "gl_renderer.h"
|
||||
#include "gl_renderbuffers.h"
|
||||
#include "flatvertices.h"
|
||||
#include "hw_lightbuffer.h"
|
||||
#include "gl_samplers.h"
|
||||
#include "hw_clock.h"
|
||||
#include "hw_vrmodes.h"
|
||||
#include "hwrenderer/postprocessing/hw_postprocess.h"
|
||||
#include "gl_postprocessstate.h"
|
||||
#include "hw_skydome.h"
|
||||
#include "hw_viewpointbuffer.h"
|
||||
#include "hw_lightbuffer.h"
|
||||
#include "gl_shaderprogram.h"
|
||||
#include "hw_cvars.h"
|
||||
#include "gl_debug.h"
|
||||
#include "r_videoscale.h"
|
||||
#include "gl_buffers.h"
|
||||
#include "gl_postprocessstate.h"
|
||||
#include "v_draw.h"
|
||||
#include "printf.h"
|
||||
#include "gl_hwtexture.h"
|
||||
|
||||
#include "flatvertices.h"
|
||||
#include "hw_cvars.h"
|
||||
|
||||
EXTERN_CVAR (Bool, vid_vsync)
|
||||
EXTERN_CVAR(Bool, r_drawvoxels)
|
||||
EXTERN_CVAR(Int, gl_tonemap)
|
||||
EXTERN_CVAR(Bool, gl_texture_usehires)
|
||||
EXTERN_CVAR(Int, gl_ssao)
|
||||
EXTERN_CVAR(Bool, cl_capfps)
|
||||
|
||||
void gl_LoadExtensions();
|
||||
void gl_PrintStartupLog();
|
||||
void DrawRateStuff();
|
||||
//void Draw2D(F2DDrawer *drawer, FRenderState &state);
|
||||
void Draw2D(F2DDrawer *drawer, FRenderState &state);
|
||||
|
||||
extern bool vid_hdr_active;
|
||||
|
||||
void DrawFullscreenBlends();
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
FGLRenderer *GLRenderer;
|
||||
|
@ -188,18 +185,15 @@ void OpenGLFrameBuffer::InitializeState()
|
|||
|
||||
void OpenGLFrameBuffer::Update()
|
||||
{
|
||||
#if 0
|
||||
twoD.Reset();
|
||||
Flush3D.Reset();
|
||||
|
||||
Flush3D.Clock();
|
||||
#endif
|
||||
GLRenderer->Flush();
|
||||
// Flush3D.Unclock();
|
||||
Flush3D.Unclock();
|
||||
|
||||
Swap();
|
||||
Super::Update();
|
||||
screen->mVertexData->Reset();
|
||||
}
|
||||
|
||||
void OpenGLFrameBuffer::CopyScreenToBuffer(int width, int height, uint8_t* scr)
|
||||
|
@ -263,13 +257,13 @@ CVAR(Bool, gl_finishbeforeswap, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
|
|||
void OpenGLFrameBuffer::Swap()
|
||||
{
|
||||
bool swapbefore = gl_finishbeforeswap && camtexcount == 0;
|
||||
//Finish.Reset();
|
||||
//Finish.Clock();
|
||||
Finish.Reset();
|
||||
Finish.Clock();
|
||||
if (swapbefore) glFinish();
|
||||
FPSLimit();
|
||||
SwapBuffers();
|
||||
if (!swapbefore) glFinish();
|
||||
//Finish.Unclock();
|
||||
Finish.Unclock();
|
||||
camtexcount = 0;
|
||||
FHardwareTexture::UnbindAll();
|
||||
mDebug->Update();
|
||||
|
@ -519,9 +513,7 @@ void OpenGLFrameBuffer::Draw2D()
|
|||
if (GLRenderer != nullptr)
|
||||
{
|
||||
GLRenderer->mBuffers->BindCurrentFB();
|
||||
::DrawFullscreenBlends();
|
||||
DrawRateStuff();
|
||||
GLInterface.Draw2D(twod);
|
||||
::Draw2D(twod, gl_RenderState);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,18 +2,22 @@
|
|||
#define __GL_FRAMEBUFFER
|
||||
|
||||
#include "gl_sysfb.h"
|
||||
#include "m_png.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
class FHardwareTexture;
|
||||
class FGLDebug;
|
||||
|
||||
class OpenGLFrameBuffer : public SystemGLFrameBuffer
|
||||
{
|
||||
typedef SystemGLFrameBuffer Super;
|
||||
|
||||
void RenderTextureView(FCanvasTexture* tex, std::function<void(IntRect &)> renderFunc) override;
|
||||
|
||||
public:
|
||||
|
||||
explicit OpenGLFrameBuffer() {}
|
||||
|
@ -22,14 +26,25 @@ public:
|
|||
|
||||
void InitializeState() override;
|
||||
void Update() override;
|
||||
void Draw2D() override;
|
||||
|
||||
void AmbientOccludeScene(float m5) override;
|
||||
void FirstEye() override;
|
||||
void NextEye(int eyecount) override;
|
||||
void SetSceneRenderTarget(bool useSSAO) override;
|
||||
void UpdateShadowMap() override;
|
||||
void WaitForCommands(bool finish) override;
|
||||
void SetSaveBuffers(bool yes) override;
|
||||
void CopyScreenToBuffer(int width, int height, uint8_t* buffer) override;
|
||||
bool FlipSavePic() const override { return true; }
|
||||
|
||||
FRenderState* RenderState() override;
|
||||
void UpdatePalette() override;
|
||||
const char* DeviceName() const override;
|
||||
IHardwareTexture *CreateHardwareTexture(int numchannels) override;
|
||||
void SetTextureFilterMode() override;
|
||||
|
||||
void PrecacheMaterial(FMaterial *mat, int translation) override;
|
||||
void BeginFrame() override;
|
||||
//void SetViewportRects(IntRect *bounds) override;
|
||||
void SetViewportRects(IntRect *bounds) override;
|
||||
void BlurScene(float amount) override;
|
||||
IVertexBuffer *CreateVertexBuffer() override;
|
||||
IIndexBuffer *CreateIndexBuffer() override;
|
||||
|
@ -43,32 +58,17 @@ public:
|
|||
void Swap();
|
||||
bool IsHWGammaActive() const { return HWGammaActive; }
|
||||
|
||||
void SetVSync(bool vsync) override;
|
||||
void SetVSync(bool vsync);
|
||||
|
||||
void SetViewportRects(IntRect* bounds) override;
|
||||
void UpdatePalette() override;
|
||||
void AmbientOccludeScene(float m5) override;
|
||||
void FirstEye() override;
|
||||
void NextEye(int eyecount) override;
|
||||
void SetSceneRenderTarget(bool useSSAO) override;
|
||||
void UpdateShadowMap() override;
|
||||
void WaitForCommands(bool finish) override;
|
||||
void SetSaveBuffers(bool yes) override;
|
||||
void CopyScreenToBuffer(int width, int height, uint8_t* buffer) override;
|
||||
bool FlipSavePic() const override { return true; }
|
||||
void RenderTextureView(FCanvasTexture* tex, std::function<void(IntRect&)> renderFunc) override;
|
||||
void PrecacheMaterial(FMaterial* mat, int translation) override;
|
||||
FRenderState* RenderState() override;
|
||||
|
||||
FTexture* WipeStartScreen() override;
|
||||
FTexture* WipeEndScreen() override;
|
||||
|
||||
//void Draw2D() override;
|
||||
void Draw2D() override;
|
||||
void PostProcessScene(bool swscene, int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D) override;
|
||||
|
||||
bool HWGammaActive = false; // Are we using hardware or software gamma?
|
||||
std::shared_ptr<FGLDebug> mDebug; // Debug API
|
||||
|
||||
FTexture *WipeStartScreen() override;
|
||||
FTexture *WipeEndScreen() override;
|
||||
|
||||
int camtexcount = 0;
|
||||
};
|
||||
|
|
@ -42,6 +42,7 @@
|
|||
#include "hw_cvars.h"
|
||||
#include "gl_debug.h"
|
||||
#include "gl_renderer.h"
|
||||
#include "gl_renderstate.h"
|
||||
#include "gl_samplers.h"
|
||||
#include "gl_hwtexture.h"
|
||||
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
#include "gl_system.h"
|
||||
#include "m_png.h"
|
||||
#include "gl_buffers.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl_framebuffer.h"
|
||||
#include "gl_debug.h"
|
||||
#include "gl_renderbuffers.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl_renderer.h"
|
||||
#include "gl_postprocessstate.h"
|
||||
#include "gl_shaderprogram.h"
|
||||
#include "hwrenderer/postprocessing/hw_postprocess.h"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "printf.h"
|
||||
#include "hw_cvars.h"
|
||||
#include "gl_debug.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl_renderer.h"
|
||||
#include "gl_renderbuffers.h"
|
||||
#include "gl_postprocessstate.h"
|
||||
#include "gl_shaderprogram.h"
|
||||
|
|
|
@ -41,10 +41,10 @@
|
|||
#include "cmdlib.h"
|
||||
#include "version.h"
|
||||
#include "gl_interface.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl_framebuffer.h"
|
||||
#include "hw_cvars.h"
|
||||
#include "gl_debug.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl_renderer.h"
|
||||
#include "gl_renderstate.h"
|
||||
#include "gl_renderbuffers.h"
|
||||
#include "gl_shaderprogram.h"
|
|
@ -31,12 +31,12 @@
|
|||
#include "hw_cvars.h"
|
||||
#include "flatvertices.h"
|
||||
#include "gl_shader.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl_renderer.h"
|
||||
#include "hw_lightbuffer.h"
|
||||
#include "gl_renderbuffers.h"
|
||||
#include "gl_hwtexture.h"
|
||||
#include "gl_buffers.h"
|
||||
//#include "hwrenderer/utility/hw_clock.h"
|
||||
#include "hw_clock.h"
|
||||
#include "hwrenderer/data/hw_viewpointbuffer.h"
|
||||
|
||||
namespace OpenGLRenderer
|
||||
|
@ -394,9 +394,9 @@ void FGLRenderState::Draw(int dt, int index, int count, bool apply)
|
|||
{
|
||||
Apply();
|
||||
}
|
||||
//drawcalls.Clock();
|
||||
drawcalls.Clock();
|
||||
glDrawArrays(dt2gl[dt], index, count);
|
||||
//drawcalls.Unclock();
|
||||
drawcalls.Unclock();
|
||||
}
|
||||
|
||||
void FGLRenderState::DrawIndexed(int dt, int index, int count, bool apply)
|
||||
|
@ -405,9 +405,9 @@ void FGLRenderState::DrawIndexed(int dt, int index, int count, bool apply)
|
|||
{
|
||||
Apply();
|
||||
}
|
||||
//drawcalls.Clock();
|
||||
drawcalls.Clock();
|
||||
glDrawElements(dt2gl[dt], count, GL_UNSIGNED_INT, (void*)(intptr_t)(index * sizeof(uint32_t)));
|
||||
//drawcalls.Unclock();
|
||||
drawcalls.Unclock();
|
||||
}
|
||||
|
||||
void FGLRenderState::SetDepthMask(bool on)
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "gl_interface.h"
|
||||
#include "gl_debug.h"
|
||||
#include "matrix.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl_renderer.h"
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
|
|
|
@ -26,12 +26,12 @@
|
|||
*/
|
||||
|
||||
#include "gl_system.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl_renderer.h"
|
||||
#include "gl_renderbuffers.h"
|
||||
#include "hw_vrmodes.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl_framebuffer.h"
|
||||
#include "gl_postprocessstate.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl_framebuffer.h"
|
||||
#include "gl_shaderprogram.h"
|
||||
#include "gl_buffers.h"
|
||||
#include "templates.h"
|
212
source/common/rendering/hwrenderer/data/hw_clock.cpp
Normal file
212
source/common/rendering/hwrenderer/data/hw_clock.cpp
Normal file
|
@ -0,0 +1,212 @@
|
|||
/*
|
||||
**
|
||||
** Hardware render profiling info
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2007-2018 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 "c_console.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "v_video.h"
|
||||
#include "hw_clock.h"
|
||||
#include "i_time.h"
|
||||
#include "i_interface.h"
|
||||
#include "printf.h"
|
||||
|
||||
glcycle_t RenderWall,SetupWall,ClipWall;
|
||||
glcycle_t RenderFlat,SetupFlat;
|
||||
glcycle_t RenderSprite,SetupSprite;
|
||||
glcycle_t All, Finish, PortalAll, Bsp;
|
||||
glcycle_t ProcessAll, PostProcess;
|
||||
glcycle_t RenderAll;
|
||||
glcycle_t Dirty;
|
||||
glcycle_t drawcalls;
|
||||
glcycle_t twoD, Flush3D;
|
||||
glcycle_t MTWait, WTTotal;
|
||||
int vertexcount, flatvertices, flatprimitives;
|
||||
|
||||
int rendered_lines,rendered_flats,rendered_sprites,render_vertexsplit,render_texsplit,rendered_decals, rendered_portals, rendered_commandbuffers;
|
||||
int iter_dlightf, iter_dlight, draw_dlight, draw_dlightf;
|
||||
|
||||
void ResetProfilingData()
|
||||
{
|
||||
All.Reset();
|
||||
All.Clock();
|
||||
Bsp.Reset();
|
||||
PortalAll.Reset();
|
||||
RenderAll.Reset();
|
||||
ProcessAll.Reset();
|
||||
PostProcess.Reset();
|
||||
RenderWall.Reset();
|
||||
SetupWall.Reset();
|
||||
ClipWall.Reset();
|
||||
RenderFlat.Reset();
|
||||
SetupFlat.Reset();
|
||||
RenderSprite.Reset();
|
||||
SetupSprite.Reset();
|
||||
drawcalls.Reset();
|
||||
MTWait.Reset();
|
||||
WTTotal.Reset();
|
||||
|
||||
flatvertices=flatprimitives=vertexcount=0;
|
||||
render_texsplit=render_vertexsplit=rendered_lines=rendered_flats=rendered_sprites=rendered_decals=rendered_portals = 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Rendering statistics
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static void AppendRenderTimes(FString &str)
|
||||
{
|
||||
double setupwall = SetupWall.TimeMS();
|
||||
double clipwall = ClipWall.TimeMS();
|
||||
double bsp = Bsp.TimeMS() - ClipWall.TimeMS();
|
||||
|
||||
str.AppendFormat("BSP = %2.3f, Clip=%2.3f\n"
|
||||
"W: Render=%2.3f, Setup=%2.3f\n"
|
||||
"F: Render=%2.3f, Setup=%2.3f\n"
|
||||
"S: Render=%2.3f, Setup=%2.3f\n"
|
||||
"2D: %2.3f Finish3D: %2.3f\n"
|
||||
"Main thread total=%2.3f, Main thread waiting=%2.3f Worker thread total=%2.3f, Worker thread waiting=%2.3f\n"
|
||||
"All=%2.3f, Render=%2.3f, Setup=%2.3f, Portal=%2.3f, Drawcalls=%2.3f, Postprocess=%2.3f, Finish=%2.3f\n",
|
||||
bsp, clipwall,
|
||||
RenderWall.TimeMS(), setupwall,
|
||||
RenderFlat.TimeMS(), SetupFlat.TimeMS(),
|
||||
RenderSprite.TimeMS(), SetupSprite.TimeMS(),
|
||||
twoD.TimeMS(), Flush3D.TimeMS() - twoD.TimeMS(),
|
||||
MTWait.TimeMS() + Bsp.TimeMS(), MTWait.TimeMS(), WTTotal.TimeMS(), WTTotal.TimeMS() - setupwall - SetupFlat.TimeMS() - SetupSprite.TimeMS(),
|
||||
All.TimeMS() + Finish.TimeMS(), RenderAll.TimeMS(), ProcessAll.TimeMS(), PortalAll.TimeMS(), drawcalls.TimeMS(), PostProcess.TimeMS(), Finish.TimeMS());
|
||||
}
|
||||
|
||||
static void AppendRenderStats(FString &out)
|
||||
{
|
||||
out.AppendFormat("Walls: %d (%d splits, %d t-splits, %d vertices)\n"
|
||||
"Flats: %d (%d primitives, %d vertices)\n"
|
||||
"Sprites: %d, Decals=%d, Portals: %d, Command buffers: %d\n",
|
||||
rendered_lines, render_vertexsplit, render_texsplit, vertexcount, rendered_flats, flatprimitives, flatvertices, rendered_sprites,rendered_decals, rendered_portals, rendered_commandbuffers );
|
||||
}
|
||||
|
||||
static void AppendLightStats(FString &out)
|
||||
{
|
||||
out.AppendFormat("DLight - Walls: %d processed, %d rendered - Flats: %d processed, %d rendered\n",
|
||||
iter_dlight, draw_dlight, iter_dlightf, draw_dlightf );
|
||||
}
|
||||
|
||||
ADD_STAT(rendertimes)
|
||||
{
|
||||
static FString buff;
|
||||
static int64_t lasttime=0;
|
||||
int64_t t=I_msTime();
|
||||
if (t-lasttime>1000)
|
||||
{
|
||||
buff.Truncate(0);
|
||||
AppendRenderTimes(buff);
|
||||
lasttime=t;
|
||||
}
|
||||
return buff;
|
||||
}
|
||||
|
||||
ADD_STAT(renderstats)
|
||||
{
|
||||
FString out;
|
||||
AppendRenderStats(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
ADD_STAT(lightstats)
|
||||
{
|
||||
FString out;
|
||||
AppendLightStats(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
static int printstats;
|
||||
static bool switchfps;
|
||||
static uint64_t waitstart;
|
||||
extern uint64_t LastCount;
|
||||
EXTERN_CVAR(Bool, vid_fps)
|
||||
|
||||
void CheckBench()
|
||||
{
|
||||
if (printstats && ConsoleState == c_up)
|
||||
{
|
||||
// if we started the FPS counter ourselves or ran from the console
|
||||
// we need to wait for it to stabilize before using it.
|
||||
if (waitstart > 0 && I_msTime() - waitstart < 5000) return;
|
||||
|
||||
FString compose;
|
||||
|
||||
if (sysCallbacks && sysCallbacks->GetLocationDescription) compose = sysCallbacks->GetLocationDescription();
|
||||
|
||||
AppendRenderStats(compose);
|
||||
AppendRenderTimes(compose);
|
||||
AppendLightStats(compose);
|
||||
compose << "\n\n\n";
|
||||
|
||||
FILE *f = fopen("benchmarks.txt", "at");
|
||||
if (f != NULL)
|
||||
{
|
||||
fputs(compose.GetChars(), f);
|
||||
fclose(f);
|
||||
}
|
||||
Printf("Benchmark info saved\n");
|
||||
if (switchfps) vid_fps = false;
|
||||
printstats = false;
|
||||
}
|
||||
}
|
||||
|
||||
CCMD(bench)
|
||||
{
|
||||
printstats = true;
|
||||
if (vid_fps == 0)
|
||||
{
|
||||
vid_fps = 1;
|
||||
waitstart = I_msTime();
|
||||
switchfps = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ConsoleState == c_up) waitstart = I_msTime();
|
||||
switchfps = false;
|
||||
}
|
||||
C_HideConsole ();
|
||||
}
|
||||
|
||||
bool glcycle_t::active = false;
|
||||
|
||||
void checkBenchActive()
|
||||
{
|
||||
FStat *stat = FStat::FindStat("rendertimes");
|
||||
glcycle_t::active = ((stat != NULL && stat->isActive()) || printstats);
|
||||
}
|
||||
|
29
source/common/rendering/hwrenderer/data/hw_clock.h
Normal file
29
source/common/rendering/hwrenderer/data/hw_clock.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
#ifndef __GL_CLOCK_H
|
||||
#define __GL_CLOCK_H
|
||||
|
||||
#include "stats.h"
|
||||
#include "x86.h"
|
||||
#include "m_fixed.h"
|
||||
|
||||
extern glcycle_t RenderWall,SetupWall,ClipWall;
|
||||
extern glcycle_t RenderFlat,SetupFlat;
|
||||
extern glcycle_t RenderSprite,SetupSprite;
|
||||
extern glcycle_t All, Finish, PortalAll, Bsp;
|
||||
extern glcycle_t ProcessAll, PostProcess;
|
||||
extern glcycle_t RenderAll;
|
||||
extern glcycle_t Dirty;
|
||||
extern glcycle_t drawcalls, twoD, Flush3D;
|
||||
extern glcycle_t MTWait, WTTotal;
|
||||
|
||||
extern int iter_dlightf, iter_dlight, draw_dlight, draw_dlightf;
|
||||
extern int rendered_lines,rendered_flats,rendered_sprites,rendered_decals,render_vertexsplit,render_texsplit;
|
||||
extern int rendered_portals;
|
||||
|
||||
extern int vertexcount, flatvertices, flatprimitives;
|
||||
|
||||
void ResetProfilingData();
|
||||
void CheckBench();
|
||||
void checkBenchActive();
|
||||
|
||||
|
||||
#endif
|
|
@ -1,32 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "matrix.h"
|
||||
|
||||
struct HWDrawInfo;
|
||||
|
||||
struct HWViewpointUniforms
|
||||
{
|
||||
VSMatrix mProjectionMatrix;
|
||||
VSMatrix mViewMatrix;
|
||||
VSMatrix mNormalViewMatrix;
|
||||
FVector4 mCameraPos;
|
||||
FVector4 mClipLine;
|
||||
|
||||
float mGlobVis = 1.f;
|
||||
int mPalLightLevels = 0;
|
||||
int mViewHeight = 0;
|
||||
float mClipHeight = 0.f;
|
||||
float mClipHeightDirection = 0.f;
|
||||
int mShadowmapFilter = 1;
|
||||
|
||||
void CalcDependencies()
|
||||
{
|
||||
mNormalViewMatrix.computeNormalMatrix(mViewMatrix);
|
||||
}
|
||||
|
||||
void SetDefaults(int lightmode);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -263,6 +263,14 @@ void DrawFullscreenBlends()
|
|||
|
||||
}
|
||||
|
||||
void DrawRateStuff();
|
||||
|
||||
void Draw2D(F2DDrawer* drawer, FRenderState& state)
|
||||
{
|
||||
::DrawFullscreenBlends();
|
||||
DrawRateStuff();
|
||||
GLInterface.Draw2D(twod);
|
||||
}
|
||||
|
||||
void videoTintBlood(int32_t r, int32_t g, int32_t b)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,6 @@ CRC
|
|||
BLOOD10_CRC 0xB291418f
|
||||
BLOOD11_CRC 0xC3A99936
|
||||
BLOOD_CRC 0xA8FDDA84
|
||||
BLOOD_CRC 0xA8FDDA84
|
||||
SWREG12_CRC 0x7545319F
|
||||
SWWD_CRC 0xA9AAA7B7
|
||||
SWTD_CRC 0xA1A65BE8
|
||||
|
@ -377,11 +376,50 @@ addon
|
|||
deletecontent "turd66.anm*turdmov.anm", "turd66.voc*turdmov.voc", "end66.anm*rr_outro.anm", "end66.voc*rr_outro.voc" // This renames instead of deleting
|
||||
}
|
||||
|
||||
grpinfo
|
||||
{
|
||||
name "Blood 1.0"
|
||||
size 9570681
|
||||
crc BLOOD10_CRC
|
||||
defname "blood.def"
|
||||
scriptname "BLOOD.INI"
|
||||
flags GAMEFLAG_BLOOD
|
||||
dependency 0
|
||||
loadgrp "SOUNDS.RFF", "GUI.RFF"
|
||||
gamefilter "Blood.Blood"
|
||||
}
|
||||
|
||||
grpinfo
|
||||
{
|
||||
name "Blood 1.1"
|
||||
size 9570681
|
||||
crc BLOOD11_CRC
|
||||
defname "blood.def"
|
||||
scriptname "BLOOD.INI"
|
||||
flags GAMEFLAG_BLOOD
|
||||
dependency 0
|
||||
loadgrp "SOUNDS.RFF", "GUI.RFF"
|
||||
gamefilter "Blood.Blood"
|
||||
}
|
||||
|
||||
grpinfo
|
||||
{
|
||||
name "BLOOD: One Unit Whole Blood"
|
||||
size 9570681
|
||||
crc 0xA8FDDA84
|
||||
crc BLOOD_CRC
|
||||
defname "blood.def"
|
||||
scriptname "BLOOD.INI"
|
||||
flags GAMEFLAG_BLOOD
|
||||
dependency 0
|
||||
loadgrp "SOUNDS.RFF", "GUI.RFF"
|
||||
gamefilter "Blood.Blood"
|
||||
}
|
||||
|
||||
grpinfo
|
||||
{
|
||||
name "BLOOD: One Unit Whole Blood"
|
||||
size 9570681
|
||||
crc BLOOD_CRC
|
||||
defname "blood.def"
|
||||
scriptname "BLOOD.INI"
|
||||
flags GAMEFLAG_BLOOD
|
||||
|
|
Loading…
Reference in a new issue