Fix Vulkan headless backend resize (#4030)

This commit is contained in:
Adrian Cojocaru
2026-01-08 12:54:58 +02:00
committed by GitHub
parent 3f64c7e646
commit 32eed7a806
4 changed files with 34 additions and 6 deletions

View File

@@ -62,6 +62,9 @@ gfx::Texture2D& Texture2D::setFormat(gfx::TexturePixelType pixelFormat_,
if (pixelFormat_ == pixelFormat && channelType_ == channelType) {
return *this;
}
destroyTexture();
pixelFormat = pixelFormat_;
channelType = channelType_;
textureDirty = true;
@@ -72,6 +75,9 @@ gfx::Texture2D& Texture2D::setSize(mbgl::Size size_) noexcept {
if (size_ == size) {
return *this;
}
destroyTexture();
size = size_;
textureDirty = true;
return *this;
@@ -267,6 +273,8 @@ vk::SamplerAddressMode Texture2D::vulkanAddressMode(const gfx::TextureWrapType t
void Texture2D::createTexture() {
if (size.width == 0 || size.height == 0) return;
destroyTexture();
const auto& backend = context.getBackend();
const auto format = vulkanFormat(pixelFormat, channelType);