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

Text replacement instead of ESSL macros #838

Open
davidpiuva opened this issue Nov 19, 2015 · 12 comments
Open

Text replacement instead of ESSL macros #838

davidpiuva opened this issue Nov 19, 2015 · 12 comments
Milestone

Comments

@davidpiuva
Copy link
Contributor

Having to change macros that are hardcoded in shader code makes it hard to separate settings from code. It would be cleaner to insert text replacements together with the shader code when creating a shader. We already have the replaceAll function as used in DateTime. Giving the input argument Replacement new("<DEBUG>", debugFlag toString()) into the shader's constructor would let each occurence of <DEBUG> be replaced by the value of debugFlag.

@davidpiuva
Copy link
Contributor Author

@emilwestergren Does this sound good enough or do you have a better idea?

@emilwestergren
Copy link
Contributor

Sounds good, do we want a general Replacement structure or a specialized just for flags?

OpenGLMap new(frag, vert, VectorList<ShaderFlag>)

@davidpiuva
Copy link
Contributor Author

I have quite a lot of integers that would allow being both fast and flexible with any data type.

@emilwestergren
Copy link
Contributor

I see, are you replacing the uploads of constants?

@davidpiuva
Copy link
Contributor Author

Some of the uniform integers could be more efficient that way by rolling loops in compile time. The same blur shader could be compiled for each radius for unrolling.

@emilwestergren
Copy link
Contributor

I agree but then again it sounds like a minor optimization. Should this be prioritized at the moment?

@davidpiuva
Copy link
Contributor Author

It is not a priority right now but in the long run, this could increase our productivity when testing the contrast by having all settings on the same place.

@emilwestergren
Copy link
Contributor

Can't you just use uniforms for that?

@davidpiuva
Copy link
Contributor Author

Then a glitch in the phone's memory might accidentally turn on debug views and expose our algorithms.

@davidpiuva davidpiuva added this to the Later milestone Nov 27, 2015
@davidpiuva
Copy link
Contributor Author

@emilwestergren Giving macros to shaders from the CPU is now required to flip images of different coordinate systems without affecting performance for the majority of shaders that never get an input image of non-standard scan order. Either we implement this feature and reserve a field for built in macros or let the header of each shader including version be generated from the abstraction layer.

@davidpiuva davidpiuva modified the milestones: Draw, Later May 4, 2016
@davidpiuva
Copy link
Contributor Author

davidpiuva commented May 6, 2016

It seems like GLES do not even have a real pre-compiler since token pasting is not allowed and then I cannot mangle a name for an image's sampling transform. This is yet another feature that is needed then.

@davidpiuva
Copy link
Contributor Author

Since coordinate systems moved from Kean, this is again not a priority.

@davidpiuva davidpiuva modified the milestones: Later, Draw May 10, 2016
@davidpiuva davidpiuva changed the title Text replacement instead of GLSL macros Text replacement instead of ESSL macros May 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants