]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/sampler.cpp
Add some checks for invalid arguments
[libs/gl.git] / source / core / sampler.cpp
index 6658ef9ac75d05a8b1016a84afb6847404b196d7..7560029c64642cdef978b147c9d2be5e4263bafe 100644 (file)
@@ -1,4 +1,5 @@
 #include <msp/strings/format.h>
+#include "deviceinfo.h"
 #include "error.h"
 #include "sampler.h"
 
@@ -21,6 +22,8 @@ void Sampler::set_min_filter(TextureFilter f)
 
 void Sampler::set_mag_filter(TextureFilter f)
 {
+       if(is_mipmapped(f))
+               throw invalid_argument("Sampler::set_mag_filter");
        mag_filter = f;
        dirty_params |= MAG_FILTER;
 }
@@ -35,6 +38,8 @@ void Sampler::set_max_anisotropy(float a)
 {
        if(a<1.0f)
                throw invalid_argument("Sampler::set_max_anisotropy");
+       if(a>DeviceInfo::get_global().limits.max_anisotropy)
+               throw out_of_range("Sampler::set_max_anisotropy");
        bool supported = check_anisotropic(a>1.0f);
        max_anisotropy = a;
        if(supported)