OSDN Git Service

st/nine: Avoid useless updates in SetSamplerState
authorAxel Davy <axel.davy@ens.fr>
Sun, 15 Feb 2015 15:22:43 +0000 (16:22 +0100)
committerAxel Davy <axel.davy@ens.fr>
Fri, 21 Aug 2015 20:21:47 +0000 (22:21 +0200)
Check for redundant settings

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: David Heidelberg <david@ixit.cz>
src/gallium/state_trackers/nine/device9.c

index 4aa5892..a327bf8 100644 (file)
@@ -2718,12 +2718,14 @@ NineDevice9_SetSamplerState( struct NineDevice9 *This,
     if (Sampler >= D3DDMAPSAMPLER)
         Sampler = Sampler - D3DDMAPSAMPLER + NINE_MAX_SAMPLERS_PS;
 
-    state->samp[Sampler][Type] = Value;
-    state->changed.group |= NINE_STATE_SAMPLER;
-    state->changed.sampler[Sampler] |= 1 << Type;
+    if (state->samp[Sampler][Type] != Value || unlikely(This->is_recording)) {
+        state->samp[Sampler][Type] = Value;
+        state->changed.group |= NINE_STATE_SAMPLER;
+        state->changed.sampler[Sampler] |= 1 << Type;
 
-    if (Type == D3DSAMP_SRGBTEXTURE)
-        state->changed.srgb = TRUE;
+        if (Type == D3DSAMP_SRGBTEXTURE)
+            state->changed.srgb = TRUE;
+    }
 
     return D3D_OK;
 }