r600: Update vertex fetch shader if necessary
authorCooper Yuan <cooperyuan@gmail.com>
Wed, 26 Aug 2009 08:21:10 +0000 (16:21 +0800)
committerCooper Yuan <cooperyuan@gmail.com>
Wed, 26 Aug 2009 08:21:10 +0000 (16:21 +0800)
src/mesa/drivers/dri/r600/r600_emit.c
src/mesa/drivers/dri/r600/r700_vertprog.c
src/mesa/drivers/dri/r600/r700_vertprog.h

index be86de170f918eed354d3e3d101cce653094a011..f8c56e7774b3f439311c51784d8f31bc20376768 100644 (file)
@@ -104,7 +104,8 @@ GLboolean r600DeleteShader(GLcontext * ctx,
     struct radeon_bo * pbo = (struct radeon_bo *)shaderbo;
 
     if (pbo) {
-           radeon_bo_unmap(pbo);
+           if (pbo->ptr)
+               radeon_bo_unmap(pbo);
            radeon_bo_unref(pbo); /* when bo->cref <= 0, bo will be bo_free */
     }
 
index f8f862b33aa7d16974e0e65634e723e9015853f5..86a67ab766f8a80a8f1bcc0bdf9fb2bf130b2a67 100644 (file)
@@ -301,6 +301,11 @@ void r700SelectVertexShader(GLcontext *ctx)
     unsigned int unBit;
     unsigned int i;
 
+    if (context->radeon.NewGLState & (_NEW_PROGRAM_CONSTANTS|_NEW_PROGRAM))
+    {
+       vpc->needUpdateVF = 1;
+    }
+
     if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770)
     {
         vpc->r700AsmCode.bR6xx = 1;
@@ -341,6 +346,14 @@ GLboolean r700SetupVertexProgram(GLcontext * ctx)
     unsigned int unNumParamData;
     unsigned int ui;
 
+    if (vp->needUpdateVF)
+    {
+       vp->loaded = GL_FALSE;
+       vp->r700Shader.bNeedsAssembly = GL_TRUE;
+       Process_Vertex_Program_Vfetch_Instructions(vp, &(vp->mesa_program));
+       r600DeleteShader(ctx, vp->shaderbo);
+    }
+
     if(GL_FALSE == vp->loaded)
     {
            if(vp->r700Shader.bNeedsAssembly == GL_TRUE)
index 4c3b7ee453d326079a48ca873fbda640a7797c56..e2e65021fd32c5c3ff3d52802e97b66733e200b4 100644 (file)
@@ -45,19 +45,18 @@ struct r700_vertex_program
 {
     struct gl_vertex_program mesa_program; /* Must be first */
 
-       struct r700_vertex_program *next;
+    struct r700_vertex_program *next;
 
     r700_AssemblerBase r700AsmCode;
     R700_Shader        r700Shader;
 
-       GLboolean translated;
+    GLboolean translated;
     GLboolean loaded;
+    GLboolean needUpdateVF;
        
-       /* ... */
-
     void * shaderbo;
 
-       ArrayDesc              aos_desc[VERT_ATTRIB_MAX];
+    ArrayDesc              aos_desc[VERT_ATTRIB_MAX];
 };
 
 //Internal