• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2016-2021 The Khronos Group Inc.
2// SPDX-License-Identifier: Apache-2.0
3
4#version 310 es
5layout(local_size_x = 64) in;
6
7layout(set = 0, binding = 0, std430) readonly buffer SSBO0
8{
9	float inputs[];
10};
11
12layout(set = 0, binding = 1, std430) writeonly buffer SSBO1
13{
14	float outputs[];
15};
16
17layout(set = 0, binding = 2, std430) buffer SSBO2
18{
19	uint counter;
20};
21
22void main()
23{
24	// Builds a tightly packed list of all values less than 10.0.
25	// The output order is random.
26	float value = inputs[gl_GlobalInvocationID.x];
27	if (value < 10.0)
28	{
29		uint output_index = atomicAdd(counter, 1u);
30		outputs[output_index] = value;
31	}
32}
33