aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/bufferobj.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-11-07 08:02:14 +0100
committermarha <marha@users.sourceforge.net>2012-11-07 08:02:14 +0100
commit2c345c9da4dedfafe791557ca3fcf891ce26249d (patch)
tree18dc73394bd3921415b57b5847f03a9753374e99 /mesalib/src/mesa/main/bufferobj.c
parent7c531937cfab42f2fd3233c096c409ebdd5b59af (diff)
parent1cc98f5a48924d750fbef7ea6b05a1ba49c28589 (diff)
downloadvcxsrv-2c345c9da4dedfafe791557ca3fcf891ce26249d.tar.gz
vcxsrv-2c345c9da4dedfafe791557ca3fcf891ce26249d.tar.bz2
vcxsrv-2c345c9da4dedfafe791557ca3fcf891ce26249d.zip
Merge remote-tracking branch 'origin/released'
* origin/released: xserver mesa xkbcomp git update 5 nov 2012 Conflicts: mesalib/src/glsl/.gitignore mesalib/src/mesa/main/.gitignore xorg-server/Xi/chgdctl.c xorg-server/dix/getevents.c xorg-server/hw/xwin/winprefs.c xorg-server/os/utils.c
Diffstat (limited to 'mesalib/src/mesa/main/bufferobj.c')
-rw-r--r--mesalib/src/mesa/main/bufferobj.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index 9820693fa..9697919fa 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -660,7 +660,7 @@ _mesa_free_buffer_objects( struct gl_context *ctx )
ctx->UniformBufferBindings = NULL;
}
-static void
+static bool
handle_bind_buffer_gen(struct gl_context *ctx,
GLenum target,
GLuint buffer,
@@ -668,6 +668,11 @@ handle_bind_buffer_gen(struct gl_context *ctx,
{
struct gl_buffer_object *buf = *buf_handle;
+ if (!buf && ctx->API == API_OPENGL_CORE) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glBindBuffer(non-gen name)");
+ return false;
+ }
+
if (!buf || buf == &DummyBufferObject) {
/* If this is a new buffer object id, or one which was generated but
* never used before, allocate a buffer object now.
@@ -676,11 +681,13 @@ handle_bind_buffer_gen(struct gl_context *ctx,
buf = ctx->Driver.NewBufferObject(ctx, buffer, target);
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindBufferARB");
- return;
+ return false;
}
_mesa_HashInsert(ctx->Shared->BufferObjects, buffer, buf);
*buf_handle = buf;
}
+
+ return true;
}
/**
@@ -717,11 +724,8 @@ bind_buffer_object(struct gl_context *ctx, GLenum target, GLuint buffer)
else {
/* non-default buffer object */
newBufObj = _mesa_lookup_bufferobj(ctx, buffer);
- if (newBufObj == NULL && ctx->API == API_OPENGL_CORE) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glBindBuffer(non-gen name)");
+ if (!handle_bind_buffer_gen(ctx, target, buffer, &newBufObj))
return;
- }
- handle_bind_buffer_gen(ctx, target, buffer, &newBufObj);
}
/* bind new buffer */
@@ -2147,7 +2151,8 @@ _mesa_BindBufferRange(GLenum target, GLuint index,
} else {
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
}
- handle_bind_buffer_gen(ctx, target, buffer, &bufObj);
+ if (!handle_bind_buffer_gen(ctx, target, buffer, &bufObj))
+ return;
if (!bufObj) {
_mesa_error(ctx, GL_INVALID_OPERATION,
@@ -2193,7 +2198,8 @@ _mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer)
} else {
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
}
- handle_bind_buffer_gen(ctx, target, buffer, &bufObj);
+ if (!handle_bind_buffer_gen(ctx, target, buffer, &bufObj))
+ return;
if (!bufObj) {
_mesa_error(ctx, GL_INVALID_OPERATION,
@@ -2345,7 +2351,7 @@ _mesa_init_bufferobj_dispatch(struct gl_context *ctx, struct _glapi_table *disp)
* exist for it.
*/
SET_GetBufferPointervARB(disp, _mesa_GetBufferPointervARB);
- if (ctx->API != API_OPENGLES2) {
+ if (_mesa_is_desktop_gl(ctx)) {
SET_GetBufferSubDataARB(disp, _mesa_GetBufferSubDataARB);
}
SET_IsBufferARB(disp, _mesa_IsBufferARB);