[Mesa-dev] [PATCH] mesa/main: Fix GetTransformFeedbacki64 for glTransformFeedbackBufferBase

Samuel Iglesias Gonsálvez siglesias at igalia.com
Thu Sep 7 05:02:52 UTC 2017


Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>

On Tue, 2017-09-05 at 14:41 +0200, Iago Toral Quiroga wrote:
> The spec has special rules for querying buffer offsets and sizes
> when BindBufferBase is used, described  in the OpenGL 4.6 spec,
> section 6.8 Buffer Object State:
> 
>    "To query the starting offset or size of the range of a buffer
>     object binding in an indexed array, call GetInteger64i_v with
>     target set to respectively the starting offset or binding size
>     name from table 6.5 for that array. Index must be in the range
>     zero to the number of bind points supported minus one. If the
>     starting offset or size was not specified when the buffer object
>     was bound (e.g. if it was bound with BindBufferBase), or if no
>     buffer object is bound to the target array at index, zero is
>     returned."
> 
> Transform feedback buffer queries should follow the same rules, since
> it is the same case for them. There is a CTS test for this.
> 
> Fixes:
> KHR-GL45.direct_state_access.xfb_buffers
> ---
>  src/mesa/main/transformfeedback.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/src/mesa/main/transformfeedback.c
> b/src/mesa/main/transformfeedback.c
> index befc74444c..a5ea2a5eb7 100644
> --- a/src/mesa/main/transformfeedback.c
> +++ b/src/mesa/main/transformfeedback.c
> @@ -1402,12 +1402,34 @@ _mesa_GetTransformFeedbacki64_v(GLuint xfb,
> GLenum pname, GLuint index,
>        return;
>     }
>  
> +   /**
> +    * This follows the same general rules used for BindBufferBase:
> +    *
> +    *   "To query the starting offset or size of the range of a
> buffer
> +    *    object binding in an indexed array, call GetInteger64i_v
> with
> +    *    target set to respectively the starting offset or binding
> size
> +    *    name from table 6.5 for that array. Index must be in the
> range
> +    *    zero to the number of bind points supported minus one. If
> the
> +    *    starting offset or size was not specified when the buffer
> object
> +    *    was bound (e.g. if it was bound with BindBufferBase), or if
> no
> +    *    buffer object is bound to the target array at index, zero
> is
> +    *    returned."
> +    */
> +   if (obj->RequestedSize[index] == 0 &&
> +       (pname == GL_TRANSFORM_FEEDBACK_BUFFER_START ||
> +        pname == GL_TRANSFORM_FEEDBACK_BUFFER_SIZE)) {
> +      *param = 0;
> +      return;
> +   }
> +
>     compute_transform_feedback_buffer_sizes(obj);
>     switch(pname) {
>     case GL_TRANSFORM_FEEDBACK_BUFFER_START:
> +      assert(obj->RequestedSize[index] > 0);
>        *param = obj->Offset[index];
>        break;
>     case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
> +      assert(obj->RequestedSize[index] > 0);
>        *param = obj->Size[index];
>        break;
>     default:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170907/310cbbc4/attachment-0001.sig>


More information about the mesa-dev mailing list