writer/hlsl: Support bitcast of vectors

Add end to end tests

Fixed: tint:1026
Change-Id: I10813cbe6dc4f1bccddf9a8a29e3a249a364c051
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59663
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton
2021-07-26 15:08:28 +00:00
committed by Tint LUCI CQ
parent dcd3dcec70
commit 64dfcd2c32
91 changed files with 841 additions and 0 deletions

View File

@@ -268,6 +268,10 @@ bool GeneratorImpl::EmitArrayAccessor(std::ostream& out,
bool GeneratorImpl::EmitBitcast(std::ostream& out,
ast::BitcastExpression* expr) {
auto* type = TypeOf(expr);
if (auto* vec = type->UnwrapRef()->As<sem::Vector>()) {
type = vec->type();
}
if (!type->is_integer_scalar() && !type->is_float_scalar()) {
diagnostics_.add_error(diag::System::Writer,
"Unable to do bitcast to type " + type->type_name());