mirror of
https://github.com/bjornbytes/lovr.git
synced 2024-07-06 14:23:34 +00:00
Pass stores draw commands rather than sending them to Vulkan immediately. The main motivation is to allow more flexibility in the Lua API. Passes are now regular objects, aren't invalidated whenever submit is called, and can cache their draws across multiple frames. Draws can also be internally culled, sorted, and batched. Some API methods (tallies) are missing, and there are still some bugs to fix, notably with background color.
26 lines
502 B
Plaintext
26 lines
502 B
Plaintext
#version 460
|
|
|
|
layout(local_size_x = 32) in;
|
|
|
|
layout(push_constant) uniform PushConstants {
|
|
uint count;
|
|
uint views;
|
|
};
|
|
|
|
layout(set = 0, binding = 0) buffer readonly restrict Src { uint src[]; };
|
|
layout(set = 0, binding = 1) buffer writeonly restrict Dst { uint dst[]; };
|
|
|
|
void main() {
|
|
uint index = gl_GlobalInvocationID.x;
|
|
if (index >= count) return;
|
|
uint base = index * views;
|
|
|
|
uint total = 0;
|
|
|
|
for (uint i = 0; i < views; i++) {
|
|
total += src[base + i];
|
|
}
|
|
|
|
dst[index] = total;
|
|
}
|