Skip to content

[Matrix] [HLSL] add a ICK_HLSL_Matrix_Truncation to handle matrix truncations in HLSL #168755

@farzonl

Description

@farzonl

These are the truncation tests we should support:
https://godbolt.org/z/73vj6jMs7

essentially if the src is bigger than the dest even if destination is a scalar we should truncate. this should be handled via a new ICK_HLSL_Matrix_Truncation. tha should behave similarly to ICK_HLSL_Vector_Truncation since they share the same spec.

export int3x3 trunc_cast(int4x4 i44) {
    int3x3 i33 = (int3x3)i44;
    return i33;
}

export int3x2 trunc_cast2(int4x4 i44) {
    int3x2 i32 = (int3x2)i44;
    return i32;
}

export int2x3 trunc_cast3(int4x4 i44) {
    int2x3 i23 = (int2x3)i44;
    return i23;
}

export int2x2 trunc_cast4(int4x4 i44) {
    int2x2 i22 = (int2x2)i44;
    return i22;
}

export int2x1 trunc_cast5(int4x4 i44) {
    int2x1 i21 = (int2x1)i44;
    return i21;
}

export int trunc_cast6(int4x4 i44) {
    int i21 = (int)i44;
    return i21;
}

Originally posted by @farzonl in #162711

  • Add standard conversion
  • CK_HLSL_Matrix_Truncation needs APValue support
  • Create the code gen truncation (Clang Matrix Type to Llvm vector)
  • Create and apply the enums in all the right places.
  • Write the required tests using the ones mentioned in this description as a starting point.

Metadata

Metadata

Assignees

Labels

HLSLHLSL Language Supportclang:frontendLanguage frontend issues, e.g. anything involving "Sema"

Type

Projects

Status

Planning

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions