panfrost: Create a new sampler view bo when the layout changes
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4628>
This commit is contained in:
@@ -1382,6 +1382,17 @@ panfrost_get_tex_desc(struct panfrost_batch *batch,
|
||||
return view->midgard_bo->gpu;
|
||||
}
|
||||
|
||||
static void
|
||||
panfrost_update_sampler_view(struct panfrost_sampler_view *view,
|
||||
struct pipe_context *pctx)
|
||||
{
|
||||
struct panfrost_resource *rsrc = pan_resource(view->base.texture);
|
||||
if (view->layout != rsrc->layout) {
|
||||
panfrost_bo_unreference(view->midgard_bo);
|
||||
panfrost_create_sampler_view_bo(view, pctx, &rsrc->base);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
panfrost_emit_texture_descriptors(struct panfrost_batch *batch,
|
||||
enum pipe_shader_type stage,
|
||||
@@ -1426,9 +1437,13 @@ panfrost_emit_texture_descriptors(struct panfrost_batch *batch,
|
||||
} else {
|
||||
uint64_t trampolines[PIPE_MAX_SHADER_SAMPLER_VIEWS];
|
||||
|
||||
for (int i = 0; i < ctx->sampler_view_count[stage]; ++i)
|
||||
trampolines[i] = panfrost_get_tex_desc(batch, stage,
|
||||
ctx->sampler_views[stage][i]);
|
||||
for (int i = 0; i < ctx->sampler_view_count[stage]; ++i) {
|
||||
struct panfrost_sampler_view *view = ctx->sampler_views[stage][i];
|
||||
|
||||
panfrost_update_sampler_view(view, &ctx->base);
|
||||
|
||||
trampolines[i] = panfrost_get_tex_desc(batch, stage, view);
|
||||
}
|
||||
|
||||
postfix->textures = panfrost_upload_transient(batch,
|
||||
trampolines,
|
||||
|
@@ -918,6 +918,8 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so,
|
||||
struct panfrost_resource *prsrc = (struct panfrost_resource *)texture;
|
||||
assert(prsrc->bo);
|
||||
|
||||
so->layout = prsrc->layout;
|
||||
|
||||
unsigned char user_swizzle[4] = {
|
||||
so->base.swizzle_r,
|
||||
so->base.swizzle_g,
|
||||
|
@@ -266,6 +266,7 @@ struct panfrost_sampler_view {
|
||||
struct panfrost_bo *midgard_bo;
|
||||
struct panfrost_bo *bifrost_bo;
|
||||
struct bifrost_texture_descriptor *bifrost_descriptor;
|
||||
enum mali_texture_layout layout;
|
||||
};
|
||||
|
||||
static inline struct panfrost_context *
|
||||
|
Reference in New Issue
Block a user