diff options
author | Samuel Pitoiset <[email protected]> | 2017-06-01 11:36:13 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-06-07 11:04:27 +0200 |
commit | 4485c28e1f8276fd6395890dddb2a7f93400e6dd (patch) | |
tree | f37ac3110d15614466889c2e12e74dd4ac413087 /src | |
parent | 185a79a549dfed309c2a124c95fe18597f56dfa7 (diff) |
mesa: add prepare_target() helper
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/copyimage.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/mesa/main/copyimage.c b/src/mesa/main/copyimage.c index 07c2359dda5..6a74f7a1a88 100644 --- a/src/mesa/main/copyimage.c +++ b/src/mesa/main/copyimage.c @@ -214,6 +214,30 @@ prepare_target_err(struct gl_context *ctx, GLuint name, GLenum target, return true; } +static void +prepare_target(struct gl_context *ctx, GLuint name, GLenum target, + int level, int z, + struct gl_texture_image **texImage, + struct gl_renderbuffer **renderbuffer) +{ + if (target == GL_RENDERBUFFER) { + struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx, name); + + *renderbuffer = rb; + *texImage = NULL; + } else { + struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, name); + + if (target == GL_TEXTURE_CUBE_MAP) { + *texImage = texObj->Image[z][level]; + } + else { + *texImage = _mesa_select_tex_image(texObj, target, level); + } + + *renderbuffer = NULL; + } +} /** * Check that the x,y,z,width,height,region is within the texture image |