OSDN Git Service

fix some conflict happenings at context destroy by freeing buffers immediately. array...
authorAapo Tahkola <aet@rasterburn.org>
Sat, 8 Apr 2006 20:05:50 +0000 (20:05 +0000)
committerAapo Tahkola <aet@rasterburn.org>
Sat, 8 Apr 2006 20:05:50 +0000 (20:05 +0000)
src/mesa/drivers/dri/r300/r300_render.c
src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c

index a0375f9..e6ed06a 100644 (file)
@@ -382,7 +382,6 @@ GLboolean r300_run_vb_render(GLcontext *ctx,
        
        r300UpdateShaders(rmesa);
        if (rmesa->state.VB.LockCount == 0 || 1) {
-               r300ReleaseArrays(ctx);
                r300EmitArrays(ctx, GL_FALSE);
 
                r300UpdateShaderStates(rmesa);
@@ -446,6 +445,7 @@ GLboolean r300_run_vb_render(GLcontext *ctx,
 #ifdef USER_BUFFERS
        r300UseArrays(ctx);
 #endif
+       r300ReleaseArrays(ctx);
        return GL_FALSE;
 }
 
index 5ea9bb4..8f76204 100644 (file)
@@ -182,7 +182,7 @@ static void radeonDrawElements( GLenum mode, GLsizei count, GLenum type, const G
        unsigned int min = ~0, max = 0;
        struct tnl_prim prim;
        static void *ptr = NULL;
-       static struct r300_dma_region rvb;
+       struct r300_dma_region rvb;
        const GLvoid *indices = c_indices;
        
        if (count > 65535) {
@@ -205,8 +205,8 @@ static void radeonDrawElements( GLenum mode, GLsizei count, GLenum type, const G
                return;
        
        FLUSH_CURRENT( ctx, 0 );
-       r300ReleaseDmaRegion(rmesa, &rvb, __FUNCTION__);
        
+       memset(&rvb, 0, sizeof(rvb));
        switch (type) {
        case GL_UNSIGNED_BYTE:
                for (i=0; i < count; i++) {
@@ -311,8 +311,10 @@ static void radeonDrawElements( GLenum mode, GLsizei count, GLenum type, const G
                        return;
                }
        } else {
-               if (setup_arrays(rmesa, min) >= R300_FALLBACK_TCL)
+               if (setup_arrays(rmesa, min) >= R300_FALLBACK_TCL) {
+                       r300ReleaseDmaRegion(rmesa, &rvb, __FUNCTION__);
                        goto fallback;
+               }
                
                rmesa->state.VB.Count = max - min + 1;
        }
@@ -337,6 +339,7 @@ static void radeonDrawElements( GLenum mode, GLsizei count, GLenum type, const G
        if(rvb.buf)
                radeon_mm_use(rmesa, rvb.buf->id);
        
+       r300ReleaseDmaRegion(rmesa, &rvb, __FUNCTION__);
        return;
        
        fallback:
@@ -355,7 +358,7 @@ static void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei
        int elt_size;
        int i;
        void *ptr = NULL;
-       static struct r300_dma_region rvb;
+       struct r300_dma_region rvb;
        const GLvoid *indices = c_indices;
        
        if (count > 65535) {
@@ -381,9 +384,9 @@ static void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei
 #ifdef OPTIMIZE_ELTS
        min = 0;
 #endif
-       r300ReleaseDmaRegion(rmesa, &rvb, __FUNCTION__);
        
-       switch(type){
+       memset(&rvb, 0, sizeof(rvb));
+       switch (type){
        case GL_UNSIGNED_BYTE:
                elt_size = 2;
                
@@ -473,8 +476,10 @@ static void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei
                        return;
                }*/
        } else {
-               if (setup_arrays(rmesa, min) >= R300_FALLBACK_TCL)
+               if (setup_arrays(rmesa, min) >= R300_FALLBACK_TCL) {
+                       r300ReleaseDmaRegion(rmesa, &rvb, __FUNCTION__);
                        goto fallback;
+               }
                
                rmesa->state.VB.Count = max - min + 1;
        }
@@ -501,6 +506,7 @@ static void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei
        if(rvb.buf)
                radeon_mm_use(rmesa, rvb.buf->id);
        
+       r300ReleaseDmaRegion(rmesa, &rvb, __FUNCTION__);
        return ;
        
        fallback: