diff options
author | Laura Ekstrand <[email protected]> | 2015-02-27 14:54:00 -0800 |
---|---|---|
committer | Laura Ekstrand <[email protected]> | 2015-03-09 13:33:54 -0700 |
commit | 1e552db5228e4e0acdef1d4bec4503f7116a2622 (patch) | |
tree | 0b7072afa136434e813711bb3a9f7a76fc613dde /src/mesa/main/teximage.c | |
parent | 311b3686fe7433b1624384f7d344cc23d6363df2 (diff) |
main: Add entry point for TextureBufferRange.
v2: Review by Martin Peres
- Get rid of difficult-to-follow code copied and pasted from
the original TexBufferRange
Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/mesa/main/teximage.c')
-rw-r--r-- | src/mesa/main/teximage.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 7f11bfc46b2..7b1a0e663e8 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -5463,6 +5463,52 @@ _mesa_TextureBuffer(GLuint texture, GLenum internalFormat, GLuint buffer) bufObj, 0, buffer ? -1 : 0, "glTextureBuffer"); } +void GLAPIENTRY +_mesa_TextureBufferRange(GLuint texture, GLenum internalFormat, GLuint buffer, + GLintptr offset, GLsizeiptr size) +{ + struct gl_texture_object *texObj; + struct gl_buffer_object *bufObj; + + GET_CURRENT_CONTEXT(ctx); + + if (buffer) { + bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, + "glTextureBufferRange"); + if (!bufObj) + return; + + if (!check_texture_buffer_range(ctx, bufObj, offset, size, + "glTextureBufferRange")) + return; + + } else { + + /* OpenGL 4.5 core spec (02.02.2015) says in Section 8.9 Buffer + * Textures (PDF page 254): + * "If buffer is zero, then any buffer object attached to the buffer + * texture is detached, the values offset and size are ignored and + * the state for offset and size for the buffer texture are reset to + * zero." + */ + offset = 0; + size = 0; + bufObj = NULL; + } + + /* Get the texture object by Name. */ + texObj = _mesa_lookup_texture_err(ctx, texture, "glTextureBufferRange"); + if (!texObj) + return; + + if (!check_texture_buffer_target(ctx, texObj->Target, + "glTextureBufferRange")) + return; + + _mesa_texture_buffer_range(ctx, texObj, internalFormat, + bufObj, offset, size, "glTextureBufferRange"); +} + static GLboolean is_renderable_texture_format(struct gl_context *ctx, GLenum internalformat) { |