return &ctx->UniformBuffer;
}
break;
+ case GL_SHADER_STORAGE_BUFFER:
+ if (ctx->Extensions.ARB_shader_storage_buffer_object) {
+ return &ctx->ShaderStorageBuffer;
+ }
+ break;
case GL_ATOMIC_COUNTER_BUFFER:
if (ctx->Extensions.ARB_shader_atomic_counters) {
return &ctx->AtomicBuffer;
#define MAX_PROGRAM_LOCAL_PARAMS 4096
#define MAX_UNIFORMS 4096
#define MAX_UNIFORM_BUFFERS 15 /* + 1 default uniform buffer */
+#define MAX_SHADER_STORAGE_BUFFERS 7 /* + 1 default shader storage buffer */
/* 6 is for vertex, hull, domain, geometry, fragment, and compute shader. */
#define MAX_COMBINED_UNIFORM_BUFFERS (MAX_UNIFORM_BUFFERS * 6)
+#define MAX_COMBINED_SHADER_STORAGE_BUFFERS (MAX_SHADER_STORAGE_BUFFERS * 6)
#define MAX_ATOMIC_COUNTERS 4096
/* 6 is for vertex, hull, domain, geometry, fragment, and compute shader. */
#define MAX_COMBINED_ATOMIC_BUFFERS (MAX_UNIFORM_BUFFERS * 6)
consts->MaxUniformBlockSize = 16384;
consts->UniformBufferOffsetAlignment = 1;
+ /** GL_ARB_shader_storage_buffer_object */
+ consts->MaxCombinedShaderStorageBlocks = 8;
+ consts->MaxShaderStorageBufferBindings = 8;
+ consts->MaxShaderStorageBlockSize = 16 * 1024 * 1024;
+ consts->ShaderStorageBufferOffsetAlignment = 256;
+
/* GL_ARB_explicit_uniform_location, GL_MAX_UNIFORM_LOCATIONS */
consts->MaxUserAssignableUniformLocations =
4 * MESA_SHADER_STAGES * MAX_UNIFORMS;
GLuint UniformBufferOffsetAlignment;
/** @} */
+ /** @{
+ * GL_ARB_shader_storage_buffer_object
+ */
+ GLuint MaxCombinedShaderStorageBlocks;
+ GLuint MaxShaderStorageBufferBindings;
+ GLuint MaxShaderStorageBlockSize;
+ GLuint ShaderStorageBufferOffsetAlignment;
+ /** @} */
+
/**
* GL_ARB_explicit_uniform_location
*/
GLboolean AutomaticSize;
};
+struct gl_shader_storage_buffer_binding
+{
+ struct gl_buffer_object *BufferObject;
+ /** Start of shader storage block data in the buffer */
+ GLintptr Offset;
+ /** Size of data allowed to be referenced from the buffer (in bytes) */
+ GLsizeiptr Size;
+ /**
+ * glBindBufferBase() indicates that the Size should be ignored and only
+ * limited by the current size of the BufferObject.
+ */
+ GLboolean AutomaticSize;
+};
+
/**
* ARB_shader_image_load_store image unit.
*/
*/
struct gl_buffer_object *UniformBuffer;
+ /**
+ * Current GL_ARB_shader_storage_buffer_object binding referenced by
+ * GL_SHADER_STORAGE_BUFFER target for glBufferData, glMapBuffer, etc.
+ */
+ struct gl_buffer_object *ShaderStorageBuffer;
+
/**
* Array of uniform buffers for GL_ARB_uniform_buffer_object and GL 3.1.
* This is set up using glBindBufferRange() or glBindBufferBase(). They are
struct gl_uniform_buffer_binding
UniformBufferBindings[MAX_COMBINED_UNIFORM_BUFFERS];
+ /**
+ * Array of shader storage buffers for ARB_shader_storage_buffer_object
+ * and GL 4.3. This is set up using glBindBufferRange() or
+ * glBindBufferBase(). They are associated with shader storage blocks by
+ * glShaderStorageBlockBinding()'s state in the shader program.
+ */
+ struct gl_shader_storage_buffer_binding
+ ShaderStorageBufferBindings[MAX_COMBINED_SHADER_STORAGE_BUFFERS];
+
/**
* Object currently associated with the GL_ATOMIC_COUNTER_BUFFER
* target.