Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualATC

Posted 11 October 2012 - 12:36 AM

Ah, so I'm going to need to write a parser to parse HLSL code and read all of the shader functions in then compile each one to bytecode separately? Geez, this sounds like a mountain of work... This sets our production schedule "hopes" back dramatically lol...

But now if I understand correctly the whole concept of "Techniques" and "Passes" is just an abstraction for selecting different bits of shader bytecode to bind to the device? And that would also mean I'm going to have to parse the technique/pass definitions and implement a whole new technique and pass system in the engine to use it? If that's the case I can no longer use EffectPass.Apply() anymore either... thus I'm going to need to... I dunno... bind shader bytecode individually to the device interface's "PixelShader", "VertexShader", and "GeometryShader" (and the other stages for D3D11, of course) objects? I've never even seen anyone do this before, hmmm... However, if I understand correctly doing all this work will be worth it because I will have a very powerful/flexible system where I can dynamically piece together complete effects from fragments on-the-fly and (theoretically) generate tons of effect permutations from fragments?

There's something I'm not getting here though... Suppose I do something like this:

[source lang="csharp"]void processShader(string path){ string fxSrc = File.ReadAllText( path ); byteCode = ShaderBytecode.Compile(fxSrc, "mainVS", "fx_5_0", ShaderFlags.None, EffectFlags.None);}[/source]

Ok... well now I have the bytecode of the vertex shader "mainVS" from my .fx file. I could do the same thing to get the pixel and/or geometry shaders... But what about the rest of the fx file? All my global variables and constant buffers? How/when do they get compiled and how do I put all this back together? That's what I'm not getting... and how can I wrap all of this up cleanly to make working with shaders and materials easy for users of the engine (one of which will be myself and my team)?

EDIT:

It would be great if someone could hash out a light-weight pseudo-code example of how this is supposed to work and what I need to be doing with all of this... I'm still searching all over Google and finding a couple bits of decent info here/there but nothing to answer the mounting number of questions... Posted Image

Also... this issue of Windows 8 Metro compatibility... I was already thinking that the best route to go would be to write a utility for my engine that imports effects (e.g., a .fx file) and pre-compiles and gets all the info the engine needs. Then it would create a file of our own custom format that contains all the meta-data we want and packs in the compiled bytecode. The engine would just read the file at run-time and construct an "Effect" instance (I mean our own Effect class, not from Effects Framework) from it... does my thinking seem on the right track here? I was already planning to do this because compiling lots of shaders for any decently complex game can be like watching paint dry...

#2ATC

Posted 10 October 2012 - 10:46 PM

Ah, so I'm going to need to write a parser to parse HLSL code and read all of the shader functions in then compile each one to bytecode separately? Geez, this sounds like a mountain of work... This sets our production schedule "hopes" back dramatically lol...

But now if I understand correctly the whole concept of "Techniques" and "Passes" is just an abstraction for selecting different bits of shader bytecode to bind to the device? And that would also mean I'm going to have to parse the technique/pass definitions and implement a whole new technique and pass system in the engine to use it? If that's the case I can no longer use EffectPass.Apply() anymore either... thus I'm going to need to... I dunno... bind shader bytecode individually to the device interface's "PixelShader", "VertexShader", and "GeometryShader" (and the other stages for D3D11, of course) objects? I've never even seen anyone do this before, hmmm... However, if I understand correctly doing all this work will be worth it because I will have a very powerful/flexible system where I can dynamically piece together complete effects from fragments on-the-fly and (theoretically) generate tons of effect permutations from fragments?

There's something I'm not getting here though... Suppose I do something like this:

[source lang="csharp"]void processShader(string path){ string fxSrc = File.ReadAllText( path ); byteCode = ShaderBytecode.Compile(fxSrc, "mainVS", "fx_5_0", ShaderFlags.None, EffectFlags.None);}[/source]

Ok... well now I have the bytecode of the vertex shader "mainVS" from my .fx file. I could do the same thing to get the pixel and/or geometry shaders... But what about the rest of the fx file? All my global variables and constant buffers? How/when do they get compiled and how do I put all this back together? That's what I'm not getting... and how can I wrap all of this up cleanly to make working with shaders and materials easy for users of the engine (one of which will be myself and my team)?

EDIT:

It would be great if someone could hash out a light-weight pseudo-code example of how this is supposed to work and what I need to be doing with all of this... I'm still searching all over Google and finding a couple bits of decent info here/there but nothing to answer the mounting number of questions... :P

#1ATC

Posted 10 October 2012 - 10:45 PM

Ah, so I'm going to need to write a parser to parse HLSL code and read all of the shader functions in then compile each one to bytecode separately? Geez, this sounds like a mountain of work... This sets our production schedule "hopes" back dramatically lol...

But now if I understand correctly the whole concept of "Techniques" and "Passes" is just an abstraction for selecting different bits of shader bytecode to bind to the device? And that would also mean I'm going to have to parse the technique/pass definitions and implement a whole new technique and pass system in the engine to use it? If that's the case I can no longer use EffectPass.Apply() anymore either... thus I'm going to need to... I dunno... bind shader bytecode individually to the device interface's "PixelShader", "VertexShader", and "GeometryShader" (and the other stages for D3D11, of course) objects? I've never even seen anyone do this before, hmmm... However, if I understand correctly doing all this work will be worth it because I will have a very powerful/flexible system where I can dynamically piece together complete effects from fragments on-the-fly and (theoretically) generate tons of effect permutations from fragments?

There's something I'm not getting here though... Suppose I do something like this:

[source lang="csharp"]void processShader(string path){ string fxSrc = File.ReadAllText( path ); byteCode = ShaderBytecode.Compile(fxSrc, "mainVS", "fx_5_0", ShaderFlags.None, EffectFlags.None);}[/source]

Ok... well now I have the bytecode of the vertex shader "mainVS" from my .fx file. I could do the same thing to get the pixel and/or geometry shaders... But what about the rest of the fx file? All my global variables and constant buffers? How/when do they get compiled and how do I put all this back together? That's what I'm not getting... and how can I wrap all of this up cleanly to make working with shaders and materials easy for users of the engine (one of which will be myself and my team)?

PARTNERS