Source browser

examples/shaders/evt3_reset.cpp

Read the complete file below or download its original bytes. Line numbers provide stable links to a declaration or processing step.

File fingerprint
1// Reset state inside a pipeline when independent batches or reproducible timings are needed.
2#ifdef __cplusplus // Include the runtime only when compiling the CPU adapter.
3#include "shdr.h" // Share the portable resource and math declarations.
4#endif // Finish the C++ declaration include guard.
5layout(local_size_x = 1) in; // Use one invocation for this ordered stream-state operation.
6layout(std430, binding = 0) writeonly buffer State { // Access decoder state retained across input chunks.
7    uvec4 stream_state[]; // Retain pixel, vector and timestamp state between input chunks.
8}; // Finish this shader storage resource declaration.
9void main() { // Initialize decoder state before processing an independent event stream.
10    stream_state[0] = uvec4(0u); // Clear Y, camera, vector X, vector polarity and high timestamp bits.
11    stream_state[1] = uvec4(0u); // Clear low time, rollover count and the synchronization flag.
12} // Finish this decoder or fitting branch.