From 73ae865af8794c053812cbb5fe9532b1b6113515 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 6 Dec 2012 16:16:10 +1000 Subject: mesa/st: add ARB_uniform_buffer_object support (v2) this adds UBO support to the state tracker, it works with softpipe as-is. It uses UARL + CONST[x][ADDR[0].x] type constructs. v2: don't disable UBOs if geom shaders don't exist (me) rename upload to bind (calim) fix 12 -> 13 comparison as comment (calim + brianp) fix signed->unsigned (Brian) remove assert (Brian) Reviewed-by: Brian Paul Signed-off-by: Dave Airlie --- src/mesa/state_tracker/st_extensions.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/mesa/state_tracker/st_extensions.c') diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index ca762cab4b2..93ef7a91cf7 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -70,6 +70,8 @@ void st_init_limits(struct st_context *st) struct pipe_screen *screen = st->pipe->screen; struct gl_constants *c = &st->ctx->Const; gl_shader_type sh; + boolean can_ubo = TRUE; + int max_const_buffers; c->MaxTextureLevels = _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS), @@ -218,6 +220,17 @@ void st_init_limits(struct st_context *st) options->EmitNoIndirectUniform = !screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_INDIRECT_CONST_ADDR); + if (pc->MaxNativeInstructions) { + if (options->EmitNoIndirectUniform) + can_ubo = FALSE; + + max_const_buffers = screen->get_shader_param(screen, sh, + PIPE_SHADER_CAP_MAX_CONST_BUFFERS); + /* we need 13 buffers - 1 constant, 12 UBO */ + if (max_const_buffers < 13) + can_ubo = FALSE; + } + if (options->EmitNoLoops) options->MaxUnrollIterations = MIN2(screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_INSTRUCTIONS), 65536); else @@ -251,6 +264,9 @@ void st_init_limits(struct st_context *st) c->GLSLSkipStrictMaxVaryingLimitCheck = screen->get_param(screen, PIPE_CAP_TGSI_CAN_COMPACT_VARYINGS); + + if (can_ubo) + st->ctx->Extensions.ARB_uniform_buffer_object = GL_TRUE; } -- cgit v1.2.3