Struct GorgonShaderInclude
An include file for a shader.
Inherited Members
Namespace: Gorgon.Graphics.Core
Assembly: Gorgon.Graphics.Core.dll
Syntax
public readonly struct GorgonShaderInclude : IGorgonNamedObject, IEquatable<GorgonShaderInclude>
Remarks
Use this object to load in included external functions for a shader. If the shader source contains an HLSL #include
directive, the shader compiler will try to locate that include file on
the file system. However, this does not work when the files are loaded from a Stream (it wouldn't know where to find the include file). So to facilitate this, this object will
contain the source for the include file and will be looked up before the file system is checked for the include file.
Gorgon uses a special keyword in shaders to allow shader files to include other files as part of the source. This keyword is named #GorgonInclude
and is similar to the HLSL
#include
keyword. The difference is that this keyword allows users to include shader source from memory instead of a separate source file. This is done by assigning a name to the included
source code in the #GorgonInclude
keyword, and adding the GorgonShaderInclude containing the source to the Includes property on the
GorgonShaderFactory class. When the include is loaded from a file, then it will automatically be added to the Includes property.
The parameters for the #GorgonInclude
keyword are:
- NameThe path name of the included source. This must be unique, and assigned to the Includes property.
- (Optional) PathThe path to the shader source file to include. This may be omitted if the include is assigned from memory in the Includes property.
These include objects are ignored with binary shader data loaded from a Stream or file as those will aready contain the included source compiled into bytecode.
Constructors
| Edit this page View SourceGorgonShaderInclude(string, string)
Initializes a new instance of the GorgonShaderInclude struct.
Declaration
public GorgonShaderInclude(string includeName, string includeSourceFile)
Parameters
Type | Name | Description |
---|---|---|
string | includeName | Name of the include file. |
string | includeSourceFile | The include source code file. |
Remarks
The includeSourceFile
can be set to null or empty if the include line is pointing to a file.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentException | Thrown when the includeName parameter is empty. |
See Also
Fields
| Edit this page View SourceName
The name of the shader include file.
Declaration
public readonly string Name
Field Value
Type | Description |
---|---|
string |
See Also
| Edit this page View SourceSourceCodeFile
The source code for the shader include file.
Declaration
public readonly string SourceCodeFile
Field Value
Type | Description |
---|---|
string |
See Also
Methods
| Edit this page View SourceEquals(GorgonShaderInclude)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(GorgonShaderInclude other)
Parameters
Type | Name | Description |
---|---|---|
GorgonShaderInclude | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
bool | true if the current object is equal to the |
See Also
| Edit this page View SourceEquals(in GorgonShaderInclude, in GorgonShaderInclude)
Function to evaluate two instances for equality.
Declaration
public static bool Equals(in GorgonShaderInclude left, in GorgonShaderInclude right)
Parameters
Type | Name | Description |
---|---|---|
GorgonShaderInclude | left | The left instance to compare. |
GorgonShaderInclude | right | The right instance to compare. |
Returns
Type | Description |
---|---|
bool | true if equal, false if not. |
See Also
| Edit this page View SourceEquals(object)
Determines whether the specified object is equal to this instance.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with this instance. |
Returns
Type | Description |
---|---|
bool | true if the specified object is equal to this instance; otherwise, false. |
Overrides
See Also
| Edit this page View SourceGetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
See Also
| Edit this page View SourceToString()
Returns a string that represents this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents this instance. |
Overrides
See Also
Operators
| Edit this page View Sourceoperator ==(GorgonShaderInclude, GorgonShaderInclude)
Equality operator.
Declaration
public static bool operator ==(GorgonShaderInclude left, GorgonShaderInclude right)
Parameters
Type | Name | Description |
---|---|---|
GorgonShaderInclude | left | Left instance to compare. |
GorgonShaderInclude | right | Right instance to compare. |
Returns
Type | Description |
---|---|
bool | true if equal, false if not. |
See Also
| Edit this page View Sourceoperator !=(GorgonShaderInclude, GorgonShaderInclude)
Inequality operator.
Declaration
public static bool operator !=(GorgonShaderInclude left, GorgonShaderInclude right)
Parameters
Type | Name | Description |
---|---|---|
GorgonShaderInclude | left | Left instance to compare. |
GorgonShaderInclude | right | Right instance to compare. |
Returns
Type | Description |
---|---|
bool | true if not equal, false if equal. |