DirectX 11 render system - work-in-progress

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: DirectX 10 render system - work-in-progress

Post by Assaf Raman »

I am not sure it is needed anymore.
Watch out for my OGRE related tweets here.
User avatar
Red5_StandingBy
Greenskin
Posts: 109
Joined: Mon Jun 26, 2006 1:06 pm
Location: Turkey

Re: DirectX 10 render system - work-in-progress

Post by Red5_StandingBy »

Hi,

It may be practically unneeded, but as long as there is the following interface on Frustum class:
getProjectionMatrix()
getProjectionMatrixRS()

, the _convertProjectionMatrix() call should change the depth range/handedness for both DX9 and DX10 renderers. Then getProjectionMatrixRS() calls will be conistent for all DX render systems. Apps can get the API independent proj matrix with getProjectionMatrix() anyway.

My purpose is to use the same code base for both renderers of my game engine, specifically shadow camera setup classes. That is why I ran into this problem.
User avatar
Red5_StandingBy
Greenskin
Posts: 109
Joined: Mon Jun 26, 2006 1:06 pm
Location: Turkey

Re: DirectX 10 render system - work-in-progress

Post by Red5_StandingBy »

Hi,

I came across another problem. In D3D10HLSLProgram::processParamElement() there is a GpuConstantDefinition object called def. Its logicalIndex member is not updated. This caused a problem in release builds (Curiously, no problem in debug, maybe a coincidence). So I had to add the following line:

Code: Select all

def.logicalIndex = paramIndex;
right after object definition of def.

Also as a patch at:
http://www.momentum-dmt.com/Development ... date.patch
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: DirectX 10 render system - work-in-progress

Post by Assaf Raman »

I sorry, I am having a hard week and didn't get to this yet.
Watch out for my OGRE related tweets here.
User avatar
Red5_StandingBy
Greenskin
Posts: 109
Joined: Mon Jun 26, 2006 1:06 pm
Location: Turkey

Re: DirectX 10 render system - work-in-progress

Post by Red5_StandingBy »

No problem. I am now able to run a heavy demo scene with basic shadowed light shaders.

I can compare DX9-DX10 versions of my demo game on a frame basis (almost). The number of API calls/events is greatly reduced with DX10, from 157000 to 25000 on a specific viewpoint where the game is CPU bound. The overall performance improvement is negligible, probably due to many other things, nevertheless I am quite happy and optimistic about where DX10 is going.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: DirectX 10 render system - work-in-progress

Post by Assaf Raman »

Red5_StandingBy wrote:I can compare DX9-DX10 versions of my demo game on a frame basis (almost). The number of API calls/events is greatly reduced with DX10, from 157000 to 25000 on a specific viewpoint where the game is CPU bound. The overall performance improvement is negligible, probably due to many other things, nevertheless I am quite happy and optimistic about where DX10 is going.
Thanks man, you made my day. I have been working on the d3d10 support for the last year – and you are the first to really use it – to hear that makes me feel that my time has not been a waste.
Watch out for my OGRE related tweets here.
Nema
Gnoblar
Posts: 1
Joined: Fri Feb 06, 2009 9:34 am

Re: DirectX 10 render system - work-in-progress

Post by Nema »

Assaf, you have made an AWESOME job!

The only thing that hold me back using the newest sources with all your great DX10 improvements is that I was waiting for MOGRE to catch up with newest c++ codes. Today there are already about 100x more C# coders than C++ coders, and one way to really push Ogre as an engine would be to seriously care about C# wrapping. However, this is not the right place to complain about MOGRE.

Keep up the excellent work. I am 100% sure it will all pay out for you rather soon!
User avatar
stoneCold
OGRE Expert User
OGRE Expert User
Posts: 867
Joined: Fri Oct 01, 2004 9:13 pm
Location: Carinthia, Austria
x 1

Re: DirectX 10 render system - work-in-progress

Post by stoneCold »

Nema wrote:...Today there are already about 100x more C# coders than C++ coders, ...
<----- Lolz :wink:

Kudos to you Assaf, you did a really great job there.
cheers
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: DirectX 10 render system - work-in-progress

Post by Assaf Raman »

I have been sick the last few days. I have a low fever and such. I felt better for a few hours - so I reviewed and committed your patches.
Thank for the contribution, you are improving the render system for us all. :D
Watch out for my OGRE related tweets here.
User avatar
Red5_StandingBy
Greenskin
Posts: 109
Joined: Mon Jun 26, 2006 1:06 pm
Location: Turkey

Re: DirectX 10 render system - work-in-progress

Post by Red5_StandingBy »

Hi again,

I came across another small and interesting issue. In release mode, when going fullscreen, I got a crash. It seems the crash is due to the DXGI_MODE_SCALING_STRETCHED flag in D3D10RenderWindow::createD3DResources() function. I am almost certain I was doing release-fullscreen tests before without crashes. Anyway, leaving the flag at default value of 0 works for me.
User avatar
Red5_StandingBy
Greenskin
Posts: 109
Joined: Mon Jun 26, 2006 1:06 pm
Location: Turkey

Re: DirectX 10 render system - work-in-progress

Post by Red5_StandingBy »

Hi,

I have one more issue that is related with keeping same code base for DX9 and DX10 renderers. The issue is about RenderSystem::_beginFrame(). The DX9 version calls mpD3DDevice->BeginScene() in _beginFrame(). This approach brings a little performance overhead, since _beginFrame() is called for each render target, eg. each shadow texture update. However, it should be called once per backbuffer swap ( call of mpD3DDevice->Present() ) . I recorded several milliseconds improvement in CPU limited scenes by configuring my custom scene manager to call _beginFrame() once per "application frame". For DX10 to work, one change is needed. The only line in D3D10RenderSystem::_beginFrame():

Code: Select all

if( !mActiveViewport )
   OGRE_EXCEPT( Exception::ERR_INTERNAL_ERROR, "Cannot begin frame - no viewport selected.", "D3D10RenderSystem::_beginFrame" );
needs to be removed for this approach to work.
User avatar
Red5_StandingBy
Greenskin
Posts: 109
Joined: Mon Jun 26, 2006 1:06 pm
Location: Turkey

Re: DirectX 10 render system - work-in-progress

Post by Red5_StandingBy »

Hi,

I have been trying to improve performance of DX10 wrt DX9, and I have achieved some nice results. Based on my test scene, the following patch improves CPU performance of an average batch for a typical scene render from 0.120 ms to 0.060 ms and for shadow renders from 0.030 ms to 0.020 ms. I have a particular CPU-bound test case where DX9 does 55fps and DX10 now does 80fps. Major changes are in D3D10HLSLProgram::getConstantBuffer() and spread throughout D3D10RenderSystem. I might have got carried away in some places and cut some corners, so any feedback would be very valuable.

http://www.momentum-dmt.com/Development ... ents.patch
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: DirectX 10 render system - work-in-progress

Post by Assaf Raman »

I will review as soon as I can.
Watch out for my OGRE related tweets here.
User avatar
Red5_StandingBy
Greenskin
Posts: 109
Joined: Mon Jun 26, 2006 1:06 pm
Location: Turkey

Re: DirectX 10 render system - work-in-progress

Post by Red5_StandingBy »

I want to note a problem that I encountered while trying to get hw skeletal animation working. When I ported the DX9 vertex shaders to DX10 directly, I got weird results. After some debugging, the issue appeared to be related with BLENDINDICES vertex element semantic. I use the semantic as:

Code: Select all

   float4 blendIdx		: BLENDINDICES;
in DX9 and there is no problem. However, it seems the float4 declaration does not work with DX10, because Ogre uses blendindices as UBYTE4 values. I think DX9 automatically converts all integer types to float, but DX10 does not. So the DX10 vertex shader receives a packed DWORD ( 4 unsigned chars) in the 4-component vector assigned to the BLENDINDICES semantic. As a workaround, I modified Mesh::compileBoneAssignments() in OgreMesh.cpp by changing all char/UBYTE4 declarations to float. This way both of my DX9 and DX10 hw skeletal animation tests run fine. However, I need to look for a better understanding/solution of the issue.
[EDIT] Ogre SkeletalAnimation demo does not work with this workaround, even though the shader of the demo uses the same "float4" declaration for indices.
Last edited by Red5_StandingBy on Thu Feb 19, 2009 3:28 pm, edited 2 times in total.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: DirectX 10 render system - work-in-progress

Post by Assaf Raman »

I just reviewed your patch, can you explain more about the change you made to D3D10RenderSystem::_setSceneBlending? There is a big if there that I don't like...
Watch out for my OGRE related tweets here.
User avatar
Red5_StandingBy
Greenskin
Posts: 109
Joined: Mon Jun 26, 2006 1:06 pm
Location: Turkey

Re: DirectX 10 render system - work-in-progress

Post by Red5_StandingBy »

Right, the "big if" is not needed. A smaller "if" check would be fine:

Code: Select all

if (
	( mBlendDesc.SrcBlend != D3D10Mappings::get(sourceFactor) ) ||
	( mBlendDesc.DestBlend != D3D10Mappings::get(destFactor) ) ||
	( mBlendDesc.AlphaToCoverageEnable != mSceneAlphaToCoverage ) 				
)
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: DirectX 10 render system - work-in-progress

Post by Assaf Raman »

I will commit later today.
Watch out for my OGRE related tweets here.
User avatar
Red5_StandingBy
Greenskin
Posts: 109
Joined: Mon Jun 26, 2006 1:06 pm
Location: Turkey

Re: DirectX 10 render system - work-in-progress

Post by Red5_StandingBy »

Hi,

I cannot get the debug overlay working. I see from previous posts that it does work in standard Ogre demos. I run the demos in PerfHUD and see that the textures and (fixed function emu.)shaders are bound correctly for the overlay panel primitives but nothing gets drawn. Assaf can you confirm that overlays work for you with latest version, before I do more debugging?
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: DirectX 10 render system - work-in-progress

Post by Assaf Raman »

Last night I was about to commit your patch - I applied it, but when I tested it - I saw that I only see the overlay and not the rest of the scene in the particle demo that is a part of OGRE. I reverted the render system to before your latest patch - and the sample seems to work. I didn't find the time yet to see what the problem is - but I suspect that your latest patch (the one I didn't commit yet) is the problem.
Watch out for my OGRE related tweets here.
User avatar
Red5_StandingBy
Greenskin
Posts: 109
Joined: Mon Jun 26, 2006 1:06 pm
Location: Turkey

Re: DirectX 10 render system - work-in-progress

Post by Red5_StandingBy »

I updated everything (Ogre, plugins,render systems) from repository and did a clean rebuild for all. In particle demo with DX10 renderer I see nothing. Anyway, will have to look at it next week...
User avatar
Noman
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 714
Joined: Mon Jan 31, 2005 7:21 pm
Location: Israel
x 2
Contact:

Re: DirectX 10 render system - work-in-progress

Post by Noman »

http://developer.nvidia.com/object/cg_2_2_beta.html

CG 2.2 beta released with
DirectX10 and GLSL geometry profiles
It will now be much easier to port the demos to DX10 render system, which will make it much easier to add geometry shader support, cause of easier testing. I might do it soon...
User avatar
Red5_StandingBy
Greenskin
Posts: 109
Joined: Mon Jun 26, 2006 1:06 pm
Location: Turkey

Re: DirectX 10 render system - work-in-progress

Post by Red5_StandingBy »

Hi,

I have not been able to work on DX10 renderer lately because of changing jobs. I hope to start working again in a month. Happy coding ...
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: DirectX 10 render system - work-in-progress

Post by Assaf Raman »

March 2009 DirectX SDK Now Available

I am downloading now and will see later if they added hardware acceleration to d3d11.
Watch out for my OGRE related tweets here.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: DirectX 10 render system - work-in-progress

Post by Assaf Raman »

I still get this message when I try to run a d3d11 sample:
Image

I guess we will have to wait for the November 2009 MS DX SDK release for d3d11.

Too bad.
Watch out for my OGRE related tweets here.
User avatar
ahmedismaiel
OGRE Contributor
OGRE Contributor
Posts: 217
Joined: Wed Jan 25, 2006 11:16 pm
Location: Redmond,WA

Re: DirectX 10 render system - work-in-progress

Post by ahmedismaiel »

there is another one coming in june ,i'm wondering which hardware available today support any of directx11 features(i this 280 doesn't)
Post Reply