Platform specific native graphics functions.
Namespace: | dmGraphics |
Include: | #include <dmsdk/graphics/graphics_native.h> |
TYPES | |
---|---|
HContext | Context 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 |
HVertexStreamDeclaration | Vertex stream declaration handle |
ENUMS | |
---|---|
AttachmentOp | |
BlendFactor | Blend factor |
BufferAccess | |
BufferUsage | |
CompareFunc | |
FaceWinding | |
HandleResult | |
IndexBufferFormat | |
PrimitiveType | Primitive type |
RenderTargetAttachment | |
StencilOp | |
TextureFormat | |
Type | Data type |
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 |
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 |
void DeleteIndexBuffer(dmGraphics::HIndexBuffer buffer)
Delete the index buffer
PARAMETERS
dmGraphics::HIndexBuffer |
buffer |
the index buffer |
void DeleteVertexBuffer(dmGraphics::HVertexBuffer buffer)
Delete vertex buffer
PARAMETERS
dmGraphics::HVertexBuffer |
buffer |
the buffer |
void DeleteVertexDeclaration(dmGraphics::HVertexDeclaration vertex_declaration)
Delete vertex declaration
PARAMETERS
dmGraphics::HVertexDeclaration |
vertex_declaration |
the vertex declaration |
void DeleteVertexStreamDeclaration(dmGraphics::HVertexStreamDeclaration stream_declaration)
Delete vertex stream declaration
PARAMETERS
dmGraphics::HVertexStreamDeclaration |
stream_declaration |
the vertex stream declaration |
jobject dmGraphics::GetNativeAndroidActivity()
Get Android native jobject. Any other platform return zero.
PARAMETERS
RETURNS
jobject |
native handle |
struct android_app* dmGraphics::GetNativeAndroidApp()
Get Android app object. Any other platform return zero.
PARAMETERS
RETURNS
struct android_app* |
native handle |
EGLContext dmGraphics::GetNativeAndroidEGLContext()
Get Android EGLContext native handle (EGLContext). Any other platform return zero.
PARAMETERS
RETURNS
EGLContext |
native handle |
EGLSurface dmGraphics::GetNativeAndroidEGLSurface()
Get Android EGLSurface native handle (EGLSurface). Any other platform return zero.
PARAMETERS
RETURNS
EGLSurface |
native handle |
JavaVM* dmGraphics::GetNativeAndroidJavaVM()
Get Android JavaVM ptr. Any other platform return zero.
PARAMETERS
RETURNS
JavaVM* |
native handle |
id dmGraphics::GetNativeiOSEAGLContext()
Get iOS EAGLContext native handle (id). Any other platform return zero.
PARAMETERS
RETURNS
id |
native handle |
id dmGraphics::GetNativeiOSUIView()
Get iOS UIView native handle (id). Any other platform return zero.
PARAMETERS
RETURNS
id |
native handle |
id dmGraphics::GetNativeiOSUIWindow()
Get iOS UIWindow native handle (id). Any other platform return zero.
PARAMETERS
RETURNS
id |
native handle |
id dmGraphics::GetNativeOSXNSOpenGLContext()
Get OSX NSOpenGLContext native handle (id). Any other platform return zero.
PARAMETERS
RETURNS
id |
native handle |
id dmGraphics::GetNativeOSXNSView()
Get OSX NSView native handle (id). Any other platform return zero.
PARAMETERS
RETURNS
id |
native handle |
id dmGraphics::GetNativeOSXNSWindow()
Get OSX NSWindow native handle (id). Any other platform return zero.
PARAMETERS
RETURNS
id |
native handle |
HGLRC dmGraphics::GetNativeWindowsHGLRC()
Get Win32 gl rendercontext native handle (HGLRC). Any other platform return zero.
PARAMETERS
RETURNS
HGLRC |
native handle |
HWND dmGraphics::GetNativeWindowsHWND()
Get Win32 windows native handle (HWND). Any other platform return zero.
PARAMETERS
RETURNS
HWND |
native handle |
GLXContext dmGraphics::GetNativeX11GLXContext()
Get Linux X11GLXContext native handle (GLXContext). Any other platform return zero.
PARAMETERS
RETURNS
GLXContext |
native handle |
Window dmGraphics::GetNativeX11Window()
Get Linux X11Window windows native handle (Window). Any other platform return zero.
PARAMETERS
RETURNS
Window |
native handle |
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 |
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 |
uint32_t GetNumSupportedExtensions(dmGraphics::HContext context)
PARAMETERS
dmGraphics::HContext |
context |
the context |
RETURNS
uint32_t |
the number of supported extensions |
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 |
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 |
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(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 |
void INVALID_STREAM_OFFSET()
Invalid stream offset
PARAMETERS
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 |
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 |
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 |
void MAX_BUFFER_COLOR_ATTACHMENTS()
Max buffer color attachments
PARAMETERS
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 |
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 |
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 |
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 |
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 |
dmGraphics::HVertexStreamDeclaration NewVertexStreamDeclaration(dmGraphics::HContext context, dmGraphics::VertexStepFunction step_function)
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 |
dmGraphics::VertexStepFunction |
step_function |
the vertex step function to use |
RETURNS
dmGraphics::HVertexStreamDeclaration |
the vertex declaration |
uint32_t OpenGLGetRenderTargetId(dmGraphics::HContext context, dmGraphics::HRenderTarget render_target)
Get the OpenGL render target id from a render target
PARAMETERS
dmGraphics::HContext |
context |
the OpenGL context |
dmGraphics::HRenderTarget |
render_target |
the render target to get the ID from |
RETURNS
uint32_t |
the OpenGL render target id |
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 |
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 |
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 |
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 |
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 |
id
Get the native MTLCommandQueue from the Vulkan context. Only available when using Mac/iOS.
PARAMETERS
dmGraphics::HContext |
context |
the vulkan context |
RETURNS
id |
the Metal graphics queue wrapped with a (__bridge void*) |
id
Get a native MTLTexture from a Vulkan HTexture. Only available when using Mac/iOS.
PARAMETERS
dmGraphics::HContext |
context |
the vulkan context |
dmGraphics::HTexture |
texture |
the texture |
RETURNS
id |
the Metal texture wrapped with a (__bridge void*) |
Context handle
Index buffer handle
PipelineState handle
Program handle
Rendertarget handle
Storage buffer handle
Texture handle
Uniform location handle
Vertex buffer handle
Vertex declaration handle
Vertex stream declaration handle
ATTACHMENT_OP_DONT_CARE |
|
ATTACHMENT_OP_LOAD |
|
ATTACHMENT_OP_STORE |
|
ATTACHMENT_OP_CLEAR |
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 |
BUFFER_ACCESS_READ_ONLY |
|
BUFFER_ACCESS_WRITE_ONLY |
|
BUFFER_ACCESS_READ_WRITE |
BUFFER_USAGE_STREAM_DRAW |
|
BUFFER_USAGE_DYNAMIC_DRAW |
|
BUFFER_USAGE_STATIC_DRAW |
|
COMPARE_FUNC_NEVER |
|
COMPARE_FUNC_LESS |
|
COMPARE_FUNC_LEQUAL |
|
COMPARE_FUNC_GREATER |
|
COMPARE_FUNC_GEQUAL |
|
COMPARE_FUNC_EQUAL |
|
COMPARE_FUNC_NOTEQUAL |
|
COMPARE_FUNC_ALWAYS |
FACE_WINDING_CCW |
|
FACE_WINDING_CW |
HANDLE_RESULT_OK |
|
HANDLE_RESULT_NOT_AVAILABLE |
|
HANDLE_RESULT_ERROR |
INDEXBUFFER_FORMAT_16 |
|
INDEXBUFFER_FORMAT_32 |
Primitive type
PRIMITIVE_LINES |
|
PRIMITIVE_TRIANGLES |
|
PRIMITIVE_TRIANGLE_STRIP |
ATTACHMENT_COLOR |
|
ATTACHMENT_DEPTH |
|
ATTACHMENT_STENCIL |
|
MAX_ATTACHMENT_COUNT |
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 |
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 |
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 |