-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor shader source classes, in order to work around a Firefox bug.
The Firefox bug prevents shaders from compiling with the CORDIC algorithm, so we detect Firefox and fall back to the original algorithm. Issue #2197. The overall goal of the refactoring is to allow `#defines` to affect built-in functions, which was not possible before. In order to do this, we need the `#defines` to appear at the top of the source, so I've merged the procedural shader generation previously done in `ShaderProgram` with the generation done in `createShaderSource`. * `createShaderSource` (private) is removed and replaced by `ShaderSource`. `ShaderSource` now manages an array of `#defines`, concating source shaders, and automatically including built-in functions, keeping everything in the correct order. * `ShaderCache` (and by extension `Context.createShaderProgram` and `Context.replaceShaderProgram`) now accept either `ShaderSource` objects, or a single string, for vertex and fragment shaders. * `ShaderProgram` constructor (private) now takes an options object. It also exposes the vertex and fragment shaders as `ShaderSource` objects instead of strings. External code can still clone the `ShaderSources` and then screw around with the implementation to make new shaders procedurally, as `OIT` does.
- Loading branch information
Showing
26 changed files
with
806 additions
and
589 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.