[Mesa-dev,3/3] i965/wm: use proper API buffer size for the surfaces.

Submitted by Iago Toral Quiroga on Dec. 15, 2015, 11:51 a.m.

Details

Message ID 1450180308-20143-3-git-send-email-itoral@igalia.com
State Accepted
Commit 8cf2e892fca20c4776b4a07c39918343cb2d4e0e
Headers show
Series "Series without cover letter" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Iago Toral Quiroga Dec. 15, 2015, 11:51 a.m.
From: Samuel Iglesias Gonsálvez <siglesias@igalia.com>

Commit 5bb5eeea fix a bug indicating that the surfaces should have the
API buffer size. Hovewer it picked the wrong value.

This patch adds a new variable, which takes into account
glBindBufferRange() values. Fixes the following regressions:

ES31-CTS.shader_storage_buffer_object.advanced-unsizedArrayLength-cs-std430-vec-bindrangeOffset
ES31-CTS.shader_storage_buffer_object.advanced-unsizedArrayLength-cs-std430-vec-bindrangeSize

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
---
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 12 ++++++++----
 src/mesa/drivers/dri/i965/intel_buffer_objects.c |  1 +
 src/mesa/main/bufferobj.c                        |  4 +++-
 src/mesa/main/mtypes.h                           |  1 +
 4 files changed, 13 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index c4ebbf3..9072860 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -949,12 +949,14 @@  brw_upload_ubo_surfaces(struct brw_context *brw,
       } else {
          struct intel_buffer_object *intel_bo =
             intel_buffer_object(binding->BufferObject);
+         GLsizeiptrARB size = MIN2(binding->BufferObject->BufferRangeSize,
+                                   binding->BufferObject->Size - binding->Offset);
          drm_intel_bo *bo =
             intel_bufferobj_buffer(brw, intel_bo,
                                    binding->Offset,
-                                   binding->BufferObject->Size - binding->Offset);
+                                   size);
          brw_create_constant_surface(brw, bo, binding->Offset,
-                                     binding->BufferObject->Size - binding->Offset,
+                                     size,
                                      &ubo_surf_offsets[i]);
       }
    }
@@ -971,12 +973,14 @@  brw_upload_ubo_surfaces(struct brw_context *brw,
       } else {
          struct intel_buffer_object *intel_bo =
             intel_buffer_object(binding->BufferObject);
+         GLsizeiptrARB size = MIN2(binding->BufferObject->BufferRangeSize,
+                                   binding->BufferObject->Size - binding->Offset);
          drm_intel_bo *bo =
             intel_bufferobj_buffer(brw, intel_bo,
                                    binding->Offset,
-                                   binding->BufferObject->Size - binding->Offset);
+                                   size);
          brw_create_buffer_surface(brw, bo, binding->Offset,
-                                   binding->BufferObject->Size - binding->Offset,
+                                   size,
                                    &ssbo_surf_offsets[i]);
       }
    }
diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.c b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
index 7a5b3fc..b26c939 100644
--- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
@@ -198,6 +198,7 @@  brw_buffer_data(struct gl_context *ctx,
    (void) target;
 
    intel_obj->Base.Size = size;
+   intel_obj->Base.BufferRangeSize = size;
    intel_obj->Base.Usage = usage;
    intel_obj->Base.StorageFlags = storageFlags;
 
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index e0639c8..7f42673 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -43,7 +43,7 @@ 
 #include "glformats.h"
 #include "texstore.h"
 #include "transformfeedback.h"
-
+#include "macros.h"
 
 /* Debug flags */
 /*#define VBO_DEBUG*/
@@ -2838,6 +2838,7 @@  bind_buffer_range_uniform_buffer(struct gl_context *ctx,
 
    _mesa_reference_buffer_object(ctx, &ctx->UniformBuffer, bufObj);
    bind_uniform_buffer(ctx, index, bufObj, offset, size, GL_FALSE);
+   bufObj->BufferRangeSize = MIN2(size, bufObj->Size);
 }
 
 /**
@@ -2873,6 +2874,7 @@  bind_buffer_range_shader_storage_buffer(struct gl_context *ctx,
 
    _mesa_reference_buffer_object(ctx, &ctx->ShaderStorageBuffer, bufObj);
    bind_shader_storage_buffer(ctx, index, bufObj, offset, size, GL_FALSE);
+   bufObj->BufferRangeSize = MIN2(size, bufObj->Size);
 }
 
 /**
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index acacae0..91f9f5e 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1268,6 +1268,7 @@  struct gl_buffer_object
    GLenum Usage;        /**< GL_STREAM_DRAW_ARB, GL_STREAM_READ_ARB, etc. */
    GLbitfield StorageFlags; /**< GL_MAP_PERSISTENT_BIT, etc. */
    GLsizeiptrARB Size;  /**< Size of buffer storage in bytes */
+   GLsizeiptrARB BufferRangeSize;  /**< Amount of data that can be read from or written to, in bytes */
    GLubyte *Data;       /**< Location of storage either in RAM or VRAM. */
    GLboolean DeletePending;   /**< true if buffer object is removed from the hash */
    GLboolean Written;   /**< Ever written to? (for debugging) */

Comments

This patch is still unreviewed.

Sam

On Tue, 2015-12-15 at 12:51 +0100, Iago Toral Quiroga wrote:
> From: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
> 
> Commit 5bb5eeea fix a bug indicating that the surfaces should have
> the
> API buffer size. Hovewer it picked the wrong value.
> 
> This patch adds a new variable, which takes into account
> glBindBufferRange() values. Fixes the following regressions:
> 
> ES31-CTS.shader_storage_buffer_object.advanced-unsizedArrayLength-cs-
> std430-vec-bindrangeOffset
> ES31-CTS.shader_storage_buffer_object.advanced-unsizedArrayLength-cs-
> std430-vec-bindrangeSize
> 
> Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
> ---
>  src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 12 ++++++++----
>  src/mesa/drivers/dri/i965/intel_buffer_objects.c |  1 +
>  src/mesa/main/bufferobj.c                        |  4 +++-
>  src/mesa/main/mtypes.h                           |  1 +
>  4 files changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> index c4ebbf3..9072860 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> @@ -949,12 +949,14 @@ brw_upload_ubo_surfaces(struct brw_context
> *brw,
>        } else {
>           struct intel_buffer_object *intel_bo =
>              intel_buffer_object(binding->BufferObject);
> +         GLsizeiptrARB size = MIN2(binding->BufferObject-
> >BufferRangeSize,
> +                                   binding->BufferObject->Size -
> binding->Offset);
>           drm_intel_bo *bo =
>              intel_bufferobj_buffer(brw, intel_bo,
>                                     binding->Offset,
> -                                   binding->BufferObject->Size -
> binding->Offset);
> +                                   size);
>           brw_create_constant_surface(brw, bo, binding->Offset,
> -                                     binding->BufferObject->Size -
> binding->Offset,
> +                                     size,
>                                       &ubo_surf_offsets[i]);
>        }
>     }
> @@ -971,12 +973,14 @@ brw_upload_ubo_surfaces(struct brw_context
> *brw,
>        } else {
>           struct intel_buffer_object *intel_bo =
>              intel_buffer_object(binding->BufferObject);
> +         GLsizeiptrARB size = MIN2(binding->BufferObject-
> >BufferRangeSize,
> +                                   binding->BufferObject->Size -
> binding->Offset);
>           drm_intel_bo *bo =
>              intel_bufferobj_buffer(brw, intel_bo,
>                                     binding->Offset,
> -                                   binding->BufferObject->Size -
> binding->Offset);
> +                                   size);
>           brw_create_buffer_surface(brw, bo, binding->Offset,
> -                                   binding->BufferObject->Size -
> binding->Offset,
> +                                   size,
>                                     &ssbo_surf_offsets[i]);
>        }
>     }
> diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.c
> b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
> index 7a5b3fc..b26c939 100644
> --- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c
> +++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
> @@ -198,6 +198,7 @@ brw_buffer_data(struct gl_context *ctx,
>     (void) target;
>  
>     intel_obj->Base.Size = size;
> +   intel_obj->Base.BufferRangeSize = size;
>     intel_obj->Base.Usage = usage;
>     intel_obj->Base.StorageFlags = storageFlags;
>  
> diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
> index e0639c8..7f42673 100644
> --- a/src/mesa/main/bufferobj.c
> +++ b/src/mesa/main/bufferobj.c
> @@ -43,7 +43,7 @@
>  #include "glformats.h"
>  #include "texstore.h"
>  #include "transformfeedback.h"
> -
> +#include "macros.h"
>  
>  /* Debug flags */
>  /*#define VBO_DEBUG*/
> @@ -2838,6 +2838,7 @@ bind_buffer_range_uniform_buffer(struct
> gl_context *ctx,
>  
>     _mesa_reference_buffer_object(ctx, &ctx->UniformBuffer, bufObj);
>     bind_uniform_buffer(ctx, index, bufObj, offset, size, GL_FALSE);
> +   bufObj->BufferRangeSize = MIN2(size, bufObj->Size);
>  }
>  
>  /**
> @@ -2873,6 +2874,7 @@ bind_buffer_range_shader_storage_buffer(struct
> gl_context *ctx,
>  
>     _mesa_reference_buffer_object(ctx, &ctx->ShaderStorageBuffer,
> bufObj);
>     bind_shader_storage_buffer(ctx, index, bufObj, offset, size,
> GL_FALSE);
> +   bufObj->BufferRangeSize = MIN2(size, bufObj->Size);
>  }
>  
>  /**
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index acacae0..91f9f5e 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -1268,6 +1268,7 @@ struct gl_buffer_object
>     GLenum Usage;        /**< GL_STREAM_DRAW_ARB, GL_STREAM_READ_ARB,
> etc. */
>     GLbitfield StorageFlags; /**< GL_MAP_PERSISTENT_BIT, etc. */
>     GLsizeiptrARB Size;  /**< Size of buffer storage in bytes */
> +   GLsizeiptrARB BufferRangeSize;  /**< Amount of data that can be
> read from or written to, in bytes */
>     GLubyte *Data;       /**< Location of storage either in RAM or
> VRAM. */
>     GLboolean DeletePending;   /**< true if buffer object is removed
> from the hash */
>     GLboolean Written;   /**< Ever written to? (for debugging) */
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>


> -----Original Message-----

> From: Samuel Iglesias Gonsálvez [mailto:siglesias@igalia.com]

> Sent: Tuesday, December 22, 2015 8:40 AM

> To: Iago Toral Quiroga; mesa-dev@lists.freedesktop.org

> Cc: Lofstedt, Marta; Palli, Tapani

> Subject: Re: [PATCH 3/3] i965/wm: use proper API buffer size for the

> surfaces.

> 

> This patch is still unreviewed.

> 

> Sam

> 

> On Tue, 2015-12-15 at 12:51 +0100, Iago Toral Quiroga wrote:

> > From: Samuel Iglesias Gonsálvez <siglesias@igalia.com>

> >

> > Commit 5bb5eeea fix a bug indicating that the surfaces should have the

> > API buffer size. Hovewer it picked the wrong value.

> >

> > This patch adds a new variable, which takes into account

> > glBindBufferRange() values. Fixes the following regressions:

> >

> > ES31-CTS.shader_storage_buffer_object.advanced-unsizedArrayLength-

> cs-

> > std430-vec-bindrangeOffset

> > ES31-CTS.shader_storage_buffer_object.advanced-unsizedArrayLength-

> cs-

> > std430-vec-bindrangeSize

> >

> > Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>

> > ---

> >  src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 12 ++++++++----

> >  src/mesa/drivers/dri/i965/intel_buffer_objects.c |  1 +

> >  src/mesa/main/bufferobj.c                        |  4 +++-

> >  src/mesa/main/mtypes.h                           |  1 +

> >  4 files changed, 13 insertions(+), 5 deletions(-)

> >

> > diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c

> > b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c

> > index c4ebbf3..9072860 100644

> > --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c

> > +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c

> > @@ -949,12 +949,14 @@ brw_upload_ubo_surfaces(struct brw_context

> *brw,

> >        } else {

> >           struct intel_buffer_object *intel_bo =

> >              intel_buffer_object(binding->BufferObject);

> > +         GLsizeiptrARB size = MIN2(binding->BufferObject-

> > >BufferRangeSize,

> > +                                   binding->BufferObject->Size -

> > binding->Offset);

> >           drm_intel_bo *bo =

> >              intel_bufferobj_buffer(brw, intel_bo,

> >                                     binding->Offset,

> > -                                   binding->BufferObject->Size -

> > binding->Offset);

> > +                                   size);

> >           brw_create_constant_surface(brw, bo, binding->Offset,

> > -                                     binding->BufferObject->Size -

> > binding->Offset,

> > +                                     size,

> >                                       &ubo_surf_offsets[i]);

> >        }

> >     }

> > @@ -971,12 +973,14 @@ brw_upload_ubo_surfaces(struct brw_context

> *brw,

> >        } else {

> >           struct intel_buffer_object *intel_bo =

> >              intel_buffer_object(binding->BufferObject);

> > +         GLsizeiptrARB size = MIN2(binding->BufferObject-

> > >BufferRangeSize,

> > +                                   binding->BufferObject->Size -

> > binding->Offset);

> >           drm_intel_bo *bo =

> >              intel_bufferobj_buffer(brw, intel_bo,

> >                                     binding->Offset,

> > -                                   binding->BufferObject->Size -

> > binding->Offset);

> > +                                   size);

> >           brw_create_buffer_surface(brw, bo, binding->Offset,

> > -                                   binding->BufferObject->Size -

> > binding->Offset,

> > +                                   size,

> >                                     &ssbo_surf_offsets[i]);

> >        }

> >     }

> > diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.c

> > b/src/mesa/drivers/dri/i965/intel_buffer_objects.c

> > index 7a5b3fc..b26c939 100644

> > --- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c

> > +++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c

> > @@ -198,6 +198,7 @@ brw_buffer_data(struct gl_context *ctx,

> >     (void) target;

> >

> >     intel_obj->Base.Size = size;

> > +   intel_obj->Base.BufferRangeSize = size;

> >     intel_obj->Base.Usage = usage;

> >     intel_obj->Base.StorageFlags = storageFlags;

> >

> > diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c

> > index e0639c8..7f42673 100644

> > --- a/src/mesa/main/bufferobj.c

> > +++ b/src/mesa/main/bufferobj.c

> > @@ -43,7 +43,7 @@

> >  #include "glformats.h"

> >  #include "texstore.h"

> >  #include "transformfeedback.h"

> > -

> > +#include "macros.h"

> >

> >  /* Debug flags */

> >  /*#define VBO_DEBUG*/

> > @@ -2838,6 +2838,7 @@ bind_buffer_range_uniform_buffer(struct

> > gl_context *ctx,

> >

> >     _mesa_reference_buffer_object(ctx, &ctx->UniformBuffer, bufObj);

> >     bind_uniform_buffer(ctx, index, bufObj, offset, size, GL_FALSE);

> > +   bufObj->BufferRangeSize = MIN2(size, bufObj->Size);

> >  }

> >

> >  /**

> > @@ -2873,6 +2874,7 @@

> bind_buffer_range_shader_storage_buffer(struct

> > gl_context *ctx,

> >

> >     _mesa_reference_buffer_object(ctx, &ctx->ShaderStorageBuffer,

> > bufObj);

> >     bind_shader_storage_buffer(ctx, index, bufObj, offset, size,

> > GL_FALSE);

> > +   bufObj->BufferRangeSize = MIN2(size, bufObj->Size);

> >  }

> >

> >  /**

> > diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index

> > acacae0..91f9f5e 100644

> > --- a/src/mesa/main/mtypes.h

> > +++ b/src/mesa/main/mtypes.h

> > @@ -1268,6 +1268,7 @@ struct gl_buffer_object

> >     GLenum Usage;        /**< GL_STREAM_DRAW_ARB,

> GL_STREAM_READ_ARB,

> > etc. */

> >     GLbitfield StorageFlags; /**< GL_MAP_PERSISTENT_BIT, etc. */

> >     GLsizeiptrARB Size;  /**< Size of buffer storage in bytes */

> > +   GLsizeiptrARB BufferRangeSize;  /**< Amount of data that can be

> > read from or written to, in bytes */

> >     GLubyte *Data;       /**< Location of storage either in RAM or

> > VRAM. */

> >     GLboolean DeletePending;   /**< true if buffer object is removed

> > from the hash */

> >     GLboolean Written;   /**< Ever written to? (for debugging) */
Buffer range is a property of the binding, not the buffer. What if one
buffer is bound twice with diff ranges to diff bindings?

Also please don't make core changes in commits with a driver prefix... I
nearly missed this one because it said i965.
On Dec 15, 2015 6:52 AM, "Iago Toral Quiroga" <itoral@igalia.com> wrote:

> From: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
>
> Commit 5bb5eeea fix a bug indicating that the surfaces should have the
> API buffer size. Hovewer it picked the wrong value.
>
> This patch adds a new variable, which takes into account
> glBindBufferRange() values. Fixes the following regressions:
>
>
> ES31-CTS.shader_storage_buffer_object.advanced-unsizedArrayLength-cs-std430-vec-bindrangeOffset
>
> ES31-CTS.shader_storage_buffer_object.advanced-unsizedArrayLength-cs-std430-vec-bindrangeSize
>
> Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
> ---
>  src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 12 ++++++++----
>  src/mesa/drivers/dri/i965/intel_buffer_objects.c |  1 +
>  src/mesa/main/bufferobj.c                        |  4 +++-
>  src/mesa/main/mtypes.h                           |  1 +
>  4 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> index c4ebbf3..9072860 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> @@ -949,12 +949,14 @@ brw_upload_ubo_surfaces(struct brw_context *brw,
>        } else {
>           struct intel_buffer_object *intel_bo =
>              intel_buffer_object(binding->BufferObject);
> +         GLsizeiptrARB size = MIN2(binding->BufferObject->BufferRangeSize,
> +                                   binding->BufferObject->Size -
> binding->Offset);
>           drm_intel_bo *bo =
>              intel_bufferobj_buffer(brw, intel_bo,
>                                     binding->Offset,
> -                                   binding->BufferObject->Size -
> binding->Offset);
> +                                   size);
>           brw_create_constant_surface(brw, bo, binding->Offset,
> -                                     binding->BufferObject->Size -
> binding->Offset,
> +                                     size,
>                                       &ubo_surf_offsets[i]);
>        }
>     }
> @@ -971,12 +973,14 @@ brw_upload_ubo_surfaces(struct brw_context *brw,
>        } else {
>           struct intel_buffer_object *intel_bo =
>              intel_buffer_object(binding->BufferObject);
> +         GLsizeiptrARB size = MIN2(binding->BufferObject->BufferRangeSize,
> +                                   binding->BufferObject->Size -
> binding->Offset);
>           drm_intel_bo *bo =
>              intel_bufferobj_buffer(brw, intel_bo,
>                                     binding->Offset,
> -                                   binding->BufferObject->Size -
> binding->Offset);
> +                                   size);
>           brw_create_buffer_surface(brw, bo, binding->Offset,
> -                                   binding->BufferObject->Size -
> binding->Offset,
> +                                   size,
>                                     &ssbo_surf_offsets[i]);
>        }
>     }
> diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.c
> b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
> index 7a5b3fc..b26c939 100644
> --- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c
> +++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
> @@ -198,6 +198,7 @@ brw_buffer_data(struct gl_context *ctx,
>     (void) target;
>
>     intel_obj->Base.Size = size;
> +   intel_obj->Base.BufferRangeSize = size;
>     intel_obj->Base.Usage = usage;
>     intel_obj->Base.StorageFlags = storageFlags;
>
> diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
> index e0639c8..7f42673 100644
> --- a/src/mesa/main/bufferobj.c
> +++ b/src/mesa/main/bufferobj.c
> @@ -43,7 +43,7 @@
>  #include "glformats.h"
>  #include "texstore.h"
>  #include "transformfeedback.h"
> -
> +#include "macros.h"
>
>  /* Debug flags */
>  /*#define VBO_DEBUG*/
> @@ -2838,6 +2838,7 @@ bind_buffer_range_uniform_buffer(struct gl_context
> *ctx,
>
>     _mesa_reference_buffer_object(ctx, &ctx->UniformBuffer, bufObj);
>     bind_uniform_buffer(ctx, index, bufObj, offset, size, GL_FALSE);
> +   bufObj->BufferRangeSize = MIN2(size, bufObj->Size);
>  }
>
>  /**
> @@ -2873,6 +2874,7 @@ bind_buffer_range_shader_storage_buffer(struct
> gl_context *ctx,
>
>     _mesa_reference_buffer_object(ctx, &ctx->ShaderStorageBuffer, bufObj);
>     bind_shader_storage_buffer(ctx, index, bufObj, offset, size, GL_FALSE);
> +   bufObj->BufferRangeSize = MIN2(size, bufObj->Size);
>  }
>
>  /**
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index acacae0..91f9f5e 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -1268,6 +1268,7 @@ struct gl_buffer_object
>     GLenum Usage;        /**< GL_STREAM_DRAW_ARB, GL_STREAM_READ_ARB, etc.
> */
>     GLbitfield StorageFlags; /**< GL_MAP_PERSISTENT_BIT, etc. */
>     GLsizeiptrARB Size;  /**< Size of buffer storage in bytes */
> +   GLsizeiptrARB BufferRangeSize;  /**< Amount of data that can be read
> from or written to, in bytes */
>     GLubyte *Data;       /**< Location of storage either in RAM or VRAM. */
>     GLboolean DeletePending;   /**< true if buffer object is removed from
> the hash */
>     GLboolean Written;   /**< Ever written to? (for debugging) */
> --
> 1.9.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>