zink: add some spirv_builder functions we'll be using for geometry shaders

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7139>
This commit is contained in:
Mike Blumenkrantz 2020-10-14 10:27:56 -04:00
parent 5934fc1708
commit 182f7f9ae8
2 changed files with 32 additions and 1 deletions

View File

@ -145,6 +145,17 @@ spirv_builder_emit_entry_point(struct spirv_builder *b,
spirv_buffer_emit_word(&b->entry_points, interfaces[i]);
}
void
spirv_builder_emit_exec_mode_literal(struct spirv_builder *b, SpvId entry_point,
SpvExecutionMode exec_mode, uint32_t param)
{
spirv_buffer_prepare(&b->exec_modes, b->mem_ctx, 4);
spirv_buffer_emit_word(&b->exec_modes, SpvOpExecutionMode | (4 << 16));
spirv_buffer_emit_word(&b->exec_modes, entry_point);
spirv_buffer_emit_word(&b->exec_modes, exec_mode);
spirv_buffer_emit_word(&b->exec_modes, param);
}
void
spirv_builder_emit_exec_mode(struct spirv_builder *b, SpvId entry_point,
SpvExecutionMode exec_mode)
@ -212,6 +223,20 @@ spirv_builder_emit_builtin(struct spirv_builder *b, SpvId target,
emit_decoration(b, target, SpvDecorationBuiltIn, args, ARRAY_SIZE(args));
}
void
spirv_builder_emit_vertex(struct spirv_builder *b)
{
spirv_buffer_prepare(&b->instructions, b->mem_ctx, 1);
spirv_buffer_emit_word(&b->instructions, SpvOpEmitVertex | (1 << 16));
}
void
spirv_builder_end_primitive(struct spirv_builder *b)
{
spirv_buffer_prepare(&b->instructions, b->mem_ctx, 1);
spirv_buffer_emit_word(&b->instructions, SpvOpEndPrimitive | (1 << 16));
}
void
spirv_builder_emit_descriptor_set(struct spirv_builder *b, SpvId target,
uint32_t descriptor_set)

View File

@ -135,7 +135,9 @@ spirv_builder_emit_entry_point(struct spirv_builder *b,
SpvExecutionModel exec_model, SpvId entry_point,
const char *name, const SpvId interfaces[],
size_t num_interfaces);
void
spirv_builder_emit_exec_mode_literal(struct spirv_builder *b, SpvId entry_point,
SpvExecutionMode exec_mode, uint32_t param);
void
spirv_builder_emit_exec_mode(struct spirv_builder *b, SpvId entry_point,
SpvExecutionMode exec_mode);
@ -349,4 +351,8 @@ size_t
spirv_builder_get_words(struct spirv_builder *b, uint32_t *words,
size_t num_words);
void
spirv_builder_emit_vertex(struct spirv_builder *b);
void
spirv_builder_end_primitive(struct spirv_builder *b);
#endif