XNA Compile Effect without the content loader

Started by
3 comments, last by FeverGames 14 years, 11 months ago
Hi, does anyone know how I can compile an effect in XNA without using the content loader? The effect file is opened as a stream and from that point on i want to compile it to be used on xbox and/or windows. And i want this with methods supported on the Xbox, so no FromFile(); stuff ;-) Anyone?
Advertisement
On Windows, you can use Effect.CompileEffectFromFile or Effect.CompileEffectFromSource to compile effects during runtime.

The FX compiler doesn't exist on the Xbox 360, however, so these and any other methods of compiling effects at runtime will only work on Windows. The only way to compile effects for the Xbox 360 is to build them as content and deploy the compiled effects with your game (loading them in through a ContentManager).
There's no way to compile an Effect on 360...it doesn't have the required assemblies. What you have to do is compile the effect ahead of time on the PC, using Effect.CompileEffectFromFile to get a CompiledEffect, from which you can get the raw byte[] representing the compiled data. Then on the 360 you can pass that data to the Effect constructor to get an instance of that Effect. This is more or less what the Importer and Processor does in the Content Pipeline.

there is no way to compile it with XNA on the xbox?? what if the file itself is precompiled into byte code or anything similar, still no possibility? these xna boys are starting to be a real pain in the ***! :) thanks for the reply though.
Quote:Original post by MJP
There's no way to compile an Effect on 360...it doesn't have the required assemblies. What you have to do is compile the effect ahead of time on the PC, using Effect.CompileEffectFromFile to get a CompiledEffect, from which you can get the raw byte[] representing the compiled data. Then on the 360 you can pass that data to the Effect constructor to get an instance of that Effect. This is more or less what the Importer and Processor does in the Content Pipeline.


sorry there i didn't see your reply yet because you replied while i was replying!

thanks for that info! that sounds more like it! :-)

This topic is closed to new replies.

Advertisement