*dsa_state = dsa;
}
-/* TODO: Keep a static copy in device so we don't have to memset every time ? */
void
-nine_convert_rasterizer_state(struct cso_context *ctx, const DWORD *rs)
+nine_convert_rasterizer_state(struct pipe_rasterizer_state *rast_state, const DWORD *rs)
{
struct pipe_rasterizer_state rast;
- memset(&rast, 0, sizeof(rast)); /* memcmp safety */
+ memset(&rast, 0, sizeof(rast));
rast.flatshade = rs[D3DRS_SHADEMODE] == D3DSHADE_FLAT;
/* rast.light_twoside = 0; */
rast.offset_scale = asfloat(rs[D3DRS_SLOPESCALEDEPTHBIAS]);
/* rast.offset_clamp = 0.0f; */
- cso_set_rasterizer(ctx, &rast);
+ *rast_state = rast;
}
static inline void
extern const D3DFORMAT nine_pipe_to_d3d9_format_map[PIPE_FORMAT_COUNT];
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_rasterizer_state(struct pipe_rasterizer_state *, const DWORD *);
void nine_convert_blend_state(struct cso_context *, const DWORD *);
void nine_convert_sampler_state(struct cso_context *, int idx, const DWORD *);
device->state.commit |= NINE_STATE_COMMIT_DSA;
}
+static inline void
+prepare_rasterizer(struct NineDevice9 *device)
+{
+ nine_convert_rasterizer_state(&device->state.pipe.rast, device->state.rs);
+ device->state.commit |= NINE_STATE_COMMIT_RASTERIZER;
+}
+
/* State preparation incremental */
/* State preparation + State commit */
nine_convert_blend_state(device->cso, device->state.rs);
}
-static inline void
-update_rasterizer(struct NineDevice9 *device)
-{
- nine_convert_rasterizer_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.
pipe->set_scissor_states(pipe, 0, 1, &device->state.scissor);
}
+static inline void
+commit_rasterizer(struct NineDevice9 *device)
+{
+ cso_set_rasterizer(device->cso, &device->state.pipe.rast);
+}
+
static inline void
commit_index_buffer(struct NineDevice9 *device)
{
group |= update_vs(device);
if (group & NINE_STATE_RASTERIZER)
- update_rasterizer(device);
+ prepare_rasterizer(device);
if (group & NINE_STATE_PS)
group |= update_ps(device);
if (state->commit & NINE_STATE_COMMIT_DSA)
commit_dsa(device);
+ if (state->commit & NINE_STATE_COMMIT_RASTERIZER)
+ commit_rasterizer(device);
state->commit = 0;
#define NINE_STATE_UNHANDLED (1 << 24)
#define NINE_STATE_COMMIT_DSA (1 << 0)
+#define NINE_STATE_COMMIT_RASTERIZER (1 << 1)
#define NINE_MAX_SIMULTANEOUS_RENDERTARGETS 4
uint32_t commit;
struct {
struct pipe_depth_stencil_alpha_state dsa;
+ struct pipe_rasterizer_state rast;
} pipe;
};