Gorgon
Show / Hide Table of Contents

Class GorgonGraphicsResource

A base resource class for resource objects such as textures and buffers.

Inheritance
object
GorgonGraphicsResource
GorgonBufferCommon
GorgonTexture1D
GorgonTexture2D
GorgonTexture3D
Implements
IGorgonNamedObject
IGorgonGraphicsObject
IGorgonNativeResource
IDisposable
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: Gorgon.Graphics.Core
Assembly: Gorgon.Graphics.Core.dll
Syntax
public abstract class GorgonGraphicsResource : IGorgonNamedObject, IGorgonGraphicsObject, IGorgonNativeResource, IDisposable
Remarks

Objects that inherit from this class will be considered a resource object that may (depending on usage) be bound to the pipeline.

Constructors

| Edit this page View Source

GorgonGraphicsResource(GorgonGraphics)

Initializes a new instance of the GorgonGraphicsResource class.

Declaration
protected GorgonGraphicsResource(GorgonGraphics graphics)
Parameters
Type Name Description
GorgonGraphics graphics

The graphics interface used to create this resource.

Remarks

Names for the resource are required, but do not need to be unique. These are used to help with debugging and can be used for managing resources in an application.

Exceptions
Type Condition
ArgumentNullException

Thrown when the graphics parameter is null.

Properties

| Edit this page View Source

EvictionPriority

Property to set or return the

Declaration
public EvictionPriority EvictionPriority { get; set; }
Property Value
Type Description
EvictionPriority
| Edit this page View Source

Graphics

Property to return the graphics interface used to create this object.

Declaration
public GorgonGraphics Graphics { get; }
Property Value
Type Description
GorgonGraphics
| Edit this page View Source

IsDisposed

Property to return whether or not the resource is disposed.

Declaration
public bool IsDisposed { get; }
Property Value
Type Description
bool
| Edit this page View Source

Name

Property to return the name of this object.

Declaration
public abstract string Name { get; }
Property Value
Type Description
string
Remarks

For best practises, the name should only be set once during the lifetime of an object. Hence, this interface only provides a read-only implementation of this property.

| Edit this page View Source

ResourceType

Property to return the type of data in the resource.

Declaration
public abstract GraphicsResourceType ResourceType { get; }
Property Value
Type Description
GraphicsResourceType
| Edit this page View Source

SizeInBytes

Property to return the size, in bytes, of the resource.

Declaration
public abstract int SizeInBytes { get; }
Property Value
Type Description
int
| Edit this page View Source

Usage

Property to return the usage for the resource.

Declaration
public abstract ResourceUsage Usage { get; }
Property Value
Type Description
ResourceUsage

Methods

| Edit this page View Source

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
public virtual void Dispose()
Remarks

Objects that override this method should be sure to call this base method or else a memory leak may occur.

| Edit this page View Source

GetApplicationData(Guid)

Function to return application specific data from the resource.

Declaration
public object GetApplicationData(Guid guid)
Parameters
Type Name Description
Guid guid

GUID to associate with the data.

Returns
Type Description
object

The data associated with the GUID.

| Edit this page View Source

SetApplicationData(Guid, object)

Function to set application specific data on the resource.

Declaration
public void SetApplicationData(Guid guid, object data)
Parameters
Type Name Description
Guid guid

GUID to associate with the data.

object data

Data to set.

Remarks

Set data to null to remove the data from the resource.

Implements

IGorgonNamedObject
IGorgonGraphicsObject
IGorgonNativeResource
IDisposable

Extension Methods

GorgonDebugExtensions.ValidateObject<T>(T, string)
GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author