]> git.tdb.fi Git - libs/gl.git/commitdiff
Only mark changed fields dirty when unloading a sampler
authorMikko Rasa <tdb@tdb.fi>
Sat, 6 Feb 2021 22:14:14 +0000 (00:14 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sat, 6 Feb 2021 22:14:14 +0000 (00:14 +0200)
source/sampler.cpp

index cc54901b683a5f635f73eb69252eb8a9b82fa59e..5375d17dfc5072d9108334b1627e930449da5e4d 100644 (file)
@@ -217,9 +217,23 @@ void Sampler::unbind_from(unsigned i)
 
 void Sampler::unload()
 {
-       // TODO check which params actually need refreshing
-       if(!owner->get_id())
-               dirty_params = -1;
+       if(owner && !owner->get_id())
+       {
+               if(min_filter!=NEAREST_MIPMAP_LINEAR)
+                       dirty_params |= MIN_FILTER;
+               if(mag_filter!=LINEAR)
+                       dirty_params |= MAG_FILTER;
+               if(max_anisotropy!=1.0f)
+                       dirty_params |= MAX_ANISOTROPY;
+               if(wrap_s!=REPEAT)
+                       dirty_params |= WRAP_S;
+               if(wrap_t!=REPEAT)
+                       dirty_params |= WRAP_T;
+               if(wrap_r!=REPEAT)
+                       dirty_params |= WRAP_R;
+               if(compare || cmp_func!=LEQUAL)
+                       dirty_params |= COMPARE;
+       }
 }