#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;
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 ? */
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 *);
/* 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 */
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)
{
/* 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)
{
commit_scissor(device);
if (group & NINE_STATE_DSA)
- update_dsa(device);
+ prepare_dsa(device);
if (group & NINE_STATE_BLEND)
update_blend(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);
return "(invalid)";
}
}
-
#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
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