ID is a trivial type which contains index in pool and generation counter.
Source code: HandleTmpl, Graphics IDs.
Supports strong and weak references:
BufferID
- weak reference.
Strong<BufferID>
- strong reference.
Conversion from strong ref to weak ref has zero cost.
Weak reference can be converted to the strong ref by using IResourceManager::AcquireResource()
.
Inside command context resource internal data will be retrieved by ResourceManager::GetResourcesOrThrow()
which throws exception if ID is not valid - resource is deleted.
Exceptions are not used here. Error will be generated if ID is not valid and method will return false
.
Create*()
methods doesn't check if resource description is supported by the GPU. Vulkan implementation may create resource even if it is not supported by the current GPU.
If the engine is compiled with AE_GRAPHICS_STRONG_VALIDATION=ON
then Create*()
methods will use the IsSupported()
method to check whether the resource description is supported by the GPU. If the description is not supported, the resource will not be created and an error will be generated.
Use IsSupported()
method before creating new resource to check if the resource description is supported by the GPU.