Page 19 of 29

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

Posted: Wed Jun 15, 2011 2:06 pm
by evandropaulino
Yes, I made this in Irrlicht Dx11.

There's no need to use pass, this can be done internally in D3D11RenderSystem, based on how the descriptions is filled during frame.

In fact, the state cache is already done by D3D11 driver internally, but Microsoft recommends we don't rely on this behavior.

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

Posted: Wed Jun 15, 2011 2:15 pm
by Assaf Raman
I wrote this type of cache manager in the past, identifying the state was too costly.
I guess the bast solution is a new ogre "state" class, but it will be a big architectural change.

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

Posted: Wed Jun 15, 2011 2:47 pm
by boyamer
And what about adding all those state into ogre?
I mean ogre will have BlendState, RasterizerState, DepthStencilState and then map one by one with DirectX 11, in DirectX 9, OpenGL will be mapped as before?

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

Posted: Wed Jun 15, 2011 2:55 pm
by evandropaulino
I agree, Assaf. The greatest problem is that I used the description as key, and comparison made by memcmp !! There's no simple way to do this.

I don't think this is the best way, cause the APIs have different ways to do this. OGRE already abstract this behavior via _set state methods. Maybe we can expose the new states, as they exists in DirectX 11 and OpenGL 3+.

One thing that will help a lot is to expose the read-only depth buffer, allowing this to be bound as a texture unit and as depth-stencil buffer at the same time. This can accelerated some effects like deferred rendering.

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

Posted: Wed Jun 15, 2011 3:12 pm
by Assaf Raman
I also memcmp it, it was worse performance then creating them every call.

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

Posted: Tue Jun 28, 2011 11:59 am
by boyamer
I have a question about StateObject in DX11 RenderSystem, i saw that every time you _render(RenderOperation) method there is call for creation of BlendState,RasterizerState,DepthStencilState,SamplerState etc, i know that DX 11 inself pools creation of them and if any state object with the same description exists, it does not creates it but returns the same one, so basically into Ogre3D DX11 implementation is right the way in which they are handled or new way need to be added?

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

Posted: Tue Jun 28, 2011 12:03 pm
by Assaf Raman
I think that for now we can live with the current code, meaning I don't think this is a big issue - from the performance point of view.

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

Posted: Tue Jun 28, 2011 3:40 pm
by evandropaulino
I found an issue that impact not only Dx 11, but also the new OpenGL3+ Render System.

To implement CubeMap GS sample from DX 10 SDK (that render to all six faces of a cubic texture), I must create a render target array (that is different from multi render target). But, I can't do this in Ogre, because I pick render target from HardwarePixelBuffer, that is create for each face.

We must change this model to support this feature. Maybe a method like Texture::getSliceBuffer(int mipLevel), in addition to Texture::getBuffer(int slice, int mipLevel), what do you think?

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

Posted: Tue Jun 28, 2011 5:59 pm
by Assaf Raman
Try it, and let us see it in your fork, if the change will look good - I am for it.

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

Posted: Thu Jun 30, 2011 2:25 pm
by evandropaulino
Hi people.

I'm developing the change to CubeMap GS, and was think to add, in MultiRenderTarget, the methods bindSurfaceArray(int attachment, RenderTarget* firstSlice, RenderTarget* lastSlice) and bindSurfaceCube(int attachment, RenderTarget* firstFace, RenderTarget* lastFace). Of course, the slices/faces shall be from the same texture and same mip level.

So, we just pass the 6 view matrices during rendering to render the scene to cube map. I think that, to make this automatic in the Viewport class, the change became too big in this moment.

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

Posted: Thu Jul 28, 2011 4:20 pm
by Zero
Hi I added texture2d-array support and fixed the unlockimpl and some other stuff,
here is the patch https://sourceforge.net/tracker/?func=d ... tid=302997.

Zero

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

Posted: Wed Aug 03, 2011 5:06 pm
by Assaf Raman
I will review and add this weekend.

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

Posted: Mon Aug 22, 2011 3:55 pm
by Crashy
Hello,

I'm moving my game engine from DX9 to Dx11 render system and I'd like to have some infos about the state of the DirectX 11 render system.
First, is it possible to bind texture units to geometry program. As far as I see in the texture unit source code, there is only support for vertex and fragment program bindings, but I may have missed something.

This leads to the second question: Is there a todo list of things that are still not implemented somewhere, as I have some time to spend to help debug/finish the DirectX 11 render system.

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

Posted: Mon Aug 22, 2011 4:06 pm
by Assaf Raman
Sounds good.
The main things that are not finished are the tessellation shader and multi monitor support.
I guess that you can benefit from the abstraction of the resources in d3d11 like you would like also... But I am not sure how much it is needed.
I have a few patches I need to integrate regarding geometry shader and other small things (possibly it includes the texture binding for geometry shader).
I guess the best way to know the status is to try to run your current product - but use the d3d11 render system and see issues.

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

Posted: Mon Aug 22, 2011 4:20 pm
by Crashy
I guess that you can benefit from the abstraction of the resources in d3d11 like you would like also... But I am not sure how much it is needed.
You mean the fact that there is no more per-program-type resources and that the textures are usable for erveryone with the unified pipeline?

The main things that are not finished are the tessellation shader and multi monitor support.
I guess the best way to know the status is to try to run your current product - but use the d3d11 render system and see issues.
Ok, I don't need multi monitor support for the moment, neither tesselation shader but I'd really like to play with this one, I'm going to look if I can add this.

Thanks.

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

Posted: Mon Aug 22, 2011 4:33 pm
by Assaf Raman
Yes, no more per-program-type resources.
Compile and run the sample browser - it gives a good progress status.

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

Posted: Tue Aug 23, 2011 7:28 am
by boyamer
Assaf, when do you plan to apply patches to DX11 RenderSystem?
One from Zero too.

Thanks

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

Posted: Tue Aug 23, 2011 7:33 am
by Assaf Raman
Friday.

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

Posted: Wed Aug 24, 2011 4:30 pm
by Crashy
Is the handling of multiple constant buffers in your todo list Assaf? If not this is something I could add as it seems to be important for performance, although I don't see any implementation proposal apart from this old post from Sinbad

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

Posted: Wed Aug 24, 2011 4:46 pm
by Assaf Raman
Feel free to help.

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

Posted: Wed Aug 24, 2011 7:43 pm
by masterfalcon
I've actually been working on something to that effect for the uniform buffer support in gl3plus.

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

Posted: Thu Aug 25, 2011 5:53 am
by Assaf Raman
No.

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

Posted: Fri Aug 26, 2011 12:12 am
by Assaf Raman
I just committed Zero's patch, I also fixed the texture atlas sample to support both gl and d3d11.
I am waiting for Evandro to sign the OGRE Contributor License Agreement before I can marge his fork. I sent him an e-mail.

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

Posted: Fri Aug 26, 2011 8:04 am
by Crashy
Ok I'm going to make a design proposal for the multiple constant buffers, however it should take some time as it is not a trivial thing because it may be really different from previous Ogre implementation of shader parameters.

Before that, I got two errors, one when my Ogre::Terrain finalizes its normal map:
ID3D11DeviceContext::GetData: GetData is being invoked on a Query/ Predicate/ Counter, after invoking Begin, but not yet after End. The range of commands must be completed by invoking End, before invoking GetData.
The exception is thrown by these lines:

Code: Select all

case TEX_TYPE_CUBE_MAP:
case TEX_TYPE_2D:
case TEX_TYPE_2D_ARRAY:
			{
				mDevice.GetImmediateContext()->UpdateSubresource( 
					mParentTexture->GetTex2D(), 
					D3D11CalcSubresource(static_cast<UINT>(mSubresourceIndex), mFace, mParentTexture->getNumMipmaps()),
					&dstBoxDx11,
					converted.data,
					d3dRowPitch,
					0 );
				if (mDevice.isError())
				{
					String errorDescription = mDevice.getErrorDescription();
					OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR, 
						"D3D11 device cannot update 2d subresource\nError Description:" + errorDescription,
						"D3D11HardwarePixelBuffer::blitFromMemory");
				}
			}
And another, really similar, when the setRenderTarget is called to se the shadow map render target.
Error Description:ID3D11DeviceContext::GetData: GetData is being invoked on a Query/ Predicate/ Counter, after invoking Begin, but not yet after End. The range of commands must be completed by invoking End, before invoking GetData.
in D3D11RenderSystem::_setViewport at .\src\OgreD3D11RenderSystem.cpp (line 1674)

EDIT: Bad error report sorry, it was just an occlusion query made in my engine to flush the gpu command buffer that was not done correctly.

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

Posted: Thu Sep 01, 2011 8:10 am
by Crashy
Hello,

I'm trying to add the support of comparison samplers, I've succeded to handle the comparison filtering, but I'm stuck with the code managing samplers comparison function.
For the moment, the comparison function of a sampler is retrieved from the pass's alpha rejection setting(and alpha test is deprecated in DirectX11 ), though for comparison samplers it should be nice to have this value stored per texture unit, but it is not a trivial modification of Ogre.
Any idea? Of course this modification must preserve the compatibility for other renderers.

By the way, I'm still thinking about how to add the multiple constant buffer support, somes ideas emerged :)