<div dir="ltr">These comments have been addressed: <a href="http://cgit.freedesktop.org/~ldeks/mesa/commit/?h=adsa-textures&id=7c419db487dc3b2f55a30dca137322baae72f16b">http://cgit.freedesktop.org/~ldeks/mesa/commit/?h=adsa-textures&id=7c419db487dc3b2f55a30dca137322baae72f16b</a>.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 31, 2014 at 11:37 AM, Anuj Phogat <span dir="ltr"><<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Wed, Dec 31, 2014 at 11:21 AM, Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com">anuj.phogat@gmail.com</a>> wrote:<br>
> On Mon, Dec 15, 2014 at 5:22 PM, Laura Ekstrand <<a href="mailto:laura@jlekstrand.net">laura@jlekstrand.net</a>> wrote:<br>
>> ---<br>
>> src/mapi/glapi/gen/ARB_direct_state_access.xml | 9 +<br>
>> src/mesa/main/texgetimage.c | 315 +++++++++++++++++++------<br>
>> src/mesa/main/texgetimage.h | 9 +<br>
>> 3 files changed, 267 insertions(+), 66 deletions(-)<br>
>><br>
>> diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml<br>
>> index eef6536..605c614 100644<br>
>> --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml<br>
>> +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml<br>
>> @@ -148,6 +148,15 @@<br>
>> <param name="texture" type="GLuint" /><br>
>> </function><br>
>><br>
>> + <function name="GetTextureImage" offset="assign"><br>
>> + <param name="texture" type="GLuint" /><br>
>> + <param name="level" type="GLint" /><br>
>> + <param name="format" type="GLenum" /><br>
>> + <param name="type" type="GLenum" /><br>
>> + <param name="bufSize" type="GLsizei" /><br>
>> + <param name="pixels" type="GLvoid *" /><br>
>> + </function><br>
>> +<br>
>> <function name="GetTextureLevelParameterfv" offset="assign"><br>
>> <param name="texture" type="GLuint" /><br>
>> <param name="level" type="GLint" /><br>
>> diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c<br>
>> index 270fc85..32b5ace 100644<br>
>> --- a/src/mesa/main/texgetimage.c<br>
>> +++ b/src/mesa/main/texgetimage.c<br>
>> @@ -758,24 +758,17 @@ _mesa_GetCompressedTexImage_sw(struct gl_context *ctx,<br>
>><br>
>><br>
>> /**<br>
>> - * Validate the texture target enum supplied to glTexImage or<br>
>> - * glCompressedTexImage.<br>
>> + * Validate the texture target enum supplied to glGetTex(ture)Image or<br>
>> + * glGetCompressedTex(ture)Image.<br>
>> */<br>
>> static GLboolean<br>
>> -legal_getteximage_target(struct gl_context *ctx, GLenum target)<br>
>> +legal_getteximage_target(struct gl_context *ctx, GLenum target, bool dsa)<br>
>> {<br>
>> switch (target) {<br>
>> case GL_TEXTURE_1D:<br>
>> case GL_TEXTURE_2D:<br>
>> case GL_TEXTURE_3D:<br>
>> return GL_TRUE;<br>
>> - case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:<br>
>> - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:<br>
>> - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:<br>
>> - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:<br>
>> - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:<br>
>> - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:<br>
>> - return ctx->Extensions.ARB_texture_cube_map;<br>
>> case GL_TEXTURE_RECTANGLE_NV:<br>
>> return ctx->Extensions.NV_texture_rectangle;<br>
>> case GL_TEXTURE_1D_ARRAY_EXT:<br>
>> @@ -783,6 +776,34 @@ legal_getteximage_target(struct gl_context *ctx, GLenum target)<br>
>> return ctx->Extensions.EXT_texture_array;<br>
>> case GL_TEXTURE_CUBE_MAP_ARRAY:<br>
>> return ctx->Extensions.ARB_texture_cube_map_array;<br>
>> +<br>
>> + /* Section 8.11 (Texture Queries) of the OpenGL 4.5 core profile spec<br>
>> + * (30.10.2014) says:<br>
>> + * "An INVALID_ENUM error is generated if the effective target is not<br>
>> + * one of TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_1D_ARRAY,<br>
>> + * TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP_ARRAY, TEXTURE_RECTANGLE, one of<br>
>> + * the targets from table 8.19 (for GetTexImage and GetnTexImage *only*),<br>
>> + * or TEXTURE_CUBE_MAP (for GetTextureImage *only*)." (Emphasis added.)<br>
>> + */<br>
>> + case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:<br>
>> + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:<br>
>> + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:<br>
>> + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:<br>
>> + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:<br>
>> + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:<br>
>> + {<br>
>> + if (dsa)<br>
>> + return GL_FALSE;<br>
>> + else<br>
>> + return ctx->Extensions.ARB_texture_cube_map;<br>
>> + }<br>
>> + case GL_TEXTURE_CUBE_MAP:<br>
>> + {<br>
>> + if (dsa)<br>
>> + return GL_TRUE;<br>
>> + else<br>
>> + return GL_FALSE;<br>
>> + }<br>
</div></div>Curly braces not required under case. Might use:<br>
return dsa ? GL_TRUE : GL_FALSE;<br>
<div class="HOEnZb"><div class="h5"><br>
>> default:<br>
>> return GL_FALSE;<br>
>> }<br>
>> @@ -790,84 +811,82 @@ legal_getteximage_target(struct gl_context *ctx, GLenum target)<br>
>><br>
>><br>
>> /**<br>
>> - * Do error checking for a glGetTexImage() call.<br>
>> + * Do error checking for a glGetTex(ture)Image() call.<br>
>> * \return GL_TRUE if any error, GL_FALSE if no errors.<br>
>> */<br>
>> static GLboolean<br>
>> -getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level,<br>
>> +getteximage_error_check(struct gl_context *ctx,<br>
>> + struct gl_texture_object *texObj,<br>
>> + struct gl_texture_image *texImage,<br>
>> + GLenum target, GLint level,<br>
>> GLenum format, GLenum type, GLsizei clientMemSize,<br>
>> - GLvoid *pixels )<br>
>> + GLvoid *pixels, bool dsa )<br>
>> {<br>
>> - struct gl_texture_object *texObj;<br>
>> - struct gl_texture_image *texImage;<br>
>> + assert(texObj);<br>
>> + assert(texImage);<br>
>> +<br>
>> const GLint maxLevels = _mesa_max_texture_levels(ctx, target);<br>
>> const GLuint dimensions = (target == GL_TEXTURE_3D) ? 3 : 2;<br>
>> - GLenum baseFormat, err;<br>
>> -<br>
>> - if (!legal_getteximage_target(ctx, target)) {<br>
>> - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target=0x%x)", target);<br>
>> - return GL_TRUE;<br>
>> - }<br>
>> + GLenum baseFormat;<br>
>><br>
>> assert(maxLevels != 0);<br>
>> if (level < 0 || level >= maxLevels) {<br>
>> - _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexImage(level)" );<br>
>> + _mesa_error( ctx, GL_INVALID_VALUE, "glGetTex%sImage(level)",<br>
>> + dsa ? "ture" : "");<br>
>> return GL_TRUE;<br>
>> }<br>
>><br>
>> - err = _mesa_error_check_format_and_type(ctx, format, type);<br>
>> - if (err != GL_NO_ERROR) {<br>
>> - _mesa_error(ctx, err, "glGetTexImage(format/type)");<br>
>> - return GL_TRUE;<br>
>> - }<br>
>> -<br>
>> - texObj = _mesa_get_current_tex_object(ctx, target);<br>
>> -<br>
>> - if (!texObj) {<br>
>> - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target)");<br>
>> - return GL_TRUE;<br>
>> - }<br>
>> -<br>
>> - texImage = _mesa_select_tex_image(ctx, texObj, target, level);<br>
>> - if (!texImage) {<br>
>> - /* non-existant texture image */<br>
>> - return GL_TRUE;<br>
>> - }<br>
>> + /*<br>
>> + * Format and type checking has been moved up to GetnTexImage and<br>
>> + * GetTextureImage so that it happens before getting the texImage object.<br>
>> + */<br>
>><br>
>> baseFormat = _mesa_get_format_base_format(texImage->TexFormat);<br>
>> -<br>
>> +<br>
>> /* Make sure the requested image format is compatible with the<br>
>> * texture's format.<br>
>> */<br>
>> if (_mesa_is_color_format(format)<br>
>> && !_mesa_is_color_format(baseFormat)) {<br>
>> - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");<br>
>> + _mesa_error(ctx, GL_INVALID_OPERATION,<br>
>> + "glGetTex%sImage(format mismatch)",<br>
>> + dsa ? "ture" : "");<br>
>> return GL_TRUE;<br>
>> }<br>
>> else if (_mesa_is_depth_format(format)<br>
>> && !_mesa_is_depth_format(baseFormat)<br>
>> && !_mesa_is_depthstencil_format(baseFormat)) {<br>
>> - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");<br>
>> + _mesa_error(ctx, GL_INVALID_OPERATION,<br>
>> + "glGetTex%sImage(format mismatch)",<br>
>> + dsa ? "ture" : "");<br>
>> return GL_TRUE;<br>
>> }<br>
>> else if (_mesa_is_stencil_format(format)<br>
>> && !ctx->Extensions.ARB_texture_stencil8) {<br>
>> - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format=GL_STENCIL_INDEX)");<br>
>> + _mesa_error(ctx, GL_INVALID_ENUM,<br>
>> + "glGetTex%sImage(format=GL_STENCIL_INDEX)",<br>
>> + dsa ? "ture" : "");<br>
>> return GL_TRUE;<br>
>> }<br>
>> else if (_mesa_is_ycbcr_format(format)<br>
>> && !_mesa_is_ycbcr_format(baseFormat)) {<br>
>> - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");<br>
>> + _mesa_error(ctx, GL_INVALID_OPERATION,<br>
>> + "glGetTex%sImage(format mismatch)",<br>
>> + dsa ? "ture" : "");<br>
>> return GL_TRUE;<br>
>> }<br>
>> else if (_mesa_is_depthstencil_format(format)<br>
>> && !_mesa_is_depthstencil_format(baseFormat)) {<br>
>> - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");<br>
>> + _mesa_error(ctx, GL_INVALID_OPERATION,<br>
>> + "glGetTex%sImage(format mismatch)",<br>
>> + dsa ? "ture" : "");<br>
>> return GL_TRUE;<br>
>> }<br>
>> else if (_mesa_is_enum_format_integer(format) !=<br>
>> _mesa_is_format_integer(texImage->TexFormat)) {<br>
>> - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");<br>
>> + _mesa_error(ctx, GL_INVALID_OPERATION,<br>
>> + "glGetTex%sImage(format mismatch)",<br>
>> + dsa ? "ture" : "");<br>
>> return GL_TRUE;<br>
>> }<br>
>><br>
>> @@ -876,11 +895,14 @@ getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level,<br>
>> format, type, clientMemSize, pixels)) {<br>
>> if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {<br>
>> _mesa_error(ctx, GL_INVALID_OPERATION,<br>
>> - "glGetTexImage(out of bounds PBO access)");<br>
>> + "glGetTex%sImage(out of bounds PBO access)",<br>
>> + dsa ? "ture" : "");<br>
>> } else {<br>
>> _mesa_error(ctx, GL_INVALID_OPERATION,<br>
>> - "glGetnTexImageARB(out of bounds access:"<br>
>> - " bufSize (%d) is too small)", clientMemSize);<br>
>> + "%s(out of bounds access:"<br>
>> + " bufSize (%d) is too small)",<br>
>> + dsa ? "glGetTextureImage" : "glGetnTexImageARB",<br>
>> + clientMemSize);<br>
>> }<br>
>> return GL_TRUE;<br>
>> }<br>
>> @@ -889,7 +911,7 @@ getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level,<br>
>> /* PBO should not be mapped */<br>
>> if (_mesa_check_disallowed_mapping(ctx->Pack.BufferObj)) {<br>
>> _mesa_error(ctx, GL_INVALID_OPERATION,<br>
>> - "glGetTexImage(PBO is mapped)");<br>
>> + "glGetTex%sImage(PBO is mapped)", dsa ? "ture" : "");<br>
>> return GL_TRUE;<br>
>> }<br>
>> }<br>
>> @@ -898,9 +920,12 @@ getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level,<br>
>> }<br>
>><br>
>><br>
>> -<br>
>> /**<br>
>> - * Get texture image. Called by glGetTexImage.<br>
>> + * This is the implementation for glGetnTexImageARB, glGetTextureImage,<br>
>> + * and glGetTexImage.<br>
>> + *<br>
>> + * Requires caller to pass in texImage object because _mesa_GetTextureImage<br>
>> + * must handle the GL_TEXTURE_CUBE_MAP target.<br>
>> *<br>
>> * \param target texture target.<br>
>> * \param level image level.<br>
>> @@ -908,19 +933,29 @@ getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level,<br>
>> * \param type pixel data type for returned image.<br>
>> * \param bufSize size of the pixels data buffer.<br>
>> * \param pixels returned pixel data.<br>
>> + * \param dsa True when the caller an ARB_direct_state_access function,<br>
>> + * false otherwise<br>
>> */<br>
>> -void GLAPIENTRY<br>
>> -_mesa_GetnTexImageARB( GLenum target, GLint level, GLenum format,<br>
>> - GLenum type, GLsizei bufSize, GLvoid *pixels )<br>
>> +void<br>
>> +_mesa_get_texture_image( struct gl_context *ctx,<br>
>> + struct gl_texture_object *texObj,<br>
>> + struct gl_texture_image *texImage, GLenum target,<br>
>> + GLint level, GLenum format, GLenum type,<br>
>> + GLsizei bufSize, GLvoid *pixels, bool dsa )<br>
>> {<br>
>> - struct gl_texture_object *texObj;<br>
>> - struct gl_texture_image *texImage;<br>
>> - GET_CURRENT_CONTEXT(ctx);<br>
>> + assert(texObj);<br>
>> + assert(texImage);<br>
>><br>
>> FLUSH_VERTICES(ctx, 0);<br>
>><br>
>> - if (getteximage_error_check(ctx, target, level, format, type,<br>
>> - bufSize, pixels)) {<br>
>> + /*<br>
>> + * Legal target checking has been moved up to GetnTexImage and<br>
>> + * GetTextureImage so that it can be caught before receiving a NULL<br>
>> + * texImage object and exiting.<br>
>> + */<br>
>> +<br>
>> + if (getteximage_error_check(ctx, texObj, texImage, target, level, format,<br>
>> + type, bufSize, pixels, dsa)) {<br>
>> return;<br>
>> }<br>
>><br>
>> @@ -929,15 +964,13 @@ _mesa_GetnTexImageARB( GLenum target, GLint level, GLenum format,<br>
>> return;<br>
>> }<br>
>><br>
>> - texObj = _mesa_get_current_tex_object(ctx, target);<br>
>> - texImage = _mesa_select_tex_image(ctx, texObj, target, level);<br>
>> -<br>
>> if (_mesa_is_zero_size_texture(texImage))<br>
>> return;<br>
>><br>
>> if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) {<br>
>> - _mesa_debug(ctx, "glGetTexImage(tex %u) format = %s, w=%d, h=%d,"<br>
>> + _mesa_debug(ctx, "glGetTex%sImage(tex %u) format = %s, w=%d, h=%d,"<br>
>> " dstFmt=0x%x, dstType=0x%x\n",<br>
>> + dsa ? "ture": "",<br>
>> texObj->Name,<br>
>> _mesa_get_format_name(texImage->TexFormat),<br>
>> texImage->Width, texImage->Height,<br>
>> @@ -951,6 +984,58 @@ _mesa_GetnTexImageARB( GLenum target, GLint level, GLenum format,<br>
>> _mesa_unlock_texture(ctx, texObj);<br>
>> }<br>
>><br>
>> +/**<br>
>> + * Get texture image. Called by glGetTexImage.<br>
>> + *<br>
>> + * \param target texture target.<br>
>> + * \param level image level.<br>
>> + * \param format pixel data format for returned image.<br>
>> + * \param type pixel data type for returned image.<br>
>> + * \param bufSize size of the pixels data buffer.<br>
>> + * \param pixels returned pixel data.<br>
>> + */<br>
>> +void GLAPIENTRY<br>
>> +_mesa_GetnTexImageARB( GLenum target, GLint level, GLenum format,<br>
>> + GLenum type, GLsizei bufSize, GLvoid *pixels )<br>
>> +{<br>
>> + struct gl_texture_object *texObj;<br>
>> + struct gl_texture_image *texImage;<br>
>> + GLenum err;<br>
>> + GET_CURRENT_CONTEXT(ctx);<br>
>> +<br>
>> + /*<br>
>> + * This has been moved here because a format/type mismatch can cause a NULL<br>
>> + * texImage object, which in turn causes the mismatch error to be<br>
>> + * ignored.<br>
>> + */<br>
>> + err = _mesa_error_check_format_and_type(ctx, format, type);<br>
>> + if (err != GL_NO_ERROR) {<br>
>> + _mesa_error(ctx, err, "glGetnTexImage(format/type)");<br>
>> + return;<br>
>> + }<br>
>> +<br>
>> + /*<br>
>> + * Legal target checking has been moved here to prevent exiting with a NULL<br>
>> + * texImage object.<br>
>> + */<br>
>> + if (!legal_getteximage_target(ctx, target, false)) {<br>
>> + _mesa_error(ctx, GL_INVALID_ENUM, "glGetnTexImage(target=0x%x)",<br>
>> + target);<br>
>> + return;<br>
>> + }<br>
>> +<br>
>> + texObj = _mesa_get_current_tex_object(ctx, target);<br>
>> + if (!texObj)<br>
>> + return;<br>
>> +<br>
>> + texImage = _mesa_select_tex_image(ctx, texObj, target, level);<br>
>> + if (!texImage)<br>
>> + return;<br>
>> +<br>
>> + _mesa_get_texture_image(ctx, texObj, texImage, target, level, format, type,<br>
>> + bufSize, pixels, false);<br>
>> +}<br>
>> +<br>
>><br>
>> void GLAPIENTRY<br>
>> _mesa_GetTexImage( GLenum target, GLint level, GLenum format,<br>
>> @@ -959,6 +1044,104 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,<br>
>> _mesa_GetnTexImageARB(target, level, format, type, INT_MAX, pixels);<br>
>> }<br>
>><br>
>> +/**<br>
>> + * Get texture image.<br>
>> + *<br>
>> + * \param texture texture name.<br>
>> + * \param level image level.<br>
>> + * \param format pixel data format for returned image.<br>
>> + * \param type pixel data type for returned image.<br>
>> + * \param bufSize size of the pixels data buffer.<br>
>> + * \param pixels returned pixel data.<br>
>> + */<br>
>> +void GLAPIENTRY<br>
>> +_mesa_GetTextureImage( GLuint texture, GLint level, GLenum format,<br>
>> + GLenum type, GLsizei bufSize, GLvoid *pixels )<br>
>> +{<br>
>> + struct gl_texture_object *texObj;<br>
>> + struct gl_texture_image *texImage;<br>
>> + int i;<br>
>> + GLint image_stride;<br>
>> + GLenum err;<br>
>> + GET_CURRENT_CONTEXT(ctx);<br>
>> +<br>
>> + /*<br>
>> + * This has been moved here because a format/type mismatch can cause a NULL<br>
>> + * texImage object, which in turn causes the mismatch error to be<br>
>> + * ignored.<br>
>> + */<br>
>> + err = _mesa_error_check_format_and_type(ctx, format, type);<br>
>> + if (err != GL_NO_ERROR) {<br>
>> + _mesa_error(ctx, err, "glGetTextureImage(format/type)");<br>
>> + return;<br>
>> + }<br>
>> +<br>
>> + texObj = _mesa_lookup_texture_err(ctx, texture, "glGetTextureImage");<br>
>> + if (!texObj)<br>
>> + return;<br>
>> +<br>
>> + /*<br>
>> + * Legal target checking has been moved here to prevent exiting with a NULL<br>
>> + * texImage object.<br>
>> + */<br>
>> + if (!legal_getteximage_target(ctx, texObj->Target, true)) {<br>
>> + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTextureImage(target=0x%x)",<br>
>> + texObj->Target);<br>
>> + return;<br>
>> + }<br>
>> +<br>
>> + /* Must special case GL_TEXTURE_CUBE_MAP. */<br>
> Must handle special case<br>
>> + if (texObj->Target == GL_TEXTURE_CUBE_MAP) {<br>
>> +<br>
>> + /* Error checking */<br>
>> + if (texObj->NumLayers < 6) {<br>
>> + /* Not enough image planes for a cube map. The spec does not say<br>
>> + * what should happen in this case because the user has always<br>
>> + * specified each cube face separately (using<br>
>> + * GL_TEXTURE_CUBE_MAP_POSITIVE_X+i) in previous GL versions.<br>
>> + * This is addressed in Khronos Bug 13223.<br>
>> + */<br>
>> + _mesa_error(ctx, GL_INVALID_OPERATION,<br>
>> + "glGetTextureImage(insufficient cube map storage)");<br>
>> + return;<br>
>> + }<br>
>> + for (i = 0; i < 6; ++i) { /* For each face. */<br>
>> + if (!texObj->Image[i][level]) {<br>
>> + /* Not enough image planes for a cube map. The spec does not say<br>
>> + * what should happen in this case because the user has always<br>
>> + * specified each cube face separately (using<br>
>> + * GL_TEXTURE_CUBE_MAP_POSITIVE_X+i) in previous GL versions.<br>
>> + * This is addressed in Khronos Bug 13223.<br>
>> + */<br>
>> + _mesa_error(ctx, GL_INVALID_OPERATION,<br>
>> + "glGetTextureImage(insufficient cube map storage)");<br>
>> + return;<br>
>> + }<br>
>> + }<br>
>> +<br>
>> +<br>
> extra new line.<br>
>> + /* Copy each face. */<br>
>> + for (i = 0; i < 6; ++i) { /* For each face. */<br>
> Duplicate comment.<br>
>> + texImage = texObj->Image[i][level];<br>
>> + _mesa_get_texture_image(ctx, texObj, texImage, texObj->Target, level,<br>
>> + format, type, bufSize, pixels, true);<br>
>> +<br>
>> + image_stride = _mesa_image_image_stride(&ctx->Pack, texImage->Width,<br>
>> + texImage->Height, format,<br>
>> + type);<br>
>> + pixels += image_stride;<br>
>> + bufSize -= image_stride;<br>
>> + }<br>
>> + }<br>
>> + else {<br>
>> + texImage = _mesa_select_tex_image(ctx, texObj, texObj->Target, level);<br>
>> + if (!texImage)<br>
>> + return;<br>
>> +<br>
>> + _mesa_get_texture_image(ctx, texObj, texImage, texObj->Target, level,<br>
>> + format, type, bufSize, pixels, true);<br>
>> + }<br>
>> +}<br>
>><br>
>> /**<br>
>> * Do error checking for a glGetCompressedTexImage() call.<br>
>> @@ -973,7 +1156,7 @@ getcompressedteximage_error_check(struct gl_context *ctx, GLenum target,<br>
>> const GLint maxLevels = _mesa_max_texture_levels(ctx, target);<br>
>> GLuint compressedSize, dimensions;<br>
>><br>
>> - if (!legal_getteximage_target(ctx, target)) {<br>
>> + if (!legal_getteximage_target(ctx, target, false)) {<br>
>> _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImage(target=0x%x)",<br>
>> target);<br>
>> return GL_TRUE;<br>
>> diff --git a/src/mesa/main/texgetimage.h b/src/mesa/main/texgetimage.h<br>
>> index 54739fd..085f580 100644<br>
>> --- a/src/mesa/main/texgetimage.h<br>
>> +++ b/src/mesa/main/texgetimage.h<br>
>> @@ -47,6 +47,12 @@ _mesa_GetCompressedTexImage_sw(struct gl_context *ctx,<br>
>> struct gl_texture_image *texImage,<br>
>> GLvoid *data);<br>
>><br>
>> +extern void<br>
>> +_mesa_get_texture_image( struct gl_context *ctx,<br>
>> + struct gl_texture_object *texObj,<br>
>> + struct gl_texture_image *texImage, GLenum target,<br>
>> + GLint level, GLenum format, GLenum type,<br>
>> + GLsizei bufSize, GLvoid *pixels, bool dsa );<br>
>><br>
>><br>
>> extern void GLAPIENTRY<br>
>> @@ -55,6 +61,9 @@ _mesa_GetTexImage( GLenum target, GLint level,<br>
>> extern void GLAPIENTRY<br>
>> _mesa_GetnTexImageARB( GLenum target, GLint level, GLenum format,<br>
>> GLenum type, GLsizei bufSize, GLvoid *pixels );<br>
>> +extern void GLAPIENTRY<br>
>> +_mesa_GetTextureImage( GLuint texture, GLint level, GLenum format,<br>
>> + GLenum type, GLsizei bufSize, GLvoid *pixels );<br>
>><br>
>> extern void GLAPIENTRY<br>
>> _mesa_GetCompressedTexImage(GLenum target, GLint lod, GLvoid *img);<br>
>> --<br>
>> 2.1.0<br>
>><br>
>> _______________________________________________<br>
>> mesa-dev mailing list<br>
>> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
>> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</div></div></blockquote></div><br></div>