}
/* MSAA only supported for 2D textures (and 2D texture arrays via an
- * extension currently unimplemented */
+ * extension currently unimplemented) */
- if (so->base.target == PIPE_TEXTURE_2D) {
- assert(depth == 1);
- depth = texture->nr_samples;
- } else {
- /* MSAA only supported for 2D textures */
- assert(texture->nr_samples <= 1);
- }
+ assert(texture->nr_samples <= 1 || so->base.target == PIPE_TEXTURE_2D);
enum mali_texture_dimension type =
panfrost_translate_texture_dimension(so->base.target);
<struct name="Midgard Texture" size="8">
<field name="Width" size="16" start="0:0" type="uint" modifier="minus(1)"/>
<field name="Height" size="16" start="0:16" type="uint" modifier="minus(1)"/>
- <field name="Depth" size="16" start="1:0" type="uint" modifier="minus(1)"/>
+ <field name="Depth" size="16" start="1:0" type="uint" modifier="minus(1)" default="1"/>
+ <field name="Sample count" size="16" start="1:0" type="uint" modifier="minus(1)" default="1"/>
<field name="Array size" size="16" start="1:16" type="uint" modifier="minus(1)"/>
<field name="Format" size="22" start="2:0" type="uint"/>
<field name="Dimension" size="2" start="2:22" type="Texture Dimension"/>
pan_pack(out, MIDGARD_TEXTURE, cfg) {
cfg.width = u_minify(width, first_level);
cfg.height = u_minify(height, first_level);
- cfg.depth = u_minify(depth, first_level);
+ if (dim == MALI_TEXTURE_DIMENSION_3D)
+ cfg.depth = u_minify(depth, first_level);
+ else
+ cfg.sample_count = MAX2(1, nr_samples);
cfg.array_size = array_size;
cfg.format = panfrost_pipe_format_v6[format].hw;
cfg.dimension = dim;