From f45437b9ab18cc359a2d334aede1d3f86baa2cbd Mon Sep 17 00:00:00 2001 From: mwilsnd Date: Wed, 31 May 2023 10:05:12 -0500 Subject: [PATCH] Drawable Renderer (#1570), PremultipliedImage is RGBA only --- src/mbgl/gl/texture2d.cpp | 7 ------- src/mbgl/gl/upload_pass.cpp | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/mbgl/gl/texture2d.cpp b/src/mbgl/gl/texture2d.cpp index 9df1109ae..7a8348313 100644 --- a/src/mbgl/gl/texture2d.cpp +++ b/src/mbgl/gl/texture2d.cpp @@ -134,15 +134,8 @@ void Texture2D::upload(const PremultipliedImage& image, gfx::UploadPass& uploadP } assert(PremultipliedImage::channels == numChannels()); - if (PremultipliedImage::channels != numChannels()) { - return; - } - // note: images are always unsigned bytes assert(PremultipliedImage::channels == getPixelStride()); - if (PremultipliedImage::channels != getPixelStride()) { - return; - } uploadPass.updateTextureResource(*textureResource, size, &image.data[0], pixelFormat, channelType); } diff --git a/src/mbgl/gl/upload_pass.cpp b/src/mbgl/gl/upload_pass.cpp index 90b29b352..dcaadf8bc 100644 --- a/src/mbgl/gl/upload_pass.cpp +++ b/src/mbgl/gl/upload_pass.cpp @@ -213,7 +213,7 @@ gfx::AttributeBindingArray UploadPass::buildAttributeBindings( std::shared_ptr UploadPass::createTexture2D(const PremultipliedImage& image) { auto tex = std::make_shared(commandEncoder.context); tex->setSize(image.size) - .setFormat(image.channels == 4 ? gfx::TexturePixelType::RGBA : gfx::TexturePixelType::Alpha, + .setFormat(gfx::TexturePixelType::RGBA, gfx::TextureChannelDataType::UnsignedByte) .create(); tex->upload(image, *this);