Graphics API documentation

Version: alpha

FUNCTION
AddVertexStream() Adds a stream to a stream declaration
AddVertexStream() Adds a stream to a stream declaration
DeleteIndexBuffer() Delete the index buffer
DeleteVertexBuffer() Delete vertex buffer
DeleteVertexDeclaration() Delete vertex declaration
DeleteVertexStreamDeclaration() Delete vertex stream declaration
dmGraphics::GetNativeAndroidActivity() get Android native jobject
dmGraphics::GetNativeAndroidApp() get Android app object
dmGraphics::GetNativeAndroidEGLContext() get Android EGLContext
dmGraphics::GetNativeAndroidEGLSurface() get Android EGLSurface
dmGraphics::GetNativeAndroidJavaVM() get Android native JavaVM
dmGraphics::GetNativeiOSEAGLContext() get iOS EAGLContext
dmGraphics::GetNativeiOSUIView() get iOS UIView
dmGraphics::GetNativeiOSUIWindow() get iOS UIWindow
dmGraphics::GetNativeOSXNSOpenGLContext() get OSX NSOpenGLContext
dmGraphics::GetNativeOSXNSView() get OSX NSView
dmGraphics::GetNativeOSXNSWindow() get OSX NSWindow
dmGraphics::GetNativeWindowsHGLRC() get Win32 HGLRC
dmGraphics::GetNativeWindowsHWND() get Win32 HWND
dmGraphics::GetNativeX11GLXContext() get Linux X11GLXContext
dmGraphics::GetNativeX11Window() get Linux X11Window
GetMaxElementsIndices() Get the max number of indices allowed by the syste...
GetMaxElementsVertices() Get the max number of vertices allowed by the syst...
GetNumSupportedExtensions()
GetRenderTargetAttachment() Get the attachment texture from a render target. R...
GetSupportedExtension() get the supported extension
GetTextureHandle() Get the native graphics API texture object from an...
GetVertexStreamOffset() Get the physical offset into the vertex data for a...
HStorageBuffer() Create a new storage buffer
INVALID_STREAM_OFFSET() Max subpasses
INVALID_STREAM_OFFSET() Invalid stream offset
IsExtensionSupported() check if an extension is supported
IsIndexBufferFormatSupported() Check if the index format is supported
IsTextureFormatSupported() check if a specific texture format is supported
MAX_BUFFER_COLOR_ATTACHMENTS() Max buffer color attachments
MAX_SUBPASS_DEPENDENCIES() Max subpass dependencies
NewIndexBuffer() Create new index buffer with initial data
NewVertexBuffer() Create new vertex buffer with initial data
NewVertexDeclaration() Create new vertex declaration from a vertex stream...
NewVertexDeclaration() Create new vertex declaration from a vertex stream...
NewVertexStreamDeclaration() Create new vertex stream declaration. A stream dec...
SetIndexBufferData() Set index buffer data
SetIndexBufferSubData() Set subset of index buffer data
SetVertexBufferData() Set vertex buffer data
SetVertexBufferSubData() Set subset of vertex buffer data
SUBPASS_ATTACHMENT_UNUSED() Subpass attachment unused flag
SUBPASS_EXTERNAL() Subpass external
VulkanClearTexture() Clear a texture with RGBA values
VulkanCopyBufferToTexture() Copy a buffer to a texture
VulkanCreateRenderPass() Create a render pass
VulkanDeleteStorageBuffer() Delete a storage buffer
VulkanDrawBaseInstance() Draw with vertex buffer instanced
VulkanDrawElementsInstanced() Draw with index buffer instanced
VulkanGetActiveSwapChainTexture() Get the current swap chain texture
VulkanGetContext() Get the vulkan context of the installed adapter
VulkanGetUniformBinding() Get the set and binding information from a uniform...
VulkanMapIndexBuffer() Map the GPU data for a index buffer
VulkanMapVertexBuffer() Map the GPU data for a vertex buffer
VulkanMemorybarrier() Insert a memory barrier
VulkanNextRenderPass() Advance the render pass to the next sub pass
VulkanSetConstantBuffer() Bind a constant buffer to the currently bound shad...
VulkanSetFrameInFlightCount() Set the number of in-flight frames that the vulkan...
VulkanSetPipelineState() Set the entire current pipeline state
VulkanSetRenderTargetAttachments() Sets the attachments for a render target
VulkanSetStorageBuffer() Bind a storage buffer to the render state
VulkanSetStorageBufferData() Set the storage buffer data
VulkanSetVertexDeclarationStepFunction() Set the step function for a vertex declaration
VulkanUnmapIndexBuffer() Unmap a index buffer
VulkanUnmapVertexBuffer() Unmap a vertex buffer
ENUMS
AttachmentOp
BarrierAccessFlags
BarrierStageFlags
BlendFactor Blend factor
BufferAccess
BufferUsage
CompareFunc
FaceWinding
HandleResult
IndexBufferFormat
PrimitiveType Primitive type
RenderTargetAttachment
StencilOp
TextureFormat
Type Data type
VertexStepFunction Vertex step function. Dictates how the data for a ...

Functions

AddVertexStream()

AddVertexStream(context,name,size,type,normalize)

Adds a stream to a stream declaration

PARAMETERS

context dmGraphics::HContext the context
name const char* the name of the stream
size uint32_t the size of the stream, i.e number of components
type dmGraphics::Type the data type of the stream
normalize bool true if the stream should be normalized in the 0..1 range

AddVertexStream()

AddVertexStream(context,name_hash,size,type,normalize)

Adds a stream to a stream declaration

PARAMETERS

context dmGraphics::HContext the context
name_hash uint64_t the name hash of the stream
size uint32_t the size of the stream, i.e number of components
type dmGraphics::Type the data type of the stream
normalize bool true if the stream should be normalized in the 0..1 range

DeleteIndexBuffer()

DeleteIndexBuffer(buffer)

Delete the index buffer

PARAMETERS

buffer dmGraphics::HIndexBuffer the index buffer

DeleteVertexBuffer()

DeleteVertexBuffer(buffer)

Delete vertex buffer

PARAMETERS

buffer dmGraphics::HVertexBuffer the buffer

DeleteVertexDeclaration()

DeleteVertexDeclaration(vertex_declaration)

Delete vertex declaration

PARAMETERS

vertex_declaration dmGraphics::HVertexDeclaration the vertex declaration

DeleteVertexStreamDeclaration()

DeleteVertexStreamDeclaration(stream_declaration)

Delete vertex stream declaration

PARAMETERS

stream_declaration dmGraphics::HVertexStreamDeclaration the vertex stream declaration

dmGraphics::GetNativeAndroidActivity()

dmGraphics::GetNativeAndroidActivity()

Get Android native jobject. Any other platform return zero.

PARAMETERS

None

RETURNS

jobject jobject native handle

dmGraphics::GetNativeAndroidApp()

dmGraphics::GetNativeAndroidApp()

Get Android app object. Any other platform return zero.

PARAMETERS

None

RETURNS

app struct android_app* native handle

dmGraphics::GetNativeAndroidEGLContext()

dmGraphics::GetNativeAndroidEGLContext()

Get Android EGLContext native handle (EGLContext). Any other platform return zero.

PARAMETERS

None

RETURNS

EGLContext EGLContext native handle

dmGraphics::GetNativeAndroidEGLSurface()

dmGraphics::GetNativeAndroidEGLSurface()

Get Android EGLSurface native handle (EGLSurface). Any other platform return zero.

PARAMETERS

None

RETURNS

EGLSurface EGLSurface native handle

dmGraphics::GetNativeAndroidJavaVM()

dmGraphics::GetNativeAndroidJavaVM()

Get Android JavaVM ptr. Any other platform return zero.

PARAMETERS

None

RETURNS

JavaVM* JavaVM* native handle

dmGraphics::GetNativeiOSEAGLContext()

dmGraphics::GetNativeiOSEAGLContext()

Get iOS EAGLContext native handle (id). Any other platform return zero.

PARAMETERS

None

RETURNS

id id native handle

dmGraphics::GetNativeiOSUIView()

dmGraphics::GetNativeiOSUIView()

Get iOS UIView native handle (id). Any other platform return zero.

PARAMETERS

None

RETURNS

id id native handle

dmGraphics::GetNativeiOSUIWindow()

dmGraphics::GetNativeiOSUIWindow()

Get iOS UIWindow native handle (id). Any other platform return zero.

PARAMETERS

None

RETURNS

id id native handle

dmGraphics::GetNativeOSXNSOpenGLContext()

dmGraphics::GetNativeOSXNSOpenGLContext()

Get OSX NSOpenGLContext native handle (id). Any other platform return zero.

PARAMETERS

None

RETURNS

id id native handle

dmGraphics::GetNativeOSXNSView()

dmGraphics::GetNativeOSXNSView()

Get OSX NSView native handle (id). Any other platform return zero.

PARAMETERS

None

RETURNS

id id native handle

dmGraphics::GetNativeOSXNSWindow()

dmGraphics::GetNativeOSXNSWindow()

Get OSX NSWindow native handle (id). Any other platform return zero.

PARAMETERS

None

RETURNS

id id native handle

dmGraphics::GetNativeWindowsHGLRC()

dmGraphics::GetNativeWindowsHGLRC()

Get Win32 gl rendercontext native handle (HGLRC). Any other platform return zero.

PARAMETERS

None

RETURNS

HGLRC HGLRC native handle

dmGraphics::GetNativeWindowsHWND()

dmGraphics::GetNativeWindowsHWND()

Get Win32 windows native handle (HWND). Any other platform return zero.

PARAMETERS

None

RETURNS

HWND HWND native handle

dmGraphics::GetNativeX11GLXContext()

dmGraphics::GetNativeX11GLXContext()

Get Linux X11GLXContext native handle (GLXContext). Any other platform return zero.

PARAMETERS

None

RETURNS

GLXContext GLXContext native handle

dmGraphics::GetNativeX11Window()

dmGraphics::GetNativeX11Window()

Get Linux X11Window windows native handle (Window). Any other platform return zero.

PARAMETERS

None

RETURNS

Window Window native handle

GetMaxElementsIndices()

GetMaxElementsIndices(context)

Get the max number of indices allowed by the system in an index buffer

PARAMETERS

context dmGraphics::HContext the context

RETURNS

count uint32_t the count

GetMaxElementsVertices()

GetMaxElementsVertices(context)

Get the max number of vertices allowed by the system in a vertex buffer

PARAMETERS

context dmGraphics::HContext the context

RETURNS

count uint32_t the count

GetNumSupportedExtensions()

GetNumSupportedExtensions(context)

PARAMETERS

context dmGraphics::HContext the context

RETURNS

count uint32_t the number of supported extensions

GetRenderTargetAttachment()

GetRenderTargetAttachment(render_target,attachment_type)

Get the attachment texture from a render target. Returns zero if no such attachment texture exists.

PARAMETERS

render_target dmGraphics::HRenderTarget the render target
attachment_type dmGraphics::RenderTargetAttachment the attachment to get

RETURNS

attachment dmGraphics::HTexture the attachment texture

GetSupportedExtension()

GetSupportedExtension(context,index)

get the supported extension

PARAMETERS

context dmGraphics::HContext the context
index uint32_t the index of the extension

RETURNS

extension const char* the extension. 0 if index was out of bounds

GetTextureHandle()

GetTextureHandle(texture,out_handle)

Get the native graphics API texture object from an engine texture handle. This depends on the graphics backend and is not guaranteed to be implemented on the currently running adapter.

PARAMETERS

texture dmGraphics::HTexture the texture handle
out_handle void** a pointer to where the raw object should be stored

RETURNS

handle_result dmGraphics::HandleResult the result of the query

GetVertexStreamOffset()

GetVertexStreamOffset(vertex_declaration,name_hash)

Get the physical offset into the vertex data for a particular stream

PARAMETERS

vertex_declaration dmGraphics::HVertexDeclaration the vertex declaration
name_hash uint64_t the name hash of the vertex stream (as passed into AddVertexStream())

RETURNS

Offset in bytes into the vertex or INVALID_STREAM_OFFSET if not found

HStorageBuffer()

HStorageBuffer(context,buffer_size)

Create a new storage buffer

PARAMETERS

context dmGraphics::HContext the vulkan context
buffer_size uint32_t the size of the storage buffer to allocate

RETURNS

storage_buffer dmGraphics::HStorageBuffer the storage buffer

INVALID_STREAM_OFFSET()

INVALID_STREAM_OFFSET()

Max subpasses

PARAMETERS

None


INVALID_STREAM_OFFSET()

INVALID_STREAM_OFFSET()

Invalid stream offset

PARAMETERS

None


IsExtensionSupported()

IsExtensionSupported(context,extension)

check if an extension is supported

PARAMETERS

context dmGraphics::HContext the context
extension const char* the extension.

RETURNS

result bool true if the extension was supported

IsIndexBufferFormatSupported()

IsIndexBufferFormatSupported(context,format,result)

Check if the index format is supported

PARAMETERS

context dmGraphics::HContext the context
format dmGraphics::IndexBufferFormat the format
result bool true if the format is supoprted

IsTextureFormatSupported()

IsTextureFormatSupported(context,format)

check if a specific texture format is supported

PARAMETERS

context dmGraphics::HContext the context
format TextureFormat the texture format.

RETURNS

result bool true if the texture format was supported

MAX_BUFFER_COLOR_ATTACHMENTS()

MAX_BUFFER_COLOR_ATTACHMENTS()

Max buffer color attachments

PARAMETERS

None


MAX_SUBPASS_DEPENDENCIES()

MAX_SUBPASS_DEPENDENCIES()

Max subpass dependencies

PARAMETERS

None


NewIndexBuffer()

NewIndexBuffer(context,size,data,buffer_usage)

Create new index buffer with initial data

PARAMETERS

context dmGraphics::HContext the context
size uint32_t the size of the buffer (in bytes). May be 0
data void* the data
buffer_usage dmGraphics::BufferUsage the usage

RETURNS

buffer dmGraphics::HIndexBuffer the index buffer

NewVertexBuffer()

NewVertexBuffer(context,size,data,buffer_usage)

Create new vertex buffer with initial data

PARAMETERS

context dmGraphics::HContext the context
size uint32_t the size of the buffer (in bytes). May be 0
data void* the data
buffer_usage dmGraphics::BufferUsage the usage

RETURNS

buffer dmGraphics::HVertexBuffer the vertex buffer

NewVertexDeclaration()

NewVertexDeclaration(context,stream_declaration)

Create new vertex declaration from a vertex stream declaration

PARAMETERS

context dmGraphics::HContext the context
stream_declaration dmGraphics::HVertexStreamDeclaration the vertex stream declaration

RETURNS

declaration dmGraphics::HVertexDeclaration the vertex declaration

NewVertexDeclaration()

NewVertexDeclaration(context,stream_declaration,stride)

Create new vertex declaration from a vertex stream declaration and an explicit stride value, where the stride is the number of bytes between each consecutive vertex in a vertex buffer

PARAMETERS

context dmGraphics::HContext the context
stream_declaration dmGraphics::HVertexStreamDeclaration the vertex stream declaration
stride uint32_t the stride between the start of each vertex (in bytes)

RETURNS

declaration dmGraphics::HVertexDeclaration the vertex declaration

NewVertexStreamDeclaration()

NewVertexStreamDeclaration(context)

Create new vertex stream declaration. A stream declaration contains a list of vertex streams that should be used to create a vertex declaration from.

PARAMETERS

context dmGraphics::HContext the context

RETURNS

declaration dmGraphics::HVertexStreamDeclaration the vertex declaration

SetIndexBufferData()

SetIndexBufferData(buffer,size,data,buffer_usage)

Set index buffer data

PARAMETERS

buffer dmGraphics::HIndexBuffer the buffer
size uint32_t the size of the buffer (in bytes). May be 0
data void* the data
buffer_usage dmGraphics::BufferUsage the usage

SetIndexBufferSubData()

SetIndexBufferSubData(buffer,offset,size,data)

Set subset of index buffer data

PARAMETERS

buffer dmGraphics::HVertexBuffer the buffer
offset uint32_t the offset into the desination buffer (in bytes)
size uint32_t the size of the buffer (in bytes). May be 0
data void* the data

SetVertexBufferData()

SetVertexBufferData(buffer,size,data,buffer_usage)

Set vertex buffer data

PARAMETERS

buffer dmGraphics::HVertexBuffer the buffer
size uint32_t the size of the buffer (in bytes). May be 0
data void* the data
buffer_usage dmGraphics::BufferUsage the usage

SetVertexBufferSubData()

SetVertexBufferSubData(buffer,offset,size,data)

Set subset of vertex buffer data

PARAMETERS

buffer dmGraphics::HVertexBuffer the buffer
offset uint32_t the offset into the desination buffer (in bytes)
size uint32_t the size of the buffer (in bytes). May be 0
data void* the data

SUBPASS_ATTACHMENT_UNUSED()

SUBPASS_ATTACHMENT_UNUSED()

Subpass attachment unused flag

PARAMETERS

None


SUBPASS_EXTERNAL()

SUBPASS_EXTERNAL()

Subpass external

PARAMETERS

None


VulkanClearTexture()

VulkanClearTexture(context,texture,values)

Clear a texture with RGBA values

PARAMETERS

context dmGraphics::HContext the vulkan context
texture dmGraphics::HTexture the texture to clear
values float[4 ] the clear values

VulkanCopyBufferToTexture()

VulkanCopyBufferToTexture(context,buffer,texture,width,height,x,y,mipmap)

Copy a buffer to a texture

PARAMETERS

context dmGraphics::HContext the vulkan context
buffer dmGraphics::HVertexBuffer the buffer to copy into the texture
texture dmGraphics::HTexture the texture to copy into
width uint32_t width of the texture slice to copy
height uint32_t height of the texture slice to copy
x uint32_t x offset into the texture
y uint32_t y offset into the texture
mipmap uint32_t the mipmap slice to upload

VulkanCreateRenderPass()

VulkanCreateRenderPass(context,render_target,params)

Create a render pass

PARAMETERS

context dmGraphics::HContext the vulkan context
render_target dmGraphics::HRenderTarget the render target
params dmGraphics::CreateRenderPassParams params

VulkanDeleteStorageBuffer()

VulkanDeleteStorageBuffer(context,storage_buffer)

Delete a storage buffer

PARAMETERS

context dmGraphics::HContext the vulkan context
storage_buffer dmGraphics::HStorageBuffer the attachment to get

VulkanDrawBaseInstance()

VulkanDrawBaseInstance(context,prim_type,first,count,instance_count,type,index_buffer)

Draw with vertex buffer instanced

PARAMETERS

context dmGraphics::HContext the vulkan context
prim_type dmGraphics::PrimitiveType primitive type
first uint32_t the byte offset into the index buffer
count uint32_t number of primitives to draw
instance_count uint32_t number of instances to draw
type dmGraphics::Type the index buffer type
index_buffer dmGraphics::HIndexBuffer the index buffer

VulkanDrawElementsInstanced()

VulkanDrawElementsInstanced(context,prim_type,first,count,instance_count,type,index_buffer)

Draw with index buffer instanced

PARAMETERS

context dmGraphics::HContext the vulkan context
prim_type dmGraphics::PrimitiveType primitive type
first uint32_t the byte offset into the index buffer
count uint32_t number of primitives to draw
instance_count uint32_t number of instances to draw
type dmGraphics::Type the index buffer type
index_buffer dmGraphics::HIndexBuffer the index buffer

VulkanGetActiveSwapChainTexture()

VulkanGetActiveSwapChainTexture(context)

Get the current swap chain texture

PARAMETERS

context dmGraphics::HContext the vulkan context

RETURNS

swapchain dmGraphics::HTexture the swap chain texture for the current frame

VulkanGetContext()

VulkanGetContext()

Get the vulkan context of the installed adapter

PARAMETERS

None

RETURNS

context dmGraphics::HContext the vulkan context

VulkanGetUniformBinding()

VulkanGetUniformBinding(context,program,index,set,binding,member_index)

Get the set and binding information from a uniform index

PARAMETERS

context dmGraphics::HContext the vulkan context
program dmGraphics::HProgram the program to query
index uint32_t uniform index
set uint32_t* a pointer to store the result of the set number
binding uint32_t* a pointer to store the result of the binding number
member_index uint32_t* a pointer to store the result of the member index

VulkanMapIndexBuffer()

VulkanMapIndexBuffer(context,buffer,buffer_access)

Map the GPU data for a index buffer

PARAMETERS

context dmGraphics::HContext the vulkan context
buffer dmGraphics::HIndexBuffer the buffer to map
buffer_access dmGraphics::BufferAccess how to access the buffer

RETURNS

void* void* the mapped data buffer

VulkanMapVertexBuffer()

VulkanMapVertexBuffer(context,buffer,buffer_access)

Map the GPU data for a vertex buffer

PARAMETERS

context dmGraphics::HContext the vulkan context
buffer dmGraphics::HVertexBuffer the buffer to map
buffer_access dmGraphics::BufferAccess how to access the buffer

RETURNS

void* void* the mapped data buffer

VulkanMemorybarrier()

VulkanMemorybarrier(context,texture,src_stage_flags,dst_stage_flags,src_access_flags,dst_access_flags)

Insert a memory barrier

PARAMETERS

context dmGraphics::HContext the vulkan context
texture dmGraphics::HTexture the texture to set barrier for
src_stage_flags uint32_t src stage flag
dst_stage_flags uint32_t dst stage flag
src_access_flags uint32_t src access flag
dst_access_flags uint32_t dst access flag

VulkanNextRenderPass()

VulkanNextRenderPass(context,render_target)

Advance the render pass to the next sub pass

PARAMETERS

context dmGraphics::HContext the vulkan context
render_target dmGraphics::HRenderTarget the render target to advance

VulkanSetConstantBuffer()

VulkanSetConstantBuffer(context,buffer,buffer_offset,base_location)

Bind a constant buffer to the currently bound shader

PARAMETERS

context dmGraphics::HContext the vulkan context
buffer dmGraphics::HVertexBuffer the constant buffer
buffer_offset uint32_t offset location for the buffer
base_location dmGraphics::HUniformLocation the shader location to bind to

VulkanSetFrameInFlightCount()

VulkanSetFrameInFlightCount(context,num_frames_in_flight)

Set the number of in-flight frames that the vulkan layer uses

PARAMETERS

context dmGraphics::HContext the vulkan context
num_frames_in_flight uint8_t the max number of frames in flight

VulkanSetPipelineState()

VulkanSetPipelineState(context,ps)

Set the entire current pipeline state

PARAMETERS

context dmGraphics::HContext the vulkan context
ps dmGraphics::PipelineState the pipeline state

VulkanSetRenderTargetAttachments()

VulkanSetRenderTargetAttachments(context,render_target,params)

Sets the attachments for a render target

PARAMETERS

context dmGraphics::HContext the vulkan context
render_target dmGraphics::HRenderTarget the render target
params dmGraphics::SetRenderTargetAttachmentsParams the render target attachment params

VulkanSetStorageBuffer()

VulkanSetStorageBuffer(context,storage_buffer,binding_index,buffer_offset,base_location)

Bind a storage buffer to the render state

PARAMETERS

context dmGraphics::HContext the vulkan context
storage_buffer dmGraphics::HStorageBuffer the storage buffer to bind
binding_index uint32_t binding index
buffer_offset uint32_t the buffer offset
base_location dmGraphics::HUniformLocation the shader location to bind to

VulkanSetStorageBufferData()

VulkanSetStorageBufferData(context,storage_buffer,size,data)

Set the storage buffer data

PARAMETERS

context dmGraphics::HContext the vulkan context
storage_buffer dmGraphics::HStorageBuffer the storage buffer
size uint32_t size of the input data
data void* the buffer data

VulkanSetVertexDeclarationStepFunction()

VulkanSetVertexDeclarationStepFunction(context,vertex_declaration,step_function)

Set the step function for a vertex declaration

PARAMETERS

context dmGraphics::HContext the vulkan context
vertex_declaration dmGraphics::HVertexDeclaration the vertex declaration to set step function for
step_function dmGraphics::VertexStepFunction the step function

VulkanUnmapIndexBuffer()

VulkanUnmapIndexBuffer(context,buffer)

Unmap a index buffer

PARAMETERS

context dmGraphics::HContext the vulkan context
buffer dmGraphics::HIndexBuffer the buffer

RETURNS

flag bool unused

VulkanUnmapVertexBuffer()

VulkanUnmapVertexBuffer(context,buffer)

Unmap a vertex buffer

PARAMETERS

context dmGraphics::HContext the vulkan context
buffer dmGraphics::HVertexBuffer the buffer

RETURNS

flag bool unused