summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/textureview.c
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2014-06-27 15:34:53 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2014-08-11 11:20:23 -0700
commit41b6460e08bf878ec3372937f63bef2a7b63c484 (patch)
treecd371b795ea620fee2feaba4851c3aa01bee4176 /src/mesa/main/textureview.c
parent23d782067ae834ad53522b46638ea21c62e94ca3 (diff)
downloadexternal_mesa3d-41b6460e08bf878ec3372937f63bef2a7b63c484.zip
external_mesa3d-41b6460e08bf878ec3372937f63bef2a7b63c484.tar.gz
external_mesa3d-41b6460e08bf878ec3372937f63bef2a7b63c484.tar.bz2
mesa: Add GL API support for ARB_copy_image
This adds the API entrypoint, error checking logic, and a driver hook for the ARB_copy_image extension. v2: Fix a typo in ARB_copy_image.xml and add it to the makefile v3: Put ARB_copy_image.xml in the right place alphebetically in the makefile and properly prefix the commit message v4: Fixed some line wrapping and added a check for null v5: Check for incomplete renderbuffers Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Reviewed-by: Neil Roberts <neil@linux.intel.com> v6: Update dispatch_sanity for the addition of CopyImageSubData
Diffstat (limited to 'src/mesa/main/textureview.c')
-rw-r--r--src/mesa/main/textureview.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
index 77a3b78..b3521e2 100644
--- a/src/mesa/main/textureview.c
+++ b/src/mesa/main/textureview.c
@@ -320,15 +320,11 @@ target_valid(struct gl_context *ctx, GLenum origTarget, GLenum newTarget)
* If an error is found, record it with _mesa_error()
* \return false if any error, true otherwise.
*/
-static bool
-compatible_format(struct gl_context *ctx, const struct gl_texture_object *origTexObj,
- GLenum internalformat)
+GLboolean
+_mesa_texture_view_compatible_format(struct gl_context *ctx,
+ GLenum origInternalFormat,
+ GLenum newInternalFormat)
{
- /* Level 0 of a texture created by glTextureStorage or glTextureView
- * is always defined.
- */
- struct gl_texture_image *texImage = origTexObj->Image[0][0];
- GLint origInternalFormat = texImage->InternalFormat;
unsigned int origViewClass, newViewClass;
/* The two textures' internal formats must be compatible according to
@@ -337,19 +333,15 @@ compatible_format(struct gl_context *ctx, const struct gl_texture_object *origTe
* The internal formats must be identical if not in that table,
* or an INVALID_OPERATION error is generated.
*/
- if (origInternalFormat == internalformat)
- return true;
+ if (origInternalFormat == newInternalFormat)
+ return GL_TRUE;
origViewClass = lookup_view_class(ctx, origInternalFormat);
- newViewClass = lookup_view_class(ctx, internalformat);
+ newViewClass = lookup_view_class(ctx, newInternalFormat);
if ((origViewClass == newViewClass) && origViewClass != false)
- return true;
+ return GL_TRUE;
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glTextureView(internalformat %s not compatible with origtexture %s)",
- _mesa_lookup_enum_by_nr(internalformat),
- _mesa_lookup_enum_by_nr(origInternalFormat));
- return false;
+ return GL_FALSE;
}
/**
* Helper function for TexStorage and teximagemultisample to set immutable
@@ -512,8 +504,14 @@ _mesa_TextureView(GLuint texture, GLenum target, GLuint origtexture,
return;
}
- if (!compatible_format(ctx, origTexObj, internalformat)) {
- return; /* Error logged */
+ if (!_mesa_texture_view_compatible_format(ctx,
+ origTexObj->Image[0][0]->InternalFormat,
+ internalformat)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glTextureView(internalformat %s not compatible with origtexture %s)",
+ _mesa_lookup_enum_by_nr(internalformat),
+ _mesa_lookup_enum_by_nr(origTexObj->Image[0][0]->InternalFormat));
+ return;
}
texFormat = _mesa_choose_texture_format(ctx, texObj, target, 0,