summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/bufferobj.c9
-rw-r--r--src/mesa/main/get.c6
-rw-r--r--src/mesa/main/mtypes.h7
3 files changed, 22 insertions, 0 deletions
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 332af3d36d7..b646baa41a1 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -92,6 +92,11 @@ get_buffer_target(struct gl_context *ctx, GLenum target)
return &ctx->Texture.BufferObject;
}
break;
+ case GL_UNIFORM_BUFFER:
+ if (ctx->Extensions.ARB_uniform_buffer_object) {
+ return &ctx->UniformBuffer;
+ }
+ break;
default:
return NULL;
}
@@ -840,6 +845,10 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
}
}
+ if (ctx->UniformBuffer == bufObj) {
+ _mesa_BindBufferARB( GL_UNIFORM_BUFFER, 0 );
+ }
+
/* unbind any pixel pack/unpack pointers bound to this buffer */
if (ctx->Pack.BufferObj == bufObj) {
_mesa_BindBufferARB( GL_PIXEL_PACK_BUFFER_EXT, 0 );
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 4ac3689ae4a..9e9ddcbcc43 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1351,6 +1351,8 @@ static const struct value_desc values[] = {
{ GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, CONTEXT_INT(Const.UniformBufferOffsetAlignment),
extra_ARB_uniform_buffer_object },
+ { GL_UNIFORM_BUFFER_BINDING, LOC_CUSTOM, TYPE_INT, 0, extra_ARB_uniform_buffer_object },
+
#endif /* FEATURE_GL */
};
@@ -1801,6 +1803,10 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
v->value_int = samp ? samp->Name : 0;
}
break;
+ /* GL_ARB_uniform_buffer_object */
+ case GL_UNIFORM_BUFFER_BINDING:
+ v->value_int = ctx->UniformBuffer->Name;
+ break;
}
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 53e52807d95..cf6d9c16c05 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3430,6 +3430,13 @@ struct gl_context
struct gl_buffer_object *CopyReadBuffer; /**< GL_ARB_copy_buffer */
struct gl_buffer_object *CopyWriteBuffer; /**< GL_ARB_copy_buffer */
+
+ /**
+ * Current GL_ARB_uniform_buffer_object binding referenced by
+ * GL_UNIFORM_BUFFER target for glBufferData, glMapBuffer, etc.
+ */
+ struct gl_buffer_object *UniformBuffer;
+
/*@}*/
struct gl_meta_state *Meta; /**< for "meta" operations */