dawn-cmake/test/bug/tint/870.spvasm.expected.hlsl
Ben Clayton 165512c57e writer/hlsl: Emit UBO as an array of vector
Instead of a ConstantBuffer.

HLSL requires that each structure field in a UBO is 16 byte aligned.
WGSL has much looser constraints with its UBO field alignment rules.

Instead generate an array of uint4 vectors, and index into this, much
like we index into [RW]ByteAddressBuffers for SSBOs.

Extend the DecomposeStorageAccess transform to support uniforms too.
This has been renamed to DecomposeMemoryAccess.

Change-Id: I3868ff80af1ab3b3dddfbf5b969724cb87ef0744
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/55246
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-18 21:15:25 +00:00

28 lines
911 B
HLSL

struct tint_array_wrapper {
int arr[6];
};
tint_array_wrapper tint_symbol_1(ByteAddressBuffer buffer, uint offset) {
const tint_array_wrapper tint_symbol_2 = {{asint(buffer.Load((offset + 0u))), asint(buffer.Load((offset + 4u))), asint(buffer.Load((offset + 8u))), asint(buffer.Load((offset + 12u))), asint(buffer.Load((offset + 16u))), asint(buffer.Load((offset + 20u)))}};
return tint_symbol_2;
}
ByteAddressBuffer sspp962805860buildInformation : register(t2, space0);
void main_1() {
tint_array_wrapper orientation = {{0, 0, 0, 0, 0, 0}};
const tint_array_wrapper x_23 = tint_symbol_1(sspp962805860buildInformation, 36u);
orientation.arr[0] = x_23.arr[0u];
orientation.arr[1] = x_23.arr[1u];
orientation.arr[2] = x_23.arr[2u];
orientation.arr[3] = x_23.arr[3u];
orientation.arr[4] = x_23.arr[4u];
orientation.arr[5] = x_23.arr[5u];
return;
}
void main() {
main_1();
return;
}