treeform / shady

Nim to GPU shader language compiler and supporting utilities.
MIT License
147 stars 10 forks source link

Provide support for earlier shader versions #7

Open nixfreak opened 2 years ago

nixfreak commented 2 years ago

Anyway you can provide earlier versions of shader to be used instead of the latest?

For instance #version 330

0:1(10): error: GLSL 4.10 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, and 3.00 ES

treeform commented 2 years ago

Yes you can pass earlier version to the toGLSL macro:

macro toGLSL*(
  s: typed,
  version = "410",
  extra = "precision highp float;\n"
): string =

I have not tested with 3xx versions so I don't know if all features will work. Basic features? Yes. Advanced? I don't think so...

nixfreak commented 2 years ago

Are you saying you can change the version in the macro in one of the examples i.e. flare?

treeform commented 2 years ago

Yes. But if your code uses more advanced features it will not work.