TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

interface IResource in Tinman.Terrain.Rendering

Base interface for classes that wrap GPU resources.

interface IResource extends IDisposableGeneric<IResource>
  IMemoryConsumption
  base of IGeometryBuffer
  IGpuBuffer
  IPipelineObject
  IRenderTarget
  ITexture
  ResourceBase

Remarks

The amount of memory reported by MemoryConsumption is interpreted as the estimated amount of GPU memory that is consumed by this resource. It may be used to make large-scale resource decisions but must not be used to decide upfront whether a resource creation attempt will succeed or fail.

Passing an invalid resource object (see LifecycleState) to the graphics API will result in an TinmanException to be thrown.

Disposing a resource object while Binding returns true is invalid. An error log message will be generated in this case and the subsequent behaviour of the graphics API is implementation-specific and may even be undefined.

Disposing a resource object after all graphics API bindings have been nullified is valid, as the graphics API implementation is responsible for keeping native GPU resources alive until all pending GPU work has finished.

Attributes

AccessPattern

Returns the access pattern of this GPU resource.

property AccessPattern { get }
type ResourceAccessPattern
value The access pattern.

IsSoleOwnership

Will this object be disposed upon the next call to Dispose?

[ThreadSafe]
property IsSoleOwnership { get }
type bool
value true if the object will be disposed when Dispose is called,
false if the object will not be disposed, because some other code is still holding shared ownership (see AcquireThrow).
inherited IDisposable.IsSoleOwnership

LifecycleState

Returns the lifecycle state of this object.

property LifecycleState { get }
type LifecycleState
value The lifecycle state.
inherited ILifecycleState.LifecycleState

MemoryConsumption

Returns the estimated memory consumption of this object.

property MemoryConsumption { get }
type int64
value [>=0] The estimated memory consumption, in bytes.
inherited IMemoryConsumption.MemoryConsumption

Name

A human-readable name for debugging and testing.

property Name { get set }
type string
value The name or null.

Extensions

AssertDynamic

Asserts that AccessPattern is Dynamic.

method AssertDynamic (string source)
params source The error source tag.

AssertNotStatic

Asserts that AccessPattern is not Static.

method AssertNotStatic (string source)
params source The error source tag.

Methods

Acquire

Acquires a strong reference to this disposable object.

[OwnerReturn, Pure]
method Acquire ()
type IResource
returns The strong reference to this disposable object or null iff this object is no longer valid.
inherited IDisposableGeneric.Acquire

Remarks:

The object will not be actually disposed by calls to Dispose when there is at least one strong reference left. Code that calls this method is responsible for calling the Dispose method accordingly.

This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.

AcquireBase

Acquires a strong reference to this disposable object.

[OwnerReturn, Pure]
method AcquireBase ()
type IDisposable
returns The strong reference to this disposable object or null iff this object is no longer valid.
inherited IDisposable.AcquireBase

Remarks:

The object will not be actually disposed by calls to IDisposable when there is at least one strong reference left. Code that calls this method is responsible for calling the IDisposable method accordingly.

This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.

Using this method usually requires type casting. Subclasses may additionally implement IDisposableGeneric, in order to provide some syntactic sugar for that.

AcquireThrow

Acquires a strong reference to this disposable object.

[OwnerReturn, Pure]
method AcquireThrow ()
type IDisposable
returns [not-null] The strong reference to this disposable object.
inherited IDisposable.AcquireThrow

Remarks:

The object will not be actually disposed by calls to IDisposable when there is at least one strong reference left. Code that calls this method is responsible for calling the IDisposable method accordingly.

This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.

Exceptions:

Binding

Checks if there is at least one graphics API binding for this resource object.

method Binding ()
type bool
returns true if there is at least one graphics API binding,
false if this resource object is not bound to the graphics API.

Updates the graphics API binding counter of this resource object.

method Binding (int32 balance)
params balance The binding counter delta.

Dispose

Releases all resources held by this object if there are no more strong references to it, decrements the reference counter by one otherwise.

[Dispose, OwnerThis, ThreadSafe]
method Dispose ()
inherited IDisposable.Dispose

Remarks:

The Dispose method silently returns if the object has already been disposed.

Implementing methods must not throw any exceptions.