-
Notifications
You must be signed in to change notification settings - Fork 5
Aardvark 5.1 changelog
Aardvark 5.1 introduces a fair amount of changes and features, especially in Aardark.Rendering where a few aspects about the code base and the API have been reworked and cleaned up. This document is intended as a reference to make the process of porting from 5.0 to 5.1 easier for developers.
- Matrix constructors with a single scalar value (e.g.
M44d(2.0)) now only set the diagonal elements to that value (i.e. equivalent toM**.FromDiagonal). - Reworked and extended color types to be more consistent and usable, added more descriptive comments (e.g. indicating whether range mapping is performed by a constructor).
- Color operations like multiplications no longer allow mixing of float and double operands. E.g.
C4d * float32is not supported anymore. - Added vectors constructors from colors (e.g.
V3f(C4f)) - Removed some obsolete code
- Added missing color conversion functions in static class
Col - Added statically resolved, generic conversion functions for matrix, vector and color types.
- Removed dynamic conversion functions in
ColorConv. Use statically resolved generic functions named after the types instead (e.g.c4b : ^a -> C4b) - Added overloads for
Fun.MinandFun.Maxthat work with a variable number of arguments. - Added
Vec.MinElement,Vec.MaxElement,Mat.MinElement,Mat.MaxElement - Added
Fun.AngleDistanceandFun.AngleDifference. - Added
ConstantFstatic class containingfloat32constants. Consequently the following become obsolete:Constant.PiFConstantSqrt2HalfFConstantLn2FConstantLn2InvFConstantOneThirdF
- Changed how
Hull3dis constructed from aBox3d. Previously the (obsolete) constructor produced planes with normals pointing inside, while a correct implemention was found inHull3d.Create. This situation is cleaned up now:- Fixed obsolete and incorrect
Hull3d(Box3d)constructor by replacing with correct implementation inHull3d.Create(Box3d) - Removed
Hull3d.Create()
- Fixed obsolete and incorrect
-
Vec.Distance1now returns the field type instead ofdoublefor integer vectors. - Added
Rot.SlerpShortestandQuaternion.SlerpShortest, makingIpol.SlerpShortestobsolete. -
Ipol<T>->Ipol<T, U> - Improved performance of indexers of the following types. They no longer throw
IndexOutOfRangeException, but will fail silently with horrible consequences:- Vector types
- Matrix types
- Quaternion types
- Rot types
- Scale types
- Shift types
- Color types
- Added
Capacityproperty toDict* - Improved
Dict*enumerators - Reduced telemetry probes overhead: avoiding allocations of disposable
- Restored
Matrix<T>sampling performance: revered interpolation functions - Improved
M**.GetHashCode()performance - Improved
HashCode.Combine: eplicit overloads for up to 8 arguments avoids temporary array allocation - Introspection and plugin cache files are named based on assembly version or file modification time (see https://github.com/aardvark-platform/aardvark.base/issues/49)
- Cleanup of Ray3d.Hits* intersections:
- light-weight overloads only calculating 'out double t'
- interesctions with untyped primitives (e.g. HitsSphere(center, radius, ..))
- changed default t-range from [double.MinValue, double.MaxVaule] to [0, double.MaxValue]
A good portion of the changes introduced by this major version comes from cleaning, reworking, and extending core aspects of Aardvark.Base.Rendering. First and foremost, the backend-independent base assembly has been renamed from Aardvark.Base.Rendering to Aardvark.Rendering to make it more consistent with the naming scheme of the other assemblies. Previously, this base library contributed to multiple namespaces, namely:
Aardvark.BaseAardvark.Base.RenderingAardvark.Rendering
This was confusing as finding the origin of a type that lived in the namespace Aardvark.Base, could be in the Aardvark.Base or Aardvark.Base.Rendering assemblies. Therefore, the rendering base assembly only populates the Aardvark.Rendering namespace from now on. Also, the Aardvark.GPGPU and Aardvark.Scenegraph assemblies contribute to their own namespaces. As a first step of porting to v5.1 apply the following rules:
- Replace
open Aardvark.Base.Rendering->open Aardvark.Rendering - Add
open Aardvark.Renderingin files that produce errors. - Add
open Aardvark.Scenegraphin files that produce errors. - Add
open Aardvark.GPGPUin files that produce errors related to GPGPU logic.
Powershell script to recursively update paket.references files:
$configFiles = Get-ChildItem . paket.references -rec
foreach ($file in $configFiles)
{
(Get-Content $file.PSPath) |
Foreach-Object { $_ -replace "Aardvark.Base.Rendering", "Aardvark.Rendering" } |
Set-Content $file.PSPath
}
The way pipeline states were represented and handled, was changed in this release, making it more consistent and extending it with missing functionality required for some more advanced rendering techniques. First of all, a number of types have been renamed:
- Renamed
DepthBiasStatetoDepthBias - Renamed
SamplerStateDescriptiontoSamplerState - Renamed
StencilStatetoStencilMode - Renamed
DepthTestModetoDepthTest
Those types and BlendMode have been evacuated from the Aardvark.Base.Rendering namespace in Aardvark.Base and are now records making their construction in F# easier. Moreover, modules named after the types were added, which contain construction utilities. For stencil modes in particular, however, it is recommended to use the explicit record construction syntax. That way it is immediately apparent what a certain stencil mode is supposed to do. For example, if you used the constructor
StencilMode(StencilOperationFunction depthPass, StencilOperationFunction depthFail, StencilOperationFunction stencilFail, StencilCompareFunction compare, int reference, uint maskuse the following construct instead:
{
Pass = depthPass
Fail = stencilFail
DepthFail = depthFail
Comparison = compare
CompareMask = mask
Reference = reference
}
The (adaptive) pipeline state is encapsulated in four new types:
BlendStateDepthStateStencilStateRasterizerState
Unless you manually construct render objects, you will probably set their fields by using new and changed functionality in the Sg module. These changes include:
-
Blend modes can now be set separately for each color attachment. To this end, there exist two functions:
Sg.blendMode : aval<BlendMode> -> ISg -> ISgSg.blendModes : aval<Map<Symbol, BlendMode>> -> ISg -> ISg
The former sets the global blend mode (as usual), whereas the latter allows the user to specify a blend mode for each attachment. The blend modes defined for an attachment take precedence over the global blend mode, which is used as a default value if the map does not contain an entry for an attachment. Furthermore, it is now possible to set the blend constant with
Sg.blendConstant : aval<'a> -> ISg -> ISgwhere'acan be any type that is compatible withC4f. -
Color write masks make it possible to specify which color channels are written to a buffer. The same semantics as for blend modes are used:
Sg.colorMask : aval<ColorMask> -> ISg -> ISgSg.colorMasks : aval<Map<Symbol, ColorMask>> -> ISg -> ISg
Moreover, there are some utility functions to disable and enable color output altogether:
Sg.colorWrite : aval<bool> -> ISg -> ISgSg.colorWrites : aval<Map<Symbol, bool>> -> ISg -> ISgSg.colorOutput : aval<Set<Symbol>> -> ISg -> ISg
Internally, these functions set the color write masks to either
ColorMask.AllorColorMask.None. -
The depth state can be controlled with the following functions:
Sg.depthTest : aval<DepthTest> -> ISg -> ISgSg.depthBias : aval<DepthBias> -> ISg -> ISgSg.depthWrite : aval<bool> -> ISg -> ISgSg.depthClamp : aval<bool> -> ISg -> ISg
The
DepthTesttype no longer controls whether depth clamping is active, but only determines the applied comparison function. -
The stencil state can now be controlled separately for front- and back facing polygons (or globally as before). The functions in the
Sgmodule let users set theStencilModeand the write masks. -
Sg.writeBuffers : aval<Set<Symbol>> : ISg -> ISgis now adaptive and a utility function that callsSg.depthWrite,Sg.stencilWriteandSg.colorOutputinternally. -
The aforementioned functions (and more) now have non-adaptive counter-parts (E.g.
Sg.blendMode' : BlendMode -> ISg -> ISg)
The IRuntime interface now provides methods for creating GPU queries that can be passed to render tasks and compute programs to gather various statistics. Refer to the example (32 - Queries) to see how it works.
This release adds the possibility to explicitly clear the stencil attachment via IRuntime.CompileClear overloads. Previously, the stencil buffer was implictly cleared to 0 whenever a depth clear value was provided. Users relying on this behavior will now have to provide a stencil clear value explicitly.
Additionally, overloads that only specify a single color will now clear all color attachments to the specified value. Previously, only the attachment with name DefaultSemantic.Colors was cleared (if existent).
Previously the interface IOutputMod and the related abstract class AbstractOutputMod were used to implement custom adaptive resources. This version comes with additional overloads for creating resources in the IRuntime interface, which should cover the most common use cases that were missing until now. If you have a use case that is not implemented yet, don't hesitate to open an issue on Github.
For the remaining, more specific use cases that don't justify a dedicated IRuntime method, you can continue using the aforementioned types. They have been renamed to IAdaptiveResource and AdaptiveResource respectively.
Previously, the IRuntime interface provided the following low-level functions to create textures:
// General API
abstract member CreateTexture : size : V3i * dim : TextureDimension * format : TextureFormat * slices : int * levels : int * samples : int -> IBackendTexture
// Specialized API for 2D and cube textures
abstract member CreateTexture : size : V2i * format : TextureFormat * levels : int * samples : int -> IBackendTexture
abstract member CreateTextureArray : size : V2i * format : TextureFormat * levels : int * samples : int * count : int -> IBackendTexture
abstract member CreateTextureCube : size : int * format : TextureFormat * levels : int * samples : int -> IBackendTexture
abstract member CreateTextureCubeArray : size : int * format : TextureFormat * levels : int * samples : int * count : int -> IBackendTextureWe reworked this to address three issues with this design:
- The general API does not distinguish between regular textures and texture arrays, unlike the specialized functions. Consequently, one has to pass
0for theslicesparameter to obtain a regular texture. - There are no specialized functions for 1D and 3D textures.
- The specialized functions for 2D textures share the same name as the general API.
The new API introduced in this release looks as following:
// General API
abstract member CreateTexture : size : V3i * dimension : TextureDimension * format : TextureFormat * levels : int * samples : int -> IBackendTexture
abstract member CreateTextureArray : size : V3i * dimension : TextureDimension * format : TextureFormat * levels : int * samples : int * count : int -> IBackendTexture
// Specialized API for all dimensions (implemented as extensions of the general API)
abstract member CreateTexture1D : size : int * format : TextureFormat * levels : int -> IBackendTexture
abstract member CreateTexture1DArray : size : int * format : TextureFormat * levels : int * count : int -> IBackendTexture
abstract member CreateTexture2D : size : V2i * format : TextureFormat * levels : int * samples : int -> IBackendTexture
abstract member CreateTexture2DArray : size : V2i * format : TextureFormat * levels : int * samples : int * count : int -> IBackendTexture
abstract member CreateTexture3D : size : V3i * format : TextureFormat * levels : int -> IBackendTexture
abstract member CreateTextureCube : size : int * format : TextureFormat * levels : int -> IBackendTexture
abstract member CreateTextureCubeArray : size : int * format : TextureFormat * levels : int * count : int -> IBackendTextureHow to transition: If you create your textures manually, it will most likely be enough to just replace all occurrences of CreateTexture and CreateTextureArray with CreateTexture2D and CreateTexture2DArray respectively. If you used the general API before (e.g. for 3D textures), you probably want to use the specialized functions instead. These have the advantage that they only expose parameter combinations that make sense (e.g. 1D and 3D textures do not support multisampling). Just note that the parameter order of the old CreateTexture is different from the new API.
The typesIBackendTextureOutputView and BackendTextureOutputView were deleted as they were duplicated functionality. Use the item and slicing properties of IBackendTexture, as well as the GetOutputView() methods instead.
The wrapper around the native Vulkan API now distinguishes between different core versions, putting the interfaces in respective modules. For example, Vulkan 1.2 core features are found in the Aardvark.Rendering.Vulkan.Vulkan12 module. This makes it easier to target a specific core version. Other changes include
- Result codes have been renamed. E.g.
VkResult.VkSuccess->VkResult.Success - Default values of empty enums have been renamed
MinValue->None
The following changes are not likely to be relevant for the average user:
- Deleted
RunningMean-> UseAverageWindowin Aardvark.Base - Deleted
IExistentialArrayProcessor,GeometryPool2 - Removed
StableSet,StableDictionaryfrom GL backend, already in Aardvark.Base - Removed
GridCell, previously used in a Demo that is now deleted - Removed module
AttributePackingV2in RenderObject.fs - Deleted Ordered.fs in Aardvark.Rendering
- Removed signatureless surfaces / effects
- Deleted
ChangeableResources -
RenderTodisposes of internal render tasks - Removed obsolete
BackendSurfaceandIRuntime.AssembleEffect - [Vulkan] All resources are reference counted, implementing
IDisposable. Removed delete functions (e.g.Image.delete,Device.Delete(Image)) - [Vulkan] Deleted unused Management/ResourcesNew.fs
- Moved
ReferenceCountingSetto Aardvark.Base - Removed broken
Sg.overlayand related types - [Vulkan] Added conservative rasterization
- Rename
Sg.diffuseFileTexture'->Sg.diffuseFileTexture - Removed unused
overridesandimagesfromOutputDescription - Removed unused
imagesfromIFramebufferSignatureandIFramebufferRuntime.CreateFramebufferSignature+ - Removed unused
CustomResourceandResource.customfrom Vulkan backend - Adaptive
Sgtexture functions now accept any subtype ofITexture(e.g.aval<IBackendTexture>) - RenderTo returns IBackendTexture
-
IRuntime.CreateFramebuffer(signature : IFramebufferSignature, textures : Set<Symbol>, size : aval<V2i>)changed toIRuntime.CreateFramebuffer(signature : IFramebufferSignature, size : aval<V2i>, writeOnly : Set<Symbol>) -
IRuntime.CreateFramebuffer(signature : IFramebufferSignature, size : aval<V2i>)creates write-only attachments for depth and stencil now. - Added methods to render to cube maps
- GL / Vk MSAA + Depth and Stencil download
- Cleanup of driver info reporting
- [GL] allow configuration of depth range using
Config.DepthRange(see Issue #66) - Improved single value uniform applicators: implemented SingleUniformHolder
- Added C# Sg overloads for
VertexAttributeandVertexIndices - Changed FShade Tangent/Binormal semantics to follow common convention: tangent=DiffuseColorUTangents; binormal=DiffuseColorVTangents
- Added missing typed variants of Sg primitives. This will likely lead to warnings regarding "superfluous use of Sg.noEvents"
- Updated CEF to 87.0.4280