mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-14 06:34:10 +00:00
It's compiling!
This commit is contained in:
parent
025ba4419e
commit
535e56f580
14 changed files with 288 additions and 45 deletions
|
@ -1294,7 +1294,7 @@ void idCommonLocal::Init( int argc, const char* const* argv, const char* cmdline
|
|||
cvarSystem->ClearModifiedFlags( CVAR_ARCHIVE );
|
||||
|
||||
// init OpenGL, which will open a window and connect sound and input hardware
|
||||
renderSystem->InitOpenGL();
|
||||
renderSystem->InitBackend();
|
||||
|
||||
// Support up to 2 digits after the decimal point
|
||||
com_engineHz_denominator = 100LL * com_engineHz.GetFloat();
|
||||
|
|
|
@ -103,9 +103,7 @@ const int MAX_EXPRESSION_REGISTERS = 4096;
|
|||
#endif
|
||||
|
||||
// FIMXE remove GL with NVRHI
|
||||
// RB: replaced QGL with GLEW
|
||||
#include <GL/glew.h>
|
||||
// RB end
|
||||
#include <GL/glew.h>
|
||||
|
||||
|
||||
#include "../renderer/Cinematic.h"
|
||||
|
|
|
@ -1705,6 +1705,30 @@ void idMaterial::ParseStage( idLexer& src, const textureRepeat_t trpDefault )
|
|||
ts->texgen = TG_SCREEN;
|
||||
continue;
|
||||
}
|
||||
|
||||
if( !token.Icmp( "guiRenderMap" ) )
|
||||
{
|
||||
// Emit fullscreen view of the gui to this dynamically generated texture
|
||||
ts->dynamic = DI_GUI_RENDER;
|
||||
ts->width = src.ParseInt();
|
||||
ts->height = src.ParseInt();
|
||||
continue;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if( !token.Icmp( "renderTargetMap" ) )
|
||||
{
|
||||
// Emit fullscreen view of the gui to this dynamically generated texture
|
||||
idToken otherMaterialToken;
|
||||
ts->dynamic = DI_RENDER_TARGET;
|
||||
src.ReadToken( &otherMaterialToken );
|
||||
ts->renderTargetMaterial = declManager->FindMaterial( otherMaterialToken.c_str() );
|
||||
ts->width = src.ParseInt();
|
||||
ts->height = src.ParseInt();
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if( !token.Icmp( "screen" ) )
|
||||
{
|
||||
ts->texgen = TG_SCREEN;
|
||||
|
|
|
@ -3855,6 +3855,15 @@ void idRenderModelStatic::TouchData()
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
idRenderModelStatic::CreateBuffers
|
||||
=================
|
||||
*/
|
||||
void idRenderModelStatic::CreateBuffers( nvrhi::ICommandList* commandList )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
idRenderModelStatic::DeleteSurfaceWithId
|
||||
|
|
|
@ -6093,6 +6093,7 @@ void idRenderBackend::DrawViewInternal( const viewDef_t* _viewDef, const int ste
|
|||
// TODO(Stephen): implement bloom
|
||||
#if !defined( USE_NVRHI )
|
||||
Bloom( _viewDef );
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(__APPLE__)
|
||||
|
|
|
@ -963,6 +963,11 @@ public:
|
|||
|
||||
public:
|
||||
// renderer globals
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
nvrhi::CommandListHandle commandList;
|
||||
#endif
|
||||
|
||||
bool registered; // cleared at shutdown, set at InitOpenGL
|
||||
|
||||
bool takingScreenshot;
|
||||
|
|
|
@ -560,7 +560,6 @@ void idRenderProgManager::Shutdown()
|
|||
idRenderProgManager::FindVertexShader
|
||||
================================================================================================
|
||||
*/
|
||||
/*
|
||||
int idRenderProgManager::FindShader( const char* name, rpStage_t stage )
|
||||
{
|
||||
idStr shaderName( name );
|
||||
|
@ -594,7 +593,6 @@ int idRenderProgManager::FindShader( const char* name, rpStage_t stage )
|
|||
|
||||
return index;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
int idRenderProgManager::FindShader( const char* name, rpStage_t stage, const char* nameOutSuffix, uint32 features, bool builtin, vertexLayoutType_t vertexLayout )
|
||||
|
|
|
@ -1661,8 +1661,26 @@ idStr idRenderProgManager::ConvertCG2GLSL( const idStr& in, const char* name, rp
|
|||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
================================================================================================
|
||||
idRenderProgManager::GetGLSLParmName
|
||||
================================================================================================
|
||||
*/
|
||||
const char* idRenderProgManager::GetGLSLParmName( int rp ) const
|
||||
{
|
||||
assert( rp < RENDERPARM_TOTAL );
|
||||
return GLSLParmNames[ rp ];
|
||||
}
|
||||
|
||||
// RB begin
|
||||
const char* idRenderProgManager::GetGLSLMacroName( shaderFeature_t sf ) const
|
||||
{
|
||||
assert( sf < MAX_SHADER_MACRO_NAMES );
|
||||
|
||||
return GLSLMacroNames[ sf ];
|
||||
}
|
||||
|
||||
#if !defined( USE_NVRHI )
|
||||
/*
|
||||
================================================================================================
|
||||
idRenderProgManager::FindGLSLProgram
|
||||
|
@ -1685,26 +1703,6 @@ int idRenderProgManager::FindGLSLProgram( const char* name, int vIndex, int fIn
|
|||
return index;
|
||||
}
|
||||
|
||||
/*
|
||||
================================================================================================
|
||||
idRenderProgManager::GetGLSLParmName
|
||||
================================================================================================
|
||||
*/
|
||||
const char* idRenderProgManager::GetGLSLParmName( int rp ) const
|
||||
{
|
||||
assert( rp < RENDERPARM_TOTAL );
|
||||
return GLSLParmNames[ rp ];
|
||||
}
|
||||
|
||||
// RB begin
|
||||
const char* idRenderProgManager::GetGLSLMacroName( shaderFeature_t sf ) const
|
||||
{
|
||||
assert( sf < MAX_SHADER_MACRO_NAMES );
|
||||
|
||||
return GLSLMacroNames[ sf ];
|
||||
}
|
||||
// RB end
|
||||
|
||||
/*
|
||||
================================================================================================
|
||||
idRenderProgManager::SetUniformValue
|
||||
|
@ -1729,3 +1727,4 @@ void idRenderProgManager::ZeroUniforms()
|
|||
memset( uniforms.Ptr(), 0, uniforms.Allocated() );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1297,6 +1297,6 @@ bool idRenderSystemLocal::UploadImage( const char* imageName, const byte* data,
|
|||
{
|
||||
return false;
|
||||
}
|
||||
image->UploadScratch( data, width, height );
|
||||
image->UploadScratch( data, width, height, nullptr );
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,10 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "RenderCommon.h"
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
#include "sys/DeviceManager.h"
|
||||
#endif
|
||||
|
||||
// RB begin
|
||||
#if defined(_WIN32)
|
||||
|
||||
|
@ -50,6 +54,9 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "../framework/Common_local.h"
|
||||
#endif
|
||||
|
||||
//#include "idlib/HandleManager.h"
|
||||
|
||||
|
||||
// DeviceContext bypasses RenderSystem to work directly with this
|
||||
idGuiModel* tr_guiModel;
|
||||
|
||||
|
@ -279,6 +286,7 @@ idCVar r_shadowMapSunDepthBiasScale( "r_shadowMapSunDepthBiasScale", "0.999991",
|
|||
#endif
|
||||
|
||||
idCVar r_hdrAutoExposure( "r_hdrAutoExposure", "0", CVAR_RENDERER | CVAR_BOOL, "EXPENSIVE: enables adapative HDR tone mapping otherwise the exposure is derived by r_exposure" );
|
||||
idCVar r_hdrAdaptionRate( "r_hdrAdaptionRate", "3", CVAR_RENDERER | CVAR_FLOAT, "The rate of adapting the hdr exposure value`. Defaulted to a third of a second." );
|
||||
idCVar r_hdrMinLuminance( "r_hdrMinLuminance", "0.005", CVAR_RENDERER | CVAR_FLOAT, "" );
|
||||
idCVar r_hdrMaxLuminance( "r_hdrMaxLuminance", "300", CVAR_RENDERER | CVAR_FLOAT, "" );
|
||||
idCVar r_hdrKey( "r_hdrKey", "0.015", CVAR_RENDERER | CVAR_FLOAT, "magic exposure key that works well with Doom 3 maps" );
|
||||
|
@ -446,34 +454,30 @@ void R_SetNewMode( const bool fullInit )
|
|||
if( fullInit )
|
||||
{
|
||||
// create the context as well as setting up the window
|
||||
// SRS - Generalized Vulkan SDL platform
|
||||
#if defined(VULKAN_USE_PLATFORM_SDL)
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
deviceManager = DeviceManager::Create( nvrhi::GraphicsAPI::D3D12 );
|
||||
#elif defined(VULKAN_USE_PLATFORM_SDL)
|
||||
if( VKimp_Init( parms ) )
|
||||
#else
|
||||
if( GLimp_Init( parms ) )
|
||||
#endif
|
||||
{
|
||||
// it worked
|
||||
|
||||
// DG: ImGui must be initialized after the window has been created, it needs an opengl context
|
||||
ImGuiHook::Init( parms.width, parms.height );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// just rebuild the window
|
||||
// SRS - Generalized Vulkan SDL platform
|
||||
|
||||
#if defined(VULKAN_USE_PLATFORM_SDL)
|
||||
if( VKimp_SetScreenParms( parms ) )
|
||||
#else
|
||||
if( GLimp_SetScreenParms( parms ) )
|
||||
#endif
|
||||
{
|
||||
// it worked
|
||||
|
||||
// DG: ImGui must know about the changed window size
|
||||
Framebuffer::ResizeFramebuffers();
|
||||
ImGuiHook::NotifyDisplaySizeChanged( parms.width, parms.height );
|
||||
break;
|
||||
}
|
||||
|
@ -513,6 +517,11 @@ static void R_ReloadSurface_f( const idCmdArgs& args )
|
|||
modelTrace_t mt;
|
||||
idVec3 start, end;
|
||||
|
||||
if( !tr.primaryView )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// start far enough away that we don't hit the player model
|
||||
start = tr.primaryView->renderView.vieworg + tr.primaryView->renderView.viewaxis[0] * 16;
|
||||
end = start + tr.primaryView->renderView.viewaxis[0] * 1000.0f;
|
||||
|
@ -526,8 +535,19 @@ static void R_ReloadSurface_f( const idCmdArgs& args )
|
|||
// reload the decl
|
||||
mt.material->base->Reload();
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
nvrhi::CommandListHandle commandList = deviceManager->GetDevice()->createCommandList();
|
||||
|
||||
commandList->open();
|
||||
#endif
|
||||
|
||||
// reload any images used by the decl
|
||||
mt.material->ReloadImages( false );
|
||||
mt.material->ReloadImages( false, commandList );
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
commandList->close();
|
||||
deviceManager->GetDevice()->executeCommandList( commandList );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -33,6 +33,11 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "RenderCommon.h"
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
#include <sys/DeviceManager.h>
|
||||
extern DeviceManager* deviceManager;
|
||||
#endif
|
||||
|
||||
/*
|
||||
===================
|
||||
R_ListRenderLightDefs_f
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013-2014 Robert Beckebans
|
||||
Copyright (C) 2022 Stephen Pridham
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
|
@ -48,6 +49,11 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "rc/doom_resource.h"
|
||||
#include "../../renderer/RenderCommon.h"
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
#include <sys/DeviceManager.h>
|
||||
extern DeviceManager* deviceManager;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
@ -610,7 +616,7 @@ static void GLW_CreateWindowClasses()
|
|||
}
|
||||
common->Printf( "...registered window class\n" );
|
||||
|
||||
#if !defined(USE_VULKAN)
|
||||
#if !defined(USE_VULKAN) && !defined(USE_DX12)
|
||||
// now register the fake window class that is only used
|
||||
// to get wgl extensions
|
||||
wc.style = 0;
|
||||
|
@ -1059,6 +1065,122 @@ static bool GLW_GetWindowDimensions( const glimpParms_t parms, int& x, int& y, i
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool DeviceManager::CreateWindowDeviceAndSwapChain( const glimpParms_t& parms, const char* windowTitle )
|
||||
{
|
||||
int x, y, w, h;
|
||||
x = 0;
|
||||
y = 0;
|
||||
w = parms.width;
|
||||
h = parms.height;
|
||||
|
||||
int stylebits;
|
||||
int exstyle;
|
||||
|
||||
if( parms.fullScreen != 0 )
|
||||
{
|
||||
exstyle = WS_EX_TOPMOST;
|
||||
stylebits = WS_POPUP | WS_VISIBLE | WS_SYSMENU;
|
||||
}
|
||||
else
|
||||
{
|
||||
exstyle = 0;
|
||||
stylebits = WINDOW_STYLE | WS_SYSMENU;
|
||||
}
|
||||
|
||||
win32.hWnd = CreateWindowEx(
|
||||
exstyle,
|
||||
WIN32_WINDOW_CLASS_NAME,
|
||||
GAME_NAME,
|
||||
stylebits,
|
||||
x, y, w, h,
|
||||
NULL,
|
||||
NULL,
|
||||
win32.hInstance,
|
||||
NULL );
|
||||
|
||||
windowHandle = win32.hWnd;
|
||||
|
||||
if( !win32.hWnd )
|
||||
{
|
||||
common->Printf( "^3GLW_CreateWindow() - Couldn't create window^0\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
::SetTimer( win32.hWnd, 0, 100, NULL );
|
||||
|
||||
ShowWindow( win32.hWnd, SW_SHOW );
|
||||
UpdateWindow( win32.hWnd );
|
||||
common->Printf( "...created window @ %d,%d (%dx%d)\n", x, y, w, h );
|
||||
|
||||
// makeCurrent NULL frees the DC, so get another
|
||||
win32.hDC = GetDC( win32.hWnd );
|
||||
if( !win32.hDC )
|
||||
{
|
||||
common->Printf( "^3GLW_CreateWindow() - GetDC()failed^0\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !CreateDeviceAndSwapChain() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SetForegroundWindow( win32.hWnd );
|
||||
SetFocus( win32.hWnd );
|
||||
|
||||
glConfig.isFullscreen = parms.fullScreen;
|
||||
|
||||
UpdateWindowSize();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DeviceManager::UpdateWindowSize()
|
||||
{
|
||||
// get the current monitor position and size on the desktop, assuming
|
||||
// any required ChangeDisplaySettings has already been done
|
||||
RECT rect;
|
||||
if( ::GetClientRect( win32.hWnd, &rect ) )
|
||||
{
|
||||
if( rect.right > rect.left && rect.bottom > rect.top )
|
||||
{
|
||||
// save the window size in cvars if we aren't fullscreen
|
||||
int style = GetWindowLong( win32.hWnd, GWL_STYLE );
|
||||
|
||||
glConfig.nativeScreenWidth = rect.right - rect.left;
|
||||
glConfig.nativeScreenHeight = rect.bottom - rect.top;
|
||||
}
|
||||
}
|
||||
|
||||
if( glConfig.nativeScreenWidth == 0 || glConfig.nativeScreenHeight == 0 )
|
||||
{
|
||||
// window is minimized
|
||||
windowVisible = false;
|
||||
return;
|
||||
}
|
||||
|
||||
windowVisible = true;
|
||||
|
||||
if( int( deviceParms.backBufferWidth ) != glConfig.nativeScreenWidth ||
|
||||
int( deviceParms.backBufferHeight ) != glConfig.nativeScreenHeight ||
|
||||
( deviceParms.vsyncEnabled != requestedVSync && GetGraphicsAPI() == nvrhi::GraphicsAPI::VULKAN ) )
|
||||
{
|
||||
// window is not minimized, and the size has changed
|
||||
|
||||
BackBufferResizing();
|
||||
|
||||
deviceParms.backBufferWidth = glConfig.nativeScreenWidth;
|
||||
deviceParms.backBufferHeight = glConfig.nativeScreenHeight;
|
||||
deviceParms.vsyncEnabled = requestedVSync;
|
||||
|
||||
ResizeSwapChain();
|
||||
//BackBufferResized();
|
||||
}
|
||||
|
||||
deviceParms.vsyncEnabled = requestedVSync;
|
||||
}
|
||||
|
||||
/*
|
||||
=======================
|
||||
GLW_CreateWindow
|
||||
|
@ -1254,6 +1376,11 @@ static bool GLW_ChangeDislaySettingsIfNeeded( glimpParms_t parms )
|
|||
return false;
|
||||
}
|
||||
|
||||
void DeviceManager::SetWindowTitle( const char* title )
|
||||
{
|
||||
SetWindowTextA( ( HWND )windowHandle, title );
|
||||
}
|
||||
|
||||
void GLimp_PreInit()
|
||||
{
|
||||
// DG: not needed on this platform, so just do nothing
|
||||
|
@ -1306,7 +1433,7 @@ bool GLimp_Init( glimpParms_t parms )
|
|||
// create our window classes if we haven't already
|
||||
GLW_CreateWindowClasses();
|
||||
|
||||
#if !defined(USE_VULKAN)
|
||||
#if !defined( USE_VULKAN ) && !defined( USE_NVRHI )
|
||||
// this will load the dll and set all our gl* function pointers,
|
||||
// but doesn't create a window
|
||||
|
||||
|
@ -1324,8 +1451,13 @@ bool GLimp_Init( glimpParms_t parms )
|
|||
|
||||
// try to create a window with the correct pixel format
|
||||
// and init the renderer context
|
||||
#if defined( USE_NVRHI )
|
||||
if( !deviceManager->CreateWindowDeviceAndSwapChain( parms, GAME_NAME ) )
|
||||
#else
|
||||
if( !GLW_CreateWindow( parms ) )
|
||||
#endif
|
||||
{
|
||||
//deviceManager->Shutdown();
|
||||
GLimp_Shutdown();
|
||||
return false;
|
||||
}
|
||||
|
@ -1358,7 +1490,7 @@ bool GLimp_Init( glimpParms_t parms )
|
|||
}
|
||||
|
||||
// RB: we probably have a new OpenGL 3.2 core context so reinitialize GLEW
|
||||
#if !defined(USE_VULKAN)
|
||||
#if !defined( USE_VULKAN ) && !defined( USE_NVRHI )
|
||||
GLenum glewResult = glewInit();
|
||||
if( GLEW_OK != glewResult )
|
||||
{
|
||||
|
@ -1409,6 +1541,7 @@ bool GLimp_SetScreenParms( glimpParms_t parms )
|
|||
stylebits = WINDOW_STYLE | WS_SYSMENU;
|
||||
}
|
||||
|
||||
// TODO(Stephen): Update the swap chain.
|
||||
SetWindowLong( win32.hWnd, GWL_STYLE, stylebits );
|
||||
SetWindowLong( win32.hWnd, GWL_EXSTYLE, exstyle );
|
||||
SetWindowPos( win32.hWnd, parms.fullScreen ? HWND_TOPMOST : HWND_NOTOPMOST, x, y, w, h, SWP_SHOWWINDOW );
|
||||
|
@ -1423,6 +1556,43 @@ bool GLimp_SetScreenParms( glimpParms_t parms )
|
|||
return true;
|
||||
}
|
||||
|
||||
void DeviceManager::Shutdown()
|
||||
{
|
||||
DestroyDeviceAndSwapChain();
|
||||
|
||||
const char* success[] = { "failed", "success" };
|
||||
int retVal;
|
||||
|
||||
// release DC
|
||||
if( win32.hDC )
|
||||
{
|
||||
retVal = ReleaseDC( win32.hWnd, win32.hDC ) != 0;
|
||||
common->Printf( "...releasing DC: %s\n", success[retVal] );
|
||||
win32.hDC = NULL;
|
||||
}
|
||||
|
||||
// destroy window
|
||||
if( windowHandle )
|
||||
{
|
||||
common->Printf( "...destroying window\n" );
|
||||
ShowWindow( ( HWND )windowHandle, SW_HIDE );
|
||||
DestroyWindow( ( HWND )windowHandle );
|
||||
windowHandle = nullptr;
|
||||
win32.hWnd = NULL;
|
||||
}
|
||||
|
||||
// reset display settings
|
||||
if( win32.cdsFullscreen )
|
||||
{
|
||||
common->Printf( "...resetting display\n" );
|
||||
ChangeDisplaySettings( 0, 0 );
|
||||
win32.cdsFullscreen = 0;
|
||||
}
|
||||
|
||||
// restore gamma
|
||||
GLimp_RestoreGamma();
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
GLimp_Shutdown
|
||||
|
@ -1433,6 +1603,12 @@ subsystem.
|
|||
*/
|
||||
void GLimp_Shutdown()
|
||||
{
|
||||
#if defined( USE_NVRHI )
|
||||
if( deviceManager )
|
||||
{
|
||||
deviceManager->Shutdown();
|
||||
}
|
||||
#else
|
||||
const char* success[] = { "failed", "success" };
|
||||
int retVal;
|
||||
|
||||
|
@ -1484,6 +1660,7 @@ void GLimp_Shutdown()
|
|||
|
||||
// restore gamma
|
||||
GLimp_RestoreGamma();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -171,7 +171,7 @@ void IN_DeactivateKeyboard()
|
|||
{
|
||||
return;
|
||||
}
|
||||
win32.g_pKeyboard->Unacquire( );
|
||||
win32.g_pKeyboard->Unacquire();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -34,6 +34,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "../../renderer/RenderCommon.h"
|
||||
|
||||
#include <windowsx.h>
|
||||
#include <sys/DeviceManager.h>
|
||||
|
||||
LONG WINAPI MainWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
|
||||
|
||||
|
@ -163,6 +164,8 @@ void WIN_Sizing( WORD side, RECT* rect )
|
|||
}
|
||||
}
|
||||
|
||||
extern DeviceManager* deviceManager;
|
||||
|
||||
/*
|
||||
====================
|
||||
MainWndProc
|
||||
|
@ -181,7 +184,8 @@ LONG WINAPI MainWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
|||
RECT rect;
|
||||
if( ::GetClientRect( win32.hWnd, &rect ) )
|
||||
{
|
||||
|
||||
auto originalWidth = glConfig.nativeScreenWidth;
|
||||
auto originalHeight = glConfig.nativeScreenHeight;
|
||||
if( rect.right > rect.left && rect.bottom > rect.top )
|
||||
{
|
||||
glConfig.nativeScreenWidth = rect.right - rect.left;
|
||||
|
@ -194,9 +198,12 @@ LONG WINAPI MainWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
|||
r_windowWidth.SetInteger( glConfig.nativeScreenWidth );
|
||||
r_windowHeight.SetInteger( glConfig.nativeScreenHeight );
|
||||
}
|
||||
}
|
||||
|
||||
// DG: ImGui must know about the changed window size
|
||||
ImGuiHook::NotifyDisplaySizeChanged( glConfig.nativeScreenWidth, glConfig.nativeScreenHeight );
|
||||
if( glConfig.nativeScreenWidth != originalWidth || glConfig.nativeScreenHeight != originalHeight )
|
||||
{
|
||||
deviceManager->UpdateWindowSize();
|
||||
Framebuffer::ResizeFramebuffers();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue