1);
cl_start_shader_reloc(&vc4->shader_rec, 3 + vtx->num_elements);
- cl_u16(&vc4->shader_rec, VC4_SHADER_FLAG_ENABLE_CLIPPING);
+ cl_u16(&vc4->shader_rec,
+ VC4_SHADER_FLAG_ENABLE_CLIPPING |
+ ((info->mode == PIPE_PRIM_POINTS &&
+ vc4->rasterizer->base.point_size_per_vertex) ?
+ VC4_SHADER_FLAG_VS_POINT_SIZE : 0));
cl_u8(&vc4->shader_rec, 0); /* fs num uniforms (unused) */
cl_u8(&vc4->shader_rec, vc4->prog.fs->num_inputs);
cl_reloc(vc4, &vc4->shader_rec, vc4->prog.fs->bo, 0);
struct vc4_vs_key {
struct vc4_key base;
enum pipe_format attr_formats[8];
+ bool per_vertex_point_size;
};
static void
case TGSI_SEMANTIC_COLOR:
c->output_color_index = decl->Range.First * 4;
break;
+ case TGSI_SEMANTIC_PSIZE:
+ c->output_point_size_index = decl->Range.First * 4;
+ break;
}
break;
qir_VPM_WRITE(c, rcp_w);
}
+static void
+emit_point_size_write(struct vc4_compile *c)
+{
+ struct qreg point_size;
+
+ if (c->output_point_size_index)
+ point_size = c->outputs[c->output_point_size_index + 3];
+ else
+ point_size = qir_uniform_f(c, 1.0);
+
+ /* Workaround: HW-2726 PTB does not handle zero-size points (BCM2835,
+ * BCM21553).
+ */
+ point_size = qir_FMAX(c, point_size, qir_uniform_f(c, .125));
+
+ qir_VPM_WRITE(c, point_size);
+}
+
static void
emit_vert_end(struct vc4_compile *c)
{
emit_scaled_viewport_write(c, rcp_w);
emit_zs_write(c, rcp_w);
emit_rcp_wc_write(c, rcp_w);
+ if (c->vs_key->per_vertex_point_size)
+ emit_point_size_write(c);
for (int i = 4; i < c->num_outputs; i++) {
qir_VPM_WRITE(c, c->outputs[i]);
emit_scaled_viewport_write(c, rcp_w);
emit_zs_write(c, rcp_w);
emit_rcp_wc_write(c, rcp_w);
+ if (c->vs_key->per_vertex_point_size)
+ emit_point_size_write(c);
}
static struct vc4_compile *
}
static void
-vc4_update_compiled_vs(struct vc4_context *vc4)
+vc4_update_compiled_vs(struct vc4_context *vc4, uint8_t prim_mode)
{
struct vc4_vs_key local_key;
struct vc4_vs_key *key = &local_key;
for (int i = 0; i < ARRAY_SIZE(key->attr_formats); i++)
key->attr_formats[i] = vc4->vtx->pipe[i].src_format;
+ key->per_vertex_point_size =
+ (prim_mode == PIPE_PRIM_POINTS &&
+ vc4->rasterizer->base.point_size_per_vertex);
+
vc4->prog.vs = util_hash_table_get(vc4->vs_cache, key);
if (vc4->prog.vs)
return;
vc4_update_compiled_shaders(struct vc4_context *vc4, uint8_t prim_mode)
{
vc4_update_compiled_fs(vc4, prim_mode);
- vc4_update_compiled_vs(vc4);
+ vc4_update_compiled_vs(vc4, prim_mode);
}
static unsigned