From 5f7a41c33b233e315e1214a7692808def9f105f1 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Sun, 23 Sep 2018 18:21:45 +0200 Subject: [PATCH] st/nine: Add dummy ff shader state 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 --- src/gallium/state_trackers/nine/nine_state.c | 16 ++++++++-------- src/gallium/state_trackers/nine/nine_state.h | 4 ++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c index 7e13feb83d6..cb62c28b7b7 100644 --- a/src/gallium/state_trackers/nine/nine_state.c +++ b/src/gallium/state_trackers/nine/nine_state.c @@ -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, diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h index b8a74a4ee2f..77823655efa 100644 --- a/src/gallium/state_trackers/nine/nine_state.h +++ b/src/gallium/state_trackers/nine/nine_state.h @@ -90,6 +90,10 @@ #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) -- 2.30.2