mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
[Coverity] Ensure window dimensions are at least 1x1 on text render
This commit is contained in:
@@ -40,8 +40,8 @@ public:
|
||||
m_width = w;
|
||||
m_height = h;
|
||||
}
|
||||
int GetWidth() { return m_width; }
|
||||
int GetHeight() { return m_height; }
|
||||
int GetWidth() { return RDCMAX(1, m_width); }
|
||||
int GetHeight() { return RDCMAX(1, m_height); }
|
||||
void SetOutputWindow(HWND w);
|
||||
|
||||
void RenderText(float x, float y, const char *textfmt, ...);
|
||||
|
||||
@@ -45,8 +45,8 @@ public:
|
||||
else
|
||||
m_BBFmtIdx = RGBA8_BACKBUFFER;
|
||||
}
|
||||
int GetWidth() { return m_width; }
|
||||
int GetHeight() { return m_height; }
|
||||
int GetWidth() { return RDCMAX(1, m_width); }
|
||||
int GetHeight() { return RDCMAX(1, m_height); }
|
||||
void RenderText(ID3D12GraphicsCommandList *list, float x, float y, const char *textfmt, ...);
|
||||
|
||||
private:
|
||||
|
||||
@@ -555,8 +555,8 @@ void WrappedOpenGL::RenderOverlayStr(float x, float y, const char *text)
|
||||
ubo->TextPosition.x = x;
|
||||
ubo->TextPosition.y = y;
|
||||
|
||||
ubo->FontScreenAspect.x = 1.0f / float(m_InitParams.width);
|
||||
ubo->FontScreenAspect.y = 1.0f / float(m_InitParams.height);
|
||||
ubo->FontScreenAspect.x = 1.0f / RDCMAX(1.0f, float(m_InitParams.width));
|
||||
ubo->FontScreenAspect.y = 1.0f / RDCMAX(1.0f, float(m_InitParams.height));
|
||||
|
||||
ubo->TextSize = ctxdata.CharSize;
|
||||
ubo->FontScreenAspect.x *= ctxdata.CharAspect;
|
||||
|
||||
@@ -682,7 +682,13 @@ VkResult WrappedVulkan::vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR
|
||||
VkLayerDispatchTable *vt = ObjDisp(GetDev());
|
||||
|
||||
TextPrintState textstate = {
|
||||
GetNextCmd(), rp, fb, swapInfo.extent.width, swapInfo.extent.height, swapInfo.format};
|
||||
GetNextCmd(),
|
||||
rp,
|
||||
fb,
|
||||
RDCMAX(1U, swapInfo.extent.width),
|
||||
RDCMAX(1U, swapInfo.extent.height),
|
||||
swapInfo.format,
|
||||
};
|
||||
|
||||
VkCommandBufferBeginInfo beginInfo = {VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, NULL,
|
||||
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT};
|
||||
|
||||
Reference in New Issue
Block a user