diff options
author | Dave Airlie <airlied@redhat.com> | 2021-12-07 10:51:49 +1000 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2021-12-08 19:06:48 +0000 |
commit | 889ac0f1b984c114da6472a394e9b00ced50df64 (patch) | |
tree | 71c77b811d42b9d9caad6fb509e1431b604dfe30 /src/mesa/state_tracker/st_cb_texture.c | |
parent | 2d912b5caa86b1bd861c8b68cdbd883ee3ef846d (diff) |
mesa/st: move texture APIs to direct st calls
This is a bit more spreadout, but is still pretty straightforward
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14100>
Diffstat (limited to 'src/mesa/state_tracker/st_cb_texture.c')
-rw-r--r-- | src/mesa/state_tracker/st_cb_texture.c | 112 |
1 files changed, 28 insertions, 84 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 599d2099d6f..3767ff46d91 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -386,8 +386,7 @@ st_pbo_get_dst_format(struct gl_context *ctx, enum pipe_texture_target target, return dst_format; } -/** called via ctx->Driver.NewTextureImage() */ -static struct gl_texture_image * +struct gl_texture_image * st_NewTextureImage(struct gl_context * ctx) { DBG("%s\n", __func__); @@ -396,8 +395,7 @@ st_NewTextureImage(struct gl_context * ctx) } -/** called via ctx->Driver.DeleteTextureImage() */ -static void +void st_DeleteTextureImage(struct gl_context * ctx, struct gl_texture_image *img) { /* nothing special (yet) for st_texture_image */ @@ -405,8 +403,7 @@ st_DeleteTextureImage(struct gl_context * ctx, struct gl_texture_image *img) } -/** called via ctx->Driver.NewTextureObject() */ -static struct gl_texture_object * +struct gl_texture_object * st_NewTextureObject(struct gl_context * ctx, GLuint name, GLenum target) { struct st_texture_object *obj = ST_CALLOC_STRUCT(st_texture_object); @@ -437,8 +434,7 @@ st_NewTextureObject(struct gl_context * ctx, GLuint name, GLenum target) } -/** called via ctx->Driver.DeleteTextureObject() */ -static void +void st_DeleteTextureObject(struct gl_context *ctx, struct gl_texture_object *texObj) { @@ -458,7 +454,7 @@ st_DeleteTextureObject(struct gl_context *ctx, * lead to dangling pointers to destroyed contexts. * Release the views to prevent this. */ -static void +void st_TextureReleaseAllSamplerViews(struct gl_context *ctx, struct gl_texture_object *texObj) { @@ -468,8 +464,7 @@ st_TextureReleaseAllSamplerViews(struct gl_context *ctx, st_texture_release_all_sampler_views(st, stObj); } -/** called via ctx->Driver.FreeTextureImageBuffer() */ -static void +void st_FreeTextureImageBuffer(struct gl_context *ctx, struct gl_texture_image *texImage) { @@ -556,8 +551,7 @@ compressed_tex_fallback_allocate(struct st_context *st, } -/** called via ctx->Driver.MapTextureImage() */ -static void +void st_MapTextureImage(struct gl_context *ctx, struct gl_texture_image *texImage, GLuint slice, GLuint x, GLuint y, GLuint w, GLuint h, @@ -619,8 +613,7 @@ st_MapTextureImage(struct gl_context *ctx, } -/** called via ctx->Driver.UnmapTextureImage() */ -static void +void st_UnmapTextureImage(struct gl_context *ctx, struct gl_texture_image *texImage, GLuint slice) @@ -1004,11 +997,10 @@ guess_and_alloc_texture(struct st_context *st, /** - * Called via ctx->Driver.AllocTextureImageBuffer(). * If the texture object/buffer already has space for the indicated image, * we're done. Otherwise, allocate memory for the new texture image. */ -static GLboolean +GLboolean st_AllocTextureImageBuffer(struct gl_context *ctx, struct gl_texture_image *texImage) { @@ -1963,7 +1955,7 @@ fail: } -static void +void st_TexSubImage(struct gl_context *ctx, GLuint dims, struct gl_texture_image *texImage, GLint xoffset, GLint yoffset, GLint zoffset, @@ -2243,7 +2235,7 @@ fallback: } -static void +void st_TexImage(struct gl_context * ctx, GLuint dims, struct gl_texture_image *texImage, GLenum format, GLenum type, const void *pixels, @@ -2257,7 +2249,7 @@ st_TexImage(struct gl_context * ctx, GLuint dims, return; /* allocate storage for texture data */ - if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage)) { + if (!st_AllocTextureImageBuffer(ctx, texImage)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage%uD", dims); return; } @@ -2296,7 +2288,7 @@ st_try_pbo_compressed_texsubimage(struct gl_context *ctx, return success; } -static void +void st_CompressedTexSubImage(struct gl_context *ctx, GLuint dims, struct gl_texture_image *texImage, GLint x, GLint y, GLint z, @@ -2435,7 +2427,7 @@ fallback: } -static void +void st_CompressedTexImage(struct gl_context *ctx, GLuint dims, struct gl_texture_image *texImage, GLsizei imageSize, const void *data) @@ -2485,7 +2477,7 @@ st_CompressedTexImage(struct gl_context *ctx, GLuint dims, * texture layouts during texture uploads/downloads, so the blit * we do here should be free in such cases. */ -static void +void st_GetTexSubImage(struct gl_context * ctx, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLint depth, @@ -2822,7 +2814,7 @@ st_can_copyteximage_using_blit(const struct gl_texture_image *texImage, * * Note: srcY=0=Bottom of renderbuffer (GL convention) */ -static void +void st_CopyTexSubImage(struct gl_context *ctx, GLuint dims, struct gl_texture_image *texImage, GLint destX, GLint destY, GLint slice, @@ -3376,7 +3368,7 @@ st_texture_storage(struct gl_context *ctx, * Called via ctx->Driver.AllocTextureStorage() to allocate texture memory * for a whole mipmap stack. */ -static GLboolean +GLboolean st_AllocTextureStorage(struct gl_context *ctx, struct gl_texture_object *texObj, GLsizei levels, GLsizei width, @@ -3388,7 +3380,7 @@ st_AllocTextureStorage(struct gl_context *ctx, } -static GLboolean +GLboolean st_TestProxyTexImage(struct gl_context *ctx, GLenum target, GLuint numLevels, GLint level, mesa_format format, GLuint numSamples, @@ -3444,7 +3436,7 @@ st_TestProxyTexImage(struct gl_context *ctx, GLenum target, } } -static GLboolean +GLboolean st_TextureView(struct gl_context *ctx, struct gl_texture_object *texObj, struct gl_texture_object *origTexObj) @@ -3534,7 +3526,7 @@ find_mipmap_level(const struct gl_texture_image *texImage, } -static void +void st_ClearTexSubImage(struct gl_context *ctx, struct gl_texture_image *texImage, GLint xoffset, GLint yoffset, GLint zoffset, @@ -3594,7 +3586,7 @@ st_ClearTexSubImage(struct gl_context *ctx, * Called via the glTexParam*() function, but only when some texture object * state has actually changed. */ -static void +void st_TexParameter(struct gl_context *ctx, struct gl_texture_object *texObj, GLenum pname) { @@ -3625,7 +3617,7 @@ st_TexParameter(struct gl_context *ctx, } } -static GLboolean +GLboolean st_SetTextureStorageForMemoryObject(struct gl_context *ctx, struct gl_texture_object *texObj, struct gl_memory_object *memObj, @@ -3638,7 +3630,7 @@ st_SetTextureStorageForMemoryObject(struct gl_context *ctx, memObj, offset); } -static GLuint64 +GLuint64 st_NewTextureHandle(struct gl_context *ctx, struct gl_texture_object *texObj, struct gl_sampler_object *sampObj) { @@ -3665,7 +3657,7 @@ st_NewTextureHandle(struct gl_context *ctx, struct gl_texture_object *texObj, } -static void +void st_DeleteTextureHandle(struct gl_context *ctx, GLuint64 handle) { struct st_context *st = st_context(ctx); @@ -3675,7 +3667,7 @@ st_DeleteTextureHandle(struct gl_context *ctx, GLuint64 handle) } -static void +void st_MakeTextureHandleResident(struct gl_context *ctx, GLuint64 handle, bool resident) { @@ -3686,7 +3678,7 @@ st_MakeTextureHandleResident(struct gl_context *ctx, GLuint64 handle, } -static GLuint64 +GLuint64 st_NewImageHandle(struct gl_context *ctx, struct gl_image_unit *imgObj) { struct st_context *st = st_context(ctx); @@ -3699,7 +3691,7 @@ st_NewImageHandle(struct gl_context *ctx, struct gl_image_unit *imgObj) } -static void +void st_DeleteImageHandle(struct gl_context *ctx, GLuint64 handle) { struct st_context *st = st_context(ctx); @@ -3709,7 +3701,7 @@ st_DeleteImageHandle(struct gl_context *ctx, GLuint64 handle) } -static void +void st_MakeImageHandleResident(struct gl_context *ctx, GLuint64 handle, GLenum access, bool resident) { @@ -3718,51 +3710,3 @@ st_MakeImageHandleResident(struct gl_context *ctx, GLuint64 handle, pipe->make_image_handle_resident(pipe, handle, access, resident); } - - -void -st_init_texture_functions(struct dd_function_table *functions) -{ - functions->ChooseTextureFormat = st_ChooseTextureFormat; - functions->QueryInternalFormat = st_QueryInternalFormat; - 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->NewTextureObject = st_NewTextureObject; - functions->NewTextureImage = st_NewTextureImage; - functions->DeleteTextureImage = st_DeleteTextureImage; - functions->DeleteTexture = st_DeleteTextureObject; - functions->TextureRemovedFromShared = st_TextureReleaseAllSamplerViews; - functions->AllocTextureImageBuffer = st_AllocTextureImageBuffer; - functions->FreeTextureImageBuffer = st_FreeTextureImageBuffer; - functions->MapTextureImage = st_MapTextureImage; - functions->UnmapTextureImage = st_UnmapTextureImage; - - /* XXX Temporary until we can query pipe's texture sizes */ - functions->TestProxyTexImage = st_TestProxyTexImage; - - functions->AllocTextureStorage = st_AllocTextureStorage; - functions->TextureView = st_TextureView; - functions->ClearTexSubImage = st_ClearTexSubImage; - - functions->TexParameter = st_TexParameter; - - /* bindless functions */ - functions->NewTextureHandle = st_NewTextureHandle; - functions->DeleteTextureHandle = st_DeleteTextureHandle; - functions->MakeTextureHandleResident = st_MakeTextureHandleResident; - functions->NewImageHandle = st_NewImageHandle; - functions->DeleteImageHandle = st_DeleteImageHandle; - functions->MakeImageHandleResident = st_MakeImageHandleResident; - - /* external object functions */ - functions->SetTextureStorageForMemoryObject = st_SetTextureStorageForMemoryObject; -} |