On 10/07/2016 12:43 PM, Ian Romanick wrote:
On 10/05/2016 05:42 PM, Brian Paul wrote:
To inform drivers of texture buffer offset/size changes, as we do for
other texture object parameters.
---
  src/mesa/main/teximage.c | 13 +++++++++++++
  1 file changed, 13 insertions(+)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index df8f0bc..411ec49 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5046,6 +5046,8 @@ texture_buffer_range(struct gl_context *ctx,
                       GLintptr offset, GLsizeiptr size,
                       const char *caller)
  {
+   GLintptr oldOffset = texObj->BufferOffset;
+   GLsizeiptr oldSize = texObj->BufferSize;
     mesa_format format;

     /* NOTE: ARB_texture_buffer_object has interactions with
@@ -5078,6 +5080,17 @@ texture_buffer_range(struct gl_context *ctx,
     }
     _mesa_unlock_texture(ctx, texObj);

+   if (ctx->Driver.TexParameter) {
+      if (offset != oldOffset) {
+         ctx->Driver.TexParameter(ctx, texObj, GL_TEXTURE_BUFFER_OFFSET,
+                                  (const GLfloat *) &offset);

This always feels icky to me.  Casting pointers in this way can only
lead to sadness.  Also, none of the driver implementations of
TexParameter (see src/mesa/drivers/dri/r200/r200_tex.c,
src/mesa/drivers/dri/radeon/radeon_tex.c,
src/mesa/drivers/dri/nouveau/nouveau_state.c, and
src/mesa/state_tracker/st_cb_texture.c) use params.  Maybe we could just
remove that parameter?

I'd be happy with that.  The alternatives are:
1. use a void * parameter
2. add new functions for int, float, pointer, etc.

Unless someone wants to bike-shed this, I'll write a patch to remove the param later.

-Brian


+      }
+      if (size != oldSize) {
+         ctx->Driver.TexParameter(ctx, texObj, GL_TEXTURE_BUFFER_SIZE,
+                                  (const GLfloat *) &size);
+      }
+   }
+
     ctx->NewDriverState |= ctx->DriverFlags.NewTextureBuffer;

     if (bufObj) {



_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to