[GSoC 2012] Complete the DirectX 11 render system

Threads related to Google Summer of Code
Post Reply
User avatar
Eugene
OGRE Team Member
OGRE Team Member
Posts: 185
Joined: Mon Mar 24, 2008 4:54 pm
Location: Kraków, Poland
x 41

Re: [GSoC 2012] Complete the DirectX 11 render system

Post by Eugene »

Assaf Raman wrote:Can the RTSS work with Feature_Level_9 out of the box?
Yes, with backward compatibility flag to compensate the fact that RTSS uses SM2.0 syntax to sample combined "sampler+texture" units rather than SM4.0 syntax that split this concept into "samplers" and "textures" that are specified separately to the sampling instruction.

Additionally, feature level is not passed to the D3DCompile API (it`s determined automatically from the shader source), but can be optionally specified for fxc.exe to generate compiler warnings at build time if limits are exceeded or undesirable features are accidentally used. I compiled several RTSS generated shaders using fxc.exe without problems with this restriction.
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: [GSoC 2012] Complete the DirectX 11 render system

Post by Assaf Raman »

It will be hard for me to make head or tails.
do you want write access to the project repo to commit directly the things you think are important?
Watch out for my OGRE related tweets here.
User avatar
Eugene
OGRE Team Member
OGRE Team Member
Posts: 185
Joined: Mon Mar 24, 2008 4:54 pm
Location: Kraków, Poland
x 41

Re: [GSoC 2012] Complete the DirectX 11 render system

Post by Eugene »

Assaf Raman wrote:Can you use SM5 on your windows 8 in a WinRT application?
Probably yes on the desktop computer with NVidia GT520 card.
Probably yes on the desktop computer with ATI card.
But Intel HD3000 videocard embedded into the Sandy Bridge processor with latest WDDM 1.2 drivers has only FEATURE_LEVEL_10_0 so not on the Samsung Slate PC.
User avatar
Eugene
OGRE Team Member
OGRE Team Member
Posts: 185
Joined: Mon Mar 24, 2008 4:54 pm
Location: Kraków, Poland
x 41

Re: [GSoC 2012] Complete the DirectX 11 render system

Post by Eugene »

Assaf Raman wrote:It will be hard for me to make head or tails.
do you want write access to the project repo to commit directly the things you think are important?
Yes. But I can not invest as much time in testing of this summer project as I do for WinRT branch (it`s used in production code so it`s tested every day).
So I`ll fix only obvious bugs in areas that I touched/fixed before.
User avatar
robert_sasu
Google Summer of Code Student
Google Summer of Code Student
Posts: 237
Joined: Mon Apr 02, 2012 11:07 am
x 42

Re: [GSoC 2012] Complete the DirectX 11 render system

Post by robert_sasu »

The changes I have made on the texture file was because of an error of wrong mipmaps calculation. After merging the winRT stuff there were some problems with nummipmaps and something happened to the Grass sample, which doesn't render correctly.
Image

Now I have changed back the things according the difference, and still the result is this.
Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
User avatar
Eugene
OGRE Team Member
OGRE Team Member
Posts: 185
Joined: Mon Mar 24, 2008 4:54 pm
Location: Kraków, Poland
x 41

Re: [GSoC 2012] Complete the DirectX 11 render system

Post by Eugene »

robert_sasu wrote:The changes I have made on the texture file was because of an error of wrong mipmaps calculation.
The basic source of the confusion is that Ogre does not count base texture as mipmap level, but D3D11 API do this. So one for ogre means base texture plus one mipmap but for D3D11 it means only base texture without mipmaps. Zero for Ogre means base texture but for D3D11 it`s special case - generate as many mipmaps as possible.
Other source of confusion is that number of the requested and obtained mipmap levels can differ due to the texture size and format (compression), so they should never be mixed, and actual count should be asked rather than calculated.
User avatar
Eugene
OGRE Team Member
OGRE Team Member
Posts: 185
Joined: Mon Mar 24, 2008 4:54 pm
Location: Kraków, Poland
x 41

Re: [GSoC 2012] Complete the DirectX 11 render system

Post by Eugene »

Code: Select all

@@ -640,14 +640,14 @@
 			if (mDriverType == DT_SOFTWARE)
 			{
 				driverType = D3D_DRIVER_TYPE_SOFTWARE; 
-				pSelectedAdapter = NULL;
+				SAFE_RELEASE(pSelectedAdapter);
 			}
 
 			
 			if (mDriverType == DT_WARP)
 			{
 				driverType = D3D_DRIVER_TYPE_WARP; 
-				pSelectedAdapter = NULL;
+				SAFE_RELEASE(pSelectedAdapter);
 			}
 
 			D3D_FEATURE_LEVEL RequestedLevels[] = {
@@ -669,7 +669,7 @@
 			ID3D11DeviceN * device;
 			// But, if creating WARP or software, don't use a selected adapter, it will be selected automatically
 			
-			HRESULT hr = D3D11CreateDeviceN(mDriverType != DT_WARP ? pSelectedAdapter : NULL,
+			HRESULT hr = D3D11CreateDeviceN(pSelectedAdapter,
 				driverType,
 				NULL,
 				deviceFlags, 
User avatar
robert_sasu
Google Summer of Code Student
Google Summer of Code Student
Posts: 237
Joined: Mon Apr 02, 2012 11:07 am
x 42

Re: [GSoC 2012] Complete the DirectX 11 render system

Post by robert_sasu »

I have changed everything regarding the miplevels conform the winRT work. After that I am having a strange error on the Water sample, I can't start it. I will describe the error:
The error is on the OgreD3D11HardwareBuffer line 89:

Code: Select all

		HRESULT hr = device->CreateBuffer( &mDesc, NULL, &mlpD3DBuffer );
		if (FAILED(hr) || mDevice.isError())
		{
			String msg = device.getErrorDescription(hr);
			OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR, 
				"Cannot create D3D11 buffer: " + msg, 
				"D3D11HardwareBuffer::D3D11HardwareBuffer");
		}
In this situation, after debugging mDevice.isError() returns false (as it doesn't have error), and the mDesc variable seems totally fine to me:

Code: Select all

mDesc.ByteWidth = 1440;
mDesc.Usage = D3D11_USAGE_DYNAMIC;
mDesc.BindFlags = 1;
mDesc.CPUAccesFlags = 65536;
mDesc.MiscFlags = 0;
mDesc.StructureByStride = 0;
The integer value of HR = -2005270523, I have searched for this HRESULT in microsoft database but haven't found it, and there is no error description after this failure as msg = NULL.
Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
User avatar
Eugene
OGRE Team Member
OGRE Team Member
Posts: 185
Joined: Mon Mar 24, 2008 4:54 pm
Location: Kraków, Poland
x 41

Re: [GSoC 2012] Complete the DirectX 11 render system

Post by Eugene »

robert_sasu wrote: The integer value of HR = -2005270523, I have searched for this HRESULT in microsoft database but haven't found it, and there is no error description after this failure as msg = NULL.
hr -2005270523 == 0x887A0005 == DXGI_ERROR_DEVICE_REMOVED

http://msdn.microsoft.com/en-us/library ... s.85).aspx
The video card has been physically removed from the system, or a driver upgrade for the video card has occurred. The application should destroy and recreate the device. For help debugging the problem, call ID3D10Device::GetDeviceRemovedReason.
Possible return values include:
•DXGI_ERROR_DEVICE_HUNG
•DXGI_ERROR_DEVICE_REMOVED
•DXGI_ERROR_DEVICE_RESET
•DXGI_ERROR_DRIVER_INTERNAL_ERROR
•DXGI_ERROR_INVALID_CALL
•S_OK
I`m suppose that you feed some trash to videocard and it is restarted, therefore DXGI_ERROR_DEVICE_REMOVED.
Try to run your test with d3d debug layer, with verbose message level so that error would be logged and/or thrown rather than crash later in unpredictable place.
User avatar
robert_sasu
Google Summer of Code Student
Google Summer of Code Student
Posts: 237
Joined: Mon Apr 02, 2012 11:07 am
x 42

Re: [GSoC 2012] Complete the DirectX 11 render system

Post by robert_sasu »

I have created a new fork of Ogre3D and merged my work there: https://bitbucket.org/sasu_robert/ogre-d3d11-2
With this, all the 6 tasks are done :).

I am still working on bugfixes for water samples as I haven't found the problem, but hopefully will find very fast.
Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
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: [GSoC 2012] Complete the DirectX 11 render system

Post by Assaf Raman »

Very good, do you remember that when we turned all exceptions on - we saw some errors about shaders parameters and such - can you recreate it by turning all exceptions on and then fixing the issues?
Watch out for my OGRE related tweets here.
User avatar
robert_sasu
Google Summer of Code Student
Google Summer of Code Student
Posts: 237
Joined: Mon Apr 02, 2012 11:07 am
x 42

Re: [GSoC 2012] Complete the DirectX 11 render system

Post by robert_sasu »

I have resolved the error by correcting the number of requested miplevels in HardwarePixelBuffer. Cherlix showed this error by correcting the water sample, after that I changed this everywhere because some samples were not rendering correctly, now everything seems fine.
OGRE stores mipmap's count - 1. So we must add one when calculating the subresource.

Code: Select all

					mDevice.GetImmediateContext()->UpdateSubresource( 
						mParentTexture->GetTex2D(), 
-						D3D11CalcSubresource(static_cast<UINT>(mSubresourceIndex), mFace, mParentTexture->getNumMipmaps()),
+						D3D11CalcSubresource(static_cast<UINT>(mSubresourceIndex), mFace, mParentTexture->getNumMipmaps() + 1),
						&dstBoxDx11,
						converted.data,
						rowWidth,
						0 );
Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
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: [GSoC 2012] Complete the DirectX 11 render system

Post by Assaf Raman »

I see the following issues with the samples (running debug compile with information queue to "info" in the render system config):
1. When you open the sample browser - the "quit" button has some visual issue on the top and button lines of its rect.
[s]2. In the bump mapping sample - I don't see the model.[/s]
3. In the compositor sample - not all the compositors work.
4. Deferred Shading crash on start.
5. Dual Quaternion crash on start.
6. Dynamic Texture - wrong color.
7. Instancing - you see only one model.
8. Isosurf - doesn't work.
9. NewInstancing multiple visual issues.
10. SSAO - doesn't work.
11. Shader system - bad skybox.
12. Textured fog - no texture on the fog.
[s]13. Multi light - crash on start.[/s]
14. Shadows - crash on start.
15. Tesselation - still need to add the controls we talked about.
[s]16. Water - crash on start.[/s]

And when I change something in the config and the render system restarts - a crash.

I think all fall under the project title - "Complete the DirectX 11 render system"
Watch out for my OGRE related tweets here.
User avatar
saejox
Goblin
Posts: 260
Joined: Tue Oct 25, 2011 1:07 am
x 36

Re: [GSoC 2012] Complete the DirectX 11 render system

Post by saejox »

thats a lot of errors.
i hope they get fixed till deadline.
good luck.
Nimet - Advanced Ogre3D Mesh/dotScene Viewer
asPEEK - Remote Angelscript debugger with html interface
ogreHTML - HTML5 user interfaces in Ogre
User avatar
robert_sasu
Google Summer of Code Student
Google Summer of Code Student
Posts: 237
Joined: Mon Apr 02, 2012 11:07 am
x 42

Re: [GSoC 2012] Complete the DirectX 11 render system

Post by robert_sasu »

Most of the errors are because of unsupported techniques from RTSS. As DirectX 11 Render System just support Shader Model 4.0 or above, and RTSS just has shader model 3.0 (a lot of materials does not exist for ps_40 or fs_40), some of those samples which uses RTSS and do not have materials written for shader model 4.0 or above, or have a techniques which is not yet supported by DirectX 11 Render System crashes or does not render correctly.
I will try to make all of them work, for this I will add support for shader model 4.0 and above in RTSS.
Today I have corrected the water sample (now it does render correctly). Compositor sample was missing some materials for Bloom, Assaf Raman created them and now every compositor is working except dither. Bump mapping sample does work when using singlePass or multiPass material (not all the techniques from Example folder are supported by D3D11, that is why we can't see the model using them). Textured fog is working fine if you disable and enable the skybox.
Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
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: [GSoC 2012] Complete the DirectX 11 render system

Post by Assaf Raman »

Strike through tasks:

By Assaf:
[s]2. In the bump mapping sample - I don't see the model.[/s]
[s]13. Multi light - crash on start.[/s]

By Robert:
[s]16. Water - crash on start.[/s]

Still a long list...
Watch out for my OGRE related tweets here.
User avatar
robert_sasu
Google Summer of Code Student
Google Summer of Code Student
Posts: 237
Joined: Mon Apr 02, 2012 11:07 am
x 42

Re: [GSoC 2012] Complete the DirectX 11 render system

Post by robert_sasu »

Today I have started to implement dynamic linkage to the directx 11 Render System with subroutines and uniform buffer handling. I decided to move on now as I haven't had any idea how to resolve certain bugs (those bugs presented above do exist in the official repo, there are much more there.) Most of the samples miss material with at least shader model 4.0 and this is what causes the error. As I am a newbie in .material, .cg, .hlsl language I found it hard to debug. So I moved on to work.
I have made a good progress, I have some issues to resolve in OgreD3D11HLSLProgram and will finish the dynamic lynkage. Next morning I will commit the working code.
Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
User avatar
robert_sasu
Google Summer of Code Student
Google Summer of Code Student
Posts: 237
Joined: Mon Apr 02, 2012 11:07 am
x 42

Re: [GSoC 2012] Complete the DirectX 11 render system

Post by robert_sasu »

I have finished implementing the dynamic linkage with subroutines and uniform buffer handling to the Directx 11 Render System. Now the tessellation sample runs faster: 100 more fps. Here is the result :).

Image

Tomorrow I will work on this sample, to give some variables to control it.
Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
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: [GSoC 2012] Complete the DirectX 11 render system

Post by Assaf Raman »

Very nice work, I looked at the code - you really worked hard the last two days...
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: [GSoC 2012] Complete the DirectX 11 render system

Post by Assaf Raman »

I am starting the merge of this project.
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: [GSoC 2012] Complete the DirectX 11 render system

Post by Assaf Raman »

I have a big issue with the merge, the resulted merged repo is 100 MB bigger then the current repo, I will need to find some solution for this.
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: [GSoC 2012] Complete the DirectX 11 render system

Post by Assaf Raman »

The student has committed then deleted a lot of junk files, I will have to merge without the history of his work, this is the only way I can see to resolve this - as I don't see a way to delete the junk files from the repo history.
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: [GSoC 2012] Complete the DirectX 11 render system

Post by Assaf Raman »

Yes, I working on it now, there are other issues with other merges done along the project - sadly this is going to be one big commit of the whole project - without the history.
This will also include all the WinRT work.
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: [GSoC 2012] Complete the DirectX 11 render system

Post by Assaf Raman »

I will divide the commits of the project to topics, like WinRT, RTSS, and d3d11 render system.
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: [GSoC 2012] Complete the DirectX 11 render system

Post by Assaf Raman »

No, one big commit - it is too hard to split the code in this stage.
Watch out for my OGRE related tweets here.
Post Reply