XNA Creators Club Online
Page 1 of 1 (10 items)
Sort Posts: Previous Next

Failed to create Effect from Compiled Code on Xbox360

Last post 5/23/2008 10:18 PM by Shawn Hargreaves. 9 replies.
  • 5/18/2008 6:17 AM

    Failed to create Effect from Compiled Code on Xbox360

    Hi there!

    I've several effects in my project which are generated from pre-compiled byte code provided as a static byte array. My effect sends the byte code to the Xna Effect base class with compiler options set to 'None' and effect pool set to 'null'. Those effects are - more or less - global effects that are only used once in the game. No multiple calls to the constructor here!

    This method works great on Windows but fails on the Xbox. Does anybody know why that happens?

    Btw.: In a #if #else block the system checks for the system and switches to the corresponding compiled code. I've a code block for Windows and a code block for the Xbox.

    The effect compiler does not complain about errors while compiling the Xbox code.

    Thanks a bunch for your help! :)

    Best regards,

    Marc Ueberall
    www.big-black-block.com
  • 5/19/2008 12:52 PM In reply to

    Re: Failed to create Effect from Compiled Code on Xbox360

    Does this effect work if you load it normally through the content pipeline?

    If so there must be something wrong in the way you are compiling or loading it, but we'd need to see some code to tell where your problem is.
    XNA Framework Developer - blog - homepage
  • 5/20/2008 5:40 PM In reply to

    Re: Failed to create Effect from Compiled Code on Xbox360

    Yes it works like expected when loaded trough the content pipeline.

    In the meantime I've switched to embedding those effects into a resource - that works like a charm. :)

  • 5/23/2008 6:32 AM In reply to

    Re: Failed to create Effect from Compiled Code on Xbox360

    I'm having exactly the same problem...

    I have a class with the windows and xbox 360 bytecode of the effect, like this:

    internal static byte[ Code = new byte[ { 
    #if XBOX360 
        // Xbox bytecode     
    #else 
        // Windows bytecode 
    #endif 
    }; 

    And I'm creating the Effect using the compiled bytecode:

    Effect effect = new Effect(graphicsDevice, SkinnedModelEffectCode.Code, CompilerOptions.None, null); 

    Then, I get the following error:
    "An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.dll
    Additional information: This resource could not be created."

    It works fine on the Windows but not on the Xbox. I checked and I'm sure that the program is using the Xbox 360 bytecode.
    I'm using the Effect Compiling Tool to generate both bytecodes. I looked at its source code and both bytecodes appears to be generated correctly...

    Could it be the shader? Despite the fact that it is not generating any error during compiling?

    Bruno Evangelista,
    Homepage | XNAnimation
    Ziggyware Article: Playing Nice Animations with XNA
    For what will it profit a man if he gains the whole world and forfeits his soul? Or what will a man give in exchange for his soul?, Matthew 16:26
  • 5/23/2008 7:27 AM In reply to

    Re: Failed to create Effect from Compiled Code on Xbox360

    It appears that the problem was in the tool that I was using...
    I recompiled the shader using the Effect class, replaced the xbox bytecode, and it worked.
    Bruno Evangelista,
    Homepage | XNAnimation
    Ziggyware Article: Playing Nice Animations with XNA
    For what will it profit a man if he gains the whole world and forfeits his soul? Or what will a man give in exchange for his soul?, Matthew 16:26
  • 5/23/2008 4:05 PM In reply to

    Re: Failed to create Effect from Compiled Code on Xbox360

    What exactly do you mean by "Effect Compiling Tool"?
    XNA Framework Developer - blog - homepage
  • 5/23/2008 5:06 PM In reply to

    Re: Failed to create Effect from Compiled Code on Xbox360

    Sorry for the confusion, I wasn't meaning any Microsoft tool.

    It is a very simple tool that compiles a shader code for xbox and windows and copy it to the clipboard:
    http://forums.xna.com/forums/t/2087.aspx

    Btw, Shawn could you help me on this topic:
    http://forums.xna.com/forums/t/12048.aspx

    Problems with deployment and strong names...

    Bruno Evangelista,
    Homepage | XNAnimation
    Ziggyware Article: Playing Nice Animations with XNA
    For what will it profit a man if he gains the whole world and forfeits his soul? Or what will a man give in exchange for his soul?, Matthew 16:26
  • 5/23/2008 6:32 PM In reply to

    Re: Failed to create Effect from Compiled Code on Xbox360

    That tool you linked to is a GS 1.0 project. You need to make sure you are using a version of the effect compiler that matches the framework version you are going to load that effect into.

    I don't know the answer to your other question, sorry.

    XNA Framework Developer - blog - homepage
  • 5/23/2008 7:12 PM In reply to

    Re: Failed to create Effect from Compiled Code on Xbox360

    Thanks for the answer.
    I thought that the compiled effect will be the same, whether it was compiled with the GS 1.0 or 2.0.

    Bruno Evangelista,
    Homepage | XNAnimation
    Ziggyware Article: Playing Nice Animations with XNA
    For what will it profit a man if he gains the whole world and forfeits his soul? Or what will a man give in exchange for his soul?, Matthew 16:26
  • 5/23/2008 10:18 PM In reply to

    Re: Failed to create Effect from Compiled Code on Xbox360

    Bruno Evangelista:

    I thought that the compiled effect will be the same, whether it was compiled with the GS 1.0 or 2.0.

     

    Not necessarily. You should always match the compiler to whatever runtime version you are using.
    XNA Framework Developer - blog - homepage
Page 1 of 1 (10 items) Previous Next