Add Valid property to handle types

This commit is contained in:
Vladimir Vukicevic 2020-02-18 09:42:47 -08:00 committed by Бранимир Караџић
parent ccdd6676ca
commit 9499acce56
2 changed files with 52 additions and 13 deletions

View File

@ -2157,29 +2157,65 @@ public static partial class bgfx
{ {
} }
public struct DynamicIndexBufferHandle{ public ushort idx; } public struct DynamicIndexBufferHandle {
public ushort idx;
public bool Valid => idx != UInt16.MaxValue;
}
public struct DynamicVertexBufferHandle{ public ushort idx; } public struct DynamicVertexBufferHandle {
public ushort idx;
public bool Valid => idx != UInt16.MaxValue;
}
public struct FrameBufferHandle{ public ushort idx; } public struct FrameBufferHandle {
public ushort idx;
public bool Valid => idx != UInt16.MaxValue;
}
public struct IndexBufferHandle{ public ushort idx; } public struct IndexBufferHandle {
public ushort idx;
public bool Valid => idx != UInt16.MaxValue;
}
public struct IndirectBufferHandle{ public ushort idx; } public struct IndirectBufferHandle {
public ushort idx;
public bool Valid => idx != UInt16.MaxValue;
}
public struct OcclusionQueryHandle{ public ushort idx; } public struct OcclusionQueryHandle {
public ushort idx;
public bool Valid => idx != UInt16.MaxValue;
}
public struct ProgramHandle{ public ushort idx; } public struct ProgramHandle {
public ushort idx;
public bool Valid => idx != UInt16.MaxValue;
}
public struct ShaderHandle{ public ushort idx; } public struct ShaderHandle {
public ushort idx;
public bool Valid => idx != UInt16.MaxValue;
}
public struct TextureHandle{ public ushort idx; } public struct TextureHandle {
public ushort idx;
public bool Valid => idx != UInt16.MaxValue;
}
public struct UniformHandle{ public ushort idx; } public struct UniformHandle {
public ushort idx;
public bool Valid => idx != UInt16.MaxValue;
}
public struct VertexBufferHandle{ public ushort idx; } public struct VertexBufferHandle {
public ushort idx;
public bool Valid => idx != UInt16.MaxValue;
}
public struct VertexLayoutHandle{ public ushort idx; } public struct VertexLayoutHandle {
public ushort idx;
public bool Valid => idx != UInt16.MaxValue;
}
/// <summary> /// <summary>

View File

@ -267,7 +267,10 @@ function converter.types(typ)
if typ.handle then if typ.handle then
lastCombinedFlagBlock() lastCombinedFlagBlock()
yield("public struct " .. typ.name .. "{ public ushort idx; }") yield("public struct " .. typ.name .. " {")
yield(" public ushort idx;")
yield(" public bool Valid => idx != UInt16.MaxValue;")
yield("}")
elseif hasSuffix(typ.name, "::Enum") then elseif hasSuffix(typ.name, "::Enum") then
lastCombinedFlagBlock() lastCombinedFlagBlock()