[Mesa-dev,1/3] mesa: add driver interface for glInvalidateBuffer(Sub)Data

Submitted by Marek Olšák on March 16, 2014, 5 p.m.

Details

Message ID 1394989254-10255-1-git-send-email-maraeo@gmail.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Marek Olšák March 16, 2014, 5 p.m.
From: Marek Olšák <marek.olsak@amd.com>

---
 src/mesa/main/bufferobj.c | 14 ++++++--------
 src/mesa/main/dd.h        |  8 +++++++-
 2 files changed, 13 insertions(+), 9 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 2e9e059..e7b6382 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -2813,10 +2813,9 @@  _mesa_InvalidateBufferSubData(GLuint buffer, GLintptr offset,
       return;
    }
 
-   /* We don't actually do anything for this yet.  Just return after
-    * validating the parameters and generating the required errors.
-    */
-   return;
+   if (ctx->Driver.InvalidateBufferSubData) {
+      ctx->Driver.InvalidateBufferSubData(ctx, bufObj, offset, length);
+   }
 }
 
 void GLAPIENTRY
@@ -2847,8 +2846,7 @@  _mesa_InvalidateBufferData(GLuint buffer)
       return;
    }
 
-   /* We don't actually do anything for this yet.  Just return after
-    * validating the parameters and generating the required errors.
-    */
-   return;
+   if (ctx->Driver.InvalidateBufferSubData) {
+      ctx->Driver.InvalidateBufferSubData(ctx, bufObj, 0, bufObj->Size);
+   }
 }
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 9715241..a2d2696 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -957,7 +957,13 @@  struct dd_function_table {
                             GLenum access, GLenum format);
 
    void (*MemoryBarrier)(struct gl_context *ctx, GLbitfield barriers);
-   /** @} */
+
+   /** @}
+    * \name GL_ARB_invalidate_subdata interface.
+    */
+   void (*InvalidateBufferSubData)(struct gl_context *ctx,
+                                   struct gl_buffer_object *bufObj,
+                                   unsigned offset, unsigned length);
 };
 
 

Comments

Please disregard this series. The extension is not about reallocating
a buffer as I thought, it's actually about freeing a buffer and
allocating it later when it's used again.

Marek

On Sun, Mar 16, 2014 at 6:00 PM, Marek Olšák <maraeo@gmail.com> wrote:
> From: Marek Olšák <marek.olsak@amd.com>
>
> ---
>  src/mesa/main/bufferobj.c | 14 ++++++--------
>  src/mesa/main/dd.h        |  8 +++++++-
>  2 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
> index 2e9e059..e7b6382 100644
> --- a/src/mesa/main/bufferobj.c
> +++ b/src/mesa/main/bufferobj.c
> @@ -2813,10 +2813,9 @@ _mesa_InvalidateBufferSubData(GLuint buffer, GLintptr offset,
>        return;
>     }
>
> -   /* We don't actually do anything for this yet.  Just return after
> -    * validating the parameters and generating the required errors.
> -    */
> -   return;
> +   if (ctx->Driver.InvalidateBufferSubData) {
> +      ctx->Driver.InvalidateBufferSubData(ctx, bufObj, offset, length);
> +   }
>  }
>
>  void GLAPIENTRY
> @@ -2847,8 +2846,7 @@ _mesa_InvalidateBufferData(GLuint buffer)
>        return;
>     }
>
> -   /* We don't actually do anything for this yet.  Just return after
> -    * validating the parameters and generating the required errors.
> -    */
> -   return;
> +   if (ctx->Driver.InvalidateBufferSubData) {
> +      ctx->Driver.InvalidateBufferSubData(ctx, bufObj, 0, bufObj->Size);
> +   }
>  }
> diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
> index 9715241..a2d2696 100644
> --- a/src/mesa/main/dd.h
> +++ b/src/mesa/main/dd.h
> @@ -957,7 +957,13 @@ struct dd_function_table {
>                              GLenum access, GLenum format);
>
>     void (*MemoryBarrier)(struct gl_context *ctx, GLbitfield barriers);
> -   /** @} */
> +
> +   /** @}
> +    * \name GL_ARB_invalidate_subdata interface.
> +    */
> +   void (*InvalidateBufferSubData)(struct gl_context *ctx,
> +                                   struct gl_buffer_object *bufObj,
> +                                   unsigned offset, unsigned length);
>  };
>
>
> --
> 1.8.3.2
>