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

Where is fxc.exe for 360?

Last post 1/9/2009 7:38 PM by Shawn Hargreaves. 12 replies.
  • 1/7/2009 11:59 AM

    Where is fxc.exe for 360?

    Anyone know where the effect compiler for the 360 is located for XNA? I was about to check that some code was being hoisted into a preshader, but can't verify it until I can find the compiler.
  • 1/7/2009 12:22 PM In reply to

    Re: Where is fxc.exe for 360?

    As far as I'm aware, there is no way to disassemble an xbox effect using the tools provided with XNA.
    However, what I do, is I compiler the effect for PC, then use Effect.Dissasemble() to get the generated ASM (with preshaders) and then compile that PC shader model ASM code for the xbox (which I assume runs through some kind of conversion to XPS/XVS).
    I do this to make sure the shader constants / preshaders match on the PC and xbox

    Xen: Graphics API for XNA
    www.codeplex.com/xen
  • 1/7/2009 4:15 PM In reply to

    Re: Where is fxc.exe for 360?

    Hmm, looks like the compilation for the 360 is done via a library rather than using fxc.exe. Can anyone confirm that preshaders work the same on the 360?
  • 1/7/2009 7:28 PM In reply to

    Re: Where is fxc.exe for 360?

    I don't think there are any preshaders on Xbox at all.
    XNA Framework Developer - blog - homepage
  • 1/8/2009 8:09 PM In reply to
    • (2330)
    • premium membership MVP
    • Posts 1,220

    Re: Where is fxc.exe for 360?

    Shawn Hargreaves:
    I don't think there are any preshaders on Xbox at all.


    Oh my....I think I need to go rewrite some shaders.
    Matt Pettineo | DirectX/XNA MVP


    Ride into The Danger Zone | PIX With XNA Tutorial
  • 1/8/2009 8:37 PM In reply to

    Re: Where is fxc.exe for 360?

    Possibly... but are you sure this app is GPU limited?

    The Xbox has a very fast GPU, so most games tend to be CPU limited. If that is the case, it may not hurt you at all to have the GPU doing redundant calculations, and would actually slow things down if you manually moved that work over to the CPU.

    (this is one of the reasons we didn't do the work to implement preshaders: moving computations from GPU to CPU tends not to be a performance win on Xbox)
    XNA Framework Developer - blog - homepage
  • 1/8/2009 10:47 PM In reply to
    • (2330)
    • premium membership MVP
    • Posts 1,220

    Re: Where is fxc.exe for 360?

    Shawn Hargreaves:
    Possibly... but are you sure this app is GPU limited?

    The Xbox has a very fast GPU, so most games tend to be CPU limited. If that is the case, it may not hurt you at all to have the GPU doing redundant calculations, and would actually slow things down if you manually moved that work over to the CPU.

    (this is one of the reasons we didn't do the work to implement preshaders: moving computations from GPU to CPU tends not to be a performance win on Xbox)


    Under certain conditions my main lighting pass I'm definitely GPU-limited.  Early on when I was writing shaders I threw in a lot of arithmetic because I never seemed to be ALU bound, but for my main pass I've gotten some nice performance gains by trimming out some arithmetic instructions.  I'm sure there's a good possibility that for most cases moving some things over to the GPU will get me absolutely nothing (especially considering the fp performance on the CPU), but I think it's worth at least investigating for a few of my shaders.
    Matt Pettineo | DirectX/XNA MVP


    Ride into The Danger Zone | PIX With XNA Tutorial
  • 1/8/2009 11:05 PM In reply to

    Re: Where is fxc.exe for 360?

    Shawn Hargreaves:

    (this is one of the reasons we didn't do the work to implement preshaders: moving computations from GPU to CPU tends not to be a performance win on Xbox)

    Now I'm lost - doesn't the full effects framework in the XDK do this for you? Did you turn preshaders off?
  • 1/9/2009 1:49 AM In reply to

    Re: Where is fxc.exe for 360?

    The XDK effect implementation does not support preshaders. They were only ever implemented on Windows.
    XNA Framework Developer - blog - homepage
  • 1/9/2009 3:56 AM In reply to

    Re: Where is fxc.exe for 360?

    Shawn Hargreaves:
    Possibly... but are you sure this app is GPU limited?

    The Xbox has a very fast GPU, so most games tend to be CPU limited. If that is the case, it may not hurt you at all to have the GPU doing redundant calculations, and would actually slow things down if you manually moved that work over to the CPU.

    (this is one of the reasons we didn't do the work to implement preshaders: moving computations from GPU to CPU tends not to be a performance win on Xbox)

    While I agree with this in some ways, I still feel preshaders can be an overall benefit (especially to new developers who may not realise they have duplicate logic in their shaders) and on the flip side, they can reduce cpu usage with fewer shader constants to copy (although I'd have no idea if that would be a net win)

    I have my own shader system, which is built from decompiled Effects. In this I actually convert the PreShaders into .net code :-).
    I thought it would be an interesting experiment to actually test to see how significant the differences could be. Now, of course, it would depend if you are cpu or gpu limited, and with the xbox shaders being unified it is tricky to measure without a real world example.

    The most common thing I see, is people doing something like this in their shader:
    float4x4 mvp = mul(mul(World,View),Projection);
    The preshader is obviously going to pull that out.

    The test case I setup was very simple, 40 instances of a ~25k triangle sphere with a very simple shader (using the above mvp matrix).
    Now, it's my opinion that even on the 360, 40-80 matrix mults per frame is hardly going to have a meaningful impact on performance. I tried my best to create an measurable impact, but I couldn't (pegging the CPU then adding redundant multiplies didn't produce a measurable result until getting up to +400 mults).
    So the question was, how much would the preshader help.

    With this very, very simple setup, I felt most of the impact would be masked by other bottlenecks, but still, there was an improvement. In the test case I mentioned, the system was 401.3 fps with the preshader (or with a single matrix), and 396.4 fps without the preshader. :-)

    I wasn't happy with this. So I tried something else. I pushed the pixel shader until it was the bottleneck. Adding ~150 useless instructions (basicaly cos(cos(cos(cos(... )))) :-) things changed a lot. With the preshader, 385fps. Without the preshader, 314fps. Nearly 20% slower. So at least in this case, the gpu hit far outweighs the cpu hit (yes I know, it doesn't mean a thing if you are cpu limited, but I still thought it was interesting)

    :-)

    Xen: Graphics API for XNA
    www.codeplex.com/xen
  • 1/9/2009 5:49 AM In reply to
    • (2330)
    • premium membership MVP
    • Posts 1,220

    Re: Where is fxc.exe for 360?

    While it would be nice for someone like me to be able to enable preshaders on a per-Effect basis, if the general case results in decreased performance then I don't see how it would be at all worth it to implement it.  Based on what I see here in the forums few people do much with custom Effects, and even less do anything where they would get close to being ALU-bound.  I would imagine that for people like myself where it is an issue, that person is going to be capable enough to to evaluate where the preshaders would help and just manually pull out the calculations into the application code.
    Matt Pettineo | DirectX/XNA MVP


    Ride into The Danger Zone | PIX With XNA Tutorial
  • 1/9/2009 10:13 AM In reply to

    Re: Where is fxc.exe for 360?

    MJP:
    I would imagine that for people like myself where it is an issue, that person is going to be capable enough to to evaluate where the preshaders would help and just manually pull out the calculations into the application code.

    Exactly - though I suspect that if the Xbox did preshaders on the CPU they would be at least 10x faster than the equivalent managed code, hence my interest.
  • 1/9/2009 7:38 PM In reply to

    Re: Where is fxc.exe for 360?

    CosmicFlux:
    though I suspect that if the Xbox did preshaders on the CPU they would be at least 10x faster than the equivalent managed code, hence my interest.


    I wouldn't be too sure of that, actually. Whatever little mini VM the Windows effect implementation uses to interpret the preshader code has probably had only a fraction the optimization effort put into it compared to the CF jitter!

    Disclaimer: I'm just speculating here. I'm not familiar with the internals of the native effect implementation on either platform.
    XNA Framework Developer - blog - homepage
Page 1 of 1 (13 items) Previous Next
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG