Thursday, 19 July 2012 13:17
You will find in this post some news about recent SharpDX development and future direction.
First of all, it is really great to see that the forum has been growing for the past few weeks, with more than 120 users and 420 messages! I hope that it will push enough to help you jump onto the Managed-DirectX bandwagon and more users will be able to help each other. Also, my apologize if I can’t always respond in detail to all questions, as I can’t afford in my spare time to make a deep diagnostic about each situation in the forum. I can only give some directions to help solve the problem and I request as much as possible your deep involvement to solve your issue: in other words, I don’t have the time to debug your application for you but if you are looking for a “gold” support – .i.e. paid-, you can contact me directly (For this kind of support, It means that I stop any SharpDX developments to solve your issue).
Secondly, if you have followed recent commits and twitter news, you are probably aware about:
- MediaFoundation for Windows 8 Metro is now providing classes to play audio or to transform video to Direct3D11 texture. You can find the project MiniCubeVideoTexture under the Win8 sample folders for more details about its usage. Also, MonoGame team took the time to fix a couple of references in the build to make MediaFoundation pass the Win8 Metro App certification.
- A new build target for the .NET 4.0 Framework has been introduced. Until now, SharpDX was compiled against the 2.0 .NET Framework making it accessible from 2.0 to 4.0 versions. Starting with next 2.3 release, SharpDX will also provide a 4.0 version of assemblies (along the existing 2.0). This is mostly interesting for people developing in 4.0 as the runtime doesn’t have to load compatible 2.0 assemblies to use SharpDX. Also, because Windows 8 Desktop doesn’t have by default 2.0/3.5 .NET Framework installed, It is more convenient to be able to release an application that doesn’t require to install an older .NET Framework. Concerning the support for 2.0 .NET Frameworks, I will try to keep it as long as it is possible to.
- Due to Windows 8 Metro App API restrictions, a couple of API refactoring has been done: All Direct3D10/Direct3D11 API won’t have any more direct dependencies against the D3DCompiler API. Also the “Effects11” framework in Direct3D11 has been moved to a separate assembly, as it is deprecated by Microsoft and impossible to use in a Metro Application, It was better to make it a satellite optional assembly rather than polluting the Direct3D11 assembly.
- With Windows 8 Metro, it seems that WIC API is being actively used, so to ease its usage, a couple of minor methods have been introduced.
But the most important work is currently focused to deliver a new API called SharpDX.Toolkit.Graphics. This is the first higher lever API in SharpDX that is going to provide a simple and powerful abstraction layer over Direct3D11, DXGI and WIC. I will cover in more details all the benefits of using this API in the future, but the main goals of this project are:
- Provides a higher level Graphics API that leverages on Direct3D11, without sacrifying performance or integration with existing SharpDX Direct3D11 API.
- In some aspects, SharpDX.Toolkit is going to give a all-in-one managed solution equivalent to DirectXTk and DirectxTex, but with more helpers and higher level APIs to make things much easier.
- Compatible with Windows 8 Metro/Desktop, Windows 7, ideally for scenarios not involving any specific UI interactions, It will be possible to write a pure Direct3D11 application and to run it in Windows 8 Metro or Windows 7 without any changes.
- All the advanced features of Direct3D11 are available (and even easier to use): You have access with this higher level API to things like geometry shaders, tessellation, compute shaders, unordered access views, indirect calls…etc.
- All classes provide a seamless integration with existing Direct3D11 API and are implicitly castable to existing SharpDX.Direct3D11 classes. Take a SharpDX.Toolkit.Graphics.Texture2D object, and you can cast it to a Direct3D11.Texture2D (and also, to a Direct3D11.ShaderResourceView or UnorderedAccessView). It means that you can use Toolkit objects and call the legacy Direct3D11 API with them.
- Drastically simplify Direct3D11 resource creation with lots of factories, making much easier to instantiate Direct3D11 resources: Buffers (Index, Vertex, Raw, Structured, RWStructured…etc.), Texture1D/2D/3D (with full array support), RenderTarget1D/2D/3D (with full array support, multisampling), DepthStencilBuffer, RasterizerStates, BlendStates, DepthStencilStates, SamplerStates.
- Simplify view management: ShaderResourceView aka SRV, RenderTargetView aka RTV, UnorderedAccessViews aka UAV, DepthStencilView aka DSV: All those views are automatically created/managed by the toolkit and associated with according resources (Buffer or Textures). The toolkit provides also convenient helper methods to access also different slices of views (slice of mipmaps, slice of texture array…etc.).
- Top level component GraphicsDevice that encapsulates into a single component Direct3D11 Device and DeviceContext. The GraphicsDevice will provide a simplified API to setup part of the pipeline: index/vertex buffers inputs, render targets outputs, states and dispatch / draw calls API.
- It is also providing components GraphicsAdapter and GraphicsPresenter to encapsulate SharpDX.DXGI adapters and swapchains.
- Lots of useful small API helpers, like the ability to Get/Set the content of any buffers, textures from the CPU to the GPU and vice-versa (The equivalent of all the GetData/SetData in XNA), and some predefined Vertex structures (VertexColorPosition, VertexTexturePosition… etc.)
- Port of DirectxTex to support loading of DDS textures and all formats supported by WIC (png, bmp, jpg, tiff, gif…etc.), with possibly mipmap creation and support for compression to BC.* texture formats.
- Also, a complete Effect Framework will be introduced similar to the legacy fx framework. This framework will manage the setup of the whole pipelines, shader stages, shader resource managements, sampler states, constant buffers…etc.
- After the previous API will be done, SpriteFont, SpriteBatch helpers will be introduced.
- Concerning meshes (convert/loading of popular 3D formats, skinning…etc.), it is still not decided if SharpDX.Toolkit will provide this kind of API.
Of course, this whole new Toolkit won’t be done in one week but will hopefully be completed by the end of the year (it is already quite usable for lots of tasks, like all resource creations).
Let me know what you think about all of this and if you have any suggestions feel free to leave a message on this post on the forum.
Next release of SharpDX is probably going to wait for the Windows Phone 8 SDK hopefuly to be released later this summer, as it will certainly be possible to use SharpDX from WP8.