mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-21 20:10:14 +01:00
zink: handle vertex streams
we already support all this, it's just a matter of slapping on some Stream decoration flex tape Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8204>
This commit is contained in:
parent
68242767d2
commit
35e346f428
4 changed files with 41 additions and 10 deletions
|
|
@ -949,6 +949,8 @@ emit_so_info(struct ntv_context *ctx, const struct zink_so_info *so_info)
|
||||||
spirv_builder_emit_offset(&ctx->builder, var_id, (so_output.dst_offset * 4));
|
spirv_builder_emit_offset(&ctx->builder, var_id, (so_output.dst_offset * 4));
|
||||||
spirv_builder_emit_xfb_buffer(&ctx->builder, var_id, so_output.output_buffer);
|
spirv_builder_emit_xfb_buffer(&ctx->builder, var_id, so_output.output_buffer);
|
||||||
spirv_builder_emit_xfb_stride(&ctx->builder, var_id, so_info->so_info.stride[so_output.output_buffer] * 4);
|
spirv_builder_emit_xfb_stride(&ctx->builder, var_id, so_info->so_info.stride[so_output.output_buffer] * 4);
|
||||||
|
if (so_output.stream)
|
||||||
|
spirv_builder_emit_stream(&ctx->builder, var_id, so_output.stream);
|
||||||
|
|
||||||
/* output location is incremented by VARYING_SLOT_VAR0 for non-builtins in vtn,
|
/* output location is incremented by VARYING_SLOT_VAR0 for non-builtins in vtn,
|
||||||
* so we need to ensure that the new xfb location slot doesn't conflict with any previously-emitted
|
* so we need to ensure that the new xfb location slot doesn't conflict with any previously-emitted
|
||||||
|
|
@ -2056,7 +2058,7 @@ emit_intrinsic(struct ntv_context *ctx, nir_intrinsic_instr *intr)
|
||||||
*/
|
*/
|
||||||
if (ctx->so_info)
|
if (ctx->so_info)
|
||||||
emit_so_outputs(ctx, ctx->so_info);
|
emit_so_outputs(ctx, ctx->so_info);
|
||||||
spirv_builder_emit_vertex(&ctx->builder);
|
spirv_builder_emit_vertex(&ctx->builder, nir_intrinsic_stream_id(intr));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nir_intrinsic_set_vertex_and_primitive_count:
|
case nir_intrinsic_set_vertex_and_primitive_count:
|
||||||
|
|
@ -2064,7 +2066,7 @@ emit_intrinsic(struct ntv_context *ctx, nir_intrinsic_instr *intr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nir_intrinsic_end_primitive_with_counter:
|
case nir_intrinsic_end_primitive_with_counter:
|
||||||
spirv_builder_end_primitive(&ctx->builder);
|
spirv_builder_end_primitive(&ctx->builder, nir_intrinsic_stream_id(intr));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nir_intrinsic_load_patch_vertices_in:
|
case nir_intrinsic_load_patch_vertices_in:
|
||||||
|
|
|
||||||
|
|
@ -227,17 +227,33 @@ spirv_builder_emit_builtin(struct spirv_builder *b, SpvId target,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
spirv_builder_emit_vertex(struct spirv_builder *b)
|
spirv_builder_emit_vertex(struct spirv_builder *b, uint32_t stream)
|
||||||
{
|
{
|
||||||
spirv_buffer_prepare(&b->instructions, b->mem_ctx, 1);
|
unsigned words = 1;
|
||||||
spirv_buffer_emit_word(&b->instructions, SpvOpEmitVertex | (1 << 16));
|
SpvOp op = SpvOpEmitVertex;
|
||||||
|
if (stream > 0) {
|
||||||
|
op = SpvOpEmitStreamVertex;
|
||||||
|
words++;
|
||||||
|
}
|
||||||
|
spirv_buffer_prepare(&b->instructions, b->mem_ctx, words);
|
||||||
|
spirv_buffer_emit_word(&b->instructions, op | (words << 16));
|
||||||
|
if (stream)
|
||||||
|
spirv_buffer_emit_word(&b->instructions, spirv_builder_const_uint(b, 32, stream));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
spirv_builder_end_primitive(struct spirv_builder *b)
|
spirv_builder_end_primitive(struct spirv_builder *b, uint32_t stream)
|
||||||
{
|
{
|
||||||
spirv_buffer_prepare(&b->instructions, b->mem_ctx, 1);
|
unsigned words = 1;
|
||||||
spirv_buffer_emit_word(&b->instructions, SpvOpEndPrimitive | (1 << 16));
|
SpvOp op = SpvOpEndPrimitive;
|
||||||
|
if (stream > 0) {
|
||||||
|
op = SpvOpEndStreamPrimitive;
|
||||||
|
words++;
|
||||||
|
}
|
||||||
|
spirv_buffer_prepare(&b->instructions, b->mem_ctx, words);
|
||||||
|
spirv_buffer_emit_word(&b->instructions, op | (words << 16));
|
||||||
|
if (stream)
|
||||||
|
spirv_buffer_emit_word(&b->instructions, spirv_builder_const_uint(b, 32, stream));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -296,6 +312,13 @@ spirv_builder_emit_index(struct spirv_builder *b, SpvId target, int index)
|
||||||
emit_decoration(b, target, SpvDecorationIndex, args, ARRAY_SIZE(args));
|
emit_decoration(b, target, SpvDecorationIndex, args, ARRAY_SIZE(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
spirv_builder_emit_stream(struct spirv_builder *b, SpvId target, int stream)
|
||||||
|
{
|
||||||
|
uint32_t args[] = { stream };
|
||||||
|
emit_decoration(b, target, SpvDecorationStream, args, ARRAY_SIZE(args));
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
emit_member_decoration(struct spirv_builder *b, SpvId target, uint32_t member,
|
emit_member_decoration(struct spirv_builder *b, SpvId target, uint32_t member,
|
||||||
SpvDecoration decoration, const uint32_t extra_operands[],
|
SpvDecoration decoration, const uint32_t extra_operands[],
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,9 @@ spirv_builder_emit_builtin(struct spirv_builder *b, SpvId target,
|
||||||
void
|
void
|
||||||
spirv_builder_emit_index(struct spirv_builder *b, SpvId target, int index);
|
spirv_builder_emit_index(struct spirv_builder *b, SpvId target, int index);
|
||||||
|
|
||||||
|
void
|
||||||
|
spirv_builder_emit_stream(struct spirv_builder *b, SpvId target, int stream);
|
||||||
|
|
||||||
void
|
void
|
||||||
spirv_builder_emit_descriptor_set(struct spirv_builder *b, SpvId target,
|
spirv_builder_emit_descriptor_set(struct spirv_builder *b, SpvId target,
|
||||||
uint32_t descriptor_set);
|
uint32_t descriptor_set);
|
||||||
|
|
@ -381,7 +384,7 @@ spirv_builder_get_words(struct spirv_builder *b, uint32_t *words,
|
||||||
size_t num_words);
|
size_t num_words);
|
||||||
|
|
||||||
void
|
void
|
||||||
spirv_builder_emit_vertex(struct spirv_builder *b);
|
spirv_builder_emit_vertex(struct spirv_builder *b, uint32_t stream);
|
||||||
void
|
void
|
||||||
spirv_builder_end_primitive(struct spirv_builder *b);
|
spirv_builder_end_primitive(struct spirv_builder *b, uint32_t stream);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,9 @@ zink_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
|
||||||
case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR:
|
case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR:
|
||||||
return screen->info.have_EXT_vertex_attribute_divisor;
|
return screen->info.have_EXT_vertex_attribute_divisor;
|
||||||
|
|
||||||
|
case PIPE_CAP_MAX_VERTEX_STREAMS:
|
||||||
|
return screen->info.tf_props.maxTransformFeedbackStreams;
|
||||||
|
|
||||||
case PIPE_CAP_INT64:
|
case PIPE_CAP_INT64:
|
||||||
case PIPE_CAP_INT64_DIVMOD:
|
case PIPE_CAP_INT64_DIVMOD:
|
||||||
case PIPE_CAP_DOUBLES:
|
case PIPE_CAP_DOUBLES:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue