r600g: avoid rebuilding the vertex shader if no change to input format
authorJerome Glisse <jglisse@redhat.com>
Tue, 28 Sep 2010 18:34:25 +0000 (14:34 -0400)
committerJerome Glisse <jglisse@redhat.com>
Tue, 28 Sep 2010 18:34:25 +0000 (14:34 -0400)
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_state2.c

index 5abf910c81c754792d232906471e41a40761caa8..e161dc5066a5a48a5523da174fadd45415740ca3 100644 (file)
@@ -69,12 +69,6 @@ struct r600_pipe_blend {
        unsigned                        cb_target_mask;
 };
 
-struct r600_pipe_shader {
-       struct r600_shader              shader;
-       struct r600_pipe_state          rstate;
-       struct radeon_ws_bo             *bo;
-};
-
 struct r600_vertex_element
 {
        unsigned                        count;
@@ -82,6 +76,14 @@ struct r600_vertex_element
        struct pipe_vertex_element      elements[32];
 };
 
+struct r600_pipe_shader {
+       struct r600_shader              shader;
+       struct r600_pipe_state          rstate;
+       struct radeon_ws_bo             *bo;
+       struct r600_vertex_element      vertex_elements;
+};
+
+
 struct r600_pipe_context {
        struct pipe_context             context;
        struct blitter_context          *blitter;
index 72d04534e6269b69f46fc49691e2195fdddc6cfb..796442f5a4baad7a8f579822db529af426c6506d 100644 (file)
@@ -257,6 +257,10 @@ static int r600_shader_update(struct pipe_context *ctx, struct r600_pipe_shader
 
        if (shader->processor_type != TGSI_PROCESSOR_VERTEX)
                return 0;
+       if (!memcmp(&rshader->vertex_elements, rctx->vertex_elements, sizeof(struct r600_vertex_element))) {
+               return 0;
+       }
+       rshader->vertex_elements = *rctx->vertex_elements;
        for (i = 0; i < rctx->vertex_elements->count; i++) {
                resource_format[nresources++] = rctx->vertex_elements->elements[i].src_format;
        }