Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A way to init/clear buffer pre frame efficiently? #152

Open
Tracked by #10
natural-harmonia-gropius opened this issue Feb 8, 2023 · 4 comments
Open
Tracked by #10

A way to init/clear buffer pre frame efficiently? #152

natural-harmonia-gropius opened this issue Feb 8, 2023 · 4 comments

Comments

@natural-harmonia-gropius

I initialize the buffer pre frame like this, but it's wasting too much performance. How should I do it correctly?

//!BUFFER FRAME_DATA
//!VAR int L_min
//!VAR int L_max
//!VAR int L_avg
//!STORAGE

//!HOOK OUTPUT
//!BIND HOOKED
//!BIND FRAME_DATA
//!SAVE EMPTY
//!COMPUTE 32 32
//!DESC initial

void hook() {
    atomicExchange(L_min, 10000);
    atomicExchange(L_max, 0);
    atomicExchange(L_avg, 0);
}
@haasn
Copy link
Owner

haasn commented Feb 8, 2023

You can use this to make it faster:

//!WIDTH 1
//!HEIGHT 1
//!COMPUTE 1 1

But I realize that this is a good idea to support natively, basically allowing for self-clearing buffers.

@haasn
Copy link
Owner

haasn commented Feb 8, 2023

Oh, also, you don't need to use atomicExchange, just set the variable directly.

@natural-harmonia-gropius
Copy link
Author

Thanks!

@haasn
Copy link
Owner

haasn commented Feb 9, 2023

I will add a feature for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants