Comments (9)
- Yes I agree.
- Wouldn't it be easier and also necessary to replace the version directive? For WebGL2 you probably need
300 es
right? While the linter needs310 es
at least to generate SPIR-V from ES at all and320 es
or440
for all the features like input blocks.
Also this is awesome. Now I can use #ifndef SHADER_TOY
instead.
Also looks like iGlobalFrame
is missing. By the way I guess you could simplify your code a bit by using some defines in shaderPreamble
like
#define iGlobalTime iTime
#define iGlobalFrame iFrame
from shader-toy.
I added a couple lines to ignore the version directive, it's shown by green squiggles that they are ignored.
For now I avoided inserting version directives because it caused some issues to do naΓ―vely.
Also documented the case of void main(void)
Lastly add iGlobalFrame
by your suggestion.
from shader-toy.
Thanks for bringing up these issues π
Considering your first point. Imho it is far beyond the scope of this extension to implement a real preprocessor rather than the stupid string finding thing we have. The code inserted before compilation, not just by us, might contain more preprocessor directives that we can't really know about. Just speculating here though, I'd need to read more about this stuff. If we know more about this we can rethink if it's worth it to make a better preprocessor, but I doubt so.
So I would vote for documenting how the automatic generation of void main()
works and make clear that using void main(void)
is an actual backdoor to defining a main that doesn't prevent generation of it. What do you think?
Considering the #version
directive, it should be quite simple to look for it on line 1 and reserve its space in the transformed shader and move it back to line 1. I can look into that later this week.
Keep the suggestions coming if you have more problems π
from shader-toy.
- Yes I agree.
Then I'll fix that for the next version
- Wouldn't it be easier and also necessary to replace the version directive? For WebGL2 you probably need
300 es
right? While the linter needs310 es
at least to generate SPIR-V from ES at all and320 es
or440
for all the features like input blocks.
Quite honestly I wasn't quite sure what versions are supported (or necessary) for WebGl and WebGL2, I wanted to take a look at the specifications when I have more time on the weekend. If a user provided #version
is ignored/replaced, it sounds like something the user should be told. So maybe if this is how it will work a message should be displayed (that can be disabled in settings). I'll look more at it on the weekend. Or if you have a clear idea of it already and the time to spare you can draft a PR.
Good catch π
I wasn't consciously aware that includes were compiled with an explicit #version
, but from what you say it would make sense to do this. However since the extension should also support WebGL and not just WebGL2, it might be necessary to pick that depending on what's available?
Also looks like
iGlobalFrame
is missing. By the way I guess you could simplify your code a bit by using some defines inshaderPreamble
like#define iGlobalTime iTime #define iGlobalFrame iFrame
Wasn't aware of iGlobalFrame
, that should be easy to add. Using the preprocessor for these is also a good idea π
from shader-toy.
Quite honestly I wasn't quite sure what versions are supported (or necessary) for WebGl and WebGL2, I wanted to take a look at the specifications when I have more time on the weekend.
Unfortunately only up to 300 es
. Let's hope for WebGPU.
If a user provided
#version
is ignored/replaced, it sounds like something the user should be told.
Maybe some squiggles in the editor.
I wasn't consciously aware that includes were compiled with an explicit
#version
, but from what you say it would make sense to do this. However since the extension should also support WebGL and not just WebGL2, it might be necessary to pick that depending on what's available?
It would have to be a quite old VSCode version to not support WebGL2.
from shader-toy.
Unfortunately only up to
300 es
.
If that's both WebGL and WebGL2 then it's simple to do though.
Maybe some squiggles in the editor.
Good idea again, I'll take a look.
It would have to be a quite old VSCode version to not support WebGL2.
Risking to sound like an idiot here, but can't that be dependent on drivers rather than just VSCode? There's no question for VSCode supporting it because we require a version new enough for using WebView already.
from shader-toy.
If that's both WebGL and WebGL2 then it's simple to do though.
WebGL is 100 only.
Risking to sound like an idiot here, but can't that be dependent on drivers rather than just VSCode? There's no question for VSCode supporting it because we require a version new enough for using WebView already.
I'm not sure, Chromium uses ANGLE to translate it to DirectX iirc so it should be well supported.
from shader-toy.
Chromium uses ANGLE to translate it to DirectX iirc so it should be well supported.
And what happens on Linux and OSx?
from shader-toy.
Yeah it just occurred to me it's cross-platform after all π
Don't know.
from shader-toy.
Related Issues (20)
- iMouse.w behavior is different from Shadertoy
- Make available as web extension HOT 2
- Compilation Error with includes HOT 2
- Feature request: setting to start the shader paused HOT 5
- Feature request: leave the preview alone if compilation fails HOT 2
- Feature request: GLSL ES 3.0 Support HOT 1
- bug report on self-input-buffer and solution to it HOT 1
- Feature request: import from shadertoy url and from shadertoy export json HOT 2
- Frametime panel blocks the Controls panel
- Feature request: export as video HOT 7
- Feature request: breakpoint debug shaders HOT 1
- Feature request: reload texture when the image changes
- Recording w/ the framerate graph enabled errantly records the framerate graph and not the shader HOT 1
- Feature request: Export Frames as PNG for High-Resolution Video Creation HOT 1
- Add .reloadOnSave HOT 1
- can't run glslify example HOT 5
- Cant preview any shader HOT 1
- Compilation error when using #define HOT 1
- Weird Artifact on Custom Screenshot Resolutions
- The menu is displayed even for files other than .glsl.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shader-toy.