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.

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

Postby chincillya » Mon Jan 12, 2009 7:59 am

We are currently in the process of moving to a new appartment, and of course the net does not work there right now. I'll get back to you ASAP.

Thanks!
"Black holes are the result of God dividing by zero."

http://www.sebastian-ahlman.fi/
chincillya
Halfling
 
Posts: 97
Kudos: 3
Joined: 19 Dec 2004
Location: Finland

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

Postby Red5_StandingBy » Mon Jan 19, 2009 12:51 pm

Hi,

I have just started using the DirectX 10 render system. I came across a problem related with constant buffer updates. In my test app, I have two different meshes with different materials that use the same vertex program. It seems the vertex program input parameters are not updated correctly. Debugging shows that in the D3D10HLSLProgram::getConstantBuffer() function, there is an "if" check:

if (!iter->wasInit)

that controls updating the source address for shader parameters. After the first render for the first mesh, the second time getConstantBuffer() is called for the vertex program, the iter->src variable is not updated. So for example, same world matrices are applied to all meshes, etc. When I remove the "if" check, everything is fine.

Thanks in advance for your ideas.
User avatar
Red5_StandingBy
Greenskin
 
Posts: 109
Kudos: 0
Joined: 26 Jun 2006
Location: Turkey

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

Postby Assaf Raman » Mon Jan 19, 2009 1:13 pm

Can you create a small sample of this and post it?
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
 
Posts: 3089
Kudos: 78
Joined: 11 Apr 2006
Location: TLV, Israel

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

Postby Red5_StandingBy » Mon Jan 19, 2009 2:29 pm

Hi,

Here is a link to a set of meshes/materials that I use in my test:
http://rapidshare.com/files/185979396/TestMedia.zip

In any simple Ogre demo app (say Demo_EnvMapping), you can add the following and see the results with the "D3D10HLSLProgram::getConstantBuffer() ... if (!iter->wasInit)" code deleted.

Code: Select all
void createScene(void)
    {
      Entity *entCyl = mSceneMgr->createEntity("cyl", "Cylinder_01.mesh");
      Ogre::SceneNode *nodeCyl = mSceneMgr->getRootSceneNode()->createChildSceneNode ();
      nodeCyl->attachObject(entCyl);
      nodeCyl->setPosition(-200,100,0);
      
      Entity *entGrid = mSceneMgr->createEntity("grid", "Grid.mesh");
      Ogre::SceneNode *nodeGrid = mSceneMgr->getRootSceneNode()->createChildSceneNode ();
      nodeGrid->attachObject(entGrid);
      nodeGrid->setPosition(200,-100,0);
    }
User avatar
Red5_StandingBy
Greenskin
 
Posts: 109
Kudos: 0
Joined: 26 Jun 2006
Location: Turkey

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

Postby Assaf Raman » Mon Jan 19, 2009 9:43 pm

I see your problem. I will fix it.
Watch out for my OGRE related tweets here.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
 
Posts: 3089
Kudos: 78
Joined: 11 Apr 2006
Location: TLV, Israel

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

Postby Assaf Raman » Mon Jan 19, 2009 9:57 pm

Yes, the iter->wasInit shouldn't be there.
I removed it for now.
We do need to add some "update only if something changed" code and support for multiple constant buffers.
Latest code is in the trunk.

Thanks for your help - you did a great job.

If there is anything else you find along the way - post I will help you as fast as I can.
Watch out for my OGRE related tweets here.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
 
Posts: 3089
Kudos: 78
Joined: 11 Apr 2006
Location: TLV, Israel

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

Postby Red5_StandingBy » Tue Jan 20, 2009 7:28 am

Thanks for the quick fix (and for your hard work in general)

We have a quite complicated DirectX10 rendering plugin for Autodesk Maya. I am trying to port the system to our Ogre based game engine, so I am sure I will be asking for many features along the way. Multiple constant buffers with different update frequencies will be probably first on the list, that is, per scene(cameras,lights), per object(world pos, list of lights affecting object, list of shadow textures), per material(artist parameters) cbuffers.
User avatar
Red5_StandingBy
Greenskin
 
Posts: 109
Kudos: 0
Joined: 26 Jun 2006
Location: Turkey

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

Postby Assaf Raman » Tue Jan 20, 2009 8:14 am

Sounds great.
Watch out for my OGRE related tweets here.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
 
Posts: 3089
Kudos: 78
Joined: 11 Apr 2006
Location: TLV, Israel

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

Postby Red5_StandingBy » Tue Jan 20, 2009 11:46 am

Hi,

I wanted to use PerfHUD with DirectX10 renderer. It did not work with the existing code in OgreD3D10RenderSystem.cpp. So I changed the adapter selection code as described in the PerfHUD user manual:

Code: Select all
// Search for a PerfHUD adapter
UINT nAdapter = 0;
IDXGIAdapter* pAdapter = NULL;
IDXGIAdapter* pSelectedAdapter = mActiveD3DDriver->getDeviceAdapter();
if ( mUseNVPerfHUD )
{
   IDXGIFactory* pDXGIFactory;
      
   HRESULT hr;
   hr = CreateDXGIFactory( __uuidof( IDXGIFactory), (void**)&pDXGIFactory);
         
   if (FAILED(hr))
   {
      OGRE_EXCEPT( Exception::ERR_INTERNAL_ERROR, "A DX10 Compliant Video Card is Required",
         "D3D10RenderSystem::D3D10RenderSystem" );
   }

   // Search for a PerfHUD adapter
   while( pDXGIFactory->EnumAdapters( nAdapter, &pAdapter ) != DXGI_ERROR_NOT_FOUND )
   {
      if ( pAdapter )
      {
         DXGI_ADAPTER_DESC adaptDesc;
         if ( SUCCEEDED( pAdapter->GetDesc( &adaptDesc ) ) )
         {
            const bool isPerfHUD = wcscmp( adaptDesc.Description, L"NVIDIA PerfHUD" ) == 0;
            if ( nAdapter == 0 || isPerfHUD )
            {
               pSelectedAdapter = pAdapter;
            }
            if ( isPerfHUD )
            {
                         driverType = D3D10_DRIVER_TYPE_REFERENCE;
            }
         }
              ++nAdapter;
      }
   }

   pDXGIFactory->Release();
}
ID3D10Device * device;
if(FAILED(D3D10CreateDevice(pSelectedAdapter,driverType ,0,deviceFlags,D3D10_SDK_VERSION, &device)))         
{
   OGRE_EXCEPT( Exception::ERR_INTERNAL_ERROR,
      "Failed to create Direct3D10 object",
      "D3D10RenderSystem::D3D10RenderSystem" );
}


This change did not immediately work though. I got a weird error in the CreateDepthStencilView() call in the OgreD3D10RenderWindow.cpp. A web search revealed a solution at this forum:
http://www.gamedev.net/community/forums ... _id=460082
[See their last post for recommended changes]
Making the changes to creation of depth stencil texture as described above cleared the issue. Now PerfHUD works for me.
( My system: Vista, GeForce GTX 280 driver 180.48, PerfHUD 6.5 Beta)
User avatar
Red5_StandingBy
Greenskin
 
Posts: 109
Kudos: 0
Joined: 26 Jun 2006
Location: Turkey

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

Postby Assaf Raman » Tue Jan 20, 2009 1:02 pm

I will review and commit later today.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
 
Posts: 3089
Kudos: 78
Joined: 11 Apr 2006
Location: TLV, Israel

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

Postby Red5_StandingBy » Tue Jan 20, 2009 2:07 pm

Hi,

Just realized that the issue with CreateDepthStencilView() also appears in D3D10RenderTexture::rebind() when running in PerfHUD. The same solution applies.
User avatar
Red5_StandingBy
Greenskin
 
Posts: 109
Kudos: 0
Joined: 26 Jun 2006
Location: Turkey

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

Postby Assaf Raman » Tue Jan 20, 2009 9:47 pm

I just committed what you wrote about on your last 2 posts on this thread.
Nice job of finding the solution to the "CreateDepthStencilView" problem.
Watch out for my OGRE related tweets here.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
 
Posts: 3089
Kudos: 78
Joined: 11 Apr 2006
Location: TLV, Israel

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

Postby sinbad » Tue Jan 20, 2009 10:24 pm

Red5_StandingBy wrote:Multiple constant buffers with different update frequencies will be probably first on the list, that is, per scene(cameras,lights), per object(world pos, list of lights affecting object, list of shadow textures), per material(artist parameters) cbuffers.


I've been doing some optimisation of params in the trunk already, and one of my next tasks after this is supporting shared parameter sets - ie parameter data which is not owned by a single pass but is referenced externally. Obviously on Dx10 this can be implemented as shared constant buffers (I've been thinking about how to make the mapping structures from shared area to program slot rendersystem-specific ).

The idea would be to make GpuProgramParameters use a rendersystem-supplied memory area as the physical buffer (other rendersystems would just allocate it in CPU memory), and also the option to create a rendersystem-specific binding structure of that parameter set to a given program (default implementation would be just a named or logical/physical mapping, Dx10 would be the binding of a constant buffer).

Still thinking about the practicalities but that's my initial thoughts.

BTW for future reference, can you submit a contributor license agreement please?
User avatar
sinbad
OGRE Founder (Retired)
OGRE Founder (Retired)
 
Posts: 25870
Kudos: 63
Joined: 06 Oct 2002
Location: Guernsey, Channel Islands

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

Postby Red5_StandingBy » Wed Jan 21, 2009 9:41 am

I just got the changes in the trunk about variability of shader params. It seems these changes are very much parallel to what I had in mind (and to our existing DirectX10 renderer). I can make more comments as I familiarize myself more with the DirectX10 renderer.

I sent the contributor license agreement as well.
User avatar
Red5_StandingBy
Greenskin
 
Posts: 109
Kudos: 0
Joined: 26 Jun 2006
Location: Turkey

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

Postby Red5_StandingBy » Wed Jan 21, 2009 12:57 pm

@sinbad: I tried to run my DirectX9 renderer based game with the trunk version. I got into a few problems in my custom scene manager class. One of them is rendering errors in reflective surfaces and was solved by changing the following line SceneManager::renderSingleObject() (line2982)

Code: Select all
mGpuParamsDirty |= (uint16)GPV_PER_OBJECT;


with

Code: Select all
mGpuParamsDirty |= ( (uint16)GPV_PER_OBJECT | (uint16)GPV_GLOBAL );


I need more debugging to do, but a very "early guess" is the change might be needed to update view matrices (which are GPV_GLOBAL).

But other than that, the GPVs seem to work. I had added some auto params of mine own to GpuProgramParameters class and they all seem to work as expected.

@Assaf:
I came across this when testing shadow textures with R32 format. The D3D10Mappings::_getPF() method has many PF_UNKNOWN value returns. Is there a reason for not defining those formats?
Ex:DXGI_FORMAT_R32_FLOAT --> PF_FLOAT32_R
User avatar
Red5_StandingBy
Greenskin
 
Posts: 109
Kudos: 0
Joined: 26 Jun 2006
Location: Turkey

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

Postby sinbad » Wed Jan 21, 2009 5:44 pm

I've split your GPU_GLOBAL issue off to another topic.
viewtopic.php?f=4&t=47309
User avatar
sinbad
OGRE Founder (Retired)
OGRE Founder (Retired)
 
Posts: 25870
Kudos: 63
Joined: 06 Oct 2002
Location: Guernsey, Channel Islands

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

Postby chincillya » Thu Jan 22, 2009 8:02 pm

Sorry for the long delay. Our appartment is still a complete mess, you know how it is...

Anyway, I have a new error message from my app that works with DX9 and OpenGL but not with DX10. The following:

Code: Select all
D3D10: CORRUPTION: ID3D10Device::CreateTexture2D: pDesc has Miplevels (value = -2147483648) and ArraySize (value = 1) that are too large when multiplied. [ MISCELLANEOUS CORRUPTION #13: CORRUPTED_PARAMETER1 ]


gets output when running the following code:

Code: Select all
Ogre::Entity* mesh = m_SceneManager->createEntity("menu_board", "menu_board.mesh");


Any idea on how to fix this? If I understand correctly this has to do with the textures that menu_board.mesh reference, but I don't quite undestand what is wrong with them.

Thanks!
"Black holes are the result of God dividing by zero."

http://www.sebastian-ahlman.fi/
chincillya
Halfling
 
Posts: 97
Kudos: 3
Joined: 19 Dec 2004
Location: Finland

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

Postby Assaf Raman » Fri Jan 23, 2009 3:42 pm

can you post the textures that menu_board.mesh references and the material file?
Watch out for my OGRE related tweets here.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
 
Posts: 3089
Kudos: 78
Joined: 11 Apr 2006
Location: TLV, Israel

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

Postby chincillya » Sat Jan 24, 2009 3:28 pm

"Black holes are the result of God dividing by zero."

http://www.sebastian-ahlman.fi/
chincillya
Halfling
 
Posts: 97
Kudos: 3
Joined: 19 Dec 2004
Location: Finland

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

Postby Assaf Raman » Sun Jan 25, 2009 5:45 pm

I didn't get your error.
Can you help?
Watch out for my OGRE related tweets here.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
 
Posts: 3089
Kudos: 78
Joined: 11 Apr 2006
Location: TLV, Israel

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

Postby chincillya » Tue Jan 27, 2009 6:23 am

So you tried the material and it worked? That's weird. I'll compile the app with DX10 enabled so you can test. It'll take some work though. I'll get back to you.
"Black holes are the result of God dividing by zero."

http://www.sebastian-ahlman.fi/
chincillya
Halfling
 
Posts: 97
Kudos: 3
Joined: 19 Dec 2004
Location: Finland

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

Postby Red5_StandingBy » Mon Feb 02, 2009 8:34 am

Hi,

Macros specified with "preprocessor_defines" was not working for DX10, so I added the code from DX9 for adding macro arrays to D3DX10CompileFromMemory() call. It seems to work.
A simple copy/paste, but here is also a patch file.

http://www.momentum-dmt.com/Development/Ogre/AddMacroArrayToShaderCompile.patch
User avatar
Red5_StandingBy
Greenskin
 
Posts: 109
Kudos: 0
Joined: 26 Jun 2006
Location: Turkey

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

Postby Assaf Raman » Mon Feb 02, 2009 8:44 am

I will review and apply later today.
Watch out for my OGRE related tweets here.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
 
Posts: 3089
Kudos: 78
Joined: 11 Apr 2006
Location: TLV, Israel

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

Postby Red5_StandingBy » Mon Feb 02, 2009 12:43 pm

Hi,

I realized "column_major_matrices" directive in program definitions was not applied. Again, I did a little copy/paste from DX9 renderer. It seems to work for me.

Here is a patch for it:

http://www.momentum-dmt.com/Development ... ices.patch
User avatar
Red5_StandingBy
Greenskin
 
Posts: 109
Kudos: 0
Joined: 26 Jun 2006
Location: Turkey

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

Postby Red5_StandingBy » Mon Feb 02, 2009 2:41 pm

Hi,

I was bitten by the code in D3D10RenderSystem::_convertProjectionMatrix(). Somehow it all got commented out. Is there a reason for it?
User avatar
Red5_StandingBy
Greenskin
 
Posts: 109
Kudos: 0
Joined: 26 Jun 2006
Location: Turkey

PreviousNext

Return to Developer talk

Who is online

Users browsing this forum: No registered users and 2 guests