summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300/r300_state.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2010-12-03 20:53:39 +1000
committerMarek Olšák <[email protected]>2010-12-05 05:47:03 +0100
commitc1365606c5b89872af4a0931e20f5cb78875eea6 (patch)
tree8eeb9533852e4739f77cad2fce9dcda760d8db0e /src/gallium/drivers/r300/r300_state.c
parent1774273bde184acb95ce0ba0bfd8a0d86d04ea8f (diff)
r300g: try and use all of vertex constant space
Finished up by Marek Olšák. We can set the constant space to use a different area per-call to the shader, we can avoid flushing the PVS as often as we do by spreading out the constants across the whole constant space. Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r300/r300_state.c')
-rw-r--r--src/gallium/drivers/r300/r300_state.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 56892755507..4eef9da06a4 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -1765,15 +1765,13 @@ static void r300_bind_vs_state(struct pipe_context* pipe, void* shader)
r300->vs_state.dirty = TRUE;
r300->vs_state.size =
vs->code.length + 9 +
- (vs->immediates_count ? vs->immediates_count * 4 + 3 : 0) +
(vs->code.num_fc_ops ? vs->code.num_fc_ops * fc_op_dwords + 4 : 0);
- if (vs->externals_count) {
- r300->vs_constants.dirty = TRUE;
- r300->vs_constants.size = vs->externals_count * 4 + 3;
- } else {
- r300->vs_constants.size = 0;
- }
+ r300->vs_constants.dirty = TRUE;
+ r300->vs_constants.size =
+ 2 +
+ (vs->externals_count ? vs->externals_count * 4 + 3 : 0) +
+ (vs->immediates_count ? vs->immediates_count * 4 + 3 : 0);
((struct r300_constant_buffer*)r300->vs_constants.state)->remap_table =
vs->code.constants_remap_table;
@@ -1835,10 +1833,22 @@ static void r300_set_constant_buffer(struct pipe_context *pipe,
if (shader == PIPE_SHADER_VERTEX) {
if (r300->screen->caps.has_tcl) {
- if (r300->vs_constants.size) {
- r300->vs_constants.dirty = TRUE;
+ struct r300_vertex_shader *vs =
+ (struct r300_vertex_shader*)r300->vs_state.state;
+
+ if (!vs) {
+ cbuf->buffer_base = 0;
+ return;
}
- r300->pvs_flush.dirty = TRUE;
+
+ cbuf->buffer_base = r300->vs_const_base;
+ r300->vs_const_base += vs->code.constants.Count;
+ if (r300->vs_const_base > R500_MAX_PVS_CONST_VECS) {
+ r300->vs_const_base = vs->code.constants.Count;
+ cbuf->buffer_base = 0;
+ r300->pvs_flush.dirty = TRUE;
+ }
+ r300->vs_constants.dirty = TRUE;
} else if (r300->draw) {
draw_set_mapped_constant_buffer(r300->draw, PIPE_SHADER_VERTEX,
0, mapped, buf->width0);