-
-
Notifications
You must be signed in to change notification settings - Fork 685
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 tool and a helper to statically analyze shader sources #3157
Comments
Probably commenting is better since any library can prepare this without waiting for Ebitengine 2.9. //ebitengine:shader
const superUltraShader = "package main
func Fragment(..." |
This adds a new compiler directive `//ebitengine:shader` indicating a shader source. A new tool internal/shaderlister can iterates all the shader strings with the directive. The tool might be exposed in the future. Updates #3157
Add a new field to provide compilation results like See also: 48f79af |
Hmm, this tool doesn't work well with embedded Kage files. What should we do? var (
//go:embed default.go
default_go []byte
//go:embed texel.go
texel_go []byte
//go:embed lighting.go
lighting_go []byte
//go:embed radialblur.go
radialblur_go []byte
//go:embed chromaticaberration.go
chromaticaberration_go []byte
//go:embed dissolve.go
dissolve_go []byte
//go:embed water.go
water_go []byte
) |
Let's add another directive like |
…tengine:embeddedshader Updates #3157
I changed the directives like these:
|
The directory check must be skipped when the pattern includes a meta character. Updates #3157
Hmm, a directive inside a function should be ignored, but it is pretty tricky to get only top-level comments from func foo() {
// Non top-level files are ignored.
//ebitengine:shaderfile *_notkage.go
} See also: |
Operating System
What feature would you like to be added?
In order to introduce shader precompilation, we need to know what shader sources are used. We have to list them before the compilation. Listing them by users would not be a good solution since unknown dependencies might use shaders internally, and users couldn't know them.
In order to resolve this issue, what about this?
ebiten.RegisterShader(src []byte)
(orstring
?). This function is just a marker and does nothing.RegisterShader
, and output them as JSON or something.Libralies using shaders would have to call
RegisterShader
to precompile the shader source, but it should be much better than having to export shader sources as a public API.Why is this needed?
No response
The text was updated successfully, but these errors were encountered: