-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Basic shader generation refactoring #6250
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as the weird clown says, I'm lovin it
import { ShaderGenerator } from './shader-generator.js'; | ||
|
||
const vShader = ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const vShader = ` | |
const vShader = /* glsl */` |
} | ||
`; | ||
|
||
const fShader = ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const fShader = ` | |
const fShader = /* glsl */` |
This PR uses recently added support for
#include
in the Preprocessor (#6242) to refactor the basic shader generation. Instead of a JS code that glues strings and chunks together, it creates a list of defines based on the generation options, and the vertex and fragment code is simply processed with those. This makes it a lot easier to understand the shader code, which is now specified as a single string.This is a prototype of where we want to go with the standard shader in the future.
New public API: