Skip to content
Snippets Groups Projects

hlsl: Error expressions, part 3.

Merged Elizabeth Figura requested to merge zfigura/vkd3d:mr3 into master
1 unresolved thread

Merge request reports

Merge request pipeline #32864 skipped

Merge request pipeline skipped for 34fdb304

Merged by Henri VerbeetHenri Verbeet 5 months ago (Oct 7, 2024 3:53pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
461 461 return add_cast(ctx, block, node, dst_type, loc);
462 462 }
463 463
464 static bool add_explicit_conversion(struct hlsl_ctx *ctx, struct hlsl_block *block,
465 struct hlsl_type *dst_type, const struct parse_array_sizes *arrays, const struct vkd3d_shader_location *loc)
466 {
467 struct hlsl_ir_node *instr = node_from_block(block);
468 struct hlsl_type *src_type = instr->data_type;
469 unsigned int i;
470
471 for (i = 0; i < arrays->count; ++i)
472 {
473 if (arrays->sizes[i] == HLSL_ARRAY_ELEMENTS_COUNT_IMPLICIT)
474 hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE, "Implicit size arrays not allowed in casts.");
475 dst_type = hlsl_new_array_type(ctx, dst_type, arrays->sizes[i]);
  • Comment on lines +473 to +475

    Not really important, but it might be a good moment to give block an error value and return here. Otherwise the forced cast might result in spurious errors later, albeit, I can't think of an example where that happens, HLSL_ARRAY_ELEMENTS_COUNT_IMPLICIT being 0, makes it improbable.

    Edited by Francisco Casas
  • As long as the destination type is valid I don't think there should be anything that cares [and if they do I'd be inclined to assert we should fix that.]

    Cases where we cannot construct a valid destination type [e.g. the 0-sized array] currently abort; we should be able to return the error type instead.

  • Please register or sign in to reply
  • Henri Verbeet approved this merge request

    approved this merge request

  • Henri Verbeet added 20 commits

    added 20 commits

    • 4bac58df...aa79bfa6 - 15 commits from branch wine:master
    • 10efdd3f - vkd3d-shader/hlsl: Introduce an add_explicit_conversion() helper.
    • 41ff4343 - vkd3d-shader/hlsl: Handle error expressions in explicit casts.
    • c66f2501 - vkd3d-shader/hlsl: Handle error expressions in array indexes.
    • 84685fb5 - vkd3d-shader/hlsl: Handle error expressions in subscripts.
    • 34fdb304 - vkd3d-shader/hlsl: Handle error expressions in increments.

    Compare with previous version

  • Please register or sign in to reply
    Loading