Commit 9327e2d3 authored by Ilia Mirkin's avatar Ilia Mirkin

mesa: add parameter buffer, used for ARB_indirect_parameters

Signed-off-by: Ilia Mirkin's avatarIlia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: default avatarMarek Olšák <marek.olsak@amd.com>
parent b3e2c21f
......@@ -127,6 +127,11 @@ get_buffer_target(struct gl_context *ctx, GLenum target)
return &ctx->DrawIndirectBuffer;
}
break;
case GL_PARAMETER_BUFFER_ARB:
if (_mesa_has_ARB_indirect_parameters(ctx)) {
return &ctx->ParameterBuffer;
}
break;
case GL_DISPATCH_INDIRECT_BUFFER:
if (_mesa_has_compute_shaders(ctx)) {
return &ctx->DispatchIndirectBuffer;
......@@ -866,6 +871,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->ParameterBuffer,
ctx->Shared->NullBufferObj);
_mesa_reference_buffer_object(ctx, &ctx->DispatchIndirectBuffer,
ctx->Shared->NullBufferObj);
......@@ -913,6 +921,8 @@ _mesa_free_buffer_objects( struct gl_context *ctx )
_mesa_reference_buffer_object(ctx, &ctx->DrawIndirectBuffer, NULL);
_mesa_reference_buffer_object(ctx, &ctx->ParameterBuffer, NULL);
_mesa_reference_buffer_object(ctx, &ctx->DispatchIndirectBuffer, NULL);
for (i = 0; i < MAX_COMBINED_UNIFORM_BUFFERS; i++) {
......@@ -1261,6 +1271,11 @@ _mesa_DeleteBuffers(GLsizei n, const GLuint *ids)
_mesa_BindBuffer( GL_DRAW_INDIRECT_BUFFER, 0 );
}
/* unbind ARB_indirect_parameters binding point */
if (ctx->ParameterBuffer == bufObj) {
_mesa_BindBuffer(GL_PARAMETER_BUFFER_ARB, 0);
}
/* unbind ARB_compute_shader binding point */
if (ctx->DispatchIndirectBuffer == bufObj) {
_mesa_BindBuffer(GL_DISPATCH_INDIRECT_BUFFER, 0);
......
......@@ -423,6 +423,7 @@ EXTRA_EXT(ARB_framebuffer_no_attachments);
EXTRA_EXT(ARB_tessellation_shader);
EXTRA_EXT(ARB_shader_subroutine);
EXTRA_EXT(ARB_shader_storage_buffer_object);
EXTRA_EXT(ARB_indirect_parameters);
static const int
extra_ARB_color_buffer_float_or_glcore[] = {
......@@ -1032,6 +1033,10 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
case GL_DRAW_INDIRECT_BUFFER_BINDING:
v->value_int = ctx->DrawIndirectBuffer->Name;
break;
/* GL_ARB_indirect_parameters */
case GL_PARAMETER_BUFFER_BINDING_ARB:
v->value_int = ctx->ParameterBuffer->Name;
break;
/* GL_ARB_separate_shader_objects */
case GL_PROGRAM_PIPELINE_BINDING:
if (ctx->Pipeline.Current) {
......
......@@ -887,6 +887,10 @@ descriptor=[
# GL_ARB_shader_subroutine
[ "MAX_SUBROUTINES", "CONST(MAX_SUBROUTINES), extra_ARB_shader_subroutine" ],
[ "MAX_SUBROUTINE_UNIFORM_LOCATIONS", "CONST(MAX_SUBROUTINE_UNIFORM_LOCATIONS), extra_ARB_shader_subroutine" ],
# GL_ARB_indirect_parameters
[ "PARAMETER_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_indirect_parameters" ],
]}
]
......@@ -4349,6 +4349,7 @@ struct gl_context
struct gl_perf_monitor_state PerfMonitor;
struct gl_buffer_object *DrawIndirectBuffer; /** < GL_ARB_draw_indirect */
struct gl_buffer_object *ParameterBuffer; /** < GL_ARB_indirect_parameters */
struct gl_buffer_object *DispatchIndirectBuffer; /** < GL_ARB_compute_shader */
struct gl_buffer_object *CopyReadBuffer; /**< GL_ARB_copy_buffer */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment