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

How to update shader uniforms? #64

Open
catgirljenni opened this issue Jan 11, 2024 · 1 comment
Open

How to update shader uniforms? #64

catgirljenni opened this issue Jan 11, 2024 · 1 comment

Comments

@catgirljenni
Copy link

I have made a runtime effect with RuntimeEffect.makeForShader(shaderSrc);
I have created the shader with effect.makeShader(Data.makeFromBytes(data), null, null, false) (data being a byte buffer of uniforms)
I created the paint with paint = new Paint(); paint.setShader(shader);

The problem is, none of these classes have a method to update the uniforms in the shader.
How do I do this? I can't just re create the shader as it takes ~3ms to create and uniforms need to be updated each frame.

@tonsky
Copy link
Contributor

tonsky commented Jan 11, 2024

Hm. It takes only 0.02..0.06 ms for me

var shader = _effectForShader.makeShader(data, new Shader[] { child }, null);

You can try asking on https://groups.google.com/g/skia-discuss/, if there’s a better way I’m happy to provide API for it

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

No branches or pull requests

2 participants