mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-18 18:50:33 +01:00
zink: add spirv_builder_function_call
It can be useful not just to create functions, but also being able to
call them. This adds the spirv_builder-helper for this.
Cc: mesa-stable
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18244>
(cherry picked from commit 47d67912bd)
This commit is contained in:
parent
1ddca52324
commit
ccac10eb5a
3 changed files with 28 additions and 1 deletions
|
|
@ -10237,7 +10237,7 @@
|
|||
"description": "zink: add spirv_builder_function_call",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null
|
||||
},
|
||||
|
|
|
|||
|
|
@ -404,6 +404,28 @@ spirv_builder_function_end(struct spirv_builder *b)
|
|||
spirv_buffer_emit_word(&b->instructions, SpvOpFunctionEnd | (1 << 16));
|
||||
}
|
||||
|
||||
SpvId
|
||||
spirv_builder_function_call(struct spirv_builder *b, SpvId result_type,
|
||||
SpvId function, const SpvId arguments[],
|
||||
size_t num_arguments)
|
||||
{
|
||||
SpvId result = spirv_builder_new_id(b);
|
||||
|
||||
int words = 4 + num_arguments;
|
||||
spirv_buffer_prepare(&b->instructions, b->mem_ctx, words);
|
||||
spirv_buffer_emit_word(&b->instructions,
|
||||
SpvOpFunctionCall | (words << 16));
|
||||
spirv_buffer_emit_word(&b->instructions, result_type);
|
||||
spirv_buffer_emit_word(&b->instructions, result);
|
||||
spirv_buffer_emit_word(&b->instructions, function);
|
||||
|
||||
for (int i = 0; i < num_arguments; ++i)
|
||||
spirv_buffer_emit_word(&b->instructions, arguments[i]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
spirv_builder_label(struct spirv_builder *b, SpvId label)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -413,6 +413,11 @@ spirv_builder_type_function(struct spirv_builder *b, SpvId return_type,
|
|||
const SpvId parameter_types[],
|
||||
size_t num_parameter_types);
|
||||
|
||||
SpvId
|
||||
spirv_builder_function_call(struct spirv_builder *b, SpvId result_type,
|
||||
SpvId function, const SpvId arguments[],
|
||||
size_t num_arguments);
|
||||
|
||||
SpvId
|
||||
spirv_builder_const_bool(struct spirv_builder *b, bool val);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue