}
void
-nine_convert_blend_state(struct cso_context *ctx, const DWORD *rs)
+nine_convert_blend_state(struct pipe_blend_state *blend_state, const DWORD *rs)
{
struct pipe_blend_state blend;
/* blend.force_srgb = !!rs[D3DRS_SRGBWRITEENABLE]; */
- cso_set_blend(ctx, &blend);
+ *blend_state = blend;
}
void
void nine_convert_dsa_state(struct pipe_depth_stencil_alpha_state *, const DWORD *);
void nine_convert_rasterizer_state(struct pipe_rasterizer_state *, const DWORD *);
-void nine_convert_blend_state(struct cso_context *, const DWORD *);
+void nine_convert_blend_state(struct pipe_blend_state *, const DWORD *);
void nine_convert_sampler_state(struct cso_context *, int idx, const DWORD *);
void nine_pipe_context_clear(struct NineDevice9 *);
/* State preparation only */
+static inline void
+prepare_blend(struct NineDevice9 *device)
+{
+ nine_convert_blend_state(&device->state.pipe.blend, device->state.rs);
+ device->state.commit |= NINE_STATE_COMMIT_BLEND;
+}
+
static inline void
prepare_dsa(struct NineDevice9 *device)
{
pipe->set_viewport_states(pipe, 0, 1, &pvport);
}
-static inline void
-update_blend(struct NineDevice9 *device)
-{
- nine_convert_blend_state(device->cso, device->state.rs);
-}
-
/* Loop through VS inputs and pick the vertex elements with the declared
* usage from the vertex declaration, then insert the instance divisor from
* the stream source frequency setting.
/* State commit only */
+static inline void
+commit_blend(struct NineDevice9 *device)
+{
+ cso_set_blend(device->cso, &device->state.pipe.blend);
+}
+
static inline void
commit_dsa(struct NineDevice9 *device)
{
if (group & NINE_STATE_DSA)
prepare_dsa(device);
if (group & NINE_STATE_BLEND)
- update_blend(device);
+ prepare_blend(device);
if (group & NINE_STATE_VS)
group |= update_vs(device);
if (state->changed.vtxbuf)
update_vertex_buffers(device);
+ if (state->commit & NINE_STATE_COMMIT_BLEND)
+ commit_blend(device);
if (state->commit & NINE_STATE_COMMIT_DSA)
commit_dsa(device);
if (state->commit & NINE_STATE_COMMIT_RASTERIZER)
#define NINE_STATE_COMMIT_DSA (1 << 0)
#define NINE_STATE_COMMIT_RASTERIZER (1 << 1)
+#define NINE_STATE_COMMIT_BLEND (1 << 2)
#define NINE_MAX_SIMULTANEOUS_RENDERTARGETS 4
struct {
struct pipe_depth_stencil_alpha_state dsa;
struct pipe_rasterizer_state rast;
+ struct pipe_blend_state blend;
} pipe;
};