hxn

Device

A GPU, and the maker of every other Metal object.

Static methods

function hxnAdopt(hxnRaw:Handle):Device

An object for a value the library returned.

function systemDefault():Device

The system's default GPU. Fails where there is none, such as a virtual machine without one.

Properties

var hxnRaw:Handle

Methods

function name():String
function newBuffer(length:Int64):Buffer

A buffer of length bytes in memory the CPU and GPU share, zeroed.

function newBufferWith(bytes:Bytes):Buffer

A shared buffer holding a copy of bytes.

function newLibraryFromSource(msl:String):Library

A library from MSL source, compiled now: hxnsl's MSL.

function newLibraryFromSourceAsync(msl:String):Future<Library>

A library from MSL source, compiled on Metal's threads; the future settles when it is.

function newLibrary(metallib:Bytes):Library

A library from a compiled .metallib.

function newCommandQueue():CommandQueue
function newComputePipeline(function_:Function):ComputePipeline
function newComputePipelineAsync(function_:Function):Future<ComputePipeline>

A compute pipeline, compiled on Metal's threads; the future settles when it is.

function newRenderPipeline(vertex:Function, fragment:Function, format:PixelFormat, attributes:Array<VertexAttribute>, layouts:Array<VertexLayout>):RenderPipeline

A render pipeline drawing to one color target of format, with vertex buffers laid out as attributes and layouts describe (both empty when the vertex stage reads none).

function newRenderPipelineAsync(vertex:Function, fragment:Function, format:PixelFormat, attributes:Array<VertexAttribute>, layouts:Array<VertexLayout>):Future<RenderPipeline>

new_render_pipeline, compiled on Metal's threads; the future settles when it is. Fails at once for a vertex layout Metal cannot take.

function newTexture(descriptor:TextureDescriptor):Texture
function newSampler(descriptor:SamplerDescriptor):Sampler
function close():Void

Releases the native value now. The collector does it otherwise. Using this object afterwards throws.