XNA Creators Club Online
Page 1 of 2 (26 items) 1 2 Next >
Sort Posts: Previous Next

[2.0] Shader errors

Last post 11-22-2007 10:31 PM by Lord Ikon. 25 replies.
  • 11-20-2007 1:00 AM

    [2.0] Shader errors

    I have a shader, that I might add is working perfectly in XNA1.0 that will not compile in 2.0beta.

    It tells me it has too many instructions (72), which is more than the maximum for PS2.0 (64). It doesn't tell me which technique is the one using too many. And if I change out all of the pixel shaders to model 3.0 I get a new error, which is:

    Resources\Effects\water.fx(185,1): error : C:\Users\Nic\Documents\Visual Studio 2005\Projects\UpgradedGame1\UpgradedGame1\Resources\Effects\water.fx(185): error X4004: program too complex; there are more active values than registers

    So is Visual Studio pickier about shaders than VSExpress? Is this possibly a bug? It ran on XNA1.0, so I don't see how this error is valid....though I am new to shaders.

    XNA QuickStart Engine | My site
    "I'll be whatever I want to do!", Philip J. Fry
  • 11-20-2007 1:13 AM In reply to

    Re: [2.0] Shader errors

    GS 2.0 will be using a newer version of the Shader compiler... Shader compilers are fixed by the DirectX SDK GSE 1.0 used October 2006.

    GS 2.0 uses ??? November 2007? August 2007?

    So the compiler results can be different...however you are right that this is a bug. It should not break so upload the .fx file to connect and say that it worked in 1.0 but not in 2.0



    The ZBuffer News and information for XNA

    Please read the forum FAQs - Bug reporting
  • 11-20-2007 1:16 AM In reply to

    Re: [2.0] Shader errors

    There is something in the docs / known issues about this, but I can't remember where I read it, I'll try and hunt it down.
  • 11-20-2007 1:20 AM In reply to

    Re: [2.0] Shader errors

    I remember reading something in the docs about compiling in Release mode...
    Microsoft DirectX/XNA MVP
  • 11-20-2007 1:21 AM In reply to

    Re: [2.0] Shader errors

    I'll file a bug, never used connect those this is a good chance to learn.
    XNA QuickStart Engine | My site
    "I'll be whatever I want to do!", Philip J. Fry
  • 11-20-2007 1:57 AM In reply to

    Re: [2.0] Shader errors

    Here is the connect issue.

    I'll try release mode and see what happens....

    XNA QuickStart Engine | My site
    "I'll be whatever I want to do!", Philip J. Fry
  • 11-20-2007 2:07 AM In reply to

    Re: [2.0] Shader errors

    In XNA GS 2.0, Debug builds compile shaders with extra debugging info so you can use PIX to debug them. The side-effect is that you have fewer registers available in Debug.

    I'm not terribly familiar with this area, but you'll find it in the docs if you look for it.

    Stephen Styrchak | XNA Game Studio Developer
  • 11-20-2007 2:14 AM In reply to

    Re: [2.0] Shader errors

    Worked great shaw, thanks. I have the engine running on 2.0beta, with the exception of water. I cannot figure out exactly how the render/resolve target system they setup works.

    Before we had a renderTarget2D, and a Texture2D. We'd resolve the backbuffer to the rendertarget, and set our texture equal to the rendertarget's texture. However now we must use a resolveTexture2D, which doesn't look like you can extract the texture from it, or I'm sure you can but I can't figure it out cause I'm so tired. Once that is working the entire engine will be running 2.0beta. Without the water performance is up around 30%, but for all I know the 30% improvement could be due to the water....

    XNA QuickStart Engine | My site
    "I'll be whatever I want to do!", Philip J. Fry
  • 11-20-2007 3:20 AM In reply to

    Re: [2.0] Shader errors

    Answer

    Yes, if you are building a Debug build, we'll compile the shaders with debug information as well.  To work around this issue for RTM, if we detect the failure in debug, we'll go ahead and build the shader in Release in an attempt to always give you a good build.

    As for render targets.  ResolveTexture2D is a dynamic texture that you create as the target for a ResolveBackBuffer.  Likewise it is the texture returned by RenderTarget2D.GetTexture().  There is no need to call ResolveRenderTarget; it's implicitly done for you.  If you are using ResolveBackBuffer, then instead of creating a Texture2D, you'll created a ResolveTexture2D.  You'll need to tweak the parameters a bit, but they should be clearer now.

     

     

    Mitch Walker
    Program Manager - XNA Game Studio
  • 11-20-2007 9:43 AM In reply to

    Re: [2.0] Shader errors

    I think I'm getting closer to getting this work. When you say that you don't need to call ResolveTarget I am confused. In the bloom sample you guys call Device.ResolveBackBuffer(). Then after rendering call Device.SetRenderTarget.

    Basically I need to save the buffer to a Texture2D to pass to my shader. I cannot get a Texture2D from the ResolveTexture2D or RenderTexture2D that I can tell.

    XNA QuickStart Engine | My site
    "I'll be whatever I want to do!", Philip J. Fry
  • 11-20-2007 10:10 AM In reply to

    Re: [2.0] Shader errors

    I'm working on figuring this out myself. I was using RenderTarget2D to created Texture2D objects to give my game that blur motion look. So far, I haven't been successful in figuring out how to use these new objects and methods. Is there a sample somewhere we can look at that uses the new methods?
  • 11-20-2007 11:25 AM In reply to

    Re: [2.0] Shader errors

    ResolveBackBuffer doesn't use RenderTargets, so that may be where the confusion comes in.  If you used ResolveBackBuffer before, it works the same now, you just need to pass in a ResolveTexture2D instead of a Texture2D.
    Mitch Walker
    Program Manager - XNA Game Studio
  • 11-20-2007 11:39 AM In reply to

    Re: [2.0] Shader errors