mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- moved RenderView out of the framebuffer classes to complete the consolidation of the renderer's entry points.
This commit is contained in:
parent
9dceedd3b0
commit
10bc37b37e
14 changed files with 108 additions and 289 deletions
|
@ -113,6 +113,7 @@
|
|||
#include "scriptutil.h"
|
||||
#include "v_palette.h"
|
||||
#include "texturemanager.h"
|
||||
#include "hwrenderer/scene/hw_drawinfo.h"
|
||||
|
||||
#ifdef __unix__
|
||||
#include "i_system.h" // for SHARE_DIR
|
||||
|
@ -925,7 +926,7 @@ void D_Display ()
|
|||
|
||||
D_Render([&]()
|
||||
{
|
||||
viewsec = screen->RenderView(&players[consoleplayer]);
|
||||
viewsec = RenderView(&players[consoleplayer]);
|
||||
}, true);
|
||||
|
||||
screen->Begin2D();
|
||||
|
@ -3471,7 +3472,7 @@ void D_Cleanup()
|
|||
M_SaveDefaults(NULL); // save config before the restart
|
||||
|
||||
// delete all data that cannot be left until reinitialization
|
||||
if (screen) screen->CleanForRestart();
|
||||
CleanSWDrawer();
|
||||
V_ClearFonts(); // must clear global font pointers
|
||||
ColorSets.Clear();
|
||||
PainFlashes.Clear();
|
||||
|
|
|
@ -63,8 +63,6 @@
|
|||
|
||||
EXTERN_CVAR(Int, screenblocks)
|
||||
|
||||
extern bool NoInterpolateView;
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
|
@ -124,7 +122,6 @@ FGLRenderer::~FGLRenderer()
|
|||
}
|
||||
if (PortalQueryObject != 0) glDeleteQueries(1, &PortalQueryObject);
|
||||
|
||||
if (swdrawer) delete swdrawer;
|
||||
if (mBuffers) delete mBuffers;
|
||||
if (mSaveBuffers) delete mSaveBuffers;
|
||||
if (mPresentShader) delete mPresentShader;
|
||||
|
@ -140,19 +137,6 @@ FGLRenderer::~FGLRenderer()
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void FGLRenderer::ResetSWScene()
|
||||
{
|
||||
// force recreation of the SW scene drawer to ensure it gets a new set of resources.
|
||||
if (swdrawer != nullptr) delete swdrawer;
|
||||
swdrawer = nullptr;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
bool FGLRenderer::StartOffscreen()
|
||||
{
|
||||
bool firstBind = (mFBID == 0);
|
||||
|
|
|
@ -68,8 +68,6 @@ public:
|
|||
|
||||
//FRotator mAngles;
|
||||
|
||||
SWSceneDrawer *swdrawer = nullptr;
|
||||
|
||||
FGLRenderer(OpenGLFrameBuffer *fb);
|
||||
~FGLRenderer() ;
|
||||
|
||||
|
@ -77,8 +75,6 @@ public:
|
|||
|
||||
void ClearBorders();
|
||||
|
||||
void ResetSWScene();
|
||||
|
||||
void PresentStereo();
|
||||
void RenderScreenQuad();
|
||||
void PostProcessScene(int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D);
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#include "r_data/r_interpolate.h"
|
||||
#include "r_utility.h"
|
||||
#include "d_player.h"
|
||||
#include "i_time.h"
|
||||
#include "swrenderer/r_swscene.h"
|
||||
#include "swrenderer/r_renderer.h"
|
||||
#include "hwrenderer/dynlights/hw_dynlightdata.h"
|
||||
#include "hwrenderer/utility/hw_clock.h"
|
||||
|
@ -45,6 +47,16 @@
|
|||
#include "hwrenderer/scene/hw_portal.h"
|
||||
#include "hwrenderer/utility/hw_vrmodes.h"
|
||||
|
||||
EXTERN_CVAR(Bool, cl_capfps)
|
||||
extern bool NoInterpolateView;
|
||||
|
||||
static SWSceneDrawer *swdrawer;
|
||||
|
||||
void CleanSWDrawer()
|
||||
{
|
||||
if (swdrawer) delete swdrawer;
|
||||
swdrawer = nullptr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
|
@ -224,3 +236,84 @@ void WriteSavePic(player_t* player, FileWriter* file, int width, int height)
|
|||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// Renders the main view
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
sector_t* RenderView(player_t* player)
|
||||
{
|
||||
auto RenderState = screen->RenderState();
|
||||
RenderState->SetVertexBuffer(screen->mVertexData);
|
||||
screen->mVertexData->Reset();
|
||||
|
||||
sector_t* retsec;
|
||||
if (!V_IsHardwareRenderer())
|
||||
{
|
||||
screen->SetActiveRenderTarget(); // only relevant for Vulkan
|
||||
|
||||
if (!swdrawer) swdrawer = new SWSceneDrawer;
|
||||
retsec = swdrawer->RenderView(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
hw_ClearFakeFlat();
|
||||
|
||||
iter_dlightf = iter_dlight = draw_dlight = draw_dlightf = 0;
|
||||
|
||||
checkBenchActive();
|
||||
|
||||
// reset statistics counters
|
||||
ResetProfilingData();
|
||||
|
||||
// Get this before everything else
|
||||
if (cl_capfps || r_NoInterpolate) r_viewpoint.TicFrac = 1.;
|
||||
else r_viewpoint.TicFrac = I_GetTimeFrac();
|
||||
|
||||
screen->mLights->Clear();
|
||||
screen->mViewpoints->Clear();
|
||||
|
||||
// NoInterpolateView should have no bearing on camera textures, but needs to be preserved for the main view below.
|
||||
bool saved_niv = NoInterpolateView;
|
||||
NoInterpolateView = false;
|
||||
|
||||
// Shader start time does not need to be handled per level. Just use the one from the camera to render from.
|
||||
if (player->camera)
|
||||
RenderState->CheckTimer(player->camera->Level->ShaderStartTime);
|
||||
// prepare all camera textures that have been used in the last frame.
|
||||
// This must be done for all levels, not just the primary one!
|
||||
for (auto Level : AllLevels())
|
||||
{
|
||||
Level->canvasTextureInfo.UpdateAll([&](AActor* camera, FCanvasTexture* camtex, double fov)
|
||||
{
|
||||
screen->RenderTextureView(camtex, [=](IntRect& bounds)
|
||||
{
|
||||
FRenderViewpoint texvp;
|
||||
float ratio = camtex->aspectRatio;
|
||||
RenderViewpoint(texvp, camera, &bounds, fov, ratio, ratio, false, false);
|
||||
});
|
||||
});
|
||||
}
|
||||
NoInterpolateView = saved_niv;
|
||||
|
||||
// now render the main view
|
||||
float fovratio;
|
||||
float ratio = r_viewwindow.WidescreenRatio;
|
||||
if (r_viewwindow.WidescreenRatio >= 1.3f)
|
||||
{
|
||||
fovratio = 1.333333f;
|
||||
}
|
||||
else
|
||||
{
|
||||
fovratio = ratio;
|
||||
}
|
||||
|
||||
screen->ImageTransitionScene(true); // Only relevant for Vulkan.
|
||||
|
||||
retsec = RenderViewpoint(r_viewpoint, player->camera, NULL, r_viewpoint.FieldOfView.Degrees, ratio, fovratio, true, true);
|
||||
}
|
||||
All.Unclock();
|
||||
return retsec;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,8 +57,6 @@ EXTERN_CVAR(Bool, r_drawvoxels)
|
|||
EXTERN_CVAR(Int, gl_tonemap)
|
||||
EXTERN_CVAR(Bool, cl_capfps)
|
||||
|
||||
extern bool NoInterpolateView;
|
||||
|
||||
void gl_LoadExtensions();
|
||||
void gl_PrintStartupLog();
|
||||
void Draw2D(F2DDrawer *drawer, FRenderState &state);
|
||||
|
@ -228,89 +226,6 @@ void OpenGLFrameBuffer::RenderTextureView(FCanvasTexture* tex, std::function<voi
|
|||
static_cast<OpenGLFrameBuffer*>(screen)->camtexcount++;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
sector_t *OpenGLFrameBuffer::RenderView(player_t *player)
|
||||
{
|
||||
if (GLRenderer != nullptr)
|
||||
{
|
||||
gl_RenderState.SetVertexBuffer(screen->mVertexData);
|
||||
screen->mVertexData->Reset();
|
||||
sector_t* retsec;
|
||||
|
||||
if (!V_IsHardwareRenderer())
|
||||
{
|
||||
if (GLRenderer->swdrawer == nullptr) GLRenderer->swdrawer = new SWSceneDrawer;
|
||||
retsec = GLRenderer->swdrawer->RenderView(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
hw_ClearFakeFlat();
|
||||
|
||||
iter_dlightf = iter_dlight = draw_dlight = draw_dlightf = 0;
|
||||
|
||||
checkBenchActive();
|
||||
|
||||
// reset statistics counters
|
||||
ResetProfilingData();
|
||||
|
||||
// Get this before everything else
|
||||
if (cl_capfps || r_NoInterpolate) r_viewpoint.TicFrac = 1.;
|
||||
else r_viewpoint.TicFrac = I_GetTimeFrac();
|
||||
|
||||
screen->mLights->Clear();
|
||||
screen->mViewpoints->Clear();
|
||||
|
||||
// NoInterpolateView should have no bearing on camera textures, but needs to be preserved for the main view below.
|
||||
bool saved_niv = NoInterpolateView;
|
||||
NoInterpolateView = false;
|
||||
|
||||
// Shader start time does not need to be handled per level. Just use the one from the camera to render from.
|
||||
if (player->camera)
|
||||
gl_RenderState.CheckTimer(player->camera->Level->ShaderStartTime);
|
||||
// prepare all camera textures that have been used in the last frame.
|
||||
// This must be done for all levels, not just the primary one!
|
||||
for (auto Level : AllLevels())
|
||||
{
|
||||
Level->canvasTextureInfo.UpdateAll([&](AActor* camera, FCanvasTexture* camtex, double fov)
|
||||
{
|
||||
RenderTextureView(camtex, [=](IntRect &bounds)
|
||||
{
|
||||
FRenderViewpoint texvp;
|
||||
float ratio = camtex->aspectRatio;
|
||||
RenderViewpoint(texvp, camera, &bounds, fov, ratio, ratio, false, false);
|
||||
});
|
||||
});
|
||||
}
|
||||
NoInterpolateView = saved_niv;
|
||||
|
||||
|
||||
// now render the main view
|
||||
float fovratio;
|
||||
float ratio = r_viewwindow.WidescreenRatio;
|
||||
if (r_viewwindow.WidescreenRatio >= 1.3f)
|
||||
{
|
||||
fovratio = 1.333333f;
|
||||
}
|
||||
else
|
||||
{
|
||||
fovratio = ratio;
|
||||
}
|
||||
|
||||
retsec = RenderViewpoint(r_viewpoint, player->camera, NULL, r_viewpoint.FieldOfView.Degrees, ratio, fovratio, true, true);
|
||||
}
|
||||
All.Unclock();
|
||||
return retsec;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -388,12 +303,6 @@ void OpenGLFrameBuffer::SetVSync(bool vsync)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void OpenGLFrameBuffer::CleanForRestart()
|
||||
{
|
||||
if (GLRenderer)
|
||||
GLRenderer->ResetSWScene();
|
||||
}
|
||||
|
||||
void OpenGLFrameBuffer::SetTextureFilterMode()
|
||||
{
|
||||
if (GLRenderer != nullptr && GLRenderer->mSamplerManager != nullptr) GLRenderer->mSamplerManager->SetTextureFilterMode();
|
||||
|
|
|
@ -38,11 +38,9 @@ public:
|
|||
bool FlipSavePic() const override { return true; }
|
||||
|
||||
FRenderState* RenderState() override;
|
||||
void CleanForRestart() override;
|
||||
void UpdatePalette() override;
|
||||
uint32_t GetCaps() override;
|
||||
const char* DeviceName() const override;
|
||||
sector_t *RenderView(player_t *player) override;
|
||||
void SetTextureFilterMode() override;
|
||||
IHardwareTexture *CreateHardwareTexture() override;
|
||||
void PrecacheMaterial(FMaterial *mat, int translation) override;
|
||||
|
|
|
@ -329,5 +329,7 @@ public:
|
|||
|
||||
};
|
||||
|
||||
void CleanSWDrawer();
|
||||
sector_t* RenderViewpoint(FRenderViewpoint& mainvp, AActor* camera, IntRect* bounds, float fov, float ratio, float fovratio, bool mainview, bool toscreen);
|
||||
void WriteSavePic(player_t* player, FileWriter* file, int width, int height);
|
||||
sector_t* RenderView(player_t* player);
|
||||
|
|
|
@ -59,7 +59,6 @@ EXTERN_CVAR(Int, gl_tonemap)
|
|||
EXTERN_CVAR(Int, screenblocks)
|
||||
EXTERN_CVAR(Bool, cl_capfps)
|
||||
|
||||
extern bool NoInterpolateView;
|
||||
extern int rendered_commandbuffers;
|
||||
extern int current_rendered_commandbuffers;
|
||||
|
||||
|
@ -217,79 +216,6 @@ void PolyFrameBuffer::Update()
|
|||
}
|
||||
|
||||
|
||||
sector_t *PolyFrameBuffer::RenderView(player_t *player)
|
||||
{
|
||||
// To do: this is virtually identical to FGLRenderer::RenderView and should be merged.
|
||||
|
||||
mRenderState->SetVertexBuffer(mVertexData);
|
||||
mVertexData->Reset();
|
||||
|
||||
sector_t *retsec;
|
||||
if (!V_IsHardwareRenderer())
|
||||
{
|
||||
if (!swdrawer) swdrawer.reset(new SWSceneDrawer);
|
||||
retsec = swdrawer->RenderView(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
hw_ClearFakeFlat();
|
||||
|
||||
iter_dlightf = iter_dlight = draw_dlight = draw_dlightf = 0;
|
||||
|
||||
checkBenchActive();
|
||||
|
||||
// reset statistics counters
|
||||
ResetProfilingData();
|
||||
|
||||
// Get this before everything else
|
||||
if (cl_capfps || r_NoInterpolate) r_viewpoint.TicFrac = 1.;
|
||||
else r_viewpoint.TicFrac = I_GetTimeFrac();
|
||||
|
||||
mLights->Clear();
|
||||
mViewpoints->Clear();
|
||||
|
||||
// NoInterpolateView should have no bearing on camera textures, but needs to be preserved for the main view below.
|
||||
bool saved_niv = NoInterpolateView;
|
||||
NoInterpolateView = false;
|
||||
|
||||
// Shader start time does not need to be handled per level. Just use the one from the camera to render from.
|
||||
if (player->camera)
|
||||
GetRenderState()->CheckTimer(player->camera->Level->ShaderStartTime);
|
||||
// prepare all camera textures that have been used in the last frame.
|
||||
// This must be done for all levels, not just the primary one!
|
||||
for (auto Level : AllLevels())
|
||||
{
|
||||
Level->canvasTextureInfo.UpdateAll([&](AActor *camera, FCanvasTexture *camtex, double fov)
|
||||
{
|
||||
RenderTextureView(camtex, [=](IntRect &bounds)
|
||||
{
|
||||
FRenderViewpoint texvp;
|
||||
float ratio = camtex->aspectRatio;
|
||||
RenderViewpoint(texvp, camera, &bounds, fov, ratio, ratio, false, false);
|
||||
});
|
||||
});
|
||||
}
|
||||
NoInterpolateView = saved_niv;
|
||||
|
||||
// now render the main view
|
||||
float fovratio;
|
||||
float ratio = r_viewwindow.WidescreenRatio;
|
||||
if (r_viewwindow.WidescreenRatio >= 1.3f)
|
||||
{
|
||||
fovratio = 1.333333f;
|
||||
}
|
||||
else
|
||||
{
|
||||
fovratio = ratio;
|
||||
}
|
||||
|
||||
retsec = RenderViewpoint(r_viewpoint, player->camera, NULL, r_viewpoint.FieldOfView.Degrees, ratio, fovratio, true, true);
|
||||
}
|
||||
All.Unclock();
|
||||
return retsec;
|
||||
}
|
||||
|
||||
|
||||
void PolyFrameBuffer::RenderTextureView(FCanvasTexture* tex, std::function<void(IntRect &)> renderFunc)
|
||||
{
|
||||
auto BaseLayer = static_cast<PolyHardwareTexture*>(tex->GetHardwareTexture(0, 0));
|
||||
|
@ -384,12 +310,6 @@ void PolyFrameBuffer::SetVSync(bool vsync)
|
|||
cur_vsync = vsync;
|
||||
}
|
||||
|
||||
void PolyFrameBuffer::CleanForRestart()
|
||||
{
|
||||
// force recreation of the SW scene drawer to ensure it gets a new set of resources.
|
||||
swdrawer.reset();
|
||||
}
|
||||
|
||||
FRenderState* PolyFrameBuffer::RenderState()
|
||||
{
|
||||
return mRenderState.get();
|
||||
|
|
|
@ -24,8 +24,6 @@ public:
|
|||
|
||||
unsigned int GetLightBufferBlockSize() const;
|
||||
|
||||
std::unique_ptr<SWSceneDrawer> swdrawer;
|
||||
|
||||
PolyFrameBuffer(void *hMonitor, bool fullscreen);
|
||||
~PolyFrameBuffer();
|
||||
|
||||
|
@ -36,11 +34,9 @@ public:
|
|||
void InitializeState() override;
|
||||
|
||||
FRenderState* RenderState() override;
|
||||
void CleanForRestart() override;
|
||||
void PrecacheMaterial(FMaterial *mat, int translation) override;
|
||||
void UpdatePalette() override;
|
||||
uint32_t GetCaps() override;
|
||||
sector_t *RenderView(player_t *player) override;
|
||||
void SetTextureFilterMode() override;
|
||||
void TextureFilterChanged() override;
|
||||
void BeginFrame() override;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <memory>
|
||||
|
||||
class FWrapperTexture;
|
||||
class DCanvas;
|
||||
|
||||
class SWSceneDrawer
|
||||
{
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "hwrenderer/scene/hw_portal.h"
|
||||
#include "hwrenderer/utility/hw_clock.h"
|
||||
#include "hwrenderer/data/flatvertices.h"
|
||||
#include "swrenderer/r_swscene.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
|
|
@ -215,7 +215,6 @@ public:
|
|||
IntRect mOutputLetterbox;
|
||||
float mSceneClearColor[4];
|
||||
|
||||
|
||||
public:
|
||||
DFrameBuffer (int width=1, int height=1);
|
||||
virtual ~DFrameBuffer();
|
||||
|
@ -261,7 +260,6 @@ public:
|
|||
virtual void SetVSync (bool vsync);
|
||||
|
||||
// Delete any resources that need to be deleted after restarting with a different IWAD
|
||||
virtual void CleanForRestart() {}
|
||||
virtual void SetTextureFilterMode() {}
|
||||
virtual IHardwareTexture *CreateHardwareTexture() { return nullptr; }
|
||||
virtual void PrecacheMaterial(FMaterial *mat, int translation) {}
|
||||
|
@ -309,7 +307,6 @@ public:
|
|||
virtual uint32_t GetCaps();
|
||||
virtual int Backend() { return 0; }
|
||||
virtual const char* DeviceName() const { return "Unknown"; }
|
||||
virtual sector_t *RenderView(player_t *player) { return nullptr; }
|
||||
virtual void AmbientOccludeScene(float m5) {}
|
||||
virtual void FirstEye() {}
|
||||
virtual void NextEye(int eyecount) {}
|
||||
|
@ -321,6 +318,7 @@ public:
|
|||
virtual void CopyScreenToBuffer(int width, int height, uint8_t* buffer) { memset(buffer, 0, width* height); }
|
||||
virtual bool FlipSavePic() const { return false; }
|
||||
virtual void RenderTextureView(FCanvasTexture* tex, std::function<void(IntRect&)> renderFunc) {}
|
||||
virtual void SetActiveRenderTarget() {}
|
||||
|
||||
|
||||
// Screen wiping
|
||||
|
|
|
@ -67,7 +67,6 @@ EXTERN_CVAR(Int, gl_tonemap)
|
|||
EXTERN_CVAR(Int, screenblocks)
|
||||
EXTERN_CVAR(Bool, cl_capfps)
|
||||
|
||||
extern bool NoInterpolateView;
|
||||
extern int rendered_commandbuffers;
|
||||
int current_rendered_commandbuffers;
|
||||
|
||||
|
@ -317,82 +316,6 @@ void VulkanFrameBuffer::WaitForCommands(bool finish)
|
|||
}
|
||||
}
|
||||
|
||||
sector_t *VulkanFrameBuffer::RenderView(player_t *player)
|
||||
{
|
||||
// To do: this is virtually identical to FGLRenderer::RenderView and should be merged.
|
||||
|
||||
mRenderState->SetVertexBuffer(screen->mVertexData);
|
||||
screen->mVertexData->Reset();
|
||||
|
||||
sector_t *retsec;
|
||||
if (!V_IsHardwareRenderer())
|
||||
{
|
||||
mPostprocess->SetActiveRenderTarget();
|
||||
|
||||
if (!swdrawer) swdrawer.reset(new SWSceneDrawer);
|
||||
retsec = swdrawer->RenderView(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
hw_ClearFakeFlat();
|
||||
|
||||
iter_dlightf = iter_dlight = draw_dlight = draw_dlightf = 0;
|
||||
|
||||
checkBenchActive();
|
||||
|
||||
// reset statistics counters
|
||||
ResetProfilingData();
|
||||
|
||||
// Get this before everything else
|
||||
if (cl_capfps || r_NoInterpolate) r_viewpoint.TicFrac = 1.;
|
||||
else r_viewpoint.TicFrac = I_GetTimeFrac();
|
||||
|
||||
screen->mLights->Clear();
|
||||
screen->mViewpoints->Clear();
|
||||
|
||||
// NoInterpolateView should have no bearing on camera textures, but needs to be preserved for the main view below.
|
||||
bool saved_niv = NoInterpolateView;
|
||||
NoInterpolateView = false;
|
||||
|
||||
// Shader start time does not need to be handled per level. Just use the one from the camera to render from.
|
||||
if (player->camera)
|
||||
GetRenderState()->CheckTimer(player->camera->Level->ShaderStartTime);
|
||||
// prepare all camera textures that have been used in the last frame.
|
||||
// This must be done for all levels, not just the primary one!
|
||||
for (auto Level : AllLevels())
|
||||
{
|
||||
Level->canvasTextureInfo.UpdateAll([&](AActor *camera, FCanvasTexture *camtex, double fov)
|
||||
{
|
||||
RenderTextureView(camtex, [=](IntRect &bounds)
|
||||
{
|
||||
FRenderViewpoint texvp;
|
||||
float ratio = camtex->aspectRatio;
|
||||
RenderViewpoint(texvp, camera, &bounds, fov, ratio, ratio, false, false);
|
||||
});
|
||||
});
|
||||
}
|
||||
NoInterpolateView = saved_niv;
|
||||
|
||||
// now render the main view
|
||||
float fovratio;
|
||||
float ratio = r_viewwindow.WidescreenRatio;
|
||||
if (r_viewwindow.WidescreenRatio >= 1.3f)
|
||||
{
|
||||
fovratio = 1.333333f;
|
||||
}
|
||||
else
|
||||
{
|
||||
fovratio = ratio;
|
||||
}
|
||||
|
||||
mPostprocess->ImageTransitionScene(true); // This is the only line that differs compared to FGLRenderer::RenderView
|
||||
|
||||
retsec = RenderViewpoint(r_viewpoint, player->camera, NULL, r_viewpoint.FieldOfView.Degrees, ratio, fovratio, true, true);
|
||||
}
|
||||
All.Unclock();
|
||||
return retsec;
|
||||
}
|
||||
|
||||
void VulkanFrameBuffer::RenderTextureView(FCanvasTexture* tex, std::function<void(IntRect &)> renderFunc)
|
||||
{
|
||||
auto BaseLayer = static_cast<VkHardwareTexture*>(tex->GetHardwareTexture(0, 0));
|
||||
|
@ -462,12 +385,6 @@ void VulkanFrameBuffer::SetVSync(bool vsync)
|
|||
cur_vsync = vsync;
|
||||
}
|
||||
|
||||
void VulkanFrameBuffer::CleanForRestart()
|
||||
{
|
||||
// force recreation of the SW scene drawer to ensure it gets a new set of resources.
|
||||
swdrawer.reset();
|
||||
}
|
||||
|
||||
void VulkanFrameBuffer::PrecacheMaterial(FMaterial *mat, int translation)
|
||||
{
|
||||
if (mat->Source()->GetUseType() == ETextureType::SWCanvas) return;
|
||||
|
@ -638,6 +555,12 @@ void VulkanFrameBuffer::CopyScreenToBuffer(int w, int h, uint8_t *data)
|
|||
staging->Unmap();
|
||||
}
|
||||
|
||||
void VulkanFrameBuffer::SetActiveRenderTarget()
|
||||
{
|
||||
mPostprocess->SetActiveRenderTarget();
|
||||
}
|
||||
|
||||
|
||||
TArray<uint8_t> VulkanFrameBuffer::GetScreenshotBuffer(int &pitch, ESSType &color_type, float &gamma)
|
||||
{
|
||||
int w = SCREENWIDTH;
|
||||
|
|
|
@ -64,8 +64,6 @@ public:
|
|||
std::vector<std::unique_ptr<VulkanCommandBuffer>> CommandBuffers;
|
||||
} FrameDeleteList;
|
||||
|
||||
std::unique_ptr<SWSceneDrawer> swdrawer;
|
||||
|
||||
VulkanFrameBuffer(void *hMonitor, bool fullscreen, VulkanDevice *dev);
|
||||
~VulkanFrameBuffer();
|
||||
bool IsVulkan() override { return true; }
|
||||
|
@ -74,13 +72,11 @@ public:
|
|||
|
||||
void InitializeState() override;
|
||||
|
||||
void CleanForRestart() override;
|
||||
void PrecacheMaterial(FMaterial *mat, int translation) override;
|
||||
void UpdatePalette() override;
|
||||
uint32_t GetCaps() override;
|
||||
const char* DeviceName() const override;
|
||||
int Backend() override { return 1; }
|
||||
sector_t *RenderView(player_t *player) override;
|
||||
void SetTextureFilterMode() override;
|
||||
void TextureFilterChanged() override;
|
||||
void StartPrecaching() override;
|
||||
|
@ -92,6 +88,7 @@ public:
|
|||
void UpdateShadowMap() override;
|
||||
void SetSaveBuffers(bool yes) override;
|
||||
void ImageTransitionScene(bool unknown) override;
|
||||
void SetActiveRenderTarget() override;
|
||||
|
||||
IHardwareTexture *CreateHardwareTexture() override;
|
||||
FMaterial* CreateMaterial(FGameTexture* tex, int scaleflags) override;
|
||||
|
|
Loading…
Reference in a new issue