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
#42
06/07/2014 (6:40 pm)
Awesome, I can't believe Anis has poured in so much time for T3D. Thanks you soo much Anis!
#44
I not for sure if it's an issue with the refactoring code but I notice crash while importing in or using certain models..The models import correctly in 3.5.1 but I've noticed the crash with the next gen branch, so I'm assuming it's with the D3D 9 refactoring..
You can see if you get the crash to using the FPS tutorial mission from Chinatown. As for model try importing the cars from that pack..
Thx
KJ
06/10/2014 (7:10 am)
Anis and Andrew,I not for sure if it's an issue with the refactoring code but I notice crash while importing in or using certain models..The models import correctly in 3.5.1 but I've noticed the crash with the next gen branch, so I'm assuming it's with the D3D 9 refactoring..
You can see if you get the crash to using the FPS tutorial mission from Chinatown. As for model try importing the cars from that pack..
Thx
KJ
#45
06/10/2014 (7:48 am)
Off the top of my head, Next-Gen branch didn't include Anis' converting TriangleFan to TriangleStrip since TriangleFan is deprecated ( if I remember correctly ) so perhaps one of those models has a TriangleFan in it?
#46
Is there away around it through exporting or something. I have a few models that I believe have trianglefans?
thanks
06/10/2014 (8:45 am)
Maybe so I'm not for sure..It's a model you can look into..Just down load the FPS tutorial, port the art of any of the missions and try load the mission..You'll get a crash. I track it down to the cars..So maybe they are triangle fans if so will trianglestrip fix the issue or would I be "SOL" with model that have trianglefan?Is there away around it through exporting or something. I have a few models that I believe have trianglefans?
thanks
#47
github.com/Lopuska/Torque3D/commit/bcc41c211774f64dc2f74de07659db41bd539b3f#diff...
06/10/2014 (9:20 am)
Quote:So maybe they are triangle fans if so will trianglestrip fix the issue or would I be "SOL" with model that have trianglefan?Not using vehicles this end, and threw the alterations into the personal codebase, so would have to re-dig-out the explicit trianglefan to trianglestrip alterations from the other stuff that slipped in (not difficult. just time-consuming), but try:
github.com/Lopuska/Torque3D/commit/bcc41c211774f64dc2f74de07659db41bd539b3f#diff...
#48
Would this fix or at least by pass the trianglefan issue?
I also have the TAIK in the build and I had to get rid of almost have the weapon models because of the trianglefan issue..If it fixes; or by passes the issue I could go ahead and add them back in and continuing working in my current build, if not I'll have to start over on the build :(
06/10/2014 (10:04 am)
Azaezel,Would this fix or at least by pass the trianglefan issue?
I also have the TAIK in the build and I had to get rid of almost have the weapon models because of the trianglefan issue..If it fixes; or by passes the issue I could go ahead and add them back in and continuing working in my current build, if not I'll have to start over on the build :(
#49
06/10/2014 (10:12 am)
I *think* so, but honestly not sure. Only one way to find out if that'll be all you need to do to shortcut it. If not, it's mostly a case of flipping the... third? entry over to the... first? for the verts across the board. Shows it: github.com/Lopuska/Torque3D/commit/bcc41c211774f64dc2f74de07659db41bd539b3f#diff...
#50
06/30/2014 (4:34 pm)
Still coming back Anis?
#51
I think I got a handle on TextureManager, it's technically working right now though I can't get far enough to actually see loaded textures, so it could be not working. There's no errors though.
I fixed up the vert/prim buffers. They were originally designed with CPU access turned on for all of them and used map/unmap for lock/unlock functionality. From what I've read this isn't a good idea as most vert/prim buffers won't be altered so static ones should just be made static with no cpu access. I made lock present a temp buffer and unlock uses UpdateSubresource to send it to the graphics card. If anyone knows better, let me know.
I kept pressing forward until I hit a pretty decent wall. DirectX 11 requires a minimum of shader model 4. All of the existing shaders in torque are shader model 3 or lower. I also need to rewrite or replace the ConstantTable to support shader model 4 output. Oh, and shadergen needs to be updated to support outputting shader model 4.
These are the kind of tasks where many hands make light work. So, who wants to help? Haha.
07/24/2014 (8:23 am)
I started working on this a bit just to see what the status is. I won't be dedicating a whole lot of time to this but each day I try to get a little further in the mornings before moving onto other things.I think I got a handle on TextureManager, it's technically working right now though I can't get far enough to actually see loaded textures, so it could be not working. There's no errors though.
I fixed up the vert/prim buffers. They were originally designed with CPU access turned on for all of them and used map/unmap for lock/unlock functionality. From what I've read this isn't a good idea as most vert/prim buffers won't be altered so static ones should just be made static with no cpu access. I made lock present a temp buffer and unlock uses UpdateSubresource to send it to the graphics card. If anyone knows better, let me know.
I kept pressing forward until I hit a pretty decent wall. DirectX 11 requires a minimum of shader model 4. All of the existing shaders in torque are shader model 3 or lower. I also need to rewrite or replace the ConstantTable to support shader model 4 output. Oh, and shadergen needs to be updated to support outputting shader model 4.
These are the kind of tasks where many hands make light work. So, who wants to help? Haha.
#52
I really wish I could help you coding @Andrew, but what I at least can do; is to give you thumbs up:
07/24/2014 (6:28 pm)
Quote:These are the kind of tasks where many hands make light work. So, who wants to help? Haha.
I really wish I could help you coding @Andrew, but what I at least can do; is to give you thumbs up:
#53

And whenever you want to check something, let me know. We have many machines (all NVIDIA)...
07/25/2014 (3:44 am)
Same here @Andrew!And whenever you want to check something, let me know. We have many machines (all NVIDIA)...
#54
07/25/2014 (9:38 pm)
With the shader model thing D3D11 should work with older shader models using the feature levels. msdn.microsoft.com/en-us/library/windows/desktop/ff476872%28v=vs.85%29.aspx
#55
http://www.gamedev.net/topic/517341-directx11-shader-compiling/
07/25/2014 (10:11 pm)
I hope you're right as it would save work, but I can't find any information to support it. I've found someone who has the same issue I have though. Loading any shader compiled with less than sm4 returns invalidarg:http://www.gamedev.net/topic/517341-directx11-shader-compiling/
#56
If it still fails even when you request a D3D_FEATURE_LEVEL_9_3 than i guess you got no choice but to modify ShaderGen to support the higher level, it has to be done one day anyway, would have been easier for you if you could do it after everything else was working.
07/25/2014 (10:35 pm)
Look i am not 100% sure actually, never used D3D11 myself. This link says shader 2.0 (4_0_level) which is confusing. msdn.microsoft.com/en-us/library/windows/desktop/ff476876%28v=vs.85%29.aspx. Doesn't sound very fun changing the ShaderGen at all ;-).If it still fails even when you request a D3D_FEATURE_LEVEL_9_3 than i guess you got no choice but to modify ShaderGen to support the higher level, it has to be done one day anyway, would have been easier for you if you could do it after everything else was working.
#57
Sorry for my last absence. I was really busy for job/personal reasons.
I should to return really soon. Now I moved to france.
for the shaders, we should not touch anything. I've activated D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY for this reason! (see d3d11shader.cpp)
Andrew is trying to proceed my job! We talk sometimes via mail :)
I'm still busy until 25-30 august! Next I'll return to help the community on the development of torque 3D.
Thanks to all!
07/28/2014 (11:20 am)
hello everyone!Sorry for my last absence. I was really busy for job/personal reasons.
I should to return really soon. Now I moved to france.
for the shaders, we should not touch anything. I've activated D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY for this reason! (see d3d11shader.cpp)
Andrew is trying to proceed my job! We talk sometimes via mail :)
I'm still busy until 25-30 august! Next I'll return to help the community on the development of torque 3D.
Thanks to all!
#58
Here is another post from a different source with someone running into the same issue:
www.ogre3d.org/forums/viewtopic.php?f=2&t=67299
To quote the response he got:
The idea of feature levels (from my understanding) is to support DX9 level hardware that has DirectX 11 installed on their operating system. If you detect DX9 hardware using feature levels you can compile your 4.0 shaders using the vs_4_0_level_9_1/ps_4_0_level_9_1 targets and it'll compile to sm2.0 instructions to work on that hardware.
07/28/2014 (12:23 pm)
I'm using that flag, and your code, but it won't load the compiled shader. Everything I've read says D3DCompile is a D3D function, not a DX11-specific function so it supports compiling for all the different shader models. The backwards compatibility compiling allows you to compile the shaders, sure, but it returns as invalid when you try to load it. Compiling it with ps_4_0 makes it load perfectly fine. Here is another post from a different source with someone running into the same issue:
www.ogre3d.org/forums/viewtopic.php?f=2&t=67299
To quote the response he got:
Quote:
I think that the D3D11 runtime expects to receive shaders that are compiled with at least vs_4_0 target, although the compiler can output shaders to any known D3D target.
The idea of feature levels (from my understanding) is to support DX9 level hardware that has DirectX 11 installed on their operating system. If you detect DX9 hardware using feature levels you can compile your 4.0 shaders using the vs_4_0_level_9_1/ps_4_0_level_9_1 targets and it'll compile to sm2.0 instructions to work on that hardware.
#59
Shouldn't we be using at least ps_4_0 anyway? We still have DX9 API to support a DX9 GPU
07/28/2014 (12:45 pm)
@Andrew Shouldn't we be using at least ps_4_0 anyway? We still have DX9 API to support a DX9 GPU
#60
07/28/2014 (1:48 pm)
Definitely, but if we can get them to load in the interim it would allow us to build everything else around it and then move on to replacing all the shaders and updating shadergen. It's gotta be done sooner or later though, you're right.
Andrew Mac