Sdk graphics api documentation

Platform specific native graphics functions.

Namespace: dmGraphics
Include: #include <dmsdk/graphics/graphics_native.h>
TYPES
HContext Context handle
HFragmentProgram Fragment program handle
HIndexBuffer Index buffer handle
HPipelineState PipelineState handle
HProgram Program handle
HRenderTarget Rendertarget handle
HStorageBuffer Storage buffer handle
HTexture Texture handle
HUniformLocation Uniform location handle
HVertexBuffer Vertex buffer handle
HVertexDeclaration Vertex declaration handle
HVertexProgram Vertex program handle
HVertexStreamDeclaration Vertex stream declaration handle
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
void AddVertexStream(dmGraphics::HContext context, const char* name, uint32_t size, dmGraphics::Type type, bool normalize) Adds a stream to a stream declaration
void AddVertexStream(dmGraphics::HContext context, uint64_t name_hash, uint32_t size, dmGraphics::Type type, bool normalize) Adds a stream to a stream declaration
void DeleteIndexBuffer(dmGraphics::HIndexBuffer buffer) Delete the index buffer
void DeleteVertexBuffer(dmGraphics::HVertexBuffer buffer) Delete vertex buffer
void DeleteVertexDeclaration(dmGraphics::HVertexDeclaration vertex_declaration) Delete vertex declaration
void DeleteVertexStreamDeclaration(dmGraphics::HVertexStreamDeclaration stream_declaration) Delete vertex stream declaration
jobject dmGraphics::GetNativeAndroidActivity() get Android native jobject
struct android_app* dmGraphics::GetNativeAndroidApp() get Android app object
EGLContext dmGraphics::GetNativeAndroidEGLContext() get Android EGLContext
EGLSurface dmGraphics::GetNativeAndroidEGLSurface() get Android EGLSurface
JavaVM* dmGraphics::GetNativeAndroidJavaVM() get Android native JavaVM
id dmGraphics::GetNativeiOSEAGLContext() get iOS EAGLContext
id dmGraphics::GetNativeiOSUIView() get iOS UIView
id dmGraphics::GetNativeiOSUIWindow() get iOS UIWindow
id dmGraphics::GetNativeOSXNSOpenGLContext() get OSX NSOpenGLContext
id dmGraphics::GetNativeOSXNSView() get OSX NSView
id dmGraphics::GetNativeOSXNSWindow() get OSX NSWindow
HGLRC dmGraphics::GetNativeWindowsHGLRC() get Win32 HGLRC
HWND dmGraphics::GetNativeWindowsHWND() get Win32 HWND
GLXContext dmGraphics::GetNativeX11GLXContext() get Linux X11GLXContext
Window dmGraphics::GetNativeX11Window() get Linux X11Window
uint32_t GetMaxElementsIndices(dmGraphics::HContext context) Get the max number of indices allowed by the syste...
uint32_t GetMaxElementsVertices(dmGraphics::HContext context) Get the max number of vertices allowed by the syst...
uint32_t GetNumSupportedExtensions(dmGraphics::HContext context)
dmGraphics::HTexture GetRenderTargetAttachment(dmGraphics::HRenderTarget render_target, dmGraphics::RenderTargetAttachment attachment_type) Get the attachment texture from a render target. R...
const char* GetSupportedExtension(dmGraphics::HContext context, uint32_t index) get the supported extension
dmGraphics::HandleResult GetTextureHandle(dmGraphics::HTexture texture, void** out_handle) Get the native graphics API texture object from an...
 GetVertexStreamOffset(dmGraphics::HVertexDeclaration vertex_declaration, uint64_t name_hash) Get the physical offset into the vertex data for a...
dmGraphics::HStorageBuffer HStorageBuffer(dmGraphics::HContext context, uint32_t buffer_size) Create a new storage buffer
void INVALID_STREAM_OFFSET() Max subpasses
void INVALID_STREAM_OFFSET() Invalid stream offset
bool IsExtensionSupported(dmGraphics::HContext context, const char* extension) check if an extension is supported
void IsIndexBufferFormatSupported(dmGraphics::HContext context, dmGraphics::IndexBufferFormat format, bool result) Check if the index format is supported
bool IsTextureFormatSupported(dmGraphics::HContext context, TextureFormat format) check if a specific texture format is supported
void MAX_BUFFER_COLOR_ATTACHMENTS() Max buffer color attachments
void MAX_SUBPASS_DEPENDENCIES() Max subpass dependencies
dmGraphics::HIndexBuffer NewIndexBuffer(dmGraphics::HContext context, uint32_t size, void* data, dmGraphics::BufferUsage buffer_usage) Create new index buffer with initial data
dmGraphics::HVertexBuffer NewVertexBuffer(dmGraphics::HContext context, uint32_t size, void* data, dmGraphics::BufferUsage buffer_usage) Create new vertex buffer with initial data
dmGraphics::HVertexDeclaration NewVertexDeclaration(dmGraphics::HContext context, dmGraphics::HVertexStreamDeclaration stream_declaration) Create new vertex declaration from a vertex stream...
dmGraphics::HVertexDeclaration NewVertexDeclaration(dmGraphics::HContext context, dmGraphics::HVertexStreamDeclaration stream_declaration, uint32_t stride) Create new vertex declaration from a vertex stream...
dmGraphics::HVertexStreamDeclaration NewVertexStreamDeclaration(dmGraphics::HContext context) Create new vertex stream declaration. A stream dec...
void SetIndexBufferData(dmGraphics::HIndexBuffer buffer, uint32_t size, void* data, dmGraphics::BufferUsage buffer_usage) Set index buffer data
void SetIndexBufferSubData(dmGraphics::HVertexBuffer buffer, uint32_t offset, uint32_t size, void* data) Set subset of index buffer data
void SetVertexBufferData(dmGraphics::HVertexBuffer buffer, uint32_t size, void* data, dmGraphics::BufferUsage buffer_usage) Set vertex buffer data
void SetVertexBufferSubData(dmGraphics::HVertexBuffer buffer, uint32_t offset, uint32_t size, void* data) Set subset of vertex buffer data
void SUBPASS_ATTACHMENT_UNUSED() Subpass attachment unused flag
void SUBPASS_EXTERNAL() Subpass external
void VulkanClearTexture(dmGraphics::HContext context, dmGraphics::HTexture texture, float[4 values) Clear a texture with RGBA values
void VulkanCopyBufferToTexture(dmGraphics::HContext context, dmGraphics::HVertexBuffer buffer, dmGraphics::HTexture texture, uint32_t width, uint32_t height, uint32_t x, uint32_t y, uint32_t mipmap) Copy a buffer to a texture
void VulkanCreateRenderPass(dmGraphics::HContext context, dmGraphics::HRenderTarget render_target, dmGraphics::CreateRenderPassParams params) Create a render pass
void VulkanDeleteStorageBuffer(dmGraphics::HContext context, dmGraphics::HStorageBuffer storage_buffer) Delete a storage buffer
void VulkanDrawBaseInstance(dmGraphics::HContext context, dmGraphics::PrimitiveType prim_type, uint32_t first, uint32_t count, uint32_t instance_count, dmGraphics::Type type, dmGraphics::HIndexBuffer index_buffer) Draw with vertex buffer instanced
void VulkanDrawElementsInstanced(dmGraphics::HContext context, dmGraphics::PrimitiveType prim_type, uint32_t first, uint32_t count, uint32_t instance_count, dmGraphics::Type type, dmGraphics::HIndexBuffer index_buffer) Draw with index buffer instanced
dmGraphics::HTexture VulkanGetActiveSwapChainTexture(dmGraphics::HContext context) Get the current swap chain texture
dmGraphics::HContext VulkanGetContext() Get the vulkan context of the installed adapter
void VulkanGetUniformBinding(dmGraphics::HContext context, dmGraphics::HProgram program, uint32_t index, uint32_t* set, uint32_t* binding, uint32_t* member_index) Get the set and binding information from a uniform...
void* VulkanMapIndexBuffer(dmGraphics::HContext context, dmGraphics::HIndexBuffer buffer, dmGraphics::BufferAccess buffer_access) Map the GPU data for a index buffer
void* VulkanMapVertexBuffer(dmGraphics::HContext context, dmGraphics::HVertexBuffer buffer, dmGraphics::BufferAccess buffer_access) Map the GPU data for a vertex buffer
void VulkanMemorybarrier(dmGraphics::HContext context, dmGraphics::HTexture texture, uint32_t src_stage_flags, uint32_t dst_stage_flags, uint32_t src_access_flags, uint32_t dst_access_flags) Insert a memory barrier
void VulkanNextRenderPass(dmGraphics::HContext context, dmGraphics::HRenderTarget render_target) Advance the render pass to the next sub pass
void VulkanSetConstantBuffer(dmGraphics::HContext context, dmGraphics::HVertexBuffer buffer, uint32_t buffer_offset, dmGraphics::HUniformLocation base_location) Bind a constant buffer to the currently bound shad...
void VulkanSetFrameInFlightCount(dmGraphics::HContext context, uint8_t num_frames_in_flight) Set the number of in-flight frames that the vulkan...
void VulkanSetPipelineState(dmGraphics::HContext context, dmGraphics::PipelineState ps) Set the entire current pipeline state
void VulkanSetRenderTargetAttachments(dmGraphics::HContext context, dmGraphics::HRenderTarget render_target, dmGraphics::SetRenderTargetAttachmentsParams params) Sets the attachments for a render target
void VulkanSetStorageBuffer(dmGraphics::HContext context, dmGraphics::HStorageBuffer storage_buffer, uint32_t binding_index, uint32_t buffer_offset, dmGraphics::HUniformLocation base_location) Bind a storage buffer to the render state
void VulkanSetStorageBufferData(dmGraphics::HContext context, dmGraphics::HStorageBuffer storage_buffer, uint32_t size, void* data) Set the storage buffer data
void VulkanSetVertexDeclarationStepFunction(dmGraphics::HContext context, dmGraphics::HVertexDeclaration vertex_declaration, dmGraphics::VertexStepFunction step_function) Set the step function for a vertex declaration
bool VulkanUnmapIndexBuffer(dmGraphics::HContext context, dmGraphics::HIndexBuffer buffer) Unmap a index buffer
bool VulkanUnmapVertexBuffer(dmGraphics::HContext context, dmGraphics::HVertexBuffer buffer) Unmap a vertex buffer

Functions

AddVertexStream

void AddVertexStream(dmGraphics::HContext context, const char* name, uint32_t size, dmGraphics::Type type, bool normalize)

Adds a stream to a stream declaration

PARAMETERS

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

AddVertexStream

void AddVertexStream(dmGraphics::HContext context, uint64_t name_hash, uint32_t size, dmGraphics::Type type, bool normalize)

Adds a stream to a stream declaration

PARAMETERS

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

DeleteIndexBuffer

void DeleteIndexBuffer(dmGraphics::HIndexBuffer buffer)

Delete the index buffer

PARAMETERS

dmGraphics::HIndexBuffer buffer the index buffer

DeleteVertexBuffer

void DeleteVertexBuffer(dmGraphics::HVertexBuffer buffer)

Delete vertex buffer

PARAMETERS

dmGraphics::HVertexBuffer buffer the buffer

DeleteVertexDeclaration

void DeleteVertexDeclaration(dmGraphics::HVertexDeclaration vertex_declaration)

Delete vertex declaration

PARAMETERS

dmGraphics::HVertexDeclaration vertex_declaration the vertex declaration

DeleteVertexStreamDeclaration

void DeleteVertexStreamDeclaration(dmGraphics::HVertexStreamDeclaration stream_declaration)

Delete vertex stream declaration

PARAMETERS

dmGraphics::HVertexStreamDeclaration stream_declaration the vertex stream declaration

dmGraphics::GetNativeAndroidActivity

jobject dmGraphics::GetNativeAndroidActivity()

Get Android native jobject. Any other platform return zero.

PARAMETERS

RETURNS

jobject native handle

dmGraphics::GetNativeAndroidApp

struct android_app* dmGraphics::GetNativeAndroidApp()

Get Android app object. Any other platform return zero.

PARAMETERS

RETURNS

struct android_app* native handle

dmGraphics::GetNativeAndroidEGLContext

EGLContext dmGraphics::GetNativeAndroidEGLContext()

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

PARAMETERS

RETURNS

EGLContext native handle

dmGraphics::GetNativeAndroidEGLSurface

EGLSurface dmGraphics::GetNativeAndroidEGLSurface()

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

PARAMETERS

RETURNS

EGLSurface native handle

dmGraphics::GetNativeAndroidJavaVM

JavaVM* dmGraphics::GetNativeAndroidJavaVM()

Get Android JavaVM ptr. Any other platform return zero.

PARAMETERS

RETURNS

JavaVM* native handle

dmGraphics::GetNativeiOSEAGLContext

id dmGraphics::GetNativeiOSEAGLContext()

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

PARAMETERS

RETURNS

id native handle

dmGraphics::GetNativeiOSUIView

id dmGraphics::GetNativeiOSUIView()

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

PARAMETERS

RETURNS

id native handle

dmGraphics::GetNativeiOSUIWindow

id dmGraphics::GetNativeiOSUIWindow()

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

PARAMETERS

RETURNS

id native handle

dmGraphics::GetNativeOSXNSOpenGLContext

id dmGraphics::GetNativeOSXNSOpenGLContext()

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

PARAMETERS

RETURNS

id native handle

dmGraphics::GetNativeOSXNSView

id dmGraphics::GetNativeOSXNSView()

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

PARAMETERS

RETURNS

id native handle

dmGraphics::GetNativeOSXNSWindow

id dmGraphics::GetNativeOSXNSWindow()

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

PARAMETERS

RETURNS

id native handle

dmGraphics::GetNativeWindowsHGLRC

HGLRC dmGraphics::GetNativeWindowsHGLRC()

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

PARAMETERS

RETURNS

HGLRC native handle

dmGraphics::GetNativeWindowsHWND

HWND dmGraphics::GetNativeWindowsHWND()

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

PARAMETERS

RETURNS

HWND native handle

dmGraphics::GetNativeX11GLXContext

GLXContext dmGraphics::GetNativeX11GLXContext()

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

PARAMETERS

RETURNS

GLXContext native handle

dmGraphics::GetNativeX11Window

Window dmGraphics::GetNativeX11Window()

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

PARAMETERS

RETURNS

Window native handle

GetMaxElementsIndices

uint32_t GetMaxElementsIndices(dmGraphics::HContext context)

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

PARAMETERS

dmGraphics::HContext context the context

RETURNS

uint32_t the count

GetMaxElementsVertices

uint32_t GetMaxElementsVertices(dmGraphics::HContext context)

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

PARAMETERS

dmGraphics::HContext context the context

RETURNS

uint32_t the count

GetNumSupportedExtensions

uint32_t GetNumSupportedExtensions(dmGraphics::HContext context)

PARAMETERS

dmGraphics::HContext context the context

RETURNS

uint32_t the number of supported extensions

GetRenderTargetAttachment

dmGraphics::HTexture GetRenderTargetAttachment(dmGraphics::HRenderTarget render_target, dmGraphics::RenderTargetAttachment attachment_type)

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

PARAMETERS

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

RETURNS

dmGraphics::HTexture the attachment texture

GetSupportedExtension

const char* GetSupportedExtension(dmGraphics::HContext context, uint32_t index)

get the supported extension

PARAMETERS

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

RETURNS

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

GetTextureHandle

dmGraphics::HandleResult GetTextureHandle(dmGraphics::HTexture texture, void** 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

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

RETURNS

dmGraphics::HandleResult the result of the query

GetVertexStreamOffset

 GetVertexStreamOffset(dmGraphics::HVertexDeclaration vertex_declaration, uint64_t name_hash)

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

PARAMETERS

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

RETURNS

in bytes into the vertex or INVALID_STREAM_OFFSET if not found

HStorageBuffer

dmGraphics::HStorageBuffer HStorageBuffer(dmGraphics::HContext context, uint32_t buffer_size)

Create a new storage buffer

PARAMETERS

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

RETURNS

dmGraphics::HStorageBuffer the storage buffer

INVALID_STREAM_OFFSET

void INVALID_STREAM_OFFSET()

Max subpasses

PARAMETERS


INVALID_STREAM_OFFSET

void INVALID_STREAM_OFFSET()

Invalid stream offset

PARAMETERS


IsExtensionSupported

bool IsExtensionSupported(dmGraphics::HContext context, const char* extension)

check if an extension is supported

PARAMETERS

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

RETURNS

bool true if the extension was supported

IsIndexBufferFormatSupported

void IsIndexBufferFormatSupported(dmGraphics::HContext context, dmGraphics::IndexBufferFormat format, bool result)

Check if the index format is supported

PARAMETERS

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

IsTextureFormatSupported

bool IsTextureFormatSupported(dmGraphics::HContext context, TextureFormat format)

check if a specific texture format is supported

PARAMETERS

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

RETURNS

bool true if the texture format was supported

MAX_BUFFER_COLOR_ATTACHMENTS

void MAX_BUFFER_COLOR_ATTACHMENTS()

Max buffer color attachments

PARAMETERS


MAX_SUBPASS_DEPENDENCIES

void MAX_SUBPASS_DEPENDENCIES()

Max subpass dependencies

PARAMETERS


NewIndexBuffer

dmGraphics::HIndexBuffer NewIndexBuffer(dmGraphics::HContext context, uint32_t size, void* data, dmGraphics::BufferUsage buffer_usage)

Create new index buffer with initial data

PARAMETERS

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

RETURNS

dmGraphics::HIndexBuffer the index buffer

NewVertexBuffer

dmGraphics::HVertexBuffer NewVertexBuffer(dmGraphics::HContext context, uint32_t size, void* data, dmGraphics::BufferUsage buffer_usage)

Create new vertex buffer with initial data

PARAMETERS

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

RETURNS

dmGraphics::HVertexBuffer the vertex buffer

NewVertexDeclaration

dmGraphics::HVertexDeclaration NewVertexDeclaration(dmGraphics::HContext context, dmGraphics::HVertexStreamDeclaration stream_declaration)

Create new vertex declaration from a vertex stream declaration

PARAMETERS

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

RETURNS

dmGraphics::HVertexDeclaration the vertex declaration

NewVertexDeclaration

dmGraphics::HVertexDeclaration NewVertexDeclaration(dmGraphics::HContext context, dmGraphics::HVertexStreamDeclaration stream_declaration, uint32_t 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

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

RETURNS

dmGraphics::HVertexDeclaration the vertex declaration

NewVertexStreamDeclaration

dmGraphics::HVertexStreamDeclaration NewVertexStreamDeclaration(dmGraphics::HContext 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

dmGraphics::HContext context the context

RETURNS

dmGraphics::HVertexStreamDeclaration the vertex declaration

SetIndexBufferData

void SetIndexBufferData(dmGraphics::HIndexBuffer buffer, uint32_t size, void* data, dmGraphics::BufferUsage buffer_usage)

Set index buffer data

PARAMETERS

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

SetIndexBufferSubData

void SetIndexBufferSubData(dmGraphics::HVertexBuffer buffer, uint32_t offset, uint32_t size, void* data)

Set subset of index buffer data

PARAMETERS

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

SetVertexBufferData

void SetVertexBufferData(dmGraphics::HVertexBuffer buffer, uint32_t size, void* data, dmGraphics::BufferUsage buffer_usage)

Set vertex buffer data

PARAMETERS

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

SetVertexBufferSubData

void SetVertexBufferSubData(dmGraphics::HVertexBuffer buffer, uint32_t offset, uint32_t size, void* data)

Set subset of vertex buffer data

PARAMETERS

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

SUBPASS_ATTACHMENT_UNUSED

void SUBPASS_ATTACHMENT_UNUSED()

Subpass attachment unused flag

PARAMETERS


SUBPASS_EXTERNAL

void SUBPASS_EXTERNAL()

Subpass external

PARAMETERS


VulkanClearTexture

void VulkanClearTexture(dmGraphics::HContext context, dmGraphics::HTexture texture, float[4 values)

Clear a texture with RGBA values

PARAMETERS

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

VulkanCopyBufferToTexture

void VulkanCopyBufferToTexture(dmGraphics::HContext context, dmGraphics::HVertexBuffer buffer, dmGraphics::HTexture texture, uint32_t width, uint32_t height, uint32_t x, uint32_t y, uint32_t mipmap)

Copy a buffer to a texture

PARAMETERS

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

VulkanCreateRenderPass

void VulkanCreateRenderPass(dmGraphics::HContext context, dmGraphics::HRenderTarget render_target, dmGraphics::CreateRenderPassParams params)

Create a render pass

PARAMETERS

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

VulkanDeleteStorageBuffer

void VulkanDeleteStorageBuffer(dmGraphics::HContext context, dmGraphics::HStorageBuffer storage_buffer)

Delete a storage buffer

PARAMETERS

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

VulkanDrawBaseInstance

void VulkanDrawBaseInstance(dmGraphics::HContext context, dmGraphics::PrimitiveType prim_type, uint32_t first, uint32_t count, uint32_t instance_count, dmGraphics::Type type, dmGraphics::HIndexBuffer index_buffer)

Draw with vertex buffer instanced

PARAMETERS

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

VulkanDrawElementsInstanced

void VulkanDrawElementsInstanced(dmGraphics::HContext context, dmGraphics::PrimitiveType prim_type, uint32_t first, uint32_t count, uint32_t instance_count, dmGraphics::Type type, dmGraphics::HIndexBuffer index_buffer)

Draw with index buffer instanced

PARAMETERS

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

VulkanGetActiveSwapChainTexture

dmGraphics::HTexture VulkanGetActiveSwapChainTexture(dmGraphics::HContext context)

Get the current swap chain texture

PARAMETERS

dmGraphics::HContext context the vulkan context

RETURNS

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

VulkanGetContext

dmGraphics::HContext VulkanGetContext()

Get the vulkan context of the installed adapter

PARAMETERS

RETURNS

dmGraphics::HContext the vulkan context

VulkanGetUniformBinding

void VulkanGetUniformBinding(dmGraphics::HContext context, dmGraphics::HProgram program, uint32_t index, uint32_t* set, uint32_t* binding, uint32_t* member_index)

Get the set and binding information from a uniform index

PARAMETERS

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

VulkanMapIndexBuffer

void* VulkanMapIndexBuffer(dmGraphics::HContext context, dmGraphics::HIndexBuffer buffer, dmGraphics::BufferAccess buffer_access)

Map the GPU data for a index buffer

PARAMETERS

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

RETURNS

void* the mapped data buffer

VulkanMapVertexBuffer

void* VulkanMapVertexBuffer(dmGraphics::HContext context, dmGraphics::HVertexBuffer buffer, dmGraphics::BufferAccess buffer_access)

Map the GPU data for a vertex buffer

PARAMETERS

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

RETURNS

void* the mapped data buffer

VulkanMemorybarrier

void VulkanMemorybarrier(dmGraphics::HContext context, dmGraphics::HTexture texture, uint32_t src_stage_flags, uint32_t dst_stage_flags, uint32_t src_access_flags, uint32_t dst_access_flags)

Insert a memory barrier

PARAMETERS

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

VulkanNextRenderPass

void VulkanNextRenderPass(dmGraphics::HContext context, dmGraphics::HRenderTarget render_target)

Advance the render pass to the next sub pass

PARAMETERS

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

VulkanSetConstantBuffer

void VulkanSetConstantBuffer(dmGraphics::HContext context, dmGraphics::HVertexBuffer buffer, uint32_t buffer_offset, dmGraphics::HUniformLocation base_location)

Bind a constant buffer to the currently bound shader

PARAMETERS

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

VulkanSetFrameInFlightCount

void VulkanSetFrameInFlightCount(dmGraphics::HContext context, uint8_t num_frames_in_flight)

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

PARAMETERS

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

VulkanSetPipelineState

void VulkanSetPipelineState(dmGraphics::HContext context, dmGraphics::PipelineState ps)

Set the entire current pipeline state

PARAMETERS

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

VulkanSetRenderTargetAttachments

void VulkanSetRenderTargetAttachments(dmGraphics::HContext context, dmGraphics::HRenderTarget render_target, dmGraphics::SetRenderTargetAttachmentsParams params)

Sets the attachments for a render target

PARAMETERS

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

VulkanSetStorageBuffer

void VulkanSetStorageBuffer(dmGraphics::HContext context, dmGraphics::HStorageBuffer storage_buffer, uint32_t binding_index, uint32_t buffer_offset, dmGraphics::HUniformLocation base_location)

Bind a storage buffer to the render state

PARAMETERS

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

VulkanSetStorageBufferData

void VulkanSetStorageBufferData(dmGraphics::HContext context, dmGraphics::HStorageBuffer storage_buffer, uint32_t size, void* data)

Set the storage buffer data

PARAMETERS

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

VulkanSetVertexDeclarationStepFunction

void VulkanSetVertexDeclarationStepFunction(dmGraphics::HContext context, dmGraphics::HVertexDeclaration vertex_declaration, dmGraphics::VertexStepFunction step_function)

Set the step function for a vertex declaration

PARAMETERS

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

VulkanUnmapIndexBuffer

bool VulkanUnmapIndexBuffer(dmGraphics::HContext context, dmGraphics::HIndexBuffer buffer)

Unmap a index buffer

PARAMETERS

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

RETURNS

bool unused

VulkanUnmapVertexBuffer

bool VulkanUnmapVertexBuffer(dmGraphics::HContext context, dmGraphics::HVertexBuffer buffer)

Unmap a vertex buffer

PARAMETERS

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

RETURNS

bool unused

Types

HContext

Context handle


HFragmentProgram

Fragment program handle


HIndexBuffer

Index buffer handle


HPipelineState

PipelineState handle


HProgram

Program handle


HRenderTarget

Rendertarget handle


HStorageBuffer

Storage buffer handle


HTexture

Texture handle


HUniformLocation

Uniform location handle


HVertexBuffer

Vertex buffer handle


HVertexDeclaration

Vertex declaration handle


HVertexProgram

Vertex program handle


HVertexStreamDeclaration

Vertex stream declaration handle


Enums

AttachmentOp

ATTACHMENT_OP_DONT_CARE
ATTACHMENT_OP_LOAD
ATTACHMENT_OP_STORE
ATTACHMENT_OP_CLEAR

BarrierAccessFlags

ACCESS_FLAG_READ
ACCESS_FLAG_WRITE
ACCESS_FLAG_SHADER

BarrierStageFlags

STAGE_FLAG_QUEUE_BEGIN
STAGE_FLAG_QUEUE_END
STAGE_FLAG_FRAGMENT_SHADER
STAGE_FLAG_EARLY_FRAGMENT_SHADER_TEST

BlendFactor

Blend factor

BLEND_FACTOR_ZERO
BLEND_FACTOR_ONE
BLEND_FACTOR_SRC_COLOR
BLEND_FACTOR_ONE_MINUS_SRC_COLOR
BLEND_FACTOR_DST_COLOR
BLEND_FACTOR_ONE_MINUS_DST_COLOR
BLEND_FACTOR_SRC_ALPHA
BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
BLEND_FACTOR_DST_ALPHA
BLEND_FACTOR_ONE_MINUS_DST_ALPHA
BLEND_FACTOR_SRC_ALPHA_SATURATE
BLEND_FACTOR_CONSTANT_COLOR
BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR
BLEND_FACTOR_CONSTANT_ALPHA
BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA

BufferAccess

BUFFER_ACCESS_READ_ONLY
BUFFER_ACCESS_WRITE_ONLY
BUFFER_ACCESS_READ_WRITE

BufferUsage

BUFFER_USAGE_STREAM_DRAW
BUFFER_USAGE_DYNAMIC_DRAW
BUFFER_USAGE_STATIC_DRAW
Preferred for buffers that never change

CompareFunc

COMPARE_FUNC_NEVER
COMPARE_FUNC_LESS
COMPARE_FUNC_LEQUAL
COMPARE_FUNC_GREATER
COMPARE_FUNC_GEQUAL
COMPARE_FUNC_EQUAL
COMPARE_FUNC_NOTEQUAL
COMPARE_FUNC_ALWAYS

FaceWinding

FACE_WINDING_CCW
FACE_WINDING_CW

HandleResult

HANDLE_RESULT_OK
HANDLE_RESULT_NOT_AVAILABLE
HANDLE_RESULT_ERROR

IndexBufferFormat

INDEXBUFFER_FORMAT_16
INDEXBUFFER_FORMAT_32

PrimitiveType

Primitive type

PRIMITIVE_LINES
PRIMITIVE_TRIANGLES
PRIMITIVE_TRIANGLE_STRIP

RenderTargetAttachment

ATTACHMENT_COLOR
ATTACHMENT_DEPTH
ATTACHMENT_STENCIL
MAX_ATTACHMENT_COUNT

StencilOp

STENCIL_OP_KEEP
STENCIL_OP_ZERO
STENCIL_OP_REPLACE
STENCIL_OP_INCR
STENCIL_OP_INCR_WRAP
STENCIL_OP_DECR
STENCIL_OP_DECR_WRAP
STENCIL_OP_INVERT

TextureFormat

TEXTURE_FORMAT_LUMINANCE
TEXTURE_FORMAT_LUMINANCE_ALPHA
TEXTURE_FORMAT_RGB
TEXTURE_FORMAT_RGBA
TEXTURE_FORMAT_RGB_16BPP
TEXTURE_FORMAT_RGBA_16BPP
TEXTURE_FORMAT_DEPTH
TEXTURE_FORMAT_STENCIL
TEXTURE_FORMAT_RGB_PVRTC_2BPPV1
TEXTURE_FORMAT_RGB_PVRTC_4BPPV1
TEXTURE_FORMAT_RGBA_PVRTC_2BPPV1
TEXTURE_FORMAT_RGBA_PVRTC_4BPPV1
TEXTURE_FORMAT_RGB_ETC1
TEXTURE_FORMAT_R_ETC2
TEXTURE_FORMAT_RG_ETC2
TEXTURE_FORMAT_RGBA_ETC2
TEXTURE_FORMAT_RGBA_ASTC_4x4
TEXTURE_FORMAT_RGB_BC1
TEXTURE_FORMAT_RGBA_BC3
TEXTURE_FORMAT_R_BC4
TEXTURE_FORMAT_RG_BC5
TEXTURE_FORMAT_RGBA_BC7
TEXTURE_FORMAT_RGB16F
TEXTURE_FORMAT_RGB32F
TEXTURE_FORMAT_RGBA16F
TEXTURE_FORMAT_RGBA32F
TEXTURE_FORMAT_R16F
TEXTURE_FORMAT_RG16F
TEXTURE_FORMAT_R32F
TEXTURE_FORMAT_RG32F
TEXTURE_FORMAT_RGBA32UI
TEXTURE_FORMAT_COUNT

Type

Data type

TYPE_BYTE
TYPE_UNSIGNED_BYTE
TYPE_SHORT
TYPE_UNSIGNED_SHORT
TYPE_INT
TYPE_UNSIGNED_INT
TYPE_FLOAT
TYPE_FLOAT_VEC4
TYPE_FLOAT_MAT4
TYPE_SAMPLER_2D
TYPE_SAMPLER_CUBE
TYPE_SAMPLER_2D_ARRAY
TYPE_FLOAT_VEC2
TYPE_FLOAT_VEC3
TYPE_FLOAT_MAT2
TYPE_FLOAT_MAT3
TYPE_IMAGE_2D

VertexStepFunction

Vertex step function. Dictates how the data for a vertex attribute should be read in a vertex shader.

VERTEX_STEP_FUNCTION_VERTEX
VERTEX_STEP_FUNCTION_INSTANCE