Commit 765f1d3e authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Abstract way more of the texture/sampler descriptors

parent abf978c4
...@@ -396,31 +396,68 @@ trans_emit_tiler_payload(struct panfrost_context *ctx) ...@@ -396,31 +396,68 @@ trans_emit_tiler_payload(struct panfrost_context *ctx)
uint32_t swizzled_bitmap[3*1] = { 0x0000ffff }; uint32_t swizzled_bitmap[3*1] = { 0x0000ffff };
mali_ptr bitmap = panfrost_upload(&ctx->cmdstream, swizzled_bitmap, sizeof(swizzled_bitmap), false); mali_ptr bitmap = panfrost_upload(&ctx->cmdstream, swizzled_bitmap, sizeof(swizzled_bitmap), false);
struct pipe_sampler_view _sampler_view = {
.target = PIPE_TEXTURE_2D,
.swizzle_r = PIPE_SWIZZLE_X,
.swizzle_g = PIPE_SWIZZLE_Y,
.swizzle_b = PIPE_SWIZZLE_Z,
.swizzle_a = PIPE_SWIZZLE_W,
};
struct pipe_sampler_state _sampler_state = {
.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE,
.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE,
.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE,
.compare_func = PIPE_FUNC_LEQUAL,
.min_img_filter = PIPE_TEX_FILTER_LINEAR,
.mag_img_filter = PIPE_TEX_FILTER_LINEAR,
.border_color = { .f = { 0.0, 0.0, 0.0, 0.0 } },
};
struct pipe_sampler_view *sampler_view = &_sampler_view;
struct pipe_sampler_state *sampler_state = &_sampler_state;
/* TODO: Other types of textures */
assert(sampler_view->target == PIPE_TEXTURE_2D);
struct mali_texture_descriptor texture_descriptor = { struct mali_texture_descriptor texture_descriptor = {
.width = MALI_POSITIVE(1), .width = MALI_POSITIVE(1),
.height = MALI_POSITIVE(3), .height = MALI_POSITIVE(3),
.depth = MALI_POSITIVE(1), .depth = MALI_POSITIVE(1),
/* TODO: Decode */
.format1 = 0x118bb688, .format1 = 0x118bb688,
.swizzle_r = trans_translate_texture_swizzle(PIPE_SWIZZLE_X),
.swizzle_g = trans_translate_texture_swizzle(PIPE_SWIZZLE_Y), .swizzle_r = trans_translate_texture_swizzle(sampler_view->swizzle_r),
.swizzle_b = trans_translate_texture_swizzle(PIPE_SWIZZLE_Z), .swizzle_g = trans_translate_texture_swizzle(sampler_view->swizzle_g),
.swizzle_a = trans_translate_texture_swizzle(PIPE_SWIZZLE_W), .swizzle_b = trans_translate_texture_swizzle(sampler_view->swizzle_b),
.unknown3 = 0x10000, .swizzle_a = trans_translate_texture_swizzle(sampler_view->swizzle_a),
.swizzled_bitmap_0 = bitmap, .swizzled_bitmap_0 = bitmap,
.swizzled_bitmap_1 = bitmap .swizzled_bitmap_1 = bitmap,
.unknown3 = 0x10000,
}; };
uint64_t texture_trampoline = panfrost_upload(&ctx->cmdstream, &texture_descriptor, sizeof(texture_descriptor), false); uint64_t texture_trampoline = panfrost_upload(&ctx->cmdstream, &texture_descriptor, sizeof(texture_descriptor), false);
struct mali_sampler_descriptor sampler_descriptor = { struct mali_sampler_descriptor sampler_descriptor = {
.filter_mode = MALI_GL_TEX_MIN(translate_tex_filter(PIPE_TEX_FILTER_LINEAR)) | MALI_GL_TEX_MAG(translate_tex_filter(PIPE_TEX_FILTER_LINEAR)) | 0x20, .filter_mode = MALI_GL_TEX_MIN(translate_tex_filter(sampler_state->min_img_filter))
.unknown1 = 0x10000, | MALI_GL_TEX_MAG(translate_tex_filter(sampler_state->mag_img_filter))
.wrap_s = translate_tex_wrap(PIPE_TEX_WRAP_CLAMP_TO_EDGE), | 0x20,
.wrap_t = translate_tex_wrap(PIPE_TEX_WRAP_CLAMP_TO_EDGE),
.wrap_r = translate_tex_wrap(PIPE_TEX_WRAP_CLAMP_TO_EDGE), .wrap_s = translate_tex_wrap(sampler_state->wrap_s),
.compare_func = trans_translate_alt_compare_func(PIPE_FUNC_LEQUAL), .wrap_t = translate_tex_wrap(sampler_state->wrap_t),
.wrap_r = translate_tex_wrap(sampler_state->wrap_r),
.compare_func = trans_translate_alt_compare_func(sampler_state->compare_func),
.border_color = {
sampler_state->border_color.f[0],
sampler_state->border_color.f[1],
sampler_state->border_color.f[2],
sampler_state->border_color.f[3]
},
.unknown2 = 1, .unknown2 = 1,
.border_color = { 0.000000, 0.000000, 0.000000, 0.000000 }, .unknown1 = 0x10000,
}; };
ctx->payload_tiler.texture_trampoline = panfrost_upload(&ctx->cmdstream, &texture_trampoline, sizeof(uint64_t), false); ctx->payload_tiler.texture_trampoline = panfrost_upload(&ctx->cmdstream, &texture_trampoline, sizeof(uint64_t), false);
......
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