Ogre`s Windows 8 UI Style port (now commited to OGRE!)

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: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Wolfmanfx » Wed Aug 22, 2012 11:27 am

The FindDirectX.cmake is already a mess the comments in the header do not reflect all created vars like DirectX_D3D11_INCLUDE_DIR / DirectX_D3D11_LIBRARIES the question is if we want to separate the detection of Dx9 and Dx11 or we can also fix it inside this one file - wait what Eugene says.
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
 
Posts: 1525
Kudos: 107
Joined: 03 Feb 2006
Location: Austria - Leoben

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Assaf Raman » Wed Aug 22, 2012 11:45 am

good idea to wait for him - as he is the only real user we have for now for the d3d11 render system.
Watch out for my OGRE related tweets here.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
 
Posts: 3092
Kudos: 79
Joined: 11 Apr 2006
Location: TLV, Israel

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Eugene » Wed Aug 22, 2012 12:04 pm

Assaf Raman wrote:How do we fix this?


Win8 SDK does not contains D3DX library at all. So, to use it you should install old DirectX SDK onto the Win8 machine, and than the question is:
Which one Ogre should select if both are installed, the new one or the old one?

If Ogre select new, than D3DX is unavailable, otherwise Direct3D 11.1 features are missing, including WinRT support.
Or may be Ogre should detect both and do cherry-picking (nightmare for maintenance)?
Or may be Ogre should avoid using D3DX if it is unavailable, as it is deprecated by MS and missing in the latest SDK (that is what D3D11 RS do now in WinRT mode, but it could be done in Win32 mode too, basing on _WIN32_WINNT >= _WIN32_WINNT_WIN8 instead of OGRE_PLATFORM == OGRE_PLATFORM_WINRT)?

You say me, as there are no easy answers.
Last edited by Eugene on Wed Aug 22, 2012 12:08 pm, edited 1 time in total.
User avatar
Eugene
OGRE Team Member
OGRE Team Member
 
Posts: 182
Kudos: 36
Joined: 24 Mar 2008
Location: Odessa, Ukraine

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Assaf Raman » Wed Aug 22, 2012 12:07 pm

A new option with the new as the default - but an option to change it with just a check box in cmake
Watch out for my OGRE related tweets here.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
 
Posts: 3092
Kudos: 79
Joined: 11 Apr 2006
Location: TLV, Israel

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Wolfmanfx » Wed Aug 22, 2012 12:13 pm

I will fix temp. atm so it use the old search paths for dx9 and the new ones for the dx11 stuff - maybe we should remove d3dx9 stuff i do not know which features we use atm?
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
 
Posts: 1525
Kudos: 107
Joined: 03 Feb 2006
Location: Austria - Leoben

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Eugene » Wed Aug 22, 2012 12:25 pm

Assaf Raman wrote:A new option with the new as the default - but an option to change it with just a check box in cmake


Is it OK that with VS2012 and fresh SDK (with D3D9 headers but without D3DX9/10/11) D3D9 RenderSystem can not be built due to the dependency on the deprecated technology?
User avatar
Eugene
OGRE Team Member
OGRE Team Member
 
Posts: 182
Kudos: 36
Joined: 24 Mar 2008
Location: Odessa, Ukraine

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Eugene » Wed Aug 22, 2012 12:28 pm

Wolfmanfx wrote:I will fix temp. atm so it use the old search paths for dx9 and the new ones for the dx11 stuff - maybe we should remove d3dx9 stuff i do not know which features we use atm?


Yes, removing D3DX at all is a good idea. Basically D3DX is used to compile shaders and to load DDS textures. Compiling can be done via D3DCompile API (D3DX here is just a thin wrapper around it, so can be bypassed without problems as is done in D3D11 RS).
DDS loading code from D3DX was open sourced by MS http://blogs.msdn.com/b/chuckw/archive/2011/10/28/directxtex.aspx, so it could be incorporated into the Ogre in both D3D9/11 RS, but even without it DDS still could be loaded without D3DX library via FreeImage codepath (but compressed textures would be unpacked :( ).

Also DXGetErrorString could be avoided or inline version from MS could be used http://blogs.msdn.com/b/chuckw/archive/2012/04/24/where-s-dxerr-lib.aspx
User avatar
Eugene
OGRE Team Member
OGRE Team Member
 
Posts: 182
Kudos: 36
Joined: 24 Mar 2008
Location: Odessa, Ukraine

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Assaf Raman » Wed Aug 22, 2012 12:41 pm

Eugene wrote:
Assaf Raman wrote:A new option with the new as the default - but an option to change it with just a check box in cmake


Is it OK that with VS2012 and fresh SDK (with D3D9 headers but without D3DX9/10/11) D3D9 RenderSystem can not be built due to the dependency on the deprecated technology?

No, it is still in very common use.
Watch out for my OGRE related tweets here.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
 
Posts: 3092
Kudos: 79
Joined: 11 Apr 2006
Location: TLV, Israel

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Eugene » Wed Aug 22, 2012 12:44 pm

Assaf Raman wrote:
Eugene wrote:Is it OK that with VS2012 and fresh SDK (with D3D9 headers but without D3DX9/10/11) D3D9 RenderSystem can not be built due to the dependency on the deprecated technology?
No, it is still in very common use.

Yeah. I think so too, so D3D9 RS should be buildable using latest SDK that does not contains D3DX9 library.
User avatar
Eugene
OGRE Team Member
OGRE Team Member
 
Posts: 182
Kudos: 36
Joined: 24 Mar 2008
Location: Odessa, Ukraine

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Assaf Raman » Wed Aug 22, 2012 1:10 pm

You can install the June 2010 SDK - side by side to the latest SDK.
Watch out for my OGRE related tweets here.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
 
Posts: 3092
Kudos: 79
Joined: 11 Apr 2006
Location: TLV, Israel

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Eugene » Wed Aug 22, 2012 3:39 pm

Eugene wrote:
Wolfmanfx wrote:I will fix temp. atm so it use the old search paths for dx9 and the new ones for the dx11 stuff - maybe we should remove d3dx9 stuff i do not know which features we use atm?


Yes, removing D3DX at all is a good idea. Basically D3DX is used to compile shaders and to load DDS textures. Compiling can be done via D3DCompile API (D3DX here is just a thin wrapper around it, so can be bypassed without problems as is done in D3D11 RS).
DDS loading code from D3DX was open sourced by MS http://blogs.msdn.com/b/chuckw/archive/2011/10/28/directxtex.aspx, so it could be incorporated into the Ogre in both D3D9/11 RS, but even without it DDS still could be loaded without D3DX library via FreeImage codepath (but compressed textures would be unpacked :( ).

Also DXGetErrorString could be avoided or inline version from MS could be used http://blogs.msdn.com/b/chuckw/archive/2012/04/24/where-s-dxerr-lib.aspx


It seems that there are no public analog to the D3DXAssembleShader() API call in d3dcompiler_XX.dll - D3DAssemble() export exist, but it is not documented. So assembling shaders written in assembler is problematic.

P.S. There are mangled name for D3DAssemble func in import library for d3dcompiler_46.dll

Code: Select all
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin>undname.exe ?D3DAssemble@@YGJPBXKPBDPBU_D3D_SHADER_MACRO@@PAUID3DInclude@@IPAPAUID3D10Blob@@4@Z
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation. All rights reserved.

Undecoration of :- "?D3DAssemble@@YGJPBXKPBDPBU_D3D_SHADER_MACRO@@PAUID3DInclude@@IPAPAUID3D10Blob@@4@Z"
is :- "long __stdcall D3DAssemble(void const *,unsigned long,char const *,struct _D3D_SHADER_MACRO const *,struct ID3DInclude *,unsigned int,struct ID3D10Blob * *,struct ID3D10Blob * *)"


So, looking for D3DXCompileShader => D3DCompile transition and having D3DXAssembleShader we can reconstruct D3DAssemble prototype.
Code: Select all
HRESULT WINAPI D3DAssemble(LPCVOID pSrcData, SIZE_T SrcDataSize, LPCSTR pSourceName,
                           const D3D_SHADER_MACRO *pDefines, LPD3DINCLUDE pInclude,
                           UINT Flags,
                           LPD3DBLOB* ppCode, LPD3DBLOB* ppErrorMsgs);


As d3dcompiler_XX.dll is redistributable and D3DAssemble is in import lib for it - we can probably use this API.
User avatar
Eugene
OGRE Team Member
OGRE Team Member
 
Posts: 182
Kudos: 36
Joined: 24 Mar 2008
Location: Odessa, Ukraine

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Eugene » Thu Aug 23, 2012 9:43 am

Wolfmanfx wrote:I will fix temp. atm so it use the old search paths for dx9 and the new ones for the dx11 stuff - maybe we should remove d3dx9 stuff i do not know which features we use atm?


WinRT build was broken on Win8 with VS2012 but without old DirectX SDK due to the this commit

Changeset: 3781 (6957b04487f6) Revert FindDirectX and guard the win8 search path inside OGRE_BUILD_PLATFORM_WIN
https://bitbucket.org/sinbad/ogre/changeset/6957b04487f622d1f1a0211aac280807b783c143
User avatar
Eugene
OGRE Team Member
OGRE Team Member
 
Posts: 182
Kudos: 36
Joined: 24 Mar 2008
Location: Odessa, Ukraine

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Assaf Raman » Thu Aug 23, 2012 9:48 am

@Eugene - we have a real issue here... I think we should use the new MS libs - only when using WinRT compile, we can add an "if" - so for normal build - we will use the normal DX SDK, and for WinRT compile - use the new win8 libs.
Watch out for my OGRE related tweets here.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
 
Posts: 3092
Kudos: 79
Joined: 11 Apr 2006
Location: TLV, Israel

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Wolfmanfx » Thu Aug 23, 2012 9:56 am

@Eugene

I reverted it into it old state but added the WINRT guard to your new search locations otherwise we have a broken build on win7.
The problem is that without the downloadable SDK Dx9 is not buildable and on DX11 we do not have dds loading (yet) - thats really a tough problem here.
Do you know if we can detect win8 platform with CMAKE?
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
 
Posts: 1525
Kudos: 107
Joined: 03 Feb 2006
Location: Austria - Leoben

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Eugene » Thu Aug 23, 2012 9:59 am

Assaf Raman wrote:@Eugene - we have a real issue here... I think we should use the new MS libs - only when using WinRT compile, we can add an "if" - so for normal build - we will use the normal DX SDK, and for WinRT compile - use the new win8 libs.


But I speak about WinRT compile here - as DirectX11 was not detected I have not option to select OGRE_BUILD_PLATFORM_WINRT, so that DirectX search pathes could be searched in another place.

Situation before this patch:
If computer has only old SDK installed - than D3D9 RS could be built
If computer has only new or both SDKs - D3D11 RS in WinRT mode could be built, and with manual switching to the old SDK D3D9 RS could be built.

Now:
If computer has only old SDK installed - than D3D9 RS could be built (the same as before)
If computer has only new SDK - nothing could be built at all, not D3D9 RS nor D3D11 RS in Win32 or WinRT mode as this SDK is not detected at all now (detection code is under if(ALREADY_DETECTED) - chicken and egg problem)
If computer has both SDKs installed - than D3D9 RS could be built
Last edited by Eugene on Thu Aug 23, 2012 10:03 am, edited 2 times in total.
User avatar
Eugene
OGRE Team Member
OGRE Team Member
 
Posts: 182
Kudos: 36
Joined: 24 Mar 2008
Location: Odessa, Ukraine

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Eugene » Thu Aug 23, 2012 10:01 am

Wolfmanfx wrote:@Eugene

I reverted it into it old state but added the WINRT guard to your new search locations otherwise we have a broken build on win7.
The problem is that without the downloadable SDK Dx9 is not buildable and on DX11 we do not have dds loading (yet) - thats really a tough problem here.
Do you know if we can detect win8 platform with CMAKE?


We should detect not a platform but available SDKs.
User avatar
Eugene
OGRE Team Member
OGRE Team Member
 
Posts: 182
Kudos: 36
Joined: 24 Mar 2008
Location: Odessa, Ukraine

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Assaf Raman » Thu Aug 23, 2012 10:02 am

I am not sure about it, explain more what you offer we should do and why.
Watch out for my OGRE related tweets here.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
 
Posts: 3092
Kudos: 79
Joined: 11 Apr 2006
Location: TLV, Israel

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Eugene » Thu Aug 23, 2012 10:09 am

Assaf Raman wrote:I am not sure about it, explain more what you offer we should do and why.


I think, that if only new SDK is available (part of VS2012) - Ogre should be buildable with it, may be without D3D9 RS if D3DX9 is absent on such computer
If both SDKs are available than may be Ogre should be able to detect both of them, and let the user select which one to use.

The point is that both scenarios are broken now, while only second was not yet implemented before.

See:
1. Win 8 computer with only old SDK (VS2010) - was: D3D9 RS OK, D3D11_WINRT RS not OK, now: the same, status quo
2. Win 8 computer with only new SDK (VS2012) - was: D3D9 RS not OK, D3D11_WINRT RS OK, now: D3D9 RS not OK, D3D11_WINRT RS not OK - nothing could be built
3. Win 8 computer with both SDKs (VS2012) - was: D3D9 RS not OK, D3D11_WINRT RS OK, now: D3D9 RS OK, D3D11_WINRT RS not OK - another default, old SDK preferred over the new one.
Last edited by Eugene on Thu Aug 23, 2012 10:15 am, edited 1 time in total.
User avatar
Eugene
OGRE Team Member
OGRE Team Member
 
Posts: 182
Kudos: 36
Joined: 24 Mar 2008
Location: Odessa, Ukraine

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Wolfmanfx » Thu Aug 23, 2012 10:11 am

Yes i see now OGRE_BUILD_PLATFORM_WINRT config option depends on DirectX_D3D11_FOUND so my added guard was useless.
If we not care about the dds stuff inside DX11 we could completely rely on the new SDK if found and if not we use the downloadable SDK this would make it easier.
Btw with script before both builds were broken on my machine i could not build dx11 and dx9 because on my machine these path exists
"C:/Program Files (x86)/Windows Kits/8.0/Include/shared", "C:/Program Files (x86)/Windows Kits/8.0/Include/um"
and there is no d3dx so i could not compile neither of them.
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
 
Posts: 1525
Kudos: 107
Joined: 03 Feb 2006
Location: Austria - Leoben

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Eugene » Thu Aug 23, 2012 10:17 am

Wolfmanfx wrote:Yes i see now OGRE_BUILD_PLATFORM_WINRT config option depends on DirectX_D3D11_FOUND so my added guard was useless.
If we not care about the dds stuff inside DX11 we could completely rely on the new SDK if found and if not we use the downloadable SDK this would make it easier.
Btw with script before both builds were broken on my machine i could not build dx11 and dx9 because on my machine these path exists
"C:/Program Files (x86)/Windows Kits/8.0/Include/shared", "C:/Program Files (x86)/Windows Kits/8.0/Include/um"
and there is no d3dx so i could not compile neither of them.


Yeah, I was focused on WinRT mode, but D3D11 RS in Win32 mode could be easily fixed to be buildable under the new SDK too. At least once I build it on some prerelease version of Win8 for debugging purpose, but there may be broken something since than.

Problem with native DDS loading I`ll fix via open sourced MS implementation, now DDS are loaded via FreeImage code path, that while not ideal but not so bad.
Last edited by Eugene on Thu Aug 23, 2012 10:20 am, edited 1 time in total.
User avatar
Eugene
OGRE Team Member
OGRE Team Member
 
Posts: 182
Kudos: 36
Joined: 24 Mar 2008
Location: Odessa, Ukraine

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Assaf Raman » Thu Aug 23, 2012 10:20 am

But what are the benefits if you are not using WinRT?
Watch out for my OGRE related tweets here.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
 
Posts: 3092
Kudos: 79
Joined: 11 Apr 2006
Location: TLV, Israel

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Wolfmanfx » Thu Aug 23, 2012 10:22 am

Lets assume we fixed DX11 to not use d3dx:

1. DX9 can not build without d3dx so we have to use the downloadable sdk
2. DX11 search first if the new stuff is there if so use it if not try to search for an downloadable sdk and use this

I would create 2 find packages FindDirectX9 and FindDirectX11 so its seperated and clean. What do you think?
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
 
Posts: 1525
Kudos: 107
Joined: 03 Feb 2006
Location: Austria - Leoben

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Assaf Raman » Thu Aug 23, 2012 10:24 am

Until we fix the DX code - we need to use the SDK also for DX11 - if not WinRT.
Watch out for my OGRE related tweets here.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
 
Posts: 3092
Kudos: 79
Joined: 11 Apr 2006
Location: TLV, Israel

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Eugene » Thu Aug 23, 2012 10:29 am

Assaf Raman wrote:But what are the benefits if you are not using WinRT?


C++11, less dependencies as DirectX SDK is integrated with Platform SDK and is available together with VS2012, fresh d3dcompiler, new shader models, .
New Win8 specific desktop APIs - usual benefits of fresh C++ compiler and fresh Platform SDK.
User avatar
Eugene
OGRE Team Member
OGRE Team Member
 
Posts: 182
Kudos: 36
Joined: 24 Mar 2008
Location: Odessa, Ukraine

Re: Ogre`s Windows 8 Metro Style port (now commited to OGRE!

Postby Eugene » Thu Aug 23, 2012 10:32 am

Wolfmanfx wrote:Lets assume we fixed DX11 to not use d3dx:

1. DX9 can not build without d3dx so we have to use the downloadable sdk
2. DX11 search first if the new stuff is there if so use it if not try to search for an downloadable sdk and use this

I would create 2 find packages FindDirectX9 and FindDirectX11 so its seperated and clean. What do you think?


Yeah, it would be excellent.

Assaf Raman wrote:Until we fix the DX code - we need to use the SDK also for DX11 - if not WinRT.


D3D11 RS is buildable with new SDK in Win32 mode out of the box - I just checked it now. So we need FindOldDirectX for D3D9 RS only and only due to the D3DX9 library
MS say that if you need D3DX library - you can use new SDK and link D3DX lib from the old one - may be it`s the way to go, separate Direct3D SDK and D3DX libs detection

P.S. buildable using revision 3778 (ce91323b3c2a) Fixed VolumeRednering crashing on use of RTSS triplanar SRS
User avatar
Eugene
OGRE Team Member
OGRE Team Member
 
Posts: 182
Kudos: 36
Joined: 24 Mar 2008
Location: Odessa, Ukraine

PreviousNext

Return to Developer talk

Who is online

Users browsing this forum: No registered users and 3 guests