This topic is 1047 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I used fxc.exe to precompile my vertex shader and pixel shader. I now have VS.fxo and PS.fxo files, that I need to load into my Windows Store Application.

Normaly, if we were in Desktop App, we would use

ShaderBytecode s = ShaderBytecode.FromFile("VS.fxo");


But since we are in Windows Store App, we do not have ShaderBytecode.FromFile() method available. We can only use Shaderbytecode.FromStream(System.IO.Stream stream). But that's a problem, because we cannot use FileStream object in Windows Store App. How do I load the precompiled shaders into my app then? :/

Share on other sites

Do you have any sort of file system?  I am still using the effect framework, and it has a nice constructor for Effect (Device, byteCode[]) that works if you can manually load it from storage somehow.  I'm not familiar with windows store restrictions.

In my stuff on PC I compile from file, then take the compilation result and save it out to a file myself.  Then later load that up and pass it into effect.

Share on other sites

I used fxc.exe to precompile my vertex shader and pixel shader. I now have VS.fxo and PS.fxo files, that I need to load into my Windows Store Application.

Normaly, if we were in Desktop App, we would use

ShaderBytecode s = ShaderBytecode.FromFile("VS.fxo");


But since we are in Windows Store App, we do not have ShaderBytecode.FromFile() method available. We can only use Shaderbytecode.FromStream(System.IO.Stream stream). But that's a problem, because we cannot use FileStream object in Windows Store App. How do I load the precompiled shaders into my app then? :/

Surely there must be some way to get a file read from the disk into a stream of bytes, right?

If you can get the URI of the file, this might work:

Uri uri = new Uri("IDon'tKnowWhatever");
var stream = System.Windows.Application.GetResourceStream(uri).Stream;
Utilities.Dispose(ref stream);

Share on other sites

If you can get the URI of the file, this might work:
Uri uri = new Uri("IDon'tKnowWhatever");
var stream = System.Windows.Application.GetResourceStream(uri).Stream;
Utilities.Dispose(ref stream);

Thank you, I will try this.