]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/texture2d.cpp
Convert pixel components if necessary when async loading textures
[libs/gl.git] / source / core / texture2d.cpp
index a0ba9515e68babe3387b9e2af1278087b1d6d3f9..e38c99deb85e2dda60603b89e97405a013c763cd 100644 (file)
@@ -238,7 +238,22 @@ bool Texture2D::AsyncLoader::process()
        }
        else if(phase==2)
        {
-               if(raw_data)
+               if(texture.swizzle==RGBA_TO_RGB)
+               {
+                       const void *data;
+                       if(raw_data)
+                       {
+                               raw_data->load();
+                               data = raw_data->get_data();
+                       }
+                       else
+                       {
+                               image.load(*img_loader);
+                               data = image.get_pixels();
+                       }
+                       texture.stage_pixels(transfer.get_address(), data, texture.width*texture.height);
+               }
+               else if(raw_data)
                        raw_data->load_into(transfer.get_address());
                else
                        image.load_into(*img_loader, transfer.get_address());