31 lines
719 B
C#
31 lines
719 B
C#
|
|
namespace XCEngine.Rendering
|
||
|
|
{
|
||
|
|
public struct RenderGraphTextureHandle
|
||
|
|
{
|
||
|
|
private readonly int m_indexPlusOne;
|
||
|
|
|
||
|
|
private RenderGraphTextureHandle(
|
||
|
|
int indexPlusOne)
|
||
|
|
{
|
||
|
|
m_indexPlusOne = indexPlusOne;
|
||
|
|
}
|
||
|
|
|
||
|
|
public bool isValid =>
|
||
|
|
m_indexPlusOne > 0;
|
||
|
|
|
||
|
|
internal int nativeIndex =>
|
||
|
|
m_indexPlusOne > 0
|
||
|
|
? m_indexPlusOne - 1
|
||
|
|
: -1;
|
||
|
|
|
||
|
|
internal static RenderGraphTextureHandle
|
||
|
|
FromNativeIndex(int nativeIndex)
|
||
|
|
{
|
||
|
|
return nativeIndex >= 0
|
||
|
|
? new RenderGraphTextureHandle(
|
||
|
|
nativeIndex + 1)
|
||
|
|
: default;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|