[Mesa-dev] [PATCH 04/23] main: Tex[ture]Buffer[Range] functions now use _mesa_lookup_bufferobj_err.
Martin Peres
martin.peres at linux.intel.com
Tue Feb 17 08:03:20 PST 2015
Hey,
Why not move these two patches before the one introducing BufferRange?
Also, I wouldn't mind seeing them squashed together since the previous patch
alone does not change any behaviour.
On 12/02/15 04:05, Laura Ekstrand wrote:
> ---
> src/mesa/main/teximage.c | 46 +++++++++++++++++++++++++---------------------
> 1 file changed, 25 insertions(+), 21 deletions(-)
>
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index ce6f446..d17f15e 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -5091,11 +5091,13 @@ _mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer)
> return;
> }
>
> - bufObj = _mesa_lookup_bufferobj(ctx, buffer);
> - if (!bufObj && buffer) {
> - _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBuffer(buffer %u)", buffer);
> - return;
> + if (buffer) {
> + bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glTexBuffer");
> + if (!bufObj)
> + return;
> }
> + else
> + bufObj = NULL;
>
> texObj = _mesa_get_current_tex_object(ctx, target);
> if (!texObj)
> @@ -5128,8 +5130,11 @@ _mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer,
> return;
> }
>
> - bufObj = _mesa_lookup_bufferobj(ctx, buffer);
> - if (bufObj) {
> + if (buffer) {
> + bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glTexBufferRange");
> + if (!bufObj)
> + return;
> +
> if (offset < 0 ||
> size <= 0 ||
> (offset + size) > bufObj->Size) {
> @@ -5141,13 +5146,10 @@ _mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer,
> "glTexBufferRange(invalid offset alignment)");
> return;
> }
> - } else if (buffer) {
> - _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBufferRange(buffer %u)",
> - buffer);
> - return;
> } else {
> offset = 0;
> size = 0;
> + bufObj = NULL;
> }
>
> texObj = _mesa_get_current_tex_object(ctx, target);
> @@ -5175,12 +5177,13 @@ _mesa_TextureBuffer(GLuint texture, GLenum internalFormat, GLuint buffer)
> return;
> }
>
> - bufObj = _mesa_lookup_bufferobj(ctx, buffer);
> - if (!bufObj && buffer) {
> - _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureBuffer(buffer %u)",
> - buffer);
> - return;
> + if (buffer) {
> + bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glTextureBuffer");
> + if (!bufObj)
> + return;
> }
> + else
> + bufObj = NULL;
>
> /* Get the texture object by Name. */
> texObj = _mesa_lookup_texture_err(ctx, texture,
> @@ -5217,8 +5220,12 @@ _mesa_TextureBufferRange(GLuint texture, GLenum internalFormat, GLuint buffer,
> return;
> }
>
> - bufObj = _mesa_lookup_bufferobj(ctx, buffer);
> - if (bufObj) {
> + if (buffer) {
> + bufObj = _mesa_lookup_bufferobj_err(ctx, buffer,
> + "glTextureBufferRange");
> + if (!bufObj)
> + return;
> +
> /* OpenGL 4.5 core spec (30.10.2014) says in Section 8.9 Buffer
> * Textures:
> * "An INVALID_VALUE error is generated if offset is negative, if
> @@ -5255,10 +5262,6 @@ _mesa_TextureBufferRange(GLuint texture, GLenum internalFormat, GLuint buffer,
> "glTextureBufferRange(invalid offset alignment)");
> return;
> }
> - } else if (buffer) {
> - _mesa_error(ctx, GL_INVALID_OPERATION,
> - "glTextureBufferRange(unrecognized buffer %u)", buffer);
> - return;
> } else {
>
> /* OpenGL 4.5 core spec (30.10.2014) says in Section 8.9 Buffer
> @@ -5270,6 +5273,7 @@ _mesa_TextureBufferRange(GLuint texture, GLenum internalFormat, GLuint buffer,
> */
> offset = 0;
> size = 0;
> + bufObj = NULL;
> }
>
> /* Get the texture object by Name. */
More information about the mesa-dev
mailing list