Torque 3D DirectX11 Port - DirectX 9 refactor
by Lopuska · in Torque 3D Professional · 03/11/2014 (6:23 pm) · 81 replies
Hi everybody!
I'm Lopuska, I'm from Italy.
I'm taking some of my time to try a conversion of Torque3D from DirectX9 to DirectX11.
This is my current status, there's still a lot of work to do...
I don't have many times in this period, if anyone would like to help me for this big task it would be great!
Before that, I've done a lot of code refactoring on D3D9 layer, also to make porting to D3D11 easier.
Here there are change list about DirectX9 refactoring:
- Better *.cpp organization / code cleaning
- Removed D3DX calls dependencies. (deprecated by Microsoft)
- Removed D3D9 XBOX360 old reference.
- Shader/Constant buffer refactor with a custom parser.
- gfxD3D9Shader total refactor.
- Mipmap autogen fixes
- Minor fixes under cubemap
- Speed improved on texture loading
- Removed 24bit format (deprecated since DX10) (i convert it to 32bit)
There is a better explanation about it on code as comment.
- Some performance improvement (especially under a lot of dynamic_cast used in wrong context)
- Removed fixed pipeline (deprecated by Microsoft since DX10)
- Many other minor bug fixed.
With this patch, you don't need DirectX SDK installed anymore. It's deprecated as well. You just need Visual Studio with its windows SDK.
Everything is inside d3d9.h/d3dcompiler.h -> d3d9.lib/d3dcompiler.lib
So, to try this patch, remove from linker input d3dx9.lib and dxerr.lib and DX_SDK includes to avoid conflicts and errors during compile/link.
(You can also remove d3d9.lib input linker because since this is Microsoft specific code, I've included it from #pragma directive inside *.cpp)
To remove fixed pipeline, I've used the same method used by Luis Anton Rebollo.
So if the community want to merge this part of code with Luis' work, it will be very easy because from high-level GFX layer you just need to make the same calls that Luis already do for OpenGL.
With the actual DirectX9 implementation, the situation should be:
//from precipitation.cpp
if(RenderDevice == OpenGL) //ugly!
GFX->setupGenericShaders(GFXDevice::GSTexture);
else if(RenderDevice == Direct3D9)
GFX->disableShaders();
With this Patch we have just:
GFX->setupGenericShaders(GFXDevice::GSTexture); //Now also DirectX use shaders without FFP
The main branch is:
https://github.com/Lopuska/Torque3D/tree/D3D9_D3D11_R%26D
For DirectX11 situation, I'll start a new thread.
byee!
Lopuska
I'm Lopuska, I'm from Italy.
I'm taking some of my time to try a conversion of Torque3D from DirectX9 to DirectX11.
This is my current status, there's still a lot of work to do...
I don't have many times in this period, if anyone would like to help me for this big task it would be great!
Before that, I've done a lot of code refactoring on D3D9 layer, also to make porting to D3D11 easier.
Here there are change list about DirectX9 refactoring:
- Better *.cpp organization / code cleaning
- Removed D3DX calls dependencies. (deprecated by Microsoft)
- Removed D3D9 XBOX360 old reference.
- Shader/Constant buffer refactor with a custom parser.
- gfxD3D9Shader total refactor.
- Mipmap autogen fixes
- Minor fixes under cubemap
- Speed improved on texture loading
- Removed 24bit format (deprecated since DX10) (i convert it to 32bit)
There is a better explanation about it on code as comment.
- Some performance improvement (especially under a lot of dynamic_cast used in wrong context)
- Removed fixed pipeline (deprecated by Microsoft since DX10)
- Many other minor bug fixed.
With this patch, you don't need DirectX SDK installed anymore. It's deprecated as well. You just need Visual Studio with its windows SDK.
Everything is inside d3d9.h/d3dcompiler.h -> d3d9.lib/d3dcompiler.lib
So, to try this patch, remove from linker input d3dx9.lib and dxerr.lib and DX_SDK includes to avoid conflicts and errors during compile/link.
(You can also remove d3d9.lib input linker because since this is Microsoft specific code, I've included it from #pragma directive inside *.cpp)
To remove fixed pipeline, I've used the same method used by Luis Anton Rebollo.
So if the community want to merge this part of code with Luis' work, it will be very easy because from high-level GFX layer you just need to make the same calls that Luis already do for OpenGL.
With the actual DirectX9 implementation, the situation should be:
//from precipitation.cpp
if(RenderDevice == OpenGL) //ugly!
GFX->setupGenericShaders(GFXDevice::GSTexture);
else if(RenderDevice == Direct3D9)
GFX->disableShaders();
With this Patch we have just:
GFX->setupGenericShaders(GFXDevice::GSTexture); //Now also DirectX use shaders without FFP
The main branch is:
https://github.com/Lopuska/Torque3D/tree/D3D9_D3D11_R%26D
For DirectX11 situation, I'll start a new thread.
byee!
Lopuska
johxz