]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/framebuffer.cpp
Track the number of layers in Framebuffer
[libs/gl.git] / source / core / framebuffer.cpp
index 8a1a52316f9fa6835e685570f6357d14955389d0..97cc905d5bfb107d9af7dc3101333218ea0301f7 100644 (file)
@@ -60,6 +60,7 @@ void Framebuffer::check_size()
                {
                        unsigned w = 0;
                        unsigned h = 0;
+                       unsigned l = 1;
                        if(const Texture2D *tex2d = dynamic_cast<const Texture2D *>(a.tex))
                        {
                                w = max(tex2d->get_width()>>a.level, 1U);
@@ -74,6 +75,7 @@ void Framebuffer::check_size()
                        {
                                w = max(tex3d->get_width()>>a.level, 1U);
                                h = max(tex3d->get_height()>>a.level, 1U);
+                               l = (a.layer<0 ? tex3d->get_depth() : 1);
                        }
                        else if(const TextureCube *tex_cube = dynamic_cast<const TextureCube *>(a.tex))
                        {
@@ -85,12 +87,14 @@ void Framebuffer::check_size()
                        {
                                width = w;
                                height = h;
+                               layers = l;
                                first = false;
                        }
                        else
                        {
                                width = min(width, w);
                                height = min(height, h);
+                               layers = min(layers, l);
                        }
                }
 }