[Mesa-dev] [PATCH 6/6] vtn: handle OpConstantComposites with OpUndef members
Jason Ekstrand
jason at jlekstrand.net
Wed Jul 11 21:34:22 UTC 2018
1, 2, 3, and 6 are
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
On Wed, Jul 11, 2018 at 2:30 PM Karol Herbst <kherbst at redhat.com> wrote:
> Signed-off-by: Karol Herbst <kherbst at redhat.com>
> ---
> src/compiler/spirv/spirv_to_nir.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/src/compiler/spirv/spirv_to_nir.c
> b/src/compiler/spirv/spirv_to_nir.c
> index 413fbf481c1..235003e872a 100644
> --- a/src/compiler/spirv/spirv_to_nir.c
> +++ b/src/compiler/spirv/spirv_to_nir.c
> @@ -1494,8 +1494,19 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp
> opcode,
> spirv_op_to_string(opcode), elem_count,
> val->type->length);
>
> nir_constant **elems = ralloc_array(b, nir_constant *, elem_count);
> - for (unsigned i = 0; i < elem_count; i++)
> - elems[i] = vtn_value(b, w[i + 3],
> vtn_value_type_constant)->constant;
> + for (unsigned i = 0; i < elem_count; i++) {
> + struct vtn_value *val = vtn_untyped_value(b, w[i + 3]);
> +
> + if (val->value_type == vtn_value_type_constant) {
> + elems[i] = val->constant;
> + } else {
> + vtn_fail_if(val->value_type != vtn_value_type_undef,
> + "only constants or undefs allowed for "
> + "SpvOpConstantComposite");
> + /* to make it easier, just insert a NULL constant for now */
> + elems[i] = vtn_null_constant(b, val->type->type);
> + }
> + }
>
> switch (val->type->base_type) {
> case vtn_base_type_vector: {
> --
> 2.17.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180711/0bd71ee4/attachment.html>
More information about the mesa-dev
mailing list