uint32_t scissor_bottom_right; /* R300_SC_SCISSORS_BR: 0x43e4 */
};
+struct r300_texture_state {
+};
+
#define R300_NEW_BLEND 0x0001
#define R300_NEW_BLEND_COLOR 0x0002
#define R300_NEW_DSA 0x0004
struct r300_dsa_state* dsa_state;
/* Fragment shader state. */
struct r300_fs_state* fs_state;
+ /* Framebuffer state. We currently don't need our own version of this. */
+ struct pipe_framebuffer_state framebuffer_state;
/* Rasterizer state. */
struct r300_rs_state* rs_state;
/* Sampler states. */
int sampler_count;
/* Scissor state. */
struct r300_scissor_state* scissor_state;
+ /* Texture states. */
+ struct r300_texture* textures[8];
+ struct r300_texture_state* texture_states[8];
+ int texture_count;
/* Bitmask of dirty state objects. */
uint32_t dirty_state;
/* Flag indicating whether or not the HW is dirty. */
r300->dirty_state |= R300_NEW_BLEND_COLOR;
}
+static void r300_set_clip_state(struct pipe_context* pipe,
+ const struct pipe_clip_state* state)
+{
+ struct r300_context* r300 = r300_context(pipe);
+ /* XXX Draw */
+ draw_flush(r300->draw);
+ draw_set_clip_state(r300->draw, state);
+}
+
static uint32_t translate_depth_stencil_function(int zs_func) {
switch (zs_func) {
case PIPE_FUNC_NEVER:
FREE(state);
}
+static void
+ r300_set_framebuffer_state(struct pipe_context* pipe,
+ const struct pipe_framebuffer_state* state)
+{
+ struct r300_context* r300 = r300_context(pipe);
+
+ draw_flush(r300->draw);
+
+ r300->framebuffer_state = *state;
+
+ /* XXX do we need to mark dirty state? */
+}
+
/* Create fragment shader state. */
static void* r300_create_fs_state(struct pipe_context* pipe,
const struct pipe_shader_state* state)
FREE(state);
}
+static void r300_set_polygon_stipple(struct pipe_context* pipe,
+ const struct pipe_poly_stipple* state)
+{
+ /* XXX */
+}
+
#if 0
struct pipe_rasterizer_state
{
FREE(state);
}
+static void r300_set_sampler_textures(struct pipe_context* pipe,
+ unsigned count,
+ struct pipe_texture** texture)
+{
+ struct r300_context* r300 = r300_context(pipe);
+ int i;
+
+ /* XXX magic num */
+ if (count > 8) {
+ return;
+ }
+
+ for (i = 0; i < count; i++) {
+ if (r300->textures[i] != (struct r300_texture*)texture[i]) {
+ pipe_texture_reference((struct pipe_texture**)&r300->textures[i],
+ texture[i]);
+ /* XXX NEW_TEXTURE instead? */
+ r300->dirty_state |= (R300_NEW_SAMPLER << i);
+ }
+ }
+
+ for (i = count; i < 8; i++) {
+ /* XXX also state change? */
+ pipe_texture_reference((struct pipe_texture**)&r300->textures[i],
+ NULL);
+ }
+
+ r300->texture_count = count;
+}
+
static void r300_set_scissor_state(struct pipe_context* pipe,
const struct pipe_scissor_state* state)
{
r300->dirty_state |= R300_NEW_SCISSOR;
}
+static void r300_set_viewport_state(struct pipe_context* pipe,
+ const struct pipe_viewport_state* state)
+{
+ struct r300_context* r300 = r300_context(pipe);
+ /* XXX handing this off to Draw for now */
+ draw_set_viewport_state(r300->draw, state);
+}
+
static void* r300_create_vs_state(struct pipe_context* pipe,
const struct pipe_shader_state* state)
{
r300->context.set_blend_color = r300_set_blend_color;
+ r300->context.set_clip_state = r300_set_clip_state;
+
r300->context.create_depth_stencil_alpha_state = r300_create_dsa_state;
r300->context.bind_depth_stencil_alpha_state = r300_bind_dsa_state;
r300->context.delete_depth_stencil_alpha_state = r300_delete_dsa_state;
+ r300->context.set_framebuffer_state = r300_set_framebuffer_state;
+
r300->context.create_fs_state = r300_create_fs_state;
r300->context.bind_fs_state = r300_bind_fs_state;
r300->context.delete_fs_state = r300_delete_fs_state;
+ r300->context.set_polygon_stipple = r300_set_polygon_stipple;
+
r300->context.create_rasterizer_state = r300_create_rs_state;
r300->context.bind_rasterizer_state = r300_bind_rs_state;
r300->context.delete_rasterizer_state = r300_delete_rs_state;
r300->context.bind_sampler_states = r300_bind_sampler_states;
r300->context.delete_sampler_state = r300_delete_sampler_state;
+ r300->context.set_sampler_textures = r300_set_sampler_textures;
+
r300->context.set_scissor_state = r300_set_scissor_state;
+ r300->context.set_viewport_state = r300_set_viewport_state;
+
r300->context.create_vs_state = r300_create_vs_state;
r300->context.bind_vs_state = r300_bind_vs_state;
r300->context.delete_vs_state = r300_delete_vs_state;