]> git.tdb.fi Git - libs/gl.git/commitdiff
Throw an exception if Texture*::allocate is called before storage
authorMikko Rasa <tdb@tdb.fi>
Mon, 2 Jul 2018 12:39:45 +0000 (15:39 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 2 Jul 2018 12:39:45 +0000 (15:39 +0300)
source/texture1d.cpp
source/texture2d.cpp
source/texture3d.cpp
source/texturecube.cpp

index e25a11c09ce579b0fbed76a7ec6dc5a6ed5569fd..c5e57df22843d0e0dc84675c24d08bebcaaf1c74 100644 (file)
@@ -32,6 +32,8 @@ void Texture1D::storage(PixelFormat fmt, unsigned wd)
 
 void Texture1D::allocate(unsigned level)
 {
+       if(width==0)
+               throw invalid_operation("Texture1D::allocate");
        if(allocated&(1<<level))
                return;
 
index 7ce18d00a9fa075b5df6b2a5ea1dac741411165f..8d6e8471edb72574340e6e870514bfb652a13113 100644 (file)
@@ -60,6 +60,8 @@ void Texture2D::storage(PixelFormat fmt, unsigned wd, unsigned ht)
 
 void Texture2D::allocate(unsigned level)
 {
+       if(width==0 || height==0)
+               throw invalid_operation("Texture2D::allocate");
        if(allocated&(1<<level))
                return;
 
index 4cba3afccbfade39750ef6ec00cd890182142b58..5e1f9866e185e6ecdb047f167a26ffa8054d03ea 100644 (file)
@@ -48,6 +48,8 @@ void Texture3D::storage(PixelFormat fmt, unsigned wd, unsigned ht, unsigned dp)
 
 void Texture3D::allocate(unsigned level)
 {
+       if(width==0 || height==0 || depth==0)
+               throw invalid_operation("Texture3D::allocate");
        if(allocated&(1<<level))
                return;
 
index db679cf9e1259cb4feb0e087c0f3e066c40921c3..b9a8f5dd02b8cacb73f63df7bce028a5920035cd 100644 (file)
@@ -64,6 +64,8 @@ void TextureCube::storage(PixelFormat fmt, unsigned sz)
 
 void TextureCube::allocate(unsigned level)
 {
+       if(size==0)
+               throw invalid_operation("TextureCube::allocate");
        if(allocated&(1<<level))
                return;