[Mesa-dev] [PATCH v2 3/9] mesa: Add QueryBuffer to context
Ian Romanick
idr at freedesktop.org
Mon Mar 31 13:45:58 PDT 2014
On 03/27/2014 01:59 PM, Rafal Mielniczuk wrote:
> Add QueryBuffer and initialise it to NullBufferObj
> on start
>
> Signed-off-by: Rafal Mielniczuk <rafal.mielniczuk2 at gmail.com>
> ---
> src/mesa/main/bufferobj.c | 5 +++++
> src/mesa/main/mtypes.h | 2 ++
> 2 files changed, 7 insertions(+)
>
> diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
> index 2e9e059..8d6e1ee 100644
> --- a/src/mesa/main/bufferobj.c
> +++ b/src/mesa/main/bufferobj.c
> @@ -89,6 +89,8 @@ get_buffer_target(struct gl_context *ctx, GLenum target)
> return &ctx->CopyReadBuffer;
> case GL_COPY_WRITE_BUFFER:
> return &ctx->CopyWriteBuffer;
> + case GL_QUERY_BUFFER:
This query is only available if the extension is enabled and you're in
desktop OpenGL. You'll need something like:
if (_mesa_is_desktop_gl(ctx)
&& ctx->Extensions.ARB_query_buffer_object)
return &ctx->QueryBuffer;
break;
> + return &ctx->QueryBuffer;
> case GL_DRAW_INDIRECT_BUFFER:
> if (ctx->API == API_OPENGL_CORE &&
> ctx->Extensions.ARB_draw_indirect) {
> @@ -835,6 +837,9 @@ _mesa_init_buffer_objects( struct gl_context *ctx )
> _mesa_reference_buffer_object(ctx, &ctx->DrawIndirectBuffer,
> ctx->Shared->NullBufferObj);
>
> + _mesa_reference_buffer_object(ctx, &ctx->QueryBuffer,
> + ctx->Shared->NullBufferObj);
> +
> for (i = 0; i < MAX_COMBINED_UNIFORM_BUFFERS; i++) {
> _mesa_reference_buffer_object(ctx,
> &ctx->UniformBufferBindings[i].BufferObject,
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 3e3e6fd..ebb581c 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -4164,6 +4164,8 @@ struct gl_context
> struct gl_buffer_object *CopyReadBuffer; /**< GL_ARB_copy_buffer */
> struct gl_buffer_object *CopyWriteBuffer; /**< GL_ARB_copy_buffer */
>
> + struct gl_buffer_object *QueryBuffer; /**< GL_ARB_query_buffer_object */
> +
> /**
> * Current GL_ARB_uniform_buffer_object binding referenced by
> * GL_UNIFORM_BUFFER target for glBufferData, glMapBuffer, etc.
>
More information about the mesa-dev
mailing list