st/nine: Catch setting the same shader
authorAxel Davy <axel.davy@ens.fr>
Sun, 9 Aug 2015 17:06:01 +0000 (19:06 +0200)
committerAxel Davy <axel.davy@ens.fr>
Fri, 21 Aug 2015 20:21:48 +0000 (22:21 +0200)
This is quite rare that an app does set again
the same shaders, but it isn't an expensive check
either.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
src/gallium/state_trackers/nine/device9.c

index 7b2a2f14c8fac600eecae30b4dcc5ae8e5815afb..f136b048cf70ad029dbaefff74a21c1bbefb0463 100644 (file)
@@ -3259,6 +3259,9 @@ NineDevice9_SetVertexShader( struct NineDevice9 *This,
 
     DBG("This=%p pShader=%p\n", This, pShader);
 
+    if (!This->is_recording && state->vs == (struct NineVertexShader9*)pShader)
+      return D3D_OK;
+
     /* ff -> non-ff: commit back non-ff constants */
     if (!state->vs && pShader)
         state->commit |= NINE_STATE_COMMIT_CONST_VS;
@@ -3612,6 +3615,9 @@ NineDevice9_SetPixelShader( struct NineDevice9 *This,
 
     DBG("This=%p pShader=%p\n", This, pShader);
 
+    if (!This->is_recording && state->ps == (struct NinePixelShader9*)pShader)
+      return D3D_OK;
+
     /* ff -> non-ff: commit back non-ff constants */
     if (!state->ps && pShader)
         state->commit |= NINE_STATE_COMMIT_CONST_PS;