Jump to content


Shader Permutations hell :D


22 replies to this topic

#21 Stainless

    Member

  • Members
  • PipPipPipPip
  • 610 posts
  • LocationSouthampton

Posted 24 March 2012 - 09:30 PM

Part 2 and part 6 are completely different.

Part 2 generates source code for a shader

Part 6 generates a c++ class that loads the shader in handles all variables that need to be defined

How you do it depends on your build environment, c++, lua, perl, etc. are all possibilities

#22 SuperPixel

    Valued Member

  • Members
  • PipPipPipPip
  • 306 posts

Posted 24 March 2012 - 09:38 PM

View PostStainless, on 24 March 2012 - 09:30 PM, said:

Part 2 and part 6 are completely different.

Part 2 generates source code for a shader

Part 6 generates a c++ class that loads the shader in handles all variables that need to be defined

How you do it depends on your build environment, c++, lua, perl, etc. are all possibilities

When you say in part 2: add them to your project as resources, what you precisely mean? You mean the material saved in part 1 ? If I have a uber shader part 2 will compile the correct shader permutation?

Part 6 is clear.

#23 SuperPixel

    Valued Member

  • Members
  • PipPipPipPip
  • 306 posts

Posted 26 March 2012 - 06:16 PM

View PostReedbeta, on 20 March 2012 - 05:30 PM, said:

I meant an actual .fx file. I think it's cleaner to have all the associated shaders (vertex, pixel, etc.) in one file, as that system does.

If you work with bare shaders alone in their own files then you even more badly need some kind of metadata-driven approach to keep them all organized. :)

But in a multiplatform context will I have equivalents for .fx files if I might want to use them?

PS3 -> *.cgfx ?
DX11 -> *.fx
iOS -> ? Cgfx maybe?

I'm thinking to switch to fx files for the benefit of having annotations and techniques. Otherwise if go with bare shaders I can see that I have to add extra data by myself anyway...
Are there any cons in using fx files like approach in a multiplatform engine?
I find useful to annotate pass to be sure that a given pair pixel/vertex shader is going to be rendered in a well defined pipeline stage. Also the use of annotations to link the shader params to the materials ones etc.
I find wasteful, to write a parser by myself to do the same exact things in the end ...
What do you think? Do I really have to go with bare shaders if I have to add all of that stuff? Why I would ;)?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users