return vs->writes_point_size && ctx->active_prim == PIPE_PRIM_POINTS;
}
-void
-panfrost_vertex_state_upd_attr_offs(struct panfrost_context *ctx,
- struct mali_vertex_tiler_postfix *vertex_postfix)
-{
- if (!ctx->vertex)
- return;
-
- struct panfrost_vertex_state *so = ctx->vertex;
-
- /* Fixup offsets for the second pass. Recall that the hardware
- * calculates attribute addresses as:
- *
- * addr = base + (stride * vtx) + src_offset;
- *
- * However, on Mali, base must be aligned to 64-bytes, so we
- * instead let:
- *
- * base' = base & ~63 = base - (base & 63)
- *
- * To compensate when using base' (see emit_vertex_data), we have
- * to adjust src_offset by the masked off piece:
- *
- * addr' = base' + (stride * vtx) + (src_offset + (base & 63))
- * = base - (base & 63) + (stride * vtx) + src_offset + (base & 63)
- * = base + (stride * vtx) + src_offset
- * = addr;
- *
- * QED.
- */
-
- unsigned start = vertex_postfix->offset_start;
-
- for (unsigned i = 0; i < so->num_elements; ++i) {
- unsigned vbi = so->pipe[i].vertex_buffer_index;
- struct pipe_vertex_buffer *buf = &ctx->vertex_buffers[vbi];
-
- /* Adjust by the masked off bits of the offset. Make sure we
- * read src_offset from so->hw (which is not GPU visible)
- * rather than target (which is) due to caching effects */
-
- unsigned src_offset = so->pipe[i].src_offset;
-
- /* BOs aligned to 4k so guaranteed aligned to 64 */
- src_offset += (buf->buffer_offset & 63);
-
- /* Also, somewhat obscurely per-instance data needs to be
- * offset in response to a delayed start in an indexed draw */
-
- if (so->pipe[i].instance_divisor && ctx->instance_count > 1 && start)
- src_offset -= buf->stride * start;
-
- so->hw[i].src_offset = src_offset;
- }
-}
-
/* Compute number of UBOs active (more specifically, compute the highest UBO
* number addressable -- if there are gaps, include them in the count anyway).
* We always include UBO #0 in the count, since we *need* uniforms enabled for
&primitive_size);
panfrost_emit_shader_meta(batch, PIPE_SHADER_VERTEX, &vertex_postfix);
panfrost_emit_shader_meta(batch, PIPE_SHADER_FRAGMENT, &tiler_postfix);
- panfrost_emit_vertex_attr_meta(batch, &vertex_postfix);
panfrost_emit_sampler_descriptors(batch, PIPE_SHADER_VERTEX, &vertex_postfix);
panfrost_emit_sampler_descriptors(batch, PIPE_SHADER_FRAGMENT, &tiler_postfix);
panfrost_emit_texture_descriptors(batch, PIPE_SHADER_VERTEX, &vertex_postfix);
memcpy(so->pipe, elements, sizeof(*elements) * num_elements);
for (int i = 0; i < num_elements; ++i) {
- so->hw[i].index = i;
-
enum pipe_format fmt = elements[i].src_format;
const struct util_format_description *desc = util_format_description(fmt);
- so->hw[i].unknown1 = 0x2;
-
+ unsigned swizzle = 0;
if (dev->quirks & HAS_SWIZZLES)
- so->hw[i].swizzle = panfrost_translate_swizzle_4(desc->swizzle);
+ swizzle = panfrost_translate_swizzle_4(desc->swizzle);
else
- so->hw[i].swizzle = panfrost_bifrost_swizzle(desc->nr_channels);
+ swizzle = panfrost_bifrost_swizzle(desc->nr_channels);
enum mali_format hw_format = panfrost_pipe_format_table[desc->format].hw;
- so->hw[i].format = hw_format;
+ so->formats[i] = (hw_format << 12) | swizzle;
assert(hw_format);
}
/* Let's also prepare vertex builtins */
- so->hw[PAN_VERTEX_ID].format = MALI_R32UI;
if (dev->quirks & HAS_SWIZZLES)
- so->hw[PAN_VERTEX_ID].swizzle = panfrost_get_default_swizzle(1);
+ so->formats[PAN_VERTEX_ID] = (MALI_R32UI << 12) | panfrost_get_default_swizzle(1);
else
- so->hw[PAN_VERTEX_ID].swizzle = panfrost_bifrost_swizzle(1);
+ so->formats[PAN_VERTEX_ID] = (MALI_R32UI << 12) | panfrost_bifrost_swizzle(1);
- so->hw[PAN_INSTANCE_ID].format = MALI_R32UI;
if (dev->quirks & HAS_SWIZZLES)
- so->hw[PAN_INSTANCE_ID].swizzle = panfrost_get_default_swizzle(1);
+ so->formats[PAN_INSTANCE_ID] = (MALI_R32UI << 12) | panfrost_get_default_swizzle(1);
else
- so->hw[PAN_INSTANCE_ID].swizzle = panfrost_bifrost_swizzle(1);
+ so->formats[PAN_INSTANCE_ID] = (MALI_R32UI << 12) | panfrost_bifrost_swizzle(1);
return so;
}
so->bo = panfrost_bo_create(device, size, 0);
- so->bifrost_descriptor = rzalloc(pctx, struct bifrost_texture_descriptor);
panfrost_new_texture_bifrost(
- so->bifrost_descriptor,
+ &so->bifrost_descriptor,
texture->width0, texture->height0,
depth, array_size,
format,
pipe_resource_reference(&pview->texture, NULL);
panfrost_bo_unreference(view->bo);
- if (view->bifrost_descriptor)
- ralloc_free(view->bifrost_descriptor);
ralloc_free(view);
}