Page 7 of 11

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

Posted: Fri Aug 10, 2012 9:45 pm
by Wolfmanfx

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

Posted: Fri Aug 10, 2012 9:49 pm
by robert_sasu
I was reading the same page at this moment. What is important is that with dynamic shader linkage, developers can more easily author larger, flexible shaders and permute out specialized, optimized versions for use at run time during specific rendering.
It seems like there is a need for dynamic shader linkage because of the combinatorial explosion of the shaders.
So in essence the language design of the HLSL language is driven by the fact that we have too many shaders and someone assumes that we can't cope with the shear quantity. To fix this we need dynamic shader

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

Posted: Fri Aug 10, 2012 9:54 pm
by Wolfmanfx
I think its not a bad feature to have OOP and virtual functions / late binding when I program my shaders by hand but i am not sure if its good for rtss because you do not need to take care about shader explosion its done by rtss and not by a human and you get "optimized code".

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

Posted: Fri Aug 10, 2012 10:38 pm
by robert_sasu
I thought I will put the dynamic linkage not in the RTSS, just in the DirectX 11 Render System (anyway, it has a good effect just when using shader model 5.0) and in HLSL.

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

Posted: Sat Aug 11, 2012 11:19 am
by Assaf Raman
Yes, do it outside the RTSS, and create a new sample to demonstrate it.

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

Posted: Sun Aug 12, 2012 3:41 am
by Eugene
Wolfmanfx wrote:I think its not a bad feature to have OOP and virtual functions / late binding when I program my shaders by hand but i am not sure if its good for rtss because you do not need to take care about shader explosion its done by rtss and not by a human and you get "optimized code".
RTSS in it`s current form is not appropriate for WinRT mode, as runtime shader compilation is forbidden. So if RTSS can be tweaked to dynamically link final shader from some amount of the precompiled building blocks - it would solve this problem.

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

Posted: Sun Aug 12, 2012 9:25 am
by Assaf Raman
@robert_sasu - Well, after thinking about it more, before continuing to new features - like the dynamic linkage, as we only have one more week for the project, I want to focus this week on cleaning the code up and merging it back to the main trunk.
Talk to me over Skype and we will work out the details.

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

Posted: Sun Aug 12, 2012 9:32 am
by Assaf Raman
Can you fill this form and send it to e-mail at the end of the forum - so we can merge your work to the main repo?

Post on this thread after doing it - so I will know that you have.

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

Posted: Sun Aug 12, 2012 10:09 am
by Assaf Raman
Part of the "todo" list for this week:
1. Remove unused code - (ex: D3D11Tessellation)
2. Add comment to your new code if needed.
3. Make sure Cg compiles shader model 5 shaders. (Ex - look at line 46 in src\PlugIns\CgProgramManager\src\OgreCgProgram.cpp).
4. Finish tessellation sample - add controls to control some tessellation parameters you will also add. Add new thumbnail image to the sample. Make sure that the sample only work with the d3d11 render system - else shows a message - like other render system specific samples.
5. Work with the guys on this thread to see that the relevant code from their fork is merged.
6. Create a new fork of the current OGRE trunk, merge your fork into it, this will make the merge to the trunk easy for me.

Lets try to finish it all before the weekend - so it will not be last minute for me to merge your code into the trunk.

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

Posted: Sun Aug 12, 2012 11:49 am
by robert_sasu
1. I will remove the unused code (D3D11Tessellation), by ignoring/forgetting it by hg. Later I will include also this to my fork after I will be ready for these algorithms, as I said I want to continue to work (I like really much this project).
2. Comments are generally done for all of my new code.
3. I will look at the Cg compiler today and add changes if needed.
4. Tessellation sample is too simple now, I need a little bit to think about how to add some control parameters (I have an idea after finishing the dynamic linkage).
5. I have completed merging Eugene's work, but I am not really sure how I will do merge Cygon's work (and he wrote in the other thread that he would willing to do it, also probably started working as I understood his replies.)
6. I will create the fork tomorrow, after tasks 1, 3 are done.

I am willing to continue this project and finish the proposed features outside the GSoC. After doing these 6 tasks and creating the fork on OGRE trunk I would like to continue to work with the dynamic linkage, tessellation sample and RTSS . After I will resolve to have a machine where I can test multi-device support, I will definitely finish also that :).

About the form do I have to sign manually, so printing it, signing it and scanning it after that ?

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

Posted: Sun Aug 12, 2012 1:35 pm
by Assaf Raman
Print, sign, then scan or take a clear photo with the cell phone.

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

Posted: Sun Aug 12, 2012 7:05 pm
by robert_sasu
Here is the license agreement signed :)

I tried to close and delete a branch from my repo (d3d11-multiWindows). I tried with hg strip and hg close but neither of them worked for me. Can anyone help me out of this ? :)

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

Posted: Sun Aug 12, 2012 7:34 pm
by CABAListic
robert_sasu wrote: I tried to close and delete a branch from my repo (d3d11-multiWindows). I tried with hg strip and hg close but neither of them worked for me. Can anyone help me out of this ? :)
This isn't really something that hg is designed for, because once something is in the repository history, it's meant to stay. Branches included. You might try to clone the repository from the revision before you created the branch, then try and use transplant to cherry-pick all the revisions after that one that you want to keep (i.e. those not on the branch). I haven't actually done this, so I can't give you detailed instructions, but something along these lines should work.

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

Posted: Mon Aug 13, 2012 7:19 am
by Assaf Raman
I committed a lot of WinRT fixes to this project fork. I also wrote the code for caching shader reflections - as shader reflection is not available for WinRT application that are in the Microsoft store (according to rumors).
WinRT still doesn't run - but I am almost there in getting it to run.

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

Posted: Mon Aug 13, 2012 9:15 am
by Assaf Raman
It seems that running on VMWare will not help me with WinRT development - as it doesn't support DirectX 10 or 11.
But - From what I can tell - the code should work.

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

Posted: Mon Aug 13, 2012 9:49 am
by Assaf Raman
Trying the WARP driver.

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

Posted: Mon Aug 13, 2012 10:05 am
by Assaf Raman
Yes, with WARP driver D3D11 works with Win8 WinRT on VMWare.
So - the WinRT part of the project seems to be done as far as I can see it. Don't waste any time on it.

If you can - go over the OGRE samples one by one (not using WinRT - use the normal windows build) and try to make all of them work, leave the BSP sample to be the last - it is less important for us.

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

Posted: Mon Aug 13, 2012 10:15 am
by robert_sasu
I have worked with all of the samples: BSP, dual quaternion, isosurf and new instancing are not working. The profile in most of RTSS's shaders supports vs_3_0, but dx11's capabilities contains vs_4_0, vs_4_1, and vs_5_0, so I think this is the problem for these samples.

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

Posted: Mon Aug 13, 2012 10:50 am
by Assaf Raman
good, fix it then

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

Posted: Mon Aug 13, 2012 12:04 pm
by Eugene
robert_sasu wrote:I have worked with all of the samples: BSP, dual quaternion, isosurf and new instancing are not working. The profile in most of RTSS's shaders supports vs_3_0, but dx11's capabilities contains vs_4_0, vs_4_1, and vs_5_0, so I think this is the problem for these samples.
There is code that compiles shaders designed for profile vs_2_0, vs_2_x, vs_3_0 using first compatible profile - vs_4_0 and compatibility flag to accept legacy syntax. This is how I worked around fact that RTSS shaders were designed for lower unsupported on WinRT profiles. Look at D3D11HLSLProgram::getCompatibleTarget(). So it may be the question of specifying "enable_backward_compatibility" flag in material declarations.

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

Posted: Mon Aug 13, 2012 12:10 pm
by Assaf Raman
I know it, it doesn't work that good.
BTW: I think that only SM2 is supported on windows 8 arm and on windows phone 8.
I guess I will make the D3D9 SM2 RTSS generator work with it, I think I am work it out, I will use d3d9 interface to reflect the shader parameters and vars.

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

Posted: Mon Aug 13, 2012 12:28 pm
by Eugene
Assaf Raman wrote:I know it, it doesn't work that good.
BTW: I think that only SM2 is supported on windows 8 arm and on windows phone 8.
I guess I will make the D3D9 SM2 RTSS generator work with it, I think I am work it out, I will use d3d9 interface to reflect the shader parameters and vars.
No-no-no. I researched this area and here are the results:
1. Support for SM4.0 is mandated on D3D11, but it`s allowed to support it with reduced feature set, like "Shader Model 4 Level 9_3" (/4_0_level_9_3 command line option to fxc.exe). Its the way Windows 8 ARM will go.
2. Drivers from ATI and NVidia support SM2.0 shaders on D3D11 as vendor extension - but it`s not required and Intel`s drivers don`t do this. Shader is successfully compiled as SM2.0 shader but than just don`t work. This is why "getCompatibleTarget()" code was created in the first place.

Therefore shaders must be compiled as SM4.0 (to be runnable on Intel) and may be with "enable_backward_compatibility" flag if SM2.0 syntax was used for them.

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

Posted: Mon Aug 13, 2012 12:49 pm
by Assaf Raman
Can you use SM5 on your windows 8 in a WinRT application?

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

Posted: Mon Aug 13, 2012 1:05 pm
by Assaf Raman
Can the RTSS work with Feature_Level_9 out of the box?

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

Posted: Mon Aug 13, 2012 1:09 pm
by Eugene
Assaf Raman wrote:So - the WinRT part of the project seems to be done as far as I can see it.
There are some bugs reintroduced that were fixed in winrt branch. Diff with WinRT branch to see all of them clearly.

1. In D3D11RenderSystem::_initialize() pSelectedDevice is leaked for mDriverType == DT_SOFTWARE or DT_WARP. It`s AddRef-ed and should be released for those driver types.
2. In D3D11RenderSystem::_clearFrameBuffer() local variable numberOfViews is initialized via getCustomAttribute call but than incremented additionally in the while loop so it would hold doubled value and buffer would be overruned if more than 4 render targets are used.
3. In D3D11Texture::_create2DTex() was bug that decremented numMips variable by two for compressed formats even if autogenerated amount was requested (i.e. zero value used). This leads to (-2) value passed to the texture creation API with immediate crash on debug runtime. This bug was hidden by the fact that most compressed formats were .dds files that were loaded using another code path, D3DX. But on WinRT D3DX is not available, and problem was revealed. I carefully changed mipmap count handling code to simplify it and avoid this problem, and it is here now, but old code snippets were remerged into it so the result is really crazy now. Look at diff to see what needs to be deleted to fix it.