summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/ilo
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2013-06-24 16:26:25 +0800
committerChia-I Wu <[email protected]>2013-06-25 13:51:59 +0800
commit855b684141ddbdbc8f10a80f185c47b3a813c975 (patch)
treed8bd6602b0034515414a9b93d5aa27506875a8a1 /src/gallium/drivers/ilo
parent9b18df6e087a4db8ed5ed38bcc6b1db34fa95586 (diff)
ilo: speed up ilo_shader_select_kernel_routing() a bit
Remember the order of the source attributes and avoid recomputation when it does not change.
Diffstat (limited to 'src/gallium/drivers/ilo')
-rw-r--r--src/gallium/drivers/ilo/ilo_shader.c32
-rw-r--r--src/gallium/drivers/ilo/shader/ilo_shader_internal.h4
2 files changed, 32 insertions, 4 deletions
diff --git a/src/gallium/drivers/ilo/ilo_shader.c b/src/gallium/drivers/ilo/ilo_shader.c
index 5f95a19244f..1157c5fa21e 100644
--- a/src/gallium/drivers/ilo/ilo_shader.c
+++ b/src/gallium/drivers/ilo/ilo_shader.c
@@ -900,20 +900,36 @@ ilo_shader_select_kernel_routing(struct ilo_shader_state *shader,
src_semantics = source->shader->out.semantic_names;
src_indices = source->shader->out.semantic_indices;
src_len = source->shader->out.count;
+ }
+ else {
+ src_semantics = kernel->in.semantic_names;
+ src_indices = kernel->in.semantic_indices;
+ src_len = kernel->in.count;
+ }
+
+ /* no change */
+ if (kernel->routing_initialized &&
+ routing->source_skip + routing->source_len <= src_len &&
+ kernel->routing_sprite_coord_enable == sprite_coord_enable &&
+ !memcmp(kernel->routing_src_semantics,
+ &src_semantics[routing->source_skip],
+ sizeof(kernel->routing_src_semantics[0]) * routing->source_len) &&
+ !memcmp(kernel->routing_src_indices,
+ &src_indices[routing->source_skip],
+ sizeof(kernel->routing_src_indices[0]) * routing->source_len))
+ return false;
+ if (source) {
/* skip PSIZE and POSITION (how about the optional CLIPDISTs?) */
assert(src_semantics[0] == TGSI_SEMANTIC_PSIZE);
assert(src_semantics[1] == TGSI_SEMANTIC_POSITION);
routing->source_skip = 2;
+
routing->source_len = src_len - routing->source_skip;
src_semantics += routing->source_skip;
src_indices += routing->source_skip;
}
else {
- src_semantics = kernel->in.semantic_names;
- src_indices = kernel->in.semantic_indices;
- src_len = kernel->in.count;
-
routing->source_skip = 0;
routing->source_len = src_len;
}
@@ -997,6 +1013,14 @@ ilo_shader_select_kernel_routing(struct ilo_shader_state *shader,
*/
routing->source_len = max_src_slot + 1;
+ /* remember the states of the source */
+ kernel->routing_initialized = true;
+ kernel->routing_sprite_coord_enable = sprite_coord_enable;
+ memcpy(kernel->routing_src_semantics, src_semantics,
+ sizeof(kernel->routing_src_semantics[0]) * routing->source_len);
+ memcpy(kernel->routing_src_indices, src_indices,
+ sizeof(kernel->routing_src_indices[0]) * routing->source_len);
+
return true;
}
diff --git a/src/gallium/drivers/ilo/shader/ilo_shader_internal.h b/src/gallium/drivers/ilo/shader/ilo_shader_internal.h
index d9ae2fa0a8f..07e8ee2f683 100644
--- a/src/gallium/drivers/ilo/shader/ilo_shader_internal.h
+++ b/src/gallium/drivers/ilo/shader/ilo_shader_internal.h
@@ -116,6 +116,10 @@ struct ilo_shader {
void *kernel;
int kernel_size;
+ bool routing_initialized;
+ int routing_src_semantics[PIPE_MAX_SHADER_OUTPUTS];
+ int routing_src_indices[PIPE_MAX_SHADER_OUTPUTS];
+ uint32_t routing_sprite_coord_enable;
struct ilo_kernel_routing routing;
/* what does the push constant buffer consist of? */