Skip to content

Instantly share code, notes, and snippets.

@raizam
Created February 20, 2019 20:32
Show Gist options
  • Save raizam/a50a070ccbf1775022e3f0369dcb191c to your computer and use it in GitHub Desktop.
Save raizam/a50a070ccbf1775022e3f0369dcb191c to your computer and use it in GitHub Desktop.
public unsafe partial struct Capabilities : IDisposable
{
//bgfx_caps_t
private Capabilities(Data* ptr)
{
this.ptr = ptr;
}
public static Capabilities New(Data val = default)
{
var ptr = Alloc<Data>();
*ptr = val;
return new Capabilities(ptr);
}
public void Dispose()
{
if(ptr != null) Free(ptr);
}
Data* ptr;
public unsafe partial struct Data
{
public Capabilities AsPtr() { fixed(Data* ptr = &this) return new Capabilities(ptr); }
public RendererType RendererType;
public ulong Supported;
public ushort VendorId;
public ushort DeviceId;
public bool HomogeneousDepth;
public bool OriginBottomLeft;
public byte NumGPUs;
public GPUCapabilities Gpu;
public CapsLimits Limits;
public fixed ushort Formats[85];
}
public RendererType RendererType => ptr->RendererType;
public void SetRendererType(RendererType value) => ptr->RendererType = value;
public ulong Supported => ptr->Supported;
public void SetSupported(ulong value) => ptr->Supported = value;
public ushort VendorId => ptr->VendorId;
public void SetVendorId(ushort value) => ptr->VendorId = value;
public ushort DeviceId => ptr->DeviceId;
public void SetDeviceId(ushort value) => ptr->DeviceId = value;
public bool HomogeneousDepth => ptr->HomogeneousDepth;
public void SetHomogeneousDepth(bool value) => ptr->HomogeneousDepth = value;
public bool OriginBottomLeft => ptr->OriginBottomLeft;
public void SetOriginBottomLeft(bool value) => ptr->OriginBottomLeft = value;
public byte NumGPUs => ptr->NumGPUs;
public void SetNumGPUs(byte value) => ptr->NumGPUs = value;
public GPUCapabilities Gpu => ptr->Gpu;
public CapsLimits Limits => ptr->Limits;
public void SetLimits(CapsLimits value) => ptr->Limits = value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment