diff options
author | Axel Davy <[email protected]> | 2015-05-15 23:52:09 +0200 |
---|---|---|
committer | Axel Davy <[email protected]> | 2015-08-21 22:21:47 +0200 |
commit | 71616d0c501077a04deb4f2a3cc115b50634763d (patch) | |
tree | 0c4cf683dacb77f560175db9b440d48d9ff8d70e /src | |
parent | 06285530566ea3387b6eb3f8e1a0443132c3659b (diff) |
st/nine: Reorder DSA state settings
Separate state preparation and state commit
Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/state_trackers/nine/nine_pipe.c | 5 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_pipe.h | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_state.c | 27 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_state.h | 7 |
4 files changed, 30 insertions, 11 deletions
diff --git a/src/gallium/state_trackers/nine/nine_pipe.c b/src/gallium/state_trackers/nine/nine_pipe.c index ddf8e8b3b66..0538957e9af 100644 --- a/src/gallium/state_trackers/nine/nine_pipe.c +++ b/src/gallium/state_trackers/nine/nine_pipe.c @@ -27,7 +27,8 @@ #include "cso_cache/cso_context.h" void -nine_convert_dsa_state(struct cso_context *ctx, const DWORD *rs) +nine_convert_dsa_state(struct pipe_depth_stencil_alpha_state *dsa_state, + const DWORD *rs) { struct pipe_depth_stencil_alpha_state dsa; @@ -65,7 +66,7 @@ nine_convert_dsa_state(struct cso_context *ctx, const DWORD *rs) dsa.alpha.ref_value = (float)rs[D3DRS_ALPHAREF] / 255.0f; } - cso_set_depth_stencil_alpha(ctx, &dsa); + *dsa_state = dsa; } /* TODO: Keep a static copy in device so we don't have to memset every time ? */ diff --git a/src/gallium/state_trackers/nine/nine_pipe.h b/src/gallium/state_trackers/nine/nine_pipe.h index 9fde06d45bf..2f2e9cb815b 100644 --- a/src/gallium/state_trackers/nine/nine_pipe.h +++ b/src/gallium/state_trackers/nine/nine_pipe.h @@ -37,7 +37,7 @@ struct cso_context; extern const enum pipe_format nine_d3d9_to_pipe_format_map[120]; extern const D3DFORMAT nine_pipe_to_d3d9_format_map[PIPE_FORMAT_COUNT]; -void nine_convert_dsa_state(struct cso_context *, const DWORD *); +void nine_convert_dsa_state(struct pipe_depth_stencil_alpha_state *, const DWORD *); void nine_convert_rasterizer_state(struct cso_context *, const DWORD *); void nine_convert_blend_state(struct cso_context *, const DWORD *); void nine_convert_sampler_state(struct cso_context *, int idx, const DWORD *); diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c index 47e4148b8f6..7875d31d9b4 100644 --- a/src/gallium/state_trackers/nine/nine_state.c +++ b/src/gallium/state_trackers/nine/nine_state.c @@ -39,6 +39,13 @@ /* State preparation only */ +static inline void +prepare_dsa(struct NineDevice9 *device) +{ + nine_convert_dsa_state(&device->state.pipe.dsa, device->state.rs); + device->state.commit |= NINE_STATE_COMMIT_DSA; +} + /* State preparation incremental */ /* State preparation + State commit */ @@ -189,12 +196,6 @@ update_blend(struct NineDevice9 *device) } static inline void -update_dsa(struct NineDevice9 *device) -{ - nine_convert_dsa_state(device->cso, device->state.rs); -} - -static inline void update_rasterizer(struct NineDevice9 *device) { nine_convert_rasterizer_state(device->cso, device->state.rs); @@ -844,6 +845,12 @@ update_textures_and_samplers(struct NineDevice9 *device) /* State commit only */ static inline void +commit_dsa(struct NineDevice9 *device) +{ + cso_set_depth_stencil_alpha(device->cso, &device->state.pipe.dsa); +} + +static inline void commit_scissor(struct NineDevice9 *device) { struct pipe_context *pipe = device->pipe; @@ -943,7 +950,7 @@ nine_update_state(struct NineDevice9 *device) commit_scissor(device); if (group & NINE_STATE_DSA) - update_dsa(device); + prepare_dsa(device); if (group & NINE_STATE_BLEND) update_blend(device); @@ -1003,6 +1010,11 @@ nine_update_state(struct NineDevice9 *device) if (state->changed.vtxbuf) update_vertex_buffers(device); + if (state->commit & NINE_STATE_COMMIT_DSA) + commit_dsa(device); + + state->commit = 0; + device->state.changed.group &= (NINE_STATE_FF | NINE_STATE_VS_CONST | NINE_STATE_PS_CONST); @@ -1636,4 +1648,3 @@ const char *nine_d3drs_to_string(DWORD State) return "(invalid)"; } } - diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h index 452b4f2c041..e833225d35e 100644 --- a/src/gallium/state_trackers/nine/nine_state.h +++ b/src/gallium/state_trackers/nine/nine_state.h @@ -78,6 +78,8 @@ #define NINE_STATE_ALL 0x0ffffff #define NINE_STATE_UNHANDLED (1 << 24) +#define NINE_STATE_COMMIT_DSA (1 << 0) + #define NINE_MAX_SIMULTANEOUS_RENDERTARGETS 4 #define NINE_MAX_CONST_F_PS3 224 @@ -208,6 +210,11 @@ struct nine_state DWORD tex_stage[NINE_MAX_SAMPLERS][NINED3DTSS_COUNT]; } ff; + + uint32_t commit; + struct { + struct pipe_depth_stencil_alpha_state dsa; + } pipe; }; /* map D3DRS -> NINE_STATE_x |