Veldrid 4.5.0
2018-12-15
Veldrid 4.5.0 is now available for download. This is the largest release to date, and includes many exciting new features. A big thanks to everyone who has contributed to this release!
Veldrid can be installed from NuGet, and the source is available on GitHub.
Virtual Reality Support
A new add-on library, Veldrid.VirtualReality, provides the ability to render into VR headsets with a simple, portable API. Both OpenVR and Oculus are supported, and VR setup can be accomplished in just a few lines of code. All Veldrid backends are supported. Once a VRContext
is created, rendering is performed as normal into a Framebuffer
object for each eye, which are automatically created and managed by Veldrid. The library also includes support for updating and retrieving the HMD's current pose.
Improved SPIR-V Support
Veldrid.SPIRV now supports all desktop and mobile platforms, including iOS and Android. On Android, both arm64-v8a and armeabi-v7a ABIs are supported. The latest NuGet package includes build-time support which automatically bundles all required native components with your application.
sRGB Textures
Several sRGB pixel formats are now supported. In addition, it is possible to create a Swapchain which is backed by an sRGB-encoded Texture. When rendering to a Framebuffer backed by an sRGB Texture, automatic conversion from linear to sRGB space will be done. When sampling from a sRGB-encoded Texture, the reverse transformation (sRGB to linear) will occur automatically.
See the new SRgb-suffixed members in PixelFormat for the full set of supported sRGB formats.
CommandList Debug Groups
Several utility methods have been added to CommandList which allow nested "debug groups" to be pushed and popped into the command stream, and for individual debug markers to be inserted.
- void CommandList.PushDebugGroup(string name)
- void CommandList.PopDebugGroup()
- void CommandList.InsertDebugMarker(string name)
These groups and markers can be visualized in graphics debuggers like RenderDoc, which helps distinguish different portions of a frame capture.
commandList.PushDebugGroup("Left Eye");
RenderEye(VREye.Left);
commandList.PopDebugGroup();
commandList.PushDebugGroup("Right Eye");
RenderEye(VREye.Right);
commandList.PopDebugGroup();
Shown above: a RenderDoc frame capture, with collapsible sections for each debug group.
Native Backend Access
In order to integrate with Virtual Reality SDKs, limited support for retrieving backend-specific information has been added. These new features should be used sparingly when no fully-portable option is available. See the following new types for more information:
DeviceBufferRange and dynamic buffer resources
DeviceBufferRange is a new BindableResource type which allows a portion of a DeviceBuffer to be made available to a shader, rather than its full range.
Support for "dynamic" buffer resources has also been added. This feature allows you to choose a dynamic offset for a DeviceBuffer or DeviceBufferRange when it is bound to a CommandList. This allows you to store multiple distinct ranges of data without needing to manage multiple DeviceBuffers.
- See the documentation for DeviceBufferRange and ResourceLayoutElementOptions.DynamicBinding for more information on these features.
Source Link
Source Link has been enabled in the NuGet packages. It is now possible to step through Veldrid sources using Visual Studio or any other debugger supporing Source Link.
Miscellaneous Additions
- Added ImageSharpCubemapTexture, a helper class for creating cubemap Textures using ImageSharp. @geoeo
- Support for 16-bit float vertex formats.
- Texture now implements the BindableResource interface, meaning it can be included directly into a ResourceSet without the need to create a TextureView. Doing this is functionally equivalent to binding a TextureView that covers the full range of mip levels and array layers in the Texture.
- TextureViewDescription now includes a PixelFormat Format field, which can be used to control how the pixel data is interpreted through the TextureView. The format of a TextureView is allowed to be:
- The same PixelFormat as its Target Texture.
- The matching sRGB or non-sRGB counterpart to its Target Texture.
- For uncompressed Textures, a different PixelFormat with the same data size and number of components.
- Add Sdl2Window.Resizable and Sdl2Window.BorderVisible. Expose SDL_WINDOWPOS_CENTERED, SDL_GetClipboardText, and SDL_SetClipboardText.
- Better support for deploying the SDL2 native binary to mono projects when using Veldrid.SDL2.
- Allow creating a Metal Swapchain for an NSView directly. This allows you to embed a Veldrid view (or multiple views) into standard macOS UI applications. See SwapchainSource.CreateNSView(IntPtr).
All Changes
- [OpenGL] Improve compatibility in "roundabout" texture copy code path. [507bade]
- [OpenGLES] Replace usage of glGetTexImage with glReadPixels. [fc865ce]
- Only create GraphicsDevice.Aniso4xSampler if supported. [7f18acf]
- Fix D3D11CommandList.GenerateMipmaps on non-sampled/storage textures. [6bdcf6d]
- Add support for rendering into Virtual Reality headsets. [ca9a963]
- [Vulkan] Fix a potential thread timing issue related to Vulkan command buffer tracking. [2c0c4e8]
- [Vulkan] Enable shaderStorageImageMultisample if available. [0d37210]
- [SDL2] Do not throw a TypeInitializationException if some SDL2 functions cannot be loaded. [0ceea20]
- [OpenGL] Set Thread.IsBackground to true for the OpenGL execution thread. [2df19ea]
- [SDL2] Add Sdl2Window.Resizable and .BorderVisible. [90896fb]
- [SDL2] Add an MSBuild config file for mono targets. [75af565]
- [Metal] Add support for creating a Metal Swapchain from an NSView. [e170e90]
- Implement BindableResource on Texture directly. [044d542]
- Allow TextureViews to use a different PixelFormat from their target. [080ed1c]
- Fix typo that prevented creating a TextureView for anything other than the first array layer in a Texture2D [274e443] (@tgjones)
- Allow non-multiple-of-four-sized texture to be updated with multiple-of-four mipmap data [64b79bd] (@tgjones)
- [OpenGL] Detect GLES 3.2 support for GL_OES_draw_elements_base_vertex. [d1e1cac]
- Add additional compressed sRGB formats. [9efcc8a]
- [D3D11] Disable alt-enter fullscreen behavior in Win32. [700d2de]
- [Metal] Hook into MTLCommandBuffer's completion callback using Objective C blocks. [1995973]
- Add additional texture layout transitions in VkCommandList.cs. [c8a12cb]
- [OpenGL] Fix an error in SSBO index calculation. [768ea32]
- Add XML docs for new dynamic buffer overloads on CommandList, and add array overloads. [c705ef6]
- Add back some validation for dynamic buffers, and fix Vulkan descriptor allocation. [355dd27]
- Allow buffers to have a dynamic offset when bound to a CommandList. [3e89496]
- Allow uniform buffers to be bound with an offset+size. [33a0545]
- [ImGui] Remove unnecessary allocation in ImGuiRenderer.cs. [3540206]
- Add three debug utility methods to CommandList. [8145d9f]
- UIView Swapchains now scale with the screen's "nativeScale" property. [14461b0]
- [OpenGL] Ensure that SwapchainDescription values override GraphicsDeviceOption ones. [fc7cf9e]
- [Metal] Fix a couple of issues with texture copies with non-zero origins. [74e25c8]
- [OpenGL] Fix some unimplemented code paths involving compressed array texture copies and mapping. [36772e1]
- [Vulkan] Fix some logic related to regular->staging texture copies with non-zero copy origins. [147c0fb]
- Add support for sRGB PixelFormats.
- Refactor some things about sRGB a little bit to better support legacy OpenGL behavior. [5ba6c72]
- Add stream constructor to ImageSharpTexture (#130) [b137344] (@feliwir)
- Recompile imgui-vertex.metal. [5b5adba]
- [ImGui] Make sure alpha channel is transferred over in new sRGB-aware ImGui shaders. [485a1d2]
- [ImGui] Ensure that brief mouse presses are captured. [2569246]
- [Metal] Support SyncToVerticalBlank on macOS 10.13+. [31cd6bc]
- [OpenGL] On macOS, always consider the backbuffer sRGB. [8b0a73c]
- [Metal] Compile new ImGui Metal shader. [9b611a1]
- [Demo] Output linear pixels in the demo's UI renderer. [df79cc8]
- [ImGui] Allow ImGuiRenderer to output both linear and sRGB pixel data. [13a1a89]
- [ImageSharp] Add an option to ImageSharpTexture to treat images as sRGB. [c425edf]
- Add support for VertexElementFormat.Half1/2/4. [5880aef]
- [Demo] Fix how shader sets were being cached with respect to different SpecializationConstants. [65ee9b4]
- [Demo] Allow switching back and forth between sRGB swapchain format. [c75b1a3]
- [OpenGL] Explicitly set the SDL attribute for sRGB to false unless it is enabled. [0f75141]
- [Demo] Additional demo changes to accomodate sRGB. [698a2dd]
- [OpenGL] Do a roundabout query process for determining whether the backbuffer is sRGB. [15e4764]
- Implement sRGB support on Metal. [c0363dd]
- More sRGB work. [ccccb4e]
- Add sRGB PixelFormat support. [c2a433e]
- [D3D11] Fix an issue with how vertex bindings were flushed in some cases. [7f8f9a9]
- Expose VeldridStartup.SetSDLGLContextAttributes. [df2f131] (AridTag)
- [SDL2] Add SDL_Get/SetClipboardText. [28c91f0]
- [Vulkan] Re-acquire swapchain after recreating it due to vsync change. [b082a87]
- [Vulkan] Add the submission fence to the list after call to vkQueueSubmit. [ccea463]
- [Vulkan] Use a ConcurrentQueue for reusable VkFence collection. [391738b]
- Give Veldrid.ImGui its own independent version.json file. Bump it to 5.0.65. [cf43ced]
- Update Veldrid.ImGui to latest autogen'd ImGui.NET package. [fac9317]
- Expose Sdl2Native.SDL_WINDOWPOS_CENTERED. [a9df038]
- [Vulkan] Sort freed memory blocks and combine contiguous blocks. [59b3a30]
- [Vulkan] Fix an issue with how the "new ResourceSet count" variables were tracked. [7f0aa5b]
- [Vulkan] Insert a memory barrier after calling vkCmdCopyBuffer. [1acc3e3]
- [Vulkan] Allow allocations larger than 256 MB (64 MB dynamic). [1edc419]
- [Vulkan] Vulak is only supported when at least one VkPhysicalDevice exists. [bfae1ac]
- [Vulkan] Fix some ordering issues with how fences and staging resources were tracked. [54f578a]
- [Vulkan] Fix handling of swapchain resize when window is minimized. [7e3142f]
- [D3D11] Instead of relying on D3D11.1, use the officially-prescribed UpdateSubresource workaround in D3D11CommandList.UpdateBuffer. [12da221]
- [ImageSharp] Use CreateTextureViaUpdate instead of CreateTextureViaStaging. [e8e6084]
- [OpenGL] Stop tracking CommandLists when their reference count reaches 0. [2fa3700]
- Change all backends to skip CommandList.UpdateBuffer if the size is 0. [fd28642]
- [Metal] Fix CommandList.CopyTexture for small compressed texture regions. [516b269]
- [Metal] Fix CommandList.UpdateTexture with 0 size. [b573b76]
- Fix CommandList.CopyBuffer with a copy size of 0 bytes. [182651a]
- Fix swapped doc comments for BlendFactor.One and Zero. [a7c6382]
- Skybox.cs: Used new cubemap texture class to remove unsafe code (#115) [6205e88] @geoeo
- Free the GCHandle used in UpdateTexture(T[]). [171a33a]
- On macOS, return false for IsBackendSupported(GraphicsBackend.OpenGLES). [46ce154]
- [Metal] Track support for individual sample count values. [8c1a90a]
- [Vulkan] Fix some edge case issues around how Vulkan Framebuffer state is tracked. [9f2772c]
- Update to ImageSharp beta5 and remove obsolete methods [fac61cd] (JimBobSquarePants)