Jump to content

  • Log In with Google      Sign In   
  • Create Account

difference between xna 4 or directx 10 HLSL?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 thomasvt   Members   -  Reputation: 109

Like
0Likes
Like

Posted 08 January 2012 - 02:53 PM

Hi,

i've been using Xna 4 for quite a while now (2D mostly), but with the rumours about xna disappearing I thought to check out the real stuff (c++ & directX 10 sdk) and learn more about the 3D using the very good "Introduction to DirectX 10 game programming" book.

Doing this I discovered something weird (to me, that is). The HLSL in my book on DirectX 10 is different than XNA 4's. I'm starting to think XNA 4 is not directX 10, but then again i'm quite certain my XNA 4 games won't run on WinXP machines, so DirectX 9c is not supported.

Anyway, when i try to compile HLSL code from my DX10 book in XNA 4, i must change these things until it compiles:
* "technique10" should be "technique"
* SetGeometryShader must be deleted, it errors about the shader version that's not supported
* the VS and PS version stated in the technique, are not supported (only <= 3_0 works)

So, why is there a difference, what am I missing between native DX10 and XNA 4? And if it's DX9c after all, why doesn't XNA 4 work on WinXP?

Sample: (DirectX 10 effect)

cbuffer cbPerObject
{
float4x4 gWVP;
};
void VS(float3 iPosL : POSITION,
float4 iColor : COLOR,
out float4 oPosH : SV_POSITION,
out float4 oColor : COLOR)
{
// Transform to homogeneous clip space.
oPosH = mul(float4(iPosL, 1.0f), gWVP);

// Just pass vertex color into the pixel shader.
oColor = iColor;
}
float4 PS(float4 posH : SV_POSITION,
float4 color : COLOR) : SV_Target
{
return color;
}
technique10 ColorTech
{
pass P0
{
SetVertexShader( CompileShader( vs_4_0, VS() ) );
SetGeometryShader( NULL );
SetPixelShader( CompileShader( ps_4_0, PS() ) );
}
}


thanks

Sponsor:

#2 MJP   Moderators   -  Reputation: 11736

Like
0Likes
Like

Posted 08 January 2012 - 03:19 PM

XNA 4 is built on D3D9. It absolutely works on Windows XP. XP is there in the list of supported operatoring systems. If your game doesn't work on XP, then there must be a problem with your game or how you're deploying it.

D3D10 brought some huge changes when it came out, and a lot of them had to do with Shader Model 4.0 which brought a lot of new shader features. There were also changes to the effect framework (which is seperate from core shaders), which is why you had to change "technique" to "technique10".

If you want to learn D3D10/D3D11, then I'm afraid you're going to have to actually use those API's. XNA is limited to a subset of D3D9-era functionality, which means you're going to get to a point in your book where there's no way to translate it back to XNA and SM3.0. If you want to know what you're missing out on by sticking with SM3.0, there's some info in the documentation:

http://msdn.microsof...v=vs.85%29.aspx

http://msdn.microsof...v=vs.85%29.aspx

http://msdn.microsoft.com/en-us/library/windows/desktop/ff476342%28v=vs.85%29.aspx

#3 thomasvt   Members   -  Reputation: 109

Like
0Likes
Like

Posted 08 January 2012 - 03:40 PM

thanks, after googling around a bit more, i indeed found out it's actually DX9 but with some non-standardized features (in hidef profile) that only work by DX10 supporting hardware. that's probably the reason why it's not working on xp machines, they often don't have DX10 hardware.

But thanks for clarifying even more.

So, i guess I'll have to learn C++ with all the difficult COM syntax and macro's. I'm a pro .NET guy for about 8 years, but damn, advanced C++ is hard to learn in absence of decent code completion and helping descriptions popping up everywhere. pitty c++ hasnt changed much the last decade. Even c++11 doesn't bring much improvement on the usability-domain imho. The IDE is just not very helpfull, like c# or any more mainstream language.

Ah well, i guess my hobby-games will have to settle with DX 9 :) It's more about the AI to me anyway.

thanks

#4 Alpha_ProgDes   Crossbones+   -  Reputation: 4692

Like
1Likes
Like

Posted 08 January 2012 - 05:08 PM

I'm pretty sure the SlimDX guys have ported DX10 and 11 to C#. You may want to check that out.
Beginner in Game Development? Read here.
 
Super Mario Bros clone tutorial written in XNA 4.0 [MonoGame, ANX, and MonoXNA] by Scott Haley
 
If you have found any of the posts helpful, please show your appreciation by clicking the up arrow on those posts Posted Image
 
Spoiler

#5 MJP   Moderators   -  Reputation: 11736

Like
0Likes
Like

Posted 08 January 2012 - 08:37 PM

Yeah you also have the option of managed wrappers like SlimDX and SharpDX. They fully expose D3D10/D3D11, so you don't lose out on anything that you would have by using native C++.

#6 thomasvt   Members   -  Reputation: 109

Like
0Likes
Like

Posted 09 January 2012 - 01:22 AM

i'm speechless...

you just made my day, or probably even my year :)

i already wondered why there wasn't anybody making some .NET interop of DX, but i figured XNA (what i thought to be DX10 before today) made any such attempt obsolete and that explained why no decent interop project existed.. but apparently they DO exist !!

thank you for your service but please close the door behind you, XNA :)

thanks a whole lot!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS