mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Fix Vulkan swapchain invalidation issue. (#3379)
* Fix Vulkan swapchain invalidation issue. * Always clamp render pass to frame buffer size. * Fix formatting.
This commit is contained in:
committed by
GitHub
parent
4372a1f56c
commit
01af383a6c
@@ -767,6 +767,7 @@ restart:
|
||||
handle = size->m_handle;
|
||||
_width = size->m_width;
|
||||
_height = size->m_height;
|
||||
BX_TRACE("Window resize event: %d: %dx%d", handle, _width, _height);
|
||||
|
||||
needReset = true;
|
||||
}
|
||||
@@ -800,6 +801,7 @@ restart:
|
||||
&& needReset)
|
||||
{
|
||||
_reset = s_reset;
|
||||
BX_TRACE("bgfx::reset(%d, %d, 0x%x)", _width, _height, _reset)
|
||||
bgfx::reset(_width, _height, _reset);
|
||||
inputSetMouseResolution(uint16_t(_width), uint16_t(_height) );
|
||||
}
|
||||
@@ -979,6 +981,7 @@ restart:
|
||||
if (needReset)
|
||||
{
|
||||
_reset = s_reset;
|
||||
BX_TRACE("bgfx::reset(%d, %d, 0x%x)", s_window[0].m_width, s_window[0].m_height, _reset)
|
||||
bgfx::reset(s_window[0].m_width, s_window[0].m_height, _reset);
|
||||
inputSetMouseResolution(uint16_t(s_window[0].m_width), uint16_t(s_window[0].m_height) );
|
||||
}
|
||||
|
||||
@@ -446,7 +446,7 @@ namespace entry
|
||||
|
||||
// Force window resolution...
|
||||
WindowHandle defaultWindow = { 0 };
|
||||
setWindowSize(defaultWindow, m_width, m_height, true);
|
||||
entry::setWindowSize(defaultWindow, m_width, m_height);
|
||||
|
||||
SDL_EventState(SDL_DROPFILE, SDL_ENABLE);
|
||||
|
||||
@@ -624,7 +624,15 @@ namespace entry
|
||||
case SDL_WINDOWEVENT_SIZE_CHANGED:
|
||||
{
|
||||
WindowHandle handle = findHandle(wev.windowID);
|
||||
setWindowSize(handle, wev.data1, wev.data2);
|
||||
uint32_t width = wev.data1;
|
||||
uint32_t height = wev.data2;
|
||||
if (width != m_width
|
||||
|| height != m_height)
|
||||
{
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
m_eventQueue.postSizeEvent(handle, m_width, m_height);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -825,7 +833,7 @@ namespace entry
|
||||
Msg* msg = (Msg*)uev.data2;
|
||||
if (isValid(handle) )
|
||||
{
|
||||
setWindowSize(handle, msg->m_width, msg->m_height);
|
||||
SDL_SetWindowSize(m_window[handle.idx], msg->m_width, msg->m_height);
|
||||
}
|
||||
delete msg;
|
||||
}
|
||||
@@ -897,20 +905,6 @@ namespace entry
|
||||
return invalid;
|
||||
}
|
||||
|
||||
void setWindowSize(WindowHandle _handle, uint32_t _width, uint32_t _height, bool _force = false)
|
||||
{
|
||||
if (_width != m_width
|
||||
|| _height != m_height
|
||||
|| _force)
|
||||
{
|
||||
m_width = _width;
|
||||
m_height = _height;
|
||||
|
||||
SDL_SetWindowSize(m_window[_handle.idx], m_width, m_height);
|
||||
m_eventQueue.postSizeEvent(_handle, m_width, m_height);
|
||||
}
|
||||
}
|
||||
|
||||
GamepadHandle findGamepad(SDL_JoystickID _jid)
|
||||
{
|
||||
for (uint32_t ii = 0, num = m_gamepadAlloc.getNumHandles(); ii < num; ++ii)
|
||||
@@ -1011,6 +1005,7 @@ namespace entry
|
||||
|
||||
void setWindowSize(WindowHandle _handle, uint32_t _width, uint32_t _height)
|
||||
{
|
||||
// Function to set the window size programmatically from the examples/tools.
|
||||
Msg* msg = new Msg;
|
||||
msg->m_width = _width;
|
||||
msg->m_height = _height;
|
||||
|
||||
Reference in New Issue
Block a user