[1.12.11] RenderingAPIException with DX9 Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
Pellaeon
Goblin
Posts: 230
Joined: Thu Apr 28, 2011 12:23 pm
x 28

[1.12.11] RenderingAPIException with DX9

Post by Pellaeon »

Ogre Version: 1.12.11
Operating System: Win10 x64
Render System: DX9

Hi,

today, I migrated from Ogre 1.12.9 to 1.12.11. My program runs as expected when using the DX11 renderer.
But when switching to DX9, nothing is rendered. First, renderOneFrame throws an RenderingAPIException which says 'Failed to set index buffer'. After this, the second call and every further calls of renderOneFrame throw exceptions which say 'Error beginning frame :Invalid call'.

Which changes from 1.12.9 to 1.12.11 could lead to this behaviour? I am clueless where to start with the error search. I also attached my log file. There are only two warnings regarding missing materials, but no hard error.

Best regards
Attachments
Ogre.log
(15.55 KiB) Downloaded 40 times
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1075
Contact:

Re: [1.12.11] RenderingAPIException with DX9

Post by paroj »

I would start looking around this commit:
https://github.com/OGRECave/ogre/pull/1 ... 0c56988a23

note, that things work as expected with NVIDIA & D3D9 using SampleBrowser for me.
Pellaeon
Goblin
Posts: 230
Joined: Thu Apr 28, 2011 12:23 pm
x 28

Re: [1.12.11] RenderingAPIException with DX9

Post by Pellaeon »

paroj wrote: Mon Feb 15, 2021 5:05 pm I would start looking around this commit:
https://github.com/OGRECave/ogre/pull/1 ... 0c56988a23

note, that things work as expected with NVIDIA & D3D9 using SampleBrowser for me.
Hum, I am not really familiar with the internals of Ogre. Normally, I "only" use it.
The first exception is thrown in OgreD3D9RenderSystem.cpp in line 3254 (getActiveD3D9Device()->SetIndices):

Code: Select all

HRESULT hr;
if( op.useIndexes )
{
D3D9HardwareBuffer* d3dIdxBuf = op.indexData->indexBuffer->_getImpl<D3D9HardwareBuffer>();
hr = getActiveD3D9Device()->SetIndices( (IDirect3DIndexBuffer9*)d3dIdxBuf->getD3D9Resource() );
if (FAILED(hr))
{
      OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR, "Failed to set index buffer", "D3D9RenderSystem::_render" );
}
SetIndices returns "0x8876086c", which results in the exception. What could trigger this failure? Problems with the model data? But DX11 works fine with the same data, and Ogre 1.12.9 works also fine.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1075
Contact:

Re: [1.12.11] RenderingAPIException with DX9

Post by paroj »

Pellaeon wrote: Tue Feb 16, 2021 10:55 am
paroj wrote: Mon Feb 15, 2021 5:05 pm I would start looking around this commit:
https://github.com/OGRECave/ogre/pull/1 ... 0c56988a23

note, that things work as expected with NVIDIA & D3D9 using SampleBrowser for me.
Hum, I am not really familiar with the internals of Ogre. Normally, I "only" use it.
yes, i meant that you could try going back to that commit & the parent of that and try whether any of them work. This would narrow down what to look at.
Unfortunately, I copied the wrong link. This one gives you the correct hashes:
https://github.com/OGRECave/ogre/commit ... cb7b8541e4

right now we merely know what the exception already told us.
Pellaeon
Goblin
Posts: 230
Joined: Thu Apr 28, 2011 12:23 pm
x 28

Re: [1.12.11] RenderingAPIException with DX9

Post by Pellaeon »

Ok, I hoped for a more effective solution than trying out one commit after the other. Very time-consuming :(

I compiled and tested Ogre 1.12.10 (only changing the linked libraries and the DLL files, nothing changed in my own source). Both, DX9 and DX11 work fine. So it must be a change from .10 to .11.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1075
Contact:

Re: [1.12.11] RenderingAPIException with DX9

Post by paroj »

Pellaeon wrote: Tue Feb 16, 2021 5:10 pm Ok, I hoped for a more effective solution than trying out one commit after the other. Very time-consuming :(
"git bisect" tells me its 6 steps for inspecting all commits in the range v1.12.10..v1.12.11 - but I am pretty sure we can focus on the one I referenced. You just did 1 step with compiling 1.12.10, so I would say thats "reasonable" time-consuming.
Pellaeon
Goblin
Posts: 230
Joined: Thu Apr 28, 2011 12:23 pm
x 28

Re: [1.12.11] RenderingAPIException with DX9

Post by Pellaeon »

paroj wrote: Tue Feb 16, 2021 5:45 pm "git bisect" tells me its 6 steps for inspecting all commits in the range v1.12.10..v1.12.11 - but I am pretty sure we can focus on the one I referenced. You just did 1 step with compiling 1.12.10, so I would say thats "reasonable" time-consuming.
Ah ok, I read "108 additions and 628 deletions. ". That scared me^^ 6 possible intermediate steps are of course much better than 108 :D
Pellaeon
Goblin
Posts: 230
Joined: Thu Apr 28, 2011 12:23 pm
x 28

Re: [1.12.11] RenderingAPIException with DX9

Post by Pellaeon »

paroj wrote:yes, i meant that you could try going back to that commit & the parent of that and try whether any of them work. This would narrow down what to look at.
Unfortunately, I copied the wrong link. This one gives you the correct hashes:
https://github.com/OGRECave/ogre/commit ... cb7b8541e4
Ok, the given commit results in the described exceptions, but the parent works.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1075
Contact:

Re: [1.12.11] RenderingAPIException with DX9

Post by paroj »

Pellaeon
Goblin
Posts: 230
Joined: Thu Apr 28, 2011 12:23 pm
x 28

Re: [1.12.11] RenderingAPIException with DX9

Post by Pellaeon »

paroj wrote: Wed Feb 17, 2021 11:15 pm does this help?
https://github.com/OGRECave/ogre/pull/1 ... c8af3b7c06
This change results in a compile error: ..\..\..\..\RenderSystems\Direct3D9\src\OgreD3D9HardwareBuffer.cpp(316,92): error C2664: "HRESULT IDirect3DIndexBuffer9::GetDesc(D3DINDEXBUFFER_DESC *)" : Konvertierung von Argument 1 von "D3DVERTEXBUFFER_DESC *" in "D3DINDEXBUFFER_DESC *" nicht möglich (Can't convert D3DVERTEXBUFFER_DESC * to D3DINDEXBUFFER_DESC *).

I could create a local variable and use this instead. But mBufferDesc is a member variable and used in other methods. So I suppose the description, which is fetched in this lines, is needed in other methods?! I suppose, it is necessary to discting between vertex and index buffer every time when mBufferDesc is used in the whole cpp file?


edit: I did a small hack for testing purpose in the else branch: hr = static_cast<IDirect3DIndexBuffer9*>(bufferResources->mBuffer)->GetDesc(reinterpret_cast<D3DINDEXBUFFER_DESC*>(&mBufferDesc));

This compiles and starts. The exceptions still occur.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1075
Contact:

Re: [1.12.11] RenderingAPIException with DX9

Post by paroj »

that commit actually broke several things. You will need all D3D9 related changes from this pull:
https://github.com/OGRECave/ogre/pull/1895
Pellaeon
Goblin
Posts: 230
Joined: Thu Apr 28, 2011 12:23 pm
x 28

Re: [1.12.11] RenderingAPIException with DX9

Post by Pellaeon »

paroj wrote: Thu Feb 18, 2021 7:47 pm that commit actually broke several things. You will need all D3D9 related changes from this pull:
https://github.com/OGRECave/ogre/pull/1895
This worked. Thank you very much!

Best regards
Post Reply