diff options
author | Francisco Jerez <[email protected]> | 2013-10-07 18:53:40 -0700 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2013-10-29 12:40:55 -0700 |
commit | 1c7dcfed7ceb9e47943d6adaacc1ca483c97fcf6 (patch) | |
tree | 2452628247d8021725a47e408c1300d4f0d63363 /src/mesa/main/get.c | |
parent | e3fd31dc411c023495970ac51ce28b4d0deb80e6 (diff) |
mesa: Add support for ARB_shader_atomic_counters.
This patch implements the common support code required for the
ARB_shader_atomic_counters extension. It defines the necessary data
structures for tracking atomic counter buffer objects (from now on
"ABOs") associated with some specific context or shader program, it
implements support for binding buffers to an ABO binding point and
querying the existing atomic counters and buffers declared by GLSL
shaders.
v2: Fix extension checks. Drop unused MAX_ATOMIC_BUFFERS constant.
Acked-by: Paul Berry <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/main/get.c')
-rw-r--r-- | src/mesa/main/get.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 89b3bf09ddb..6e72ff5c298 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -143,6 +143,7 @@ enum value_extra { EXTRA_FLUSH_CURRENT, EXTRA_GLSL_130, EXTRA_EXT_UBO_GS4, + EXTRA_EXT_ATOMICS_GS4, }; #define NO_EXTRA NULL @@ -331,6 +332,11 @@ static const int extra_MESA_texture_array_es3[] = { EXTRA_END }; +static const int extra_ARB_shader_atomic_counters_and_geometry_shader[] = { + EXTRA_EXT_ATOMICS_GS4, + EXTRA_END +}; + EXTRA_EXT(ARB_texture_cube_map); EXTRA_EXT(MESA_texture_array); EXTRA_EXT(NV_fog_distance); @@ -367,6 +373,7 @@ EXTRA_EXT(ARB_texture_cube_map_array); EXTRA_EXT(ARB_texture_buffer_range); EXTRA_EXT(ARB_texture_multisample); EXTRA_EXT(ARB_texture_gather); +EXTRA_EXT(ARB_shader_atomic_counters); static const int extra_ARB_color_buffer_float_or_glcore[] = { @@ -894,6 +901,10 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu _mesa_problem(ctx, "driver doesn't implement GetTimestamp"); } break; + /* GL_ARB_shader_atomic_counters */ + case GL_ATOMIC_COUNTER_BUFFER_BINDING: + v->value_int = ctx->AtomicBuffer->Name; + break; } } @@ -999,6 +1010,11 @@ check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d api_found = (ctx->Extensions.ARB_uniform_buffer_object && _mesa_has_geometry_shaders(ctx)); break; + case EXTRA_EXT_ATOMICS_GS4: + api_check = GL_TRUE; + api_found = (ctx->Extensions.ARB_shader_atomic_counters && + _mesa_has_geometry_shaders(ctx)); + break; case EXTRA_END: break; default: /* *e is a offset into the extension struct */ @@ -1692,6 +1708,30 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v) goto invalid_enum; v->value_int = ctx->Multisample.SampleMaskValue; return TYPE_INT; + + case GL_ATOMIC_COUNTER_BUFFER_BINDING: + if (!ctx->Extensions.ARB_shader_atomic_counters) + goto invalid_enum; + if (index >= ctx->Const.MaxAtomicBufferBindings) + goto invalid_value; + v->value_int = ctx->AtomicBufferBindings[index].BufferObject->Name; + return TYPE_INT; + + case GL_ATOMIC_COUNTER_BUFFER_START: + if (!ctx->Extensions.ARB_shader_atomic_counters) + goto invalid_enum; + if (index >= ctx->Const.MaxAtomicBufferBindings) + goto invalid_value; + v->value_int64 = ctx->AtomicBufferBindings[index].Offset; + return TYPE_INT64; + + case GL_ATOMIC_COUNTER_BUFFER_SIZE: + if (!ctx->Extensions.ARB_shader_atomic_counters) + goto invalid_enum; + if (index >= ctx->Const.MaxAtomicBufferBindings) + goto invalid_value; + v->value_int64 = ctx->AtomicBufferBindings[index].Size; + return TYPE_INT64; } invalid_enum: |