mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-08-05 11:45:54 +00:00
Combined with the new PadArrayElements transform, arrays with strides are now correctly emitted. Fixed: tint:182 Fixed: tint:895 Change-Id: I26a1be94dee6e4c9d9747c8317a932fc1fb3c810 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54640 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: James Price <jrprice@google.com>
41 lines
1.1 KiB
HLSL
41 lines
1.1 KiB
HLSL
struct Uniforms {
|
|
/* 0x0000 */ uint2 aShape;
|
|
/* 0x0008 */ uint2 bShape;
|
|
/* 0x0010 */ uint2 outShape;
|
|
};
|
|
|
|
ByteAddressBuffer firstMatrix : register(t0, space0);
|
|
ByteAddressBuffer secondMatrix : register(t1, space0);
|
|
RWByteAddressBuffer resultMatrix : register(u2, space0);
|
|
ConstantBuffer<Uniforms> uniforms : register(b3, space0);
|
|
|
|
struct tint_symbol_1 {
|
|
uint3 global_id : SV_DispatchThreadID;
|
|
};
|
|
|
|
[numthreads(2, 2, 1)]
|
|
void main(tint_symbol_1 tint_symbol) {
|
|
const uint3 global_id = tint_symbol.global_id;
|
|
const uint2 resultCell = uint2(global_id.y, global_id.x);
|
|
const uint dimInner = uniforms.aShape.y;
|
|
const uint dimOutter = uniforms.outShape.y;
|
|
uint result = 0u;
|
|
{
|
|
uint i = 0u;
|
|
while (true) {
|
|
if (!((i < dimInner))) {
|
|
break;
|
|
}
|
|
const uint a = (i + (resultCell.x * dimInner));
|
|
const uint b = (resultCell.y + (i * dimOutter));
|
|
result = (result + (firstMatrix.Load((4u * a)) * secondMatrix.Load((4u * b))));
|
|
{
|
|
i = (i + 1u);
|
|
}
|
|
}
|
|
}
|
|
const uint index = (resultCell.y + (resultCell.x * dimOutter));
|
|
resultMatrix.Store((4u * index), asuint(result));
|
|
return;
|
|
}
|