mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +00:00
[drape] Fixed signed/unsigned comparison warning by changing Resize interface to uint32_t
Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
committed by
Konstantin Pastbin
parent
55dc1e17e6
commit
a28d5d15ce
@@ -12,7 +12,7 @@ public:
|
|||||||
, m_metalLayer(metalLayer)
|
, m_metalLayer(metalLayer)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void Resize(int w, int h) override
|
void Resize(uint32_t w, uint32_t h) override
|
||||||
{
|
{
|
||||||
m_metalLayer.drawableSize = CGSize{static_cast<float>(w), static_cast<float>(h)};
|
m_metalLayer.drawableSize = CGSize{static_cast<float>(w), static_cast<float>(h)};
|
||||||
ResetFrameDrawable();
|
ResetFrameDrawable();
|
||||||
@@ -32,7 +32,7 @@ public:
|
|||||||
|
|
||||||
void Present() override {}
|
void Present() override {}
|
||||||
void MakeCurrent() override {}
|
void MakeCurrent() override {}
|
||||||
void Resize(int w, int h) override {}
|
void Resize(uint32_t w, uint32_t h) override {}
|
||||||
void SetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) override {}
|
void SetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) override {}
|
||||||
void Init(dp::ApiVersion apiVersion) override
|
void Init(dp::ApiVersion apiVersion) override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public:
|
|||||||
void MakeCurrent() override;
|
void MakeCurrent() override;
|
||||||
void Present() override;
|
void Present() override;
|
||||||
void SetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) override;
|
void SetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) override;
|
||||||
void Resize(int w, int h) override;
|
void Resize(uint32_t w, uint32_t h) override;
|
||||||
void SetPresentAvailable(bool available) override;
|
void SetPresentAvailable(bool available) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ void iosOGLContext::SetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void iosOGLContext::Resize(int w, int h)
|
void iosOGLContext::Resize(uint32_t w, uint32_t h)
|
||||||
{
|
{
|
||||||
if (m_needBuffers && m_hasBuffers)
|
if (m_needBuffers && m_hasBuffers)
|
||||||
{
|
{
|
||||||
@@ -89,7 +89,7 @@ void iosOGLContext::Resize(int w, int h)
|
|||||||
GLint height = 0;
|
GLint height = 0;
|
||||||
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &width);
|
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &width);
|
||||||
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &height);
|
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &height);
|
||||||
if (width == w && height == h)
|
if (width == static_cast<GLint>(w) && height == static_cast<GLint>(h))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DestroyBuffers();
|
DestroyBuffers();
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public:
|
|||||||
virtual void ForgetFramebuffer(ref_ptr<BaseFramebuffer> framebuffer) = 0;
|
virtual void ForgetFramebuffer(ref_ptr<BaseFramebuffer> framebuffer) = 0;
|
||||||
virtual void ApplyFramebuffer(std::string const & framebufferLabel) = 0;
|
virtual void ApplyFramebuffer(std::string const & framebufferLabel) = 0;
|
||||||
// w, h - pixel size of render target (logical size * visual scale).
|
// w, h - pixel size of render target (logical size * visual scale).
|
||||||
virtual void Resize(int /* w */, int /* h */) {}
|
virtual void Resize(uint32_t /* w */, uint32_t /* h */) {}
|
||||||
virtual void SetRenderingEnabled(bool /* enabled */) {}
|
virtual void SetRenderingEnabled(bool /* enabled */) {}
|
||||||
virtual void SetPresentAvailable(bool /* available */) {}
|
virtual void SetPresentAvailable(bool /* available */) {}
|
||||||
virtual bool Validate() { return true; }
|
virtual bool Validate() { return true; }
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public:
|
|||||||
void MakeCurrent() override {}
|
void MakeCurrent() override {}
|
||||||
void DoneCurrent() override {}
|
void DoneCurrent() override {}
|
||||||
bool Validate() override { return true; }
|
bool Validate() override { return true; }
|
||||||
void Resize(int w, int h) override;
|
void Resize(uint32_t w, uint32_t h) override;
|
||||||
void SetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) override;
|
void SetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) override;
|
||||||
void ForgetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) override {}
|
void ForgetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) override {}
|
||||||
void ApplyFramebuffer(std::string const & framebufferLabel) override;
|
void ApplyFramebuffer(std::string const & framebufferLabel) override;
|
||||||
|
|||||||
@@ -130,12 +130,12 @@ void MetalBaseContext::PopDebugLabel()
|
|||||||
[m_currentCommandEncoder popDebugGroup];
|
[m_currentCommandEncoder popDebugGroup];
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetalBaseContext::Resize(int w, int h)
|
void MetalBaseContext::Resize(uint32_t w, uint32_t h)
|
||||||
{
|
{
|
||||||
if (m_depthTexture && m_depthTexture->GetWidth() == w && m_depthTexture->GetHeight() == h)
|
if (m_depthTexture && m_depthTexture->GetWidth() == w && m_depthTexture->GetHeight() == h)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RecreateDepthTexture(m2::PointU(w, h));
|
RecreateDepthTexture({w, h});
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetalBaseContext::SetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer)
|
void MetalBaseContext::SetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer)
|
||||||
|
|||||||
@@ -142,15 +142,15 @@ void VulkanBaseContext::SetRenderingQueue(VkQueue queue)
|
|||||||
m_queue = queue;
|
m_queue = queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VulkanBaseContext::Resize(int w, int h)
|
void VulkanBaseContext::Resize(uint32_t w, uint32_t h)
|
||||||
{
|
{
|
||||||
if (m_swapchain != VK_NULL_HANDLE && m_surfaceCapabilities.currentExtent.width == static_cast<uint32_t>(w) &&
|
if (m_swapchain != VK_NULL_HANDLE && m_surfaceCapabilities.currentExtent.width == w &&
|
||||||
m_surfaceCapabilities.currentExtent.height == static_cast<uint32_t>(h))
|
m_surfaceCapabilities.currentExtent.height == h)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_surfaceCapabilities.currentExtent.width = static_cast<uint32_t>(w);
|
m_surfaceCapabilities.currentExtent.width = w;
|
||||||
m_surfaceCapabilities.currentExtent.height = static_cast<uint32_t>(h);
|
m_surfaceCapabilities.currentExtent.height = h;
|
||||||
RecreateSwapchainAndDependencies();
|
RecreateSwapchainAndDependencies();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public:
|
|||||||
void CollectMemory() override;
|
void CollectMemory() override;
|
||||||
void DoneCurrent() override {}
|
void DoneCurrent() override {}
|
||||||
bool Validate() override { return true; }
|
bool Validate() override { return true; }
|
||||||
void Resize(int w, int h) override;
|
void Resize(uint32_t w, uint32_t h) override;
|
||||||
void SetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) override;
|
void SetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) override;
|
||||||
void ForgetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) override;
|
void ForgetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) override;
|
||||||
void ApplyFramebuffer(std::string const & framebufferLabel) override;
|
void ApplyFramebuffer(std::string const & framebufferLabel) override;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
|
|
||||||
void Present() override {}
|
void Present() override {}
|
||||||
|
|
||||||
void Resize(int w, int h) override {}
|
void Resize(uint32_t w, uint32_t h) override {}
|
||||||
void SetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) override {}
|
void SetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) override {}
|
||||||
void Init(dp::ApiVersion apiVersion) override { CHECK_EQUAL(apiVersion, dp::ApiVersion::Vulkan, ()); }
|
void Init(dp::ApiVersion apiVersion) override { CHECK_EQUAL(apiVersion, dp::ApiVersion::Vulkan, ()); }
|
||||||
|
|
||||||
|
|||||||
@@ -53,17 +53,15 @@ void QtRenderOGLContext::SetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer
|
|||||||
m_backFrame->bind();
|
m_backFrame->bind();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtRenderOGLContext::Resize(int w, int h)
|
void QtRenderOGLContext::Resize(uint32_t w, uint32_t h)
|
||||||
{
|
{
|
||||||
CHECK(m_isContextAvailable, ());
|
CHECK(m_isContextAvailable, ());
|
||||||
CHECK_GREATER_OR_EQUAL(w, 0, ());
|
|
||||||
CHECK_GREATER_OR_EQUAL(h, 0, ());
|
|
||||||
|
|
||||||
// This function can't be called inside BeginRendering - EndRendering.
|
// This function can't be called inside BeginRendering - EndRendering.
|
||||||
std::lock_guard<std::mutex> lock(m_frameMutex);
|
std::lock_guard lock(m_frameMutex);
|
||||||
|
|
||||||
auto const nw = static_cast<int>(math::NextPowOf2(static_cast<uint32_t>(w)));
|
auto const nw = static_cast<int>(math::NextPowOf2(w));
|
||||||
auto const nh = static_cast<int>(math::NextPowOf2(static_cast<uint32_t>(h)));
|
auto const nh = static_cast<int>(math::NextPowOf2(h));
|
||||||
|
|
||||||
if (nw <= m_width && nh <= m_height && m_backFrame != nullptr)
|
if (nw <= m_width && nh <= m_height && m_backFrame != nullptr)
|
||||||
{
|
{
|
||||||
@@ -86,7 +84,7 @@ bool QtRenderOGLContext::AcquireFrame()
|
|||||||
if (!m_isContextAvailable)
|
if (!m_isContextAvailable)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(m_frameMutex);
|
std::lock_guard lock(m_frameMutex);
|
||||||
// Render current acquired frame.
|
// Render current acquired frame.
|
||||||
if (!m_frameUpdated)
|
if (!m_frameUpdated)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public:
|
|||||||
void MakeCurrent() override;
|
void MakeCurrent() override;
|
||||||
void DoneCurrent() override;
|
void DoneCurrent() override;
|
||||||
void SetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) override;
|
void SetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) override;
|
||||||
void Resize(int w, int h) override;
|
void Resize(uint32_t w, uint32_t h) override;
|
||||||
|
|
||||||
bool AcquireFrame();
|
bool AcquireFrame();
|
||||||
GLuint GetTextureHandle() const;
|
GLuint GetTextureHandle() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user