From af5e3dd1b85607fb7f0427f074b1f87f4be7f725 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 27 Sep 2020 11:58:54 +0200 Subject: [PATCH] - render backend update from GZDoom, mostly minor stuff. --- source/common/engine/sc_man.cpp | 2 +- source/common/fonts/v_font.cpp | 2 +- source/common/rendering/gl/gl_postprocess.cpp | 2 +- source/common/rendering/hwrenderer/data/flatvertices.cpp | 6 +++--- source/common/rendering/v_framebuffer.cpp | 2 +- source/common/rendering/v_video.cpp | 6 ++---- .../common/rendering/vulkan/renderer/vk_postprocess.cpp | 2 +- source/common/rendering/vulkan/system/vk_framebuffer.cpp | 9 +++++++++ source/core/mainloop.cpp | 2 +- 9 files changed, 20 insertions(+), 13 deletions(-) diff --git a/source/common/engine/sc_man.cpp b/source/common/engine/sc_man.cpp index b68fb8c1e..6cf0044c3 100644 --- a/source/common/engine/sc_man.cpp +++ b/source/common/engine/sc_man.cpp @@ -546,7 +546,7 @@ bool FScanner::GetString () return ScanString (false); } -//============================================ ============================== +//========================================================================== // // FScanner :: MustGetString // diff --git a/source/common/fonts/v_font.cpp b/source/common/fonts/v_font.cpp index 3f64b1625..1d75d9f18 100644 --- a/source/common/fonts/v_font.cpp +++ b/source/common/fonts/v_font.cpp @@ -786,7 +786,7 @@ void V_InitFonts() } if (!(IntermissionFont = FFont::FindFont("IntermissionFont"))) { - if (fileSystem.CheckNumForName("WINUM0") >= 0) + if (TexMan.CheckForTexture("WINUM0", ETextureType::MiscPatch).isValid()) { IntermissionFont = FFont::FindFont("IntermissionFont_Doom"); } diff --git a/source/common/rendering/gl/gl_postprocess.cpp b/source/common/rendering/gl/gl_postprocess.cpp index 4beed0577..949fee4b0 100644 --- a/source/common/rendering/gl/gl_postprocess.cpp +++ b/source/common/rendering/gl/gl_postprocess.cpp @@ -49,7 +49,7 @@ void FGLRenderer::RenderScreenQuad() { auto buffer = static_cast(screen->mVertexData->GetBufferObjects().first); buffer->Bind(nullptr); - glDrawArrays(GL_TRIANGLE_STRIP, FFlatVertexBuffer::PRESENT_INDEX, 4); + glDrawArrays(GL_TRIANGLE_STRIP, FFlatVertexBuffer::PRESENT_INDEX, 3); } void FGLRenderer::PostProcessScene(int fixedcm, float flash, const std::function &afterBloomDrawEndScene2D) diff --git a/source/common/rendering/hwrenderer/data/flatvertices.cpp b/source/common/rendering/hwrenderer/data/flatvertices.cpp index bdee1e5c1..47ae19ec3 100644 --- a/source/common/rendering/hwrenderer/data/flatvertices.cpp +++ b/source/common/rendering/hwrenderer/data/flatvertices.cpp @@ -63,9 +63,9 @@ FFlatVertexBuffer::FFlatVertexBuffer(int width, int height) // and this is for the postprocessing copy operation vbo_shadowdata[8].Set(-1.0f, -1.0f, 0, 0.0f, 0.0f); - vbo_shadowdata[9].Set(-1.0f, 1.0f, 0, 0.0f, 1.f); - vbo_shadowdata[10].Set(1.0f, -1.0f, 0, 1.f, 0.0f); - vbo_shadowdata[11].Set(1.0f, 1.0f, 0, 1.f, 1.f); + vbo_shadowdata[9].Set(3.0f, -1.0f, 0, 2.f, 0.0f); + vbo_shadowdata[10].Set(-1.0f, 3.0f, 0, 0.0f, 2.f); + vbo_shadowdata[11].Set(3.0f, 3.0f, 0, 2.f, 2.f); // Note: not used anymore // The next two are the stencil caps. vbo_shadowdata[12].Set(-32767.0f, 32767.0f, -32767.0f, 0, 0); diff --git a/source/common/rendering/v_framebuffer.cpp b/source/common/rendering/v_framebuffer.cpp index 315931d1e..4d55989c3 100644 --- a/source/common/rendering/v_framebuffer.cpp +++ b/source/common/rendering/v_framebuffer.cpp @@ -58,7 +58,7 @@ CVAR(Bool, gl_scale_viewport, true, CVAR_ARCHIVE); EXTERN_CVAR(Int, vid_maxfps) -EXTERN_CVAR(Bool, cl_capfps) +CVAR(Bool, cl_capfps, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) EXTERN_CVAR(Int, screenblocks) //========================================================================== diff --git a/source/common/rendering/v_video.cpp b/source/common/rendering/v_video.cpp index e2f4dbb9b..435768c98 100644 --- a/source/common/rendering/v_video.cpp +++ b/source/common/rendering/v_video.cpp @@ -72,13 +72,11 @@ CVAR(Int, win_w, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CVAR(Int, win_h, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CVAR(Bool, win_maximized, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) -int MinFPSRate = 35; - CUSTOM_CVAR(Int, vid_maxfps, 200, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { - if (self < MinFPSRate && self != 0) + if (self < GameTicRate && self != 0) { - self = MinFPSRate; + self = GameTicRate; } else if (self > 1000) { diff --git a/source/common/rendering/vulkan/renderer/vk_postprocess.cpp b/source/common/rendering/vulkan/renderer/vk_postprocess.cpp index ff2df7572..9d1702834 100644 --- a/source/common/rendering/vulkan/renderer/vk_postprocess.cpp +++ b/source/common/rendering/vulkan/renderer/vk_postprocess.cpp @@ -565,7 +565,7 @@ void VkPPRenderState::RenderScreenQuad(VkPPRenderPassSetup *passSetup, VulkanDes cmdbuffer->setStencilReference(VK_STENCIL_FRONT_AND_BACK, screen->stencilValue); if (pushConstantsSize > 0) cmdbuffer->pushConstants(passSetup->PipelineLayout.get(), VK_SHADER_STAGE_FRAGMENT_BIT, 0, pushConstantsSize, pushConstants); - cmdbuffer->draw(4, 1, FFlatVertexBuffer::PRESENT_INDEX, 0); + cmdbuffer->draw(3, 1, FFlatVertexBuffer::PRESENT_INDEX, 0); cmdbuffer->endRenderPass(); } diff --git a/source/common/rendering/vulkan/system/vk_framebuffer.cpp b/source/common/rendering/vulkan/system/vk_framebuffer.cpp index dd8ff2341..32d36447f 100644 --- a/source/common/rendering/vulkan/system/vk_framebuffer.cpp +++ b/source/common/rendering/vulkan/system/vk_framebuffer.cpp @@ -53,6 +53,7 @@ #include "vulkan/system/vk_builders.h" #include "vulkan/system/vk_swapchain.h" #include "engineerrors.h" +#include "c_dispatch.h" void Draw2D(F2DDrawer *drawer, FRenderState &state); @@ -68,6 +69,14 @@ extern bool gpuStatActive; extern bool keepGpuStatActive; extern FString gpuStatOutput; +CCMD(vk_memstats) +{ + VmaStats stats = {}; + vmaCalculateStats(GetVulkanFrameBuffer()->device->allocator, &stats); + Printf("Allocated objects: %d, used bytes: %d MB\n", (int)stats.total.allocationCount, (int)stats.total.usedBytes / (1024 * 1024)); + Printf("Unused range count: %d, unused bytes: %d MB\n", (int)stats.total.unusedRangeCount, (int)stats.total.unusedBytes / (1024 * 1024)); +} + VulkanFrameBuffer::VulkanFrameBuffer(void *hMonitor, bool fullscreen, VulkanDevice *dev) : Super(hMonitor, fullscreen) { diff --git a/source/core/mainloop.cpp b/source/core/mainloop.cpp index 63d554745..24382d7be 100644 --- a/source/core/mainloop.cpp +++ b/source/core/mainloop.cpp @@ -89,7 +89,7 @@ CVAR(Bool, vid_activeinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CVAR(Bool, r_ticstability, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) -CVAR(Bool, cl_capfps, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) +EXTERN_CVAR(Bool, cl_capfps) CVAR(Bool, cl_resumesavegame, true, CVAR_ARCHIVE) ticcmd_t playercmds[MAXPLAYERS];