2021-11-16 15:15:36 +00:00
|
|
|
#version 310 es
|
|
|
|
|
2021-12-09 18:54:35 +00:00
|
|
|
struct Uniforms {
|
|
|
|
uvec2 aShape;
|
|
|
|
uvec2 bShape;
|
|
|
|
uvec2 outShape;
|
|
|
|
};
|
2021-11-16 15:15:36 +00:00
|
|
|
|
2022-02-04 23:09:23 +00:00
|
|
|
layout(binding = 0, std430) buffer Matrix_1 {
|
2021-11-16 15:15:36 +00:00
|
|
|
uint numbers[];
|
|
|
|
} firstMatrix;
|
2022-02-04 23:09:23 +00:00
|
|
|
layout(binding = 1, std430) buffer Matrix_2 {
|
2021-11-16 15:15:36 +00:00
|
|
|
uint numbers[];
|
|
|
|
} secondMatrix;
|
2022-02-04 23:09:23 +00:00
|
|
|
layout(binding = 2, std430) buffer Matrix_3 {
|
2021-11-16 15:15:36 +00:00
|
|
|
uint numbers[];
|
|
|
|
} resultMatrix;
|
2022-01-25 20:06:05 +00:00
|
|
|
layout(binding = 3) uniform Uniforms_1 {
|
2021-11-16 15:15:36 +00:00
|
|
|
uvec2 aShape;
|
|
|
|
uvec2 bShape;
|
|
|
|
uvec2 outShape;
|
|
|
|
} uniforms;
|
|
|
|
|
2022-01-28 22:36:58 +00:00
|
|
|
void tint_symbol(uvec3 global_id) {
|
2021-11-16 15:15:36 +00:00
|
|
|
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() {
|
2022-01-28 22:36:58 +00:00
|
|
|
tint_symbol(gl_GlobalInvocationID);
|
|
|
|
return;
|
2021-11-16 15:15:36 +00:00
|
|
|
}
|