mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 22:38:05 +02:00
st/nine: Reorder DSA state settings
Separate state preparation and state commit Signed-off-by: Axel Davy <axel.davy@ens.fr>
This commit is contained in:
parent
0628553056
commit
71616d0c50
4 changed files with 30 additions and 11 deletions
|
|
@ -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 ? */
|
||||
|
|
|
|||
|
|
@ -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 *);
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
@ -188,12 +195,6 @@ update_blend(struct NineDevice9 *device)
|
|||
nine_convert_blend_state(device->cso, device->state.rs);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -843,6 +844,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)
|
||||
{
|
||||
|
|
@ -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)";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue