DirectX 11 - Status
by Lopuska · in Torque 3D Professional · 03/15/2014 (5:02 pm) · 118 replies
Hi All!
Ok, we have cleaned the entire DX9 Layer! thanks to all devs that help and support me.
Now we have a modern DirectX9 layer without fixed function and deprecated functionality.
I think that The DX9 layer was really unmodified since a long time (:
We can talk about DirectX 11...
Here you have DirectX 11 Status:
Note: at the moment there are no DX11 features, but just a port.
The goal is to have a working version of DirectX 11 so next, we can develop support for tipical nextgen features.
Contributors: Andrew Mac, ZeroFault
gfxD3D11CardProfiler - OK
gfxD3D11Cubemap - OK
gfxD3D11Device - OK
gfxD3D11EnumTranslate - OK
gfxD3D11IndexBuffer - OK
gfxD3D11OcclusionQuery - OK
gfxD3D11QueryFence - OK
gfxD3D11Shader - OK
gfxD3D11StateBlock - OK
gfxD3D11Target - OK
gfxD3D11TextureManager - OK
gfxD3D11TextureObject - OK
gfxD3D11VertexBuffer - OK
repository:
https://github.com/Lopuska/Torque3D/tree/D3D9_D3D11_R%26D
Ok, we have cleaned the entire DX9 Layer! thanks to all devs that help and support me.
Now we have a modern DirectX9 layer without fixed function and deprecated functionality.
I think that The DX9 layer was really unmodified since a long time (:
We can talk about DirectX 11...
Here you have DirectX 11 Status:
Note: at the moment there are no DX11 features, but just a port.
The goal is to have a working version of DirectX 11 so next, we can develop support for tipical nextgen features.
Contributors: Andrew Mac, ZeroFault
gfxD3D11CardProfiler - OK
gfxD3D11Cubemap - OK
gfxD3D11Device - OK
gfxD3D11EnumTranslate - OK
gfxD3D11IndexBuffer - OK
gfxD3D11OcclusionQuery - OK
gfxD3D11QueryFence - OK
gfxD3D11Shader - OK
gfxD3D11StateBlock - OK
gfxD3D11Target - OK
gfxD3D11TextureManager - OK
gfxD3D11TextureObject - OK
gfxD3D11VertexBuffer - OK
repository:
https://github.com/Lopuska/Torque3D/tree/D3D9_D3D11_R%26D
About the author
#102
10/01/2014 (11:00 am)
That sounds reasonable. What new features will you implement for DX11 once it's solid?
#103
10/01/2014 (11:07 am)
I'm not sure yet. I haven't spoken to Anis yet about it.
#104
I don't know... What has to be changed/modified/updated to make the "crashing" shaders work with DX11? I ask this because I have made some shaders which are crashing too, while they work perfectly fine in the DX9 version.
10/01/2014 (11:11 am)
@ZeroFault:I don't know... What has to be changed/modified/updated to make the "crashing" shaders work with DX11? I ask this because I have made some shaders which are crashing too, while they work perfectly fine in the DX9 version.
#105
First thing you have to change sampler2D type to SamplerState and
then you need a corresponding texture object that is registered on the same index as the sampler
In HLSL 3.0
sampler2D someTexSampler : register(S0);
In HLSL 4.0+ would be:
SamplerState someTexSampler : register(S0);
Texture2D someTex : register(T0);
the way to sample texture syntax is different.
HLSL 3.0:
tex2D(someTexSampler, texCoord);
HLSL 4.0+ would be:
someTex.Sample(someTexSampler,texCoord);
sampling prePass textures with custom prePassUncondition function is changed.
in HLSL 3.0
prePassUncondition(prePassSampler,....other args)
in HLSL 4.0+
prePassUncondition(prePassSampler, prePassTex,...other args)
So you just add the texture reference after the sampler
10/01/2014 (11:53 am)
The syntax in Dx11 shaders changed a bit from Dx9 shaders. Take a look at an example like VectorLightP.hlsl in shaders/common/lighting/advanced folder.First thing you have to change sampler2D type to SamplerState and
then you need a corresponding texture object that is registered on the same index as the sampler
In HLSL 3.0
sampler2D someTexSampler : register(S0);
In HLSL 4.0+ would be:
SamplerState someTexSampler : register(S0);
Texture2D someTex : register(T0);
the way to sample texture syntax is different.
HLSL 3.0:
tex2D(someTexSampler, texCoord);
HLSL 4.0+ would be:
someTex.Sample(someTexSampler,texCoord);
sampling prePass textures with custom prePassUncondition function is changed.
in HLSL 3.0
prePassUncondition(prePassSampler,....other args)
in HLSL 4.0+
prePassUncondition(prePassSampler, prePassTex,...other args)
So you just add the texture reference after the sampler
#106
so if you have:
struct VertexOutput
{
float4 pos : SV_Position;
float2 texCoord : TEXCOORD0;
};
the pixel input should be:
struct PixelInput
{
float4 pos : SV_Position;
float2 texCoord : TEXCOORD0;
};
Also, the syntax for the POSITION semantic should SV_Position for vertex outputs and and pixel inputs.
Lastly, the output of the pixel shader should be the SV_Target semantic instead of the COLOR semantic.
10/01/2014 (12:05 pm)
The output of vertex and input pixel shaders must be the exact same and in the same order.so if you have:
struct VertexOutput
{
float4 pos : SV_Position;
float2 texCoord : TEXCOORD0;
};
the pixel input should be:
struct PixelInput
{
float4 pos : SV_Position;
float2 texCoord : TEXCOORD0;
};
Also, the syntax for the POSITION semantic should SV_Position for vertex outputs and and pixel inputs.
Lastly, the output of the pixel shader should be the SV_Target semantic instead of the COLOR semantic.
#107
Many thanks for the explanation. My thoughts were to make my game use DX11, if not present fall back to DX10 or even DX9. But as I understand that won't be able with just one set of shaders, yo have to provide shaders for every DX version you might want to use :(
10/01/2014 (12:15 pm)
@ZeroFault:Many thanks for the explanation. My thoughts were to make my game use DX11, if not present fall back to DX10 or even DX9. But as I understand that won't be able with just one set of shaders, yo have to provide shaders for every DX version you might want to use :(
#108
#ifdef Torque SM 30
Do stuff here...
#ifdef TorqueSM 40
Do dx10 stuff here.
10/01/2014 (12:25 pm)
I could add a #define for each Shader model so you wouldn't need multiple shaders.#ifdef Torque SM 30
Do stuff here...
#ifdef TorqueSM 40
Do dx10 stuff here.
#109
10/01/2014 (4:59 pm)
If you want the D3D11 files included in the project generator just edit the core.inc in Tools/projectGenerator/modules or even create a new D3D11.inc
#110
Now you mentioned this, I remember seeing something like that in other hlsl files. I think that this might be the way to go for me. Thanks.
Edit:
Second thought:
Would it be possible to use something like this:
#ifdef Torque_SM30
#define COORDS POSITION
#endif
#ifdef Torque_SM50
#define COORDS SV_Position
#endif
.
.
.
struct VertexOutput
{
float4 pos : COORDS;
float2 texCoord : TEXCOORD0;
};
10/02/2014 (3:47 am)
@ZeroFault:Now you mentioned this, I remember seeing something like that in other hlsl files. I think that this might be the way to go for me. Thanks.
Edit:
Second thought:
Would it be possible to use something like this:
#ifdef Torque_SM30
#define COORDS POSITION
#endif
#ifdef Torque_SM50
#define COORDS SV_Position
#endif
.
.
.
struct VertexOutput
{
float4 pos : COORDS;
float2 texCoord : TEXCOORD0;
};
#111
The TORQUE_SM is defined as 30 currently. So the proper way to use it would be:
#if TORQUE_SM == 30
#define COORDS POSIITON
#endif
#if TORQUE_SM >= 40
#define COORDS SV_Position
#endif
10/02/2014 (3:28 pm)
That might work, I'm not sure if the compiler would literally replace it. You can try it yourself and see if it would work. There should already be a define for TORQUE_SM in the DX9 version of the engine. The TORQUE_SM is defined as 30 currently. So the proper way to use it would be:
#if TORQUE_SM == 30
#define COORDS POSIITON
#endif
#if TORQUE_SM >= 40
#define COORDS SV_Position
#endif
#112
'GetChannelMask' : is not a member of 'IXAudio2MasteringVoice'
10/25/2014 (10:01 am)
tried compiling this today and got the following error:'GetChannelMask' : is not a member of 'IXAudio2MasteringVoice'
#113
The frames dropped by 40%, time to time are some inconsistencies. The graphics in no way resemble DX11. No support and need many improvements.
When you solve the audio issues, will not make much sense then. Will await developments, although there will.
10/27/2014 (3:55 am)
I worked more than 15 days in this effort, the result does not satisfy me.The frames dropped by 40%, time to time are some inconsistencies. The graphics in no way resemble DX11. No support and need many improvements.
When you solve the audio issues, will not make much sense then. Will await developments, although there will.
#114
10/27/2014 (5:58 am)
Using Direct3D 11 is not going to magically make your scene look any better than what it does rendering with Direct3D 9 with the current GFX layer and material system ;-)
#115
10/27/2014 (2:57 pm)
What can we expect to gain by doing this upgrade, anything at the moment? Any performance gain even?
#116
It's not worth upgrading at the moment. There are lots of graphical artifacts and bugs we need to fix.As Dimitris has said, performance has dropped quite a bit because I haven't committed the optimization for state block changes yet.
Unfortunately, I haven't been able to work on this much since I work and had midterm exams the last couple weeks. I should be able to start working on this again this coming weekend.
10/27/2014 (3:11 pm)
@Scot It's not worth upgrading at the moment. There are lots of graphical artifacts and bugs we need to fix.As Dimitris has said, performance has dropped quite a bit because I haven't committed the optimization for state block changes yet.
Unfortunately, I haven't been able to work on this much since I work and had midterm exams the last couple weeks. I should be able to start working on this again this coming weekend.
#117
Quote: ""DirectX11 and DirectX9 driver always generate mipmap automatically. It's a totally waste of time to give manually the mipmap.""
No is not! Did test that today in our game. I generated DDS without mipmaps (diffuse and normal map) and the automated generating of the mipmaps was looking very bad. So I just generated it again from hand for the DDS export, and it looks much better. I used GIMP for the DDS export with the DDS exporter plugin.
11/04/2014 (5:38 pm)
@ Anis: Quote: ""DirectX11 and DirectX9 driver always generate mipmap automatically. It's a totally waste of time to give manually the mipmap.""
No is not! Did test that today in our game. I generated DDS without mipmaps (diffuse and normal map) and the automated generating of the mipmaps was looking very bad. So I just generated it again from hand for the DDS export, and it looks much better. I used GIMP for the DDS export with the DDS exporter plugin.
#118
"'GetChannelMask' : is not a member of 'IXAudio2MasteringVoice'"
Uncomment it and added the D3D11 folders items to the project and build it again. Running pretty fine with sounds and effects but the shaders might crash from time to time and I also notice the triangles during explosions and some light flickers when changing directions from time to time.
I am amazed it would even run and my 6800 Ati card even shows a DX 11. I have notice some improvements in the texture quality of the soldiers but also some textures looks more corny now.
Damn nice to see Torque 3D at least running on DX 11 as I fear DX9 might not be supported by GPU providers in the near future... Someone please tell me that my fear is wrong.... Read this and stay happy. DirectX 11 is backwards compatible with with DX10 and DX9 and I have read reports around the internet that people play their DirextX 9 games just fine on Windows 10(which should support DirectX 12... but no cards do so right now.... right? Eeehh...?) :O)
Now I guess those shaders need a hand as well as the DirectX 11 features...
07/14/2015 (7:02 pm)
Set up the DirectX 11 version today. Got the same error at Paul:"'GetChannelMask' : is not a member of 'IXAudio2MasteringVoice'"
Uncomment it and added the D3D11 folders items to the project and build it again. Running pretty fine with sounds and effects but the shaders might crash from time to time and I also notice the triangles during explosions and some light flickers when changing directions from time to time.
I am amazed it would even run and my 6800 Ati card even shows a DX 11. I have notice some improvements in the texture quality of the soldiers but also some textures looks more corny now.
Damn nice to see Torque 3D at least running on DX 11 as I fear DX9 might not be supported by GPU providers in the near future... Someone please tell me that my fear is wrong.... Read this and stay happy. DirectX 11 is backwards compatible with with DX10 and DX9 and I have read reports around the internet that people play their DirextX 9 games just fine on Windows 10(which should support DirectX 12... but no cards do so right now.... right? Eeehh...?) :O)
Now I guess those shaders need a hand as well as the DirectX 11 features...
ZeroFault
Default Studio Name