summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/r300/r300_context.c2
-rw-r--r--src/gallium/drivers/r300/r300_context.h2
-rw-r--r--src/gallium/drivers/r300/r300_emit.c12
-rw-r--r--src/gallium/drivers/r300/r300_emit.h6
-rw-r--r--src/gallium/drivers/r300/r300_state.c9
5 files changed, 15 insertions, 16 deletions
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 8d8612ed6eb..061322b75fd 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -116,10 +116,12 @@ static void r300_setup_atoms(struct r300_context* r300)
R300_INIT_ATOM(texture_cache_inval, 2);
R300_INIT_ATOM(textures_state, 0);
R300_INIT_ATOM(fs, 0);
+ R300_INIT_ATOM(fs_rc_constant_state, 0);
/* Replace emission functions for r500. */
if (r300->screen->caps.is_r500) {
r300->fs.emit = r500_emit_fs;
+ r300->fs_rc_constant_state.emit = r500_emit_fs_rc_constant_state;
}
/* Some non-CSO atoms need explicit space to store the state locally. */
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 51beaa50f57..2e248a4d6cd 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -358,6 +358,8 @@ struct r300_context {
struct r300_atom dsa_state;
/* Fragment shader. */
struct r300_atom fs;
+ /* Fragment shader RC_CONSTANT_STATE variables. */
+ struct r300_atom fs_rc_constant_state;
/* Framebuffer state. */
struct r300_atom fb_state;
/* Rasterizer state. */
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 2fa3f6fe2ec..fd857a4ac19 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -344,10 +344,10 @@ void r300_emit_fs_constant_buffer(struct r300_context* r300,
END_CS;
}
-void r300_emit_fs_constant_rc_state(struct r300_context* r300,
- struct rc_constant_list* constants)
+void r300_emit_fs_rc_constant_state(struct r300_context* r300, unsigned size, void *state)
{
struct r300_fragment_shader *fs = r300_fs(r300);
+ struct rc_constant_list *constants = &fs->shader->code.constants;
unsigned i;
unsigned count = fs->shader->rc_state_count;
unsigned first = fs->shader->externals_count;
@@ -465,10 +465,10 @@ void r500_emit_fs_constant_buffer(struct r300_context* r300,
END_CS;
}
-void r500_emit_fs_constant_rc_state(struct r300_context* r300,
- struct rc_constant_list* constants)
+void r500_emit_fs_rc_constant_state(struct r300_context* r300, unsigned size, void *state)
{
struct r300_fragment_shader *fs = r300_fs(r300);
+ struct rc_constant_list *constants = &fs->shader->code.constants;
unsigned i;
unsigned count = fs->shader->rc_state_count;
unsigned first = fs->shader->externals_count;
@@ -1215,13 +1215,9 @@ void r300_emit_dirty_state(struct r300_context* r300)
if (r300screen->caps.is_r500) {
r500_emit_fs_constant_buffer(r300,
&r300_fs(r300)->shader->code.constants);
- r500_emit_fs_constant_rc_state(r300,
- &r300_fs(r300)->shader->code.constants);
} else {
r300_emit_fs_constant_buffer(r300,
&r300_fs(r300)->shader->code.constants);
- r300_emit_fs_constant_rc_state(r300,
- &r300_fs(r300)->shader->code.constants);
}
r300->dirty_state &= ~R300_NEW_FRAGMENT_SHADER_CONSTANTS;
}
diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h
index 266538d06f3..09737fbb597 100644
--- a/src/gallium/drivers/r300/r300_emit.h
+++ b/src/gallium/drivers/r300/r300_emit.h
@@ -50,8 +50,7 @@ void r300_emit_fs(struct r300_context* r300, unsigned size, void *state);
void r300_emit_fs_constant_buffer(struct r300_context* r300,
struct rc_constant_list* constants);
-void r300_emit_fs_constant_rc_state(struct r300_context* r300,
- struct rc_constant_list* constants);
+void r300_emit_fs_rc_constant_state(struct r300_context* r300, unsigned size, void *state);
unsigned r500_get_fs_atom_size(struct r300_context *r300);
@@ -60,8 +59,7 @@ void r500_emit_fs(struct r300_context* r300, unsigned size, void *state);
void r500_emit_fs_constant_buffer(struct r300_context* r300,
struct rc_constant_list* constants);
-void r500_emit_fs_constant_rc_state(struct r300_context* r300,
- struct rc_constant_list* constants);
+void r500_emit_fs_rc_constant_state(struct r300_context* r300, unsigned size, void *state);
void r300_emit_fb_state(struct r300_context* r300, unsigned size, void* state);
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 1a0087241d7..aacaa4e6afe 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -688,11 +688,14 @@ static void r300_mark_fs_code_dirty(struct r300_context *r300)
struct r300_fragment_shader* fs = r300_fs(r300);
r300->fs.dirty = TRUE;
+ r300->fs_rc_constant_state.dirty = TRUE;
if (r300->screen->caps.is_r500) {
r300->fs.size = r500_get_fs_atom_size(r300);
+ r300->fs_rc_constant_state.size = fs->shader->rc_state_count * 7;
} else {
r300->fs.size = r300_get_fs_atom_size(r300);
+ r300->fs_rc_constant_state.size = fs->shader->rc_state_count * 5;
}
r300->dirty_state |= R300_NEW_FRAGMENT_SHADER_CONSTANTS;
@@ -999,9 +1002,7 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe,
/* R300-specific - set the texrect factor in the fragment shader */
texture = r300_texture(views[i]->texture);
if (!is_r500 && texture->uses_pitch) {
- /* XXX It would be nice to re-emit just 1 constant,
- * XXX not all of them */
- r300->dirty_state |= R300_NEW_FRAGMENT_SHADER_CONSTANTS;
+ r300->fs_rc_constant_state.dirty = TRUE;
}
}
}
@@ -1115,7 +1116,7 @@ static void r300_set_viewport_state(struct pipe_context* pipe,
r300->viewport_state.dirty = TRUE;
if (r300->fs.state && r300_fs(r300)->shader->inputs.wpos != ATTR_UNUSED) {
- r300->dirty_state |= R300_NEW_FRAGMENT_SHADER_CONSTANTS;
+ r300->fs_rc_constant_state.dirty = TRUE;
}
}