mesa/st: add st_TexturePageCommitment interface
authorQiang Yu <yuq825@gmail.com>
Wed, 8 Dec 2021 09:00:58 +0000 (17:00 +0800)
committerQiang Yu <yuq825@gmail.com>
Thu, 30 Dec 2021 08:11:19 +0000 (16:11 +0800)
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>

src/mesa/state_tracker/st_cb_texture.c
src/mesa/state_tracker/st_cb_texture.h

index 6c2ba9f..5414adb 100644 (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;
+   }
+}
index 5cc672e..1149887 100644 (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 */