From 30daded7e9292bff51d0b59e8c06546bb741259a Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Fri, 10 Dec 2021 09:53:59 +0800 Subject: [PATCH] mesa/st: update NumSparseLevels from pipe_resource MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add nr_sparse_levels in pipe_resource for updating the gl_texture_object->NumSparseLevels. Reviewed-by: Marek Olšák Signed-off-by: Qiang Yu Part-of: --- src/gallium/include/pipe/p_state.h | 2 ++ src/mesa/state_tracker/st_cb_texture.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index c96a387bab8..196a9f42c50 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -569,6 +569,8 @@ struct pipe_resource */ unsigned nr_storage_samples:8; + unsigned nr_sparse_levels:8; /**< Mipmap levels support partial resident */ + unsigned usage:8; /**< PIPE_USAGE_x (not a bitmask) */ unsigned bind; /**< bitmask of PIPE_BIND_x */ unsigned flags; /**< bitmask of PIPE_RESOURCE_FLAG_x */ diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 5414adb1016..1a3ab2a662c 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -3359,6 +3359,9 @@ st_texture_storage(struct gl_context *ctx, } } + /* Update gl_texture_object for texture parameter query. */ + texObj->NumSparseLevels = stObj->pt->nr_sparse_levels; + /* The texture is in a validated state, so no need to check later. */ stObj->needs_validation = false; stObj->validated_first_level = 0;