Skip to content

[HLSL] Layout compatible type casting #100619

@llvm-beanz

Description

@llvm-beanz

HLSL allows explicit casting between layout compatible types. For example:

struct XYZ {
  float X, Y, Z;
};

XYZ xyz = ...;
float3 f3 = (float3)xyz;
xyz = (XYZ)f3;

struct S {
int i;
float f;
};

struct OtherS {
int i;
float f;
};

S s =...;
OtherS o = (OtherS)s;

Related: #100614

Metadata

Metadata

Assignees

Labels

HLSLHLSL Language Supportclang:codegenIR generation bugs: mangling, exceptions, etc.clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

Type

No type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions