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. */
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. */
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;
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;
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;
}
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);
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);
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;
/* 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;
}
}
}
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;
}
}