[Mesa-dev] [PATCH] mesa: remove dd_function_table::GetCompressedTexSubImage and clean it up
Ian Romanick
idr at freedesktop.org
Sat Jan 6 05:42:56 UTC 2018
On 01/04/2018 05:42 PM, Marek Olšák wrote:
> On Thu, Jan 4, 2018 at 8:36 PM, Ian Romanick <idr at freedesktop.org> wrote:
>> If nobody uses this method, removing it seems fine. Does this imply
>> that nobody implements an accelerated glGetCompressedTexSubImage, or is
>> the acceleration just implemented differently (in a way that I don't
>> recall off the top of my head)?
>
> Driver.MapTextureImage is used to implement accelerated
> GetCompressedTexSubImage.
Ah, right. This patch is
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
> Marek
>
>>
>> On 01/03/2018 01:50 PM, Marek Olšák wrote:
>>> From: Marek Olšák <marek.olsak at amd.com>
>>>
>>> ---
>>> src/mesa/drivers/common/driverfuncs.c | 1 -
>>> src/mesa/main/dd.h | 10 ----------
>>> src/mesa/main/texgetimage.c | 23 +++++++++++------------
>>> src/mesa/main/texgetimage.h | 8 --------
>>> src/mesa/state_tracker/st_cb_texture.c | 1 -
>>> 5 files changed, 11 insertions(+), 32 deletions(-)
>>>
>>> diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
>>> index ddb4bb6..94dc0e6 100644
>>> --- a/src/mesa/drivers/common/driverfuncs.c
>>> +++ b/src/mesa/drivers/common/driverfuncs.c
>>> @@ -94,21 +94,20 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
>>> driver->QueryInternalFormat = _mesa_query_internal_format_default;
>>> driver->TexImage = _mesa_store_teximage;
>>> driver->TexSubImage = _mesa_store_texsubimage;
>>> driver->GetTexSubImage = _mesa_meta_GetTexSubImage;
>>> driver->ClearTexSubImage = _mesa_meta_ClearTexSubImage;
>>> driver->CopyTexSubImage = _mesa_meta_CopyTexSubImage;
>>> driver->GenerateMipmap = _mesa_meta_GenerateMipmap;
>>> driver->TestProxyTexImage = _mesa_test_proxy_teximage;
>>> driver->CompressedTexImage = _mesa_store_compressed_teximage;
>>> driver->CompressedTexSubImage = _mesa_store_compressed_texsubimage;
>>> - driver->GetCompressedTexSubImage = _mesa_GetCompressedTexSubImage_sw;
>>> driver->BindTexture = NULL;
>>> driver->NewTextureObject = _mesa_new_texture_object;
>>> driver->DeleteTexture = _mesa_delete_texture_object;
>>> driver->NewTextureImage = _swrast_new_texture_image;
>>> driver->DeleteTextureImage = _swrast_delete_texture_image;
>>> driver->AllocTextureImageBuffer = _swrast_alloc_texture_image_buffer;
>>> driver->FreeTextureImageBuffer = _swrast_free_texture_image_buffer;
>>> driver->MapTextureImage = _swrast_map_teximage;
>>> driver->UnmapTextureImage = _swrast_unmap_teximage;
>>> driver->DrawTex = _mesa_meta_DrawTex;
>>> diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
>>> index 4e4d2a6..3455ddb 100644
>>> --- a/src/mesa/main/dd.h
>>> +++ b/src/mesa/main/dd.h
>>> @@ -330,30 +330,20 @@ struct dd_function_table {
>>>
>>> /**
>>> * Called by glCompressedTexSubImage[123]D().
>>> */
>>> void (*CompressedTexSubImage)(struct gl_context *ctx, GLuint dims,
>>> struct gl_texture_image *texImage,
>>> GLint xoffset, GLint yoffset, GLint zoffset,
>>> GLsizei width, GLsizei height, GLsizei depth,
>>> GLenum format,
>>> GLsizei imageSize, const GLvoid *data);
>>> -
>>> - /**
>>> - * Called by glGetCompressedTexImage.
>>> - */
>>> - void (*GetCompressedTexSubImage)(struct gl_context *ctx,
>>> - struct gl_texture_image *texImage,
>>> - GLint xoffset, GLint yoffset,
>>> - GLint zoffset, GLsizei width,
>>> - GLsizei height, GLsizei depth,
>>> - GLvoid *data);
>>> /*@}*/
>>>
>>> /**
>>> * \name Texture object / image functions
>>> */
>>> /*@{*/
>>>
>>> /**
>>> * Called by glBindTexture() and glBindTextures().
>>> */
>>> diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
>>> index 26cf3e5..c61842e 100644
>>> --- a/src/mesa/main/texgetimage.c
>>> +++ b/src/mesa/main/texgetimage.c
>>> @@ -754,30 +754,29 @@ _mesa_GetTexSubImage_sw(struct gl_context *ctx,
>>> }
>>>
>>> if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
>>> ctx->Driver.UnmapBuffer(ctx, ctx->Pack.BufferObj, MAP_INTERNAL);
>>> }
>>> }
>>>
>>>
>>>
>>> /**
>>> - * This is the software fallback for Driver.GetCompressedTexSubImage().
>>> - * All error checking will have been done before this routine is called.
>>> + * This function assumes that all error checking has been done.
>>> */
>>> -void
>>> -_mesa_GetCompressedTexSubImage_sw(struct gl_context *ctx,
>>> - struct gl_texture_image *texImage,
>>> - GLint xoffset, GLint yoffset,
>>> - GLint zoffset, GLsizei width,
>>> - GLint height, GLint depth,
>>> - GLvoid *img)
>>> +static void
>>> +get_compressed_texsubimage_sw(struct gl_context *ctx,
>>> + struct gl_texture_image *texImage,
>>> + GLint xoffset, GLint yoffset,
>>> + GLint zoffset, GLsizei width,
>>> + GLint height, GLint depth,
>>> + GLvoid *img)
>>> {
>>> const GLuint dimensions =
>>> _mesa_get_texture_dimensions(texImage->TexObject->Target);
>>> struct compressed_pixelstore store;
>>> GLint slice;
>>> GLubyte *dest;
>>>
>>> _mesa_compute_compressed_pixelstore(dimensions, texImage->TexFormat,
>>> width, height, depth,
>>> &ctx->Pack, &store);
>>> @@ -1654,23 +1653,23 @@ get_compressed_texture_image(struct gl_context *ctx,
>>> firstFace = _mesa_tex_target_to_face(target);
>>> numFaces = 1;
>>> }
>>>
>>> _mesa_lock_texture(ctx, texObj);
>>>
>>> for (i = 0; i < numFaces; i++) {
>>> texImage = texObj->Image[firstFace + i][level];
>>> assert(texImage);
>>>
>>> - ctx->Driver.GetCompressedTexSubImage(ctx, texImage,
>>> - xoffset, yoffset, zoffset,
>>> - width, height, depth, pixels);
>>> + get_compressed_texsubimage_sw(ctx, texImage,
>>> + xoffset, yoffset, zoffset,
>>> + width, height, depth, pixels);
>>>
>>> /* next cube face */
>>> pixels = (GLubyte *) pixels + imageStride;
>>> }
>>>
>>> _mesa_unlock_texture(ctx, texObj);
>>> }
>>>
>>>
>>> void GLAPIENTRY
>>> diff --git a/src/mesa/main/texgetimage.h b/src/mesa/main/texgetimage.h
>>> index 63c75eb..3928e7a 100644
>>> --- a/src/mesa/main/texgetimage.h
>>> +++ b/src/mesa/main/texgetimage.h
>>> @@ -37,28 +37,20 @@ extern GLenum
>>> _mesa_base_pack_format(GLenum format);
>>>
>>> extern void
>>> _mesa_GetTexSubImage_sw(struct gl_context *ctx,
>>> GLint xoffset, GLint yoffset, GLint zoffset,
>>> GLsizei width, GLsizei height, GLint depth,
>>> GLenum format, GLenum type, GLvoid *pixels,
>>> struct gl_texture_image *texImage);
>>>
>>> extern void
>>> -_mesa_GetCompressedTexSubImage_sw(struct gl_context *ctx,
>>> - struct gl_texture_image *texImage,
>>> - GLint xoffset, GLint yoffset,
>>> - GLint zoffset, GLsizei width,
>>> - GLint height, GLint depth,
>>> - GLvoid *data);
>>> -
>>> -extern void
>>> _mesa_get_compressed_texture_image( struct gl_context *ctx,
>>> struct gl_texture_object *texObj,
>>> struct gl_texture_image *texImage,
>>> GLenum target, GLint level,
>>> GLsizei bufSize, GLvoid *pixels,
>>> bool dsa );
>>>
>>>
>>> extern void GLAPIENTRY
>>> _mesa_GetTexImage( GLenum target, GLint level,
>>> diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
>>> index 7766273..98f2443 100644
>>> --- a/src/mesa/state_tracker/st_cb_texture.c
>>> +++ b/src/mesa/state_tracker/st_cb_texture.c
>>> @@ -3173,21 +3173,20 @@ st_init_texture_functions(struct dd_function_table *functions)
>>> functions->TexImage = st_TexImage;
>>> functions->TexSubImage = st_TexSubImage;
>>> functions->CompressedTexSubImage = st_CompressedTexSubImage;
>>> functions->CopyTexSubImage = st_CopyTexSubImage;
>>> functions->GenerateMipmap = st_generate_mipmap;
>>>
>>> functions->GetTexSubImage = st_GetTexSubImage;
>>>
>>> /* compressed texture functions */
>>> functions->CompressedTexImage = st_CompressedTexImage;
>>> - functions->GetCompressedTexSubImage = _mesa_GetCompressedTexSubImage_sw;
>>>
>>> functions->NewTextureObject = st_NewTextureObject;
>>> functions->NewTextureImage = st_NewTextureImage;
>>> functions->DeleteTextureImage = st_DeleteTextureImage;
>>> functions->DeleteTexture = st_DeleteTextureObject;
>>> functions->AllocTextureImageBuffer = st_AllocTextureImageBuffer;
>>> functions->FreeTextureImageBuffer = st_FreeTextureImageBuffer;
>>> functions->MapTextureImage = st_MapTextureImage;
>>> functions->UnmapTextureImage = st_UnmapTextureImage;
>>>
More information about the mesa-dev
mailing list