Module: Mesa
Branch: master
Commit: 6dc051557d99e81fc58e09edf21f185874dc1979
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6dc051557d99e81fc58e09edf21f185874dc1979

Author: Dave Airlie <[email protected]>
Date:   Mon Oct  4 16:24:59 2010 +1000

r600g: the code to check whether a new vertex shader is needed was wrong

this code was memcmp'ing two structs, but refcounting one of them afterwards,
so any subsequent memcmp was never going to work.

again this stops unnecessary uploads of vertex program,

---

 src/gallium/drivers/r600/r600_shader.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index 5709426..21b9180 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -245,7 +245,9 @@ 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))) {
+       /* doing a full memcmp fell over the refcount */
+       if ((rshader->vertex_elements.count == rctx->vertex_elements->count) &&
+           (!memcmp(&rshader->vertex_elements.elements, 
&rctx->vertex_elements->elements, 32 * sizeof(struct pipe_vertex_element)))) {
                return 0;
        }
        rshader->vertex_elements = *rctx->vertex_elements;

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to