st/nine: Add dummy ff shader state
authorAxel Davy <davyaxel0@gmail.com>
Sun, 23 Sep 2018 16:21:45 +0000 (18:21 +0200)
committerAxel Davy <davyaxel0@gmail.com>
Tue, 25 Sep 2018 20:05:24 +0000 (22:05 +0200)
Some states only affect the ff shader,
not its constants.
Currently we don't check anything and
always recompute the ff shader key.

However we do check for NINE_STATE_FF_OTHER
and if set we reupload some constants.

Thus for those states which had NINE_STATE_FF_OTHER
set but didn't need it,
replace by a dummy ff shader state (which is
easier to understand for an external reader than
just setting 0 and more future proof).

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
src/gallium/state_trackers/nine/nine_state.c
src/gallium/state_trackers/nine/nine_state.h

index 7e13feb83d6ef02bc443f8dc305d75e13a71c943..cb62c28b7b7eb84ec0fbbed2a69d156ebd6b8916 100644 (file)
@@ -3529,14 +3529,14 @@ const uint32_t nine_render_state_group[NINED3DRS_LAST + 1] =
     [D3DRS_ALPHAFUNC] = NINE_STATE_DSA,
     [D3DRS_DITHERENABLE] = NINE_STATE_BLEND,
     [D3DRS_ALPHABLENDENABLE] = NINE_STATE_BLEND,
-    [D3DRS_FOGENABLE] = NINE_STATE_FF_OTHER | NINE_STATE_VS_PARAMS_MISC | NINE_STATE_PS_PARAMS_MISC | NINE_STATE_PS_CONST,
+    [D3DRS_FOGENABLE] = NINE_STATE_FF_SHADER | NINE_STATE_VS_PARAMS_MISC | NINE_STATE_PS_PARAMS_MISC | NINE_STATE_PS_CONST,
     [D3DRS_SPECULARENABLE] = NINE_STATE_FF_LIGHTING,
     [D3DRS_FOGCOLOR] = NINE_STATE_FF_OTHER | NINE_STATE_PS_CONST,
-    [D3DRS_FOGTABLEMODE] = NINE_STATE_FF_OTHER | NINE_STATE_PS_PARAMS_MISC | NINE_STATE_PS_CONST,
+    [D3DRS_FOGTABLEMODE] = NINE_STATE_FF_SHADER | NINE_STATE_PS_PARAMS_MISC | NINE_STATE_PS_CONST,
     [D3DRS_FOGSTART] = NINE_STATE_FF_OTHER | NINE_STATE_PS_CONST,
     [D3DRS_FOGEND] = NINE_STATE_FF_OTHER | NINE_STATE_PS_CONST,
     [D3DRS_FOGDENSITY] = NINE_STATE_FF_OTHER | NINE_STATE_PS_CONST,
-    [D3DRS_RANGEFOGENABLE] = NINE_STATE_FF_OTHER,
+    [D3DRS_RANGEFOGENABLE] = NINE_STATE_FF_SHADER,
     [D3DRS_STENCILENABLE] = NINE_STATE_DSA | NINE_STATE_MULTISAMPLE,
     [D3DRS_STENCILFAIL] = NINE_STATE_DSA,
     [D3DRS_STENCILZFAIL] = NINE_STATE_DSA,
@@ -3557,20 +3557,20 @@ const uint32_t nine_render_state_group[NINED3DRS_LAST + 1] =
     [D3DRS_CLIPPING] = 0, /* software vertex processing only */
     [D3DRS_LIGHTING] = NINE_STATE_FF_LIGHTING,
     [D3DRS_AMBIENT] = NINE_STATE_FF_LIGHTING | NINE_STATE_FF_MATERIAL,
-    [D3DRS_FOGVERTEXMODE] = NINE_STATE_FF_OTHER,
+    [D3DRS_FOGVERTEXMODE] = NINE_STATE_FF_SHADER,
     [D3DRS_COLORVERTEX] = NINE_STATE_FF_LIGHTING,
     [D3DRS_LOCALVIEWER] = NINE_STATE_FF_LIGHTING,
-    [D3DRS_NORMALIZENORMALS] = NINE_STATE_FF_OTHER,
+    [D3DRS_NORMALIZENORMALS] = NINE_STATE_FF_SHADER,
     [D3DRS_DIFFUSEMATERIALSOURCE] = NINE_STATE_FF_LIGHTING,
     [D3DRS_SPECULARMATERIALSOURCE] = NINE_STATE_FF_LIGHTING,
     [D3DRS_AMBIENTMATERIALSOURCE] = NINE_STATE_FF_LIGHTING,
     [D3DRS_EMISSIVEMATERIALSOURCE] = NINE_STATE_FF_LIGHTING,
-    [D3DRS_VERTEXBLEND] = NINE_STATE_FF_OTHER,
+    [D3DRS_VERTEXBLEND] = NINE_STATE_FF_SHADER,
     [D3DRS_CLIPPLANEENABLE] = NINE_STATE_RASTERIZER,
     [D3DRS_POINTSIZE] = NINE_STATE_RASTERIZER | NINE_STATE_FF_OTHER,
     [D3DRS_POINTSIZE_MIN] = NINE_STATE_RASTERIZER | NINE_STATE_FF_OTHER | NINE_STATE_VS_PARAMS_MISC,
     [D3DRS_POINTSPRITEENABLE] = NINE_STATE_RASTERIZER,
-    [D3DRS_POINTSCALEENABLE] = NINE_STATE_FF_OTHER,
+    [D3DRS_POINTSCALEENABLE] = NINE_STATE_FF_SHADER,
     [D3DRS_POINTSCALE_A] = NINE_STATE_FF_OTHER,
     [D3DRS_POINTSCALE_B] = NINE_STATE_FF_OTHER,
     [D3DRS_POINTSCALE_C] = NINE_STATE_FF_OTHER,
@@ -3579,7 +3579,7 @@ const uint32_t nine_render_state_group[NINED3DRS_LAST + 1] =
     [D3DRS_PATCHEDGESTYLE] = NINE_STATE_UNHANDLED,
     [D3DRS_DEBUGMONITORTOKEN] = NINE_STATE_UNHANDLED,
     [D3DRS_POINTSIZE_MAX] = NINE_STATE_RASTERIZER | NINE_STATE_FF_OTHER | NINE_STATE_VS_PARAMS_MISC,
-    [D3DRS_INDEXEDVERTEXBLENDENABLE] = NINE_STATE_FF_OTHER,
+    [D3DRS_INDEXEDVERTEXBLENDENABLE] = NINE_STATE_FF_SHADER,
     [D3DRS_COLORWRITEENABLE] = NINE_STATE_BLEND,
     [D3DRS_TWEENFACTOR] = NINE_STATE_FF_OTHER,
     [D3DRS_BLENDOP] = NINE_STATE_BLEND,
index b8a74a4ee2fa079e163e3979d6660a9c382d9a0d..77823655efa3b75ac70d7629c71561b0c1f893ee 100644 (file)
 #define NINE_STATE_ALL          0x1fffffff
 #define NINE_STATE_UNHANDLED   (1 << 29)
 
+/* These states affect the ff shader key,
+ * which we recompute everytime. */
+#define NINE_STATE_FF_SHADER    0
+
 #define NINE_STATE_COMMIT_DSA  (1 << 0)
 #define NINE_STATE_COMMIT_RASTERIZER (1 << 1)
 #define NINE_STATE_COMMIT_BLEND (1 << 2)