summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorLaura Ekstrand <[email protected]>2015-03-04 14:31:29 -0800
committerLaura Ekstrand <[email protected]>2015-03-09 13:33:54 -0700
commit6b78a1fb89670fd050747c79a20ecb1b2cd2dc2e (patch)
treec48215c093f0cb8a3f84eec555760e07ed86b4d6 /src/mesa/main
parentd03337306a59ec7a9c1b4bd37856a95c40c1c801 (diff)
main: Refactor _mesa_texture_buffer_range.
Changes how the caller is identified in error messages, moves a check for ARB_texture_buffer_object from the entry points to the shared code in _mesa_texture_buffer_range, and removes an unused argument (GLenum target). v2: Review from Anuj Phogat - Split rebase of Tex[ture]Buffer[Range] Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/teximage.c58
-rw-r--r--src/mesa/main/teximage.h6
2 files changed, 25 insertions, 39 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 6374ec98a39..706c76b046c 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5243,24 +5243,34 @@ _mesa_validate_texbuffer_format(const struct gl_context *ctx,
void
_mesa_texture_buffer_range(struct gl_context *ctx,
- struct gl_texture_object *texObj, GLenum target,
+ struct gl_texture_object *texObj,
GLenum internalFormat,
struct gl_buffer_object *bufObj,
- GLintptr offset, GLsizeiptr size, bool range,
- bool dsa)
+ GLintptr offset, GLsizeiptr size,
+ const char *caller)
{
mesa_format format;
- FLUSH_VERTICES(ctx, 0);
+ /* 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,
+ "%s(ARB_texture_buffer_object is not"
+ " implemented for the compatibility profile)", caller);
+ return;
+ }
format = _mesa_validate_texbuffer_format(ctx, internalFormat);
if (format == MESA_FORMAT_NONE) {
_mesa_error(ctx, GL_INVALID_ENUM,
- "glTex%sBuffer%s(internalFormat 0x%x)", dsa ? "ture" : "",
- range ? "Range" : "", internalFormat);
+ "%s(internalFormat 0x%x)", caller, internalFormat);
return;
}
+ FLUSH_VERTICES(ctx, 0);
+
_mesa_lock_texture(ctx, texObj);
{
_mesa_reference_buffer_object(ctx, &texObj->BufferObject, bufObj);
@@ -5294,15 +5304,6 @@ _mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer)
return;
}
- /* 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;
- }
-
if (buffer) {
bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glTexBuffer");
if (!bufObj)
@@ -5314,8 +5315,8 @@ _mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer)
if (!texObj)
return;
- _mesa_texture_buffer_range(ctx, texObj, target, internalFormat, bufObj, 0,
- buffer ? -1 : 0, false, false);
+ _mesa_texture_buffer_range(ctx, texObj, internalFormat, bufObj, 0,
+ buffer ? -1 : 0, "glTexBuffer");
}
@@ -5335,12 +5336,6 @@ _mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer,
return;
}
- 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 ||
@@ -5367,8 +5362,8 @@ _mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer,
if (!texObj)
return;
- _mesa_texture_buffer_range(ctx, texObj, target, internalFormat, bufObj,
- offset, size, true, false);
+ _mesa_texture_buffer_range(ctx, texObj, internalFormat, bufObj,
+ offset, size, "glTexBufferRange");
}
void GLAPIENTRY
@@ -5379,15 +5374,6 @@ _mesa_TextureBuffer(GLuint texture, GLenum internalFormat, GLuint buffer)
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, "glTextureBuffer");
- return;
- }
-
if (buffer) {
bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glTextureBuffer");
if (!bufObj)
@@ -5406,8 +5392,8 @@ _mesa_TextureBuffer(GLuint texture, GLenum internalFormat, GLuint buffer)
return;
}
- _mesa_texture_buffer_range(ctx, texObj, texObj->Target, internalFormat,
- bufObj, 0, buffer ? -1 : 0, false, true);
+ _mesa_texture_buffer_range(ctx, texObj, internalFormat,
+ bufObj, 0, buffer ? -1 : 0, "glTextureBuffer");
}
static GLboolean
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index 9468650f519..db6b6485a99 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -209,11 +209,11 @@ _mesa_texture_image_multisample(struct gl_context *ctx, GLuint dims,
extern void
_mesa_texture_buffer_range(struct gl_context *ctx,
- struct gl_texture_object *texObj, GLenum target,
+ struct gl_texture_object *texObj,
GLenum internalFormat,
struct gl_buffer_object *bufObj,
- GLintptr offset, GLsizeiptr size, bool range,
- bool dsa);
+ GLintptr offset, GLsizeiptr size,
+ const char *caller);
/*@}*/