Using a lot of if ... else in the fragment shader is suboptimal plus XOR, NXOR drawing modes are not supported.
I want to try and address this. The current plan I have is:
- Implement shader for different drawing modes using preprocessor definitions to avoid condition checks in the fragment shader.
- NOR and XOR modes will be using the current canvas as a uniform texture source.
- Render in pure black and white colors (zeroes and ones) to simplify logic and blending math.
- Implement final output shader which will map black and white image from the previous step to nice color values or perform some post processing like CRT effect etc.
Using a lot of
if ... elsein the fragment shader is suboptimal plus XOR, NXOR drawing modes are not supported.I want to try and address this. The current plan I have is: