This project is read-only.

Bad news I'm afraid.. (Or maybe not...)

Mar 17, 2010 at 8:54 PM
Edited Mar 18, 2010 at 7:59 PM

Looks like XNA 4 is removing the low level shader APIs.


That pretty much means a Xen upgrade will be impossible.



Mar 18, 2010 at 3:11 PM

Sad news indeed :\

Mar 18, 2010 at 3:34 PM
Hey StatusUnknown, So if XNA 4 is removing the low level shader APIs, would we still be able to use the core application framework as long as we do not use the DrawTarget procedures and XenFx? Thanks Philippe
Mar 18, 2010 at 4:19 PM
Edited Mar 18, 2010 at 4:26 PM

Well, it's a tricky one.

I haven't had time to try the CTP, but it looks like XNA 4 is implementing a lot of Xen's core features anyway (strictly typed vertex buffers, render state objects, better render targets, etc). How well they are implement is an open question.

The main problem is that they have cut out the low level shader parts of the API (so the ability to specify the vertex and pixel shader / constants directly). This is the foundation that XenFx is built on - and realistically, XenFx is 50% of Xen itself. Pretty much everything else is built around it in some sense

For example, the particle system relies very heavily on it. All the filters. The model format relies on MaterialShader - which is entirely reliant on XenFx. The list goes on, everything has a dependency that eventually gets to XenFx.


On the one hand, I'm happy they are improving the API. I don't know how efficient it'll be internally (The Effect system is pretty horrific) - but at least in theory by tightening up their API (and reducing the surface area) it gives them the opportunity to massively optimise API calls, etc (which is exactly what Xen is designed to do). The question is simply 'have they?'.

If they have, then that's great. If they haven't, well, I'm a bit disappointed.
It leaves me in a very difficult position. It would be a lot of work to port Xen to XNA 4, and that would mean removing major parts of the API. It would be impossible to keep it backwards compatible too (Xen is compatible back to XNA 1.1 if you are really keen).
It also means that what Xen offers is greatly diminished. I've put a lot of effort into Xen, XenFx in particular. Most of this effort has been to create an API that hopefully works first time, tells you if something is wrong early, and works as efficiently as possible. The fort zombie guys saw a HUGE performance boost moving to Xen - however, if XNA 4 is similarly efficient, then things are even more complex. It would be a case of an API that offers no efficiency boost, and has it's headline feature cut. All you get is an alternative, not a clear advantage.

And as I said, it would be a lot of work. Xen is something like 3-4MB of code, I would imagine at least half of that would be removed or require a significant reworking.


It's doubly disappointing, because I've only recently got back into a state where I can devote the energy needed to keep Xen up to date. I was looking forward to writing a Windows Phone shader layer (Imagine that, one shader on all three platforms! - I actually doubt XNA 4 will manage this). I am also half way through preparing a massive new tutorial dealing with several aspects of lighting (you can see work in progress shots here and here).


But things change.


So in short, to answer your question, "would we still be able to use the core application framework" ?. Yes, with a lot of work. But to be honest, I really don't think I have the energy or motivation to do it.

Mar 25, 2010 at 7:32 AM

Hi everybody!

Yeah, it's quite disappointing, that XNA 4.0 does not support low level shader API, but they say that they decided to cut this feature off just for the first release! I am sure, that in future releases we'll get the feature back. So don't panic! :) Just sit and wait :)

Mar 29, 2010 at 4:10 PM
Edited Mar 29, 2010 at 4:15 PM

Unfortunately, my interpretation of his post is that XNA 4 won't support any custom shaders on the phone for the first release, but it will support them some time in the future. (So future versions won't reintegrate the low level API).

I've contacted Shawn, and the response is pretty much that I'm out in the cold. Disappointing really.

Mar 29, 2010 at 10:52 PM

I'm not sure to understand... Are they breaking the Low level API for the entire platforms or only for the Phone? If so, couldn't we consider Xen a solution for Windows & Xbox only?


Mar 29, 2010 at 11:27 PM
Edited Mar 29, 2010 at 11:30 PM

No, they are dropping it from all platforms. They intend to only support the Effect system. So you can no longer set specific vertex/pixel shaders or vertex/pixel shader constants.

My understanding (from reading between the lines) is that they want to apply some optimisations in XNA internals - and supporting the low level API would have made that harder. So they decided few people were using the low level API, so it was a good candidate to get rid of (which to an extent is true, I'm probably the one 'big' exception :-)


The phone won't have any custom shaders in XNA 4 - that is something they intend to add at a later date. At first it will only support the 5 built in Effect classes (such as BasicEffect and SkinnedEffect).
This is because the phone uses a very different native language/API for interfacing with the hardware (I thought it was OpenGL ES, but according to Shawn it's even lower level).
I'm not surprised they are not supporting Effects for the phone day 1, because I had enough trouble supporting some of their features on the PC/xbox.

Apr 10, 2010 at 1:15 PM
Edited Apr 10, 2010 at 1:16 PM

Just an update: I think I have figured out a way that I can port xen to XNA 4 while still retaining many of the performance advantages of the shader system, and keeping the current API almost identical. It's an almighty hack, but I think it should actually work. :-)

I'm not going to go into specifics, as I still need to think through the possible ramifications. However it's promising, as it wouldn't require a massive reworking of the shader system (in fact, it would be a fairly minor set of changes).

Note that it would still be bound by all the current limitations / restrictions of the xen shader system, including single pass only and no render state changes.

Apr 12, 2010 at 5:50 AM


When can we expect the new version? ;) How about Windows Phone support?

Apr 12, 2010 at 10:31 AM

Well in 4 the phone will have no custom shader support at all, so it's probably best to not expect anything just yet.

Apr 12, 2010 at 12:47 PM

How about integrating\hacking prebuilt effects with Xen shader system? Is that possible?

Apr 12, 2010 at 2:29 PM
Edited Apr 12, 2010 at 2:46 PM

There will be work-arounds, yes. I'm still thinking over how things may work.

I'll be writing up a post about the changes I'm wanting to make for Xen 2.0 (I'm looking to make several breaking changes, so more than simply porting to XNA 4 which justifies that it'll get a proper version number bump).

However unlike the XNA team I'll actually let you guys know what I plan to break before I break it! (I'm not bitter I swear! :-)