uint32_t utile_h = vc5_utile_height(rsc->cpp);
uint32_t uif_block_w = utile_w * 2;
uint32_t uif_block_h = utile_h * 2;
- bool uif_top = false;
+ bool msaa = prsc->nr_samples > 1;
+ /* MSAA textures/renderbuffers are always laid out as single-level
+ * UIF.
+ */
+ bool uif_top = prsc->nr_samples > 1;
for (int i = prsc->last_level; i >= 0; i--) {
struct vc5_resource_slice *slice = &rsc->slices[i];
level_height = u_minify(pot_height, i);
}
+ if (msaa) {
+ level_width *= 2;
+ level_height *= 2;
+ }
+
if (!rsc->tiled) {
slice->tiling = VC5_TILING_RASTER;
- if (prsc->nr_samples > 1) {
- /* MSAA (4x) surfaces are stored as raw tile buffer contents. */
- level_width = align(level_width, 32);
- level_height = align(level_height, 32);
- }
} else {
if ((i != 0 || !uif_top) &&
(level_width <= utile_w ||
}
slice->offset = offset;
- slice->stride = (level_width * rsc->cpp *
- MAX2(prsc->nr_samples, 1));
+ slice->stride = level_width * rsc->cpp;
slice->size = level_height * slice->stride;
offset += slice->size;
pipe_reference_init(&prsc->reference, 1);
prsc->screen = pscreen;
- if (prsc->nr_samples <= 1)
- rsc->cpp = util_format_get_blocksize(tmpl->format);
- else
- rsc->cpp = sizeof(uint32_t);
+ if (prsc->nr_samples <= 1) {
+ rsc->cpp = util_format_get_blocksize(prsc->format);
+ } else {
+ assert(vc5_rt_format_supported(prsc->format));
+ uint32_t output_image_format = vc5_get_rt_format(prsc->format);
+ uint32_t internal_type;
+ uint32_t internal_bpp;
+ vc5_get_internal_type_bpp_for_output_format(output_image_format,
+ &internal_type,
+ &internal_bpp);
+ switch (internal_bpp) {
+ case INTERNAL_BPP_32:
+ rsc->cpp = 4;
+ break;
+ case INTERNAL_BPP_64:
+ rsc->cpp = 8;
+ break;
+ case INTERNAL_BPP_128:
+ rsc->cpp = 16;
+ break;
+ }
+ }
assert(rsc->cpp);
so->base.reference.count = 1;
so->base.context = pctx;
+ int msaa_scale = prsc->nr_samples > 1 ? 2 : 1;
+
struct V3D33_TEXTURE_SHADER_STATE state_unpacked = {
cl_packet_header(TEXTURE_SHADER_STATE),
- .image_width = prsc->width0,
- .image_height = prsc->height0,
+ .image_width = prsc->width0 * msaa_scale,
+ .image_height = prsc->height0 * msaa_scale,
.image_depth = prsc->depth0,
.texture_type = rsc->tex_format,