aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/teximage.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-01-31 08:14:38 +0100
committermarha <marha@users.sourceforge.net>2013-01-31 08:14:38 +0100
commit3dc034dda1a451ed7dc48cfb10caba11e66b4132 (patch)
treeac2f7522e5b3287afdb5dcd5af6d9c6bb9a3d079 /mesalib/src/mesa/main/teximage.c
parent4e7e0bd9194a033f05179fb64126c56fc6f072b5 (diff)
parent436f8246cd5a377596f6e42e6562da186ef8df48 (diff)
downloadvcxsrv-3dc034dda1a451ed7dc48cfb10caba11e66b4132.tar.gz
vcxsrv-3dc034dda1a451ed7dc48cfb10caba11e66b4132.tar.bz2
vcxsrv-3dc034dda1a451ed7dc48cfb10caba11e66b4132.zip
Merge remote-tracking branch 'origin/released'
* origin/released: libxtrans mesa pixman xkeyboard-config git update 31 jan 2013
Diffstat (limited to 'mesalib/src/mesa/main/teximage.c')
-rw-r--r--mesalib/src/mesa/main/teximage.c89
1 files changed, 72 insertions, 17 deletions
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 31a559e9d..f03e84ad8 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -3994,23 +3994,16 @@ validate_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat)
}
-/** GL_ARB_texture_buffer_object */
-void GLAPIENTRY
-_mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer)
+static void
+texbufferrange(struct gl_context *ctx, GLenum target, GLenum internalFormat,
+ struct gl_buffer_object *bufObj,
+ GLintptr offset, GLsizeiptr size)
{
struct gl_texture_object *texObj;
- struct gl_buffer_object *bufObj;
gl_format format;
- GET_CURRENT_CONTEXT(ctx);
FLUSH_VERTICES(ctx, 0);
- if (!(ctx->API == API_OPENGL_CORE &&
- ctx->Extensions.ARB_texture_buffer_object)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBuffer");
- return;
- }
-
if (target != GL_TEXTURE_BUFFER_ARB) {
_mesa_error(ctx, GL_INVALID_ENUM, "glTexBuffer(target)");
return;
@@ -4023,12 +4016,6 @@ _mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer)
return;
}
- bufObj = _mesa_lookup_bufferobj(ctx, buffer);
- if (buffer && !bufObj) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBuffer(buffer %u)", buffer);
- return;
- }
-
texObj = _mesa_get_current_tex_object(ctx, target);
_mesa_lock_texture(ctx, texObj);
@@ -4036,6 +4023,74 @@ _mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer)
_mesa_reference_buffer_object(ctx, &texObj->BufferObject, bufObj);
texObj->BufferObjectFormat = internalFormat;
texObj->_BufferObjectFormat = format;
+ texObj->BufferOffset = offset;
+ texObj->BufferSize = size;
}
_mesa_unlock_texture(ctx, texObj);
}
+
+/** GL_ARB_texture_buffer_object */
+void GLAPIENTRY
+_mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer)
+{
+ struct gl_buffer_object *bufObj;
+
+ GET_CURRENT_CONTEXT(ctx);
+
+ /* NOTE: ARB_texture_buffer_object has interactions with
+ * the compatibility profile that are not implemented.
+ */
+ if (!(ctx->API == API_OPENGL_CORE &&
+ ctx->Extensions.ARB_texture_buffer_object)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBuffer");
+ return;
+ }
+
+ bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+ if (!bufObj && buffer) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBuffer(buffer %u)", buffer);
+ return;
+ }
+
+ texbufferrange(ctx, target, internalFormat, bufObj, 0, buffer ? -1 : 0);
+}
+
+/** GL_ARB_texture_buffer_range */
+void GLAPIENTRY
+_mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer,
+ GLintptr offset, GLsizeiptr size)
+{
+ struct gl_buffer_object *bufObj;
+
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (!(ctx->API == API_OPENGL_CORE &&
+ ctx->Extensions.ARB_texture_buffer_range)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBufferRange");
+ return;
+ }
+
+ bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+ if (bufObj) {
+ if (offset < 0 ||
+ size <= 0 ||
+ (offset + size) > bufObj->Size) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glTexBufferRange");
+ return;
+ }
+ if (offset % ctx->Const.TextureBufferOffsetAlignment) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glTexBufferRange(invalid offset alignment)");
+ return;
+ }
+ } else if (buffer) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBufferRange(buffer %u)",
+ buffer);
+ return;
+ } else {
+ offset = 0;
+ size = 0;
+ }
+
+ texbufferrange(ctx, target, internalFormat, bufObj, offset, size);
+}