mesa/st: add st_TexturePageCommitment interface

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14223>
This commit is contained in:
Qiang Yu 2021-12-08 17:00:58 +08:00
parent 34e5c14f70
commit 82f2ab0bfc
2 changed files with 23 additions and 0 deletions

View file

@ -3728,3 +3728,22 @@ st_GetSparseTextureVirtualPageSize(struct gl_context *ctx,
return !!screen->get_sparse_texture_virtual_page_size(
screen, ptarget, pformat, index, 1, x, y, z);
}
void
st_TexturePageCommitment(struct gl_context *ctx,
struct gl_texture_object *tex_obj,
int level, int xoffset, int yoffset, int zoffset,
int width, int height, int depth, bool commit)
{
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
struct st_texture_object *tex = st_texture_object(tex_obj);
struct pipe_box box;
u_box_3d(xoffset, yoffset, zoffset, width, height, depth, &box);
if (!pipe->resource_commit(pipe, tex->pt, level, &box, commit)) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexPageCommitmentARB(out of memory)");
return;
}
}

View file

@ -139,4 +139,8 @@ void st_MakeImageHandleResident(struct gl_context *ctx, GLuint64 handle,
GLboolean st_GetSparseTextureVirtualPageSize(struct gl_context *ctx,
GLenum target, mesa_format format,
unsigned index, int *x, int *y, int *z);
void st_TexturePageCommitment(struct gl_context *ctx,
struct gl_texture_object *tex_obj,
int level, int xoffset, int yoffset, int zoffset,
int width, int height, int depth, bool commit);
#endif /* ST_CB_TEXTURE_H */