mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-08-04 11:15:46 +00:00
Since GLSL ES does not support the offset= attribute, struct members with explicit @align or @size attributes require adding explicit padding members. This in turn requires rewriting any constructor calls to initialize the new padding to zero, handled in the same transform. Note that this is currently overly-verbose, and will add padding where GLSL doesn't technically need it (e.g., padding a vec3 out to 16 bytes). Bug: tint:1415 Change-Id: Ia9ba513066a0e84f4c43247fcbbe02f5fadd6630 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101720 Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Stephen White <senorblanco@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
44 lines
1.0 KiB
GLSL
44 lines
1.0 KiB
GLSL
#version 310 es
|
|
|
|
layout(binding = 0, std430) buffer Matrix_ssbo {
|
|
uint numbers[];
|
|
} firstMatrix;
|
|
|
|
layout(binding = 1, std430) buffer Matrix_ssbo_1 {
|
|
uint numbers[];
|
|
} secondMatrix;
|
|
|
|
layout(binding = 2, std430) buffer Matrix_ssbo_2 {
|
|
uint numbers[];
|
|
} resultMatrix;
|
|
|
|
layout(binding = 3, std140) uniform Uniforms_ubo {
|
|
uvec2 aShape;
|
|
uvec2 bShape;
|
|
uvec2 outShape;
|
|
uint pad;
|
|
uint pad_1;
|
|
} uniforms;
|
|
|
|
void tint_symbol(uvec3 global_id) {
|
|
uvec2 resultCell = uvec2(global_id.y, global_id.x);
|
|
uint dimInner = uniforms.aShape.y;
|
|
uint dimOutter = uniforms.outShape.y;
|
|
uint result = 0u;
|
|
{
|
|
for(uint i = 0u; (i < dimInner); i = (i + 1u)) {
|
|
uint a = (i + (resultCell.x * dimInner));
|
|
uint b = (resultCell.y + (i * dimOutter));
|
|
result = (result + (firstMatrix.numbers[a] * secondMatrix.numbers[b]));
|
|
}
|
|
}
|
|
uint index = (resultCell.y + (resultCell.x * dimOutter));
|
|
resultMatrix.numbers[index] = result;
|
|
}
|
|
|
|
layout(local_size_x = 2, local_size_y = 2, local_size_z = 1) in;
|
|
void main() {
|
|
tint_symbol(gl_GlobalInvocationID);
|
|
return;
|
|
}
|