Commit 37d06b23 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Multitexture support, possibly

parent 4f4ca596
......@@ -839,20 +839,23 @@ trans_emit_for_draw(struct panfrost_context *ctx)
}
if ((ctx->dirty & PAN_DIRTY_TEXTURES) && ctx->sampler_view_count /* XXX */) {
assert(ctx->sampler_view_count == 1);
uint64_t *trampolines = malloc(ctx->sampler_view_count * sizeof(uint64_t));
/* Upload the bitmap itself. TODO: Should be swizzled */
for (int i = 0; i < ctx->sampler_view_count; ++i) {
/* Upload the bitmap itself. TODO: Should be swizzled */
struct pipe_resource *tex_rsrc = ctx->sampler_views[PIPE_SHADER_FRAGMENT][0]->base.texture;
struct panfrost_resource *rsrc = (struct panfrost_resource *) tex_rsrc;
mali_ptr bitmap = panfrost_upload(&ctx->cmdstream, (uint8_t *) rsrc->cpu, rsrc->len, false);
struct pipe_resource *tex_rsrc = ctx->sampler_views[PIPE_SHADER_FRAGMENT][i]->base.texture;
struct panfrost_resource *rsrc = (struct panfrost_resource *) tex_rsrc;
mali_ptr bitmap = panfrost_upload(&ctx->cmdstream, (uint8_t *) rsrc->cpu, rsrc->len, false);
/* Inject the address in. XXX: Should be its own dirty flag or something... */
ctx->sampler_views[PIPE_SHADER_FRAGMENT][0]->hw.swizzled_bitmap_0 = bitmap;
ctx->sampler_views[PIPE_SHADER_FRAGMENT][0]->hw.swizzled_bitmap_1 = bitmap;
/* Inject the address in. XXX: Should be its own dirty flag or something... */
ctx->sampler_views[PIPE_SHADER_FRAGMENT][i]->hw.swizzled_bitmap_0 = bitmap;
ctx->sampler_views[PIPE_SHADER_FRAGMENT][i]->hw.swizzled_bitmap_1 = bitmap;
uint64_t texture_trampoline = panfrost_upload(&ctx->cmdstream, &ctx->sampler_views[PIPE_SHADER_FRAGMENT][0]->hw, sizeof(struct mali_texture_descriptor), false);
ctx->payload_tiler.texture_trampoline = panfrost_upload(&ctx->cmdstream, &texture_trampoline, sizeof(uint64_t) * 1, false);
trampolines[i] = panfrost_upload(&ctx->cmdstream, &ctx->sampler_views[PIPE_SHADER_FRAGMENT][0]->hw, sizeof(struct mali_texture_descriptor), false);
}
ctx->payload_tiler.texture_trampoline = panfrost_upload(&ctx->cmdstream, trampolines, sizeof(uint64_t) * ctx->sampler_view_count, false);
}
for (int i = 0; i < PIPE_SHADER_TYPES; ++i) {
......@@ -1482,7 +1485,6 @@ panfrost_set_sampler_views(
assert(shader == PIPE_SHADER_FRAGMENT);
assert(start_slot == 0);
assert(num_views == 1);
ctx->sampler_views[shader] = calloc(num_views, sizeof (void *)); /* XXX: leak */
memcpy(ctx->sampler_views[shader], views, num_views * sizeof (void *));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment