2014-05-31 03:18:45 -04:00
|
|
|
/*
|
2015-01-01 18:04:46 -05:00
|
|
|
* Copyright 2011-2015 Branimir Karadzic. All rights reserved.
|
2014-06-01 16:25:31 -04:00
|
|
|
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
|
|
|
|
*
|
|
|
|
* vim: set tabstop=4 expandtab:
|
2014-05-31 03:18:45 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BGFX_C99_H_HEADER_GUARD
|
|
|
|
#define BGFX_C99_H_HEADER_GUARD
|
|
|
|
|
2015-07-24 21:02:17 -04:00
|
|
|
#include <stdarg.h> // va_list
|
2014-05-31 03:18:45 -04:00
|
|
|
#include <stdbool.h> // bool
|
|
|
|
#include <stdint.h> // uint32_t
|
|
|
|
#include <stdlib.h> // size_t
|
|
|
|
|
|
|
|
#include "bgfxdefines.h"
|
|
|
|
|
2014-05-31 18:50:01 -04:00
|
|
|
typedef enum bgfx_renderer_type
|
2014-05-31 03:18:45 -04:00
|
|
|
{
|
2014-06-01 00:02:37 -04:00
|
|
|
BGFX_RENDERER_TYPE_NULL,
|
|
|
|
BGFX_RENDERER_TYPE_DIRECT3D9,
|
|
|
|
BGFX_RENDERER_TYPE_DIRECT3D11,
|
2015-03-05 23:34:39 -05:00
|
|
|
BGFX_RENDERER_TYPE_DIRECT3D12,
|
2015-06-11 12:38:17 -04:00
|
|
|
BGFX_RENDERER_TYPE_METAL,
|
2015-03-05 23:34:39 -05:00
|
|
|
BGFX_RENDERER_TYPE_OPENGLES,
|
2014-06-01 00:02:37 -04:00
|
|
|
BGFX_RENDERER_TYPE_OPENGL,
|
2015-03-05 23:34:39 -05:00
|
|
|
BGFX_RENDERER_TYPE_VULKAN,
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2014-06-01 00:02:37 -04:00
|
|
|
BGFX_RENDERER_TYPE_COUNT
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2014-05-31 18:50:01 -04:00
|
|
|
} bgfx_renderer_type_t;
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2014-07-22 00:13:16 -04:00
|
|
|
typedef enum bgfx_access
|
|
|
|
{
|
2014-09-18 23:28:41 -04:00
|
|
|
BGFX_ACCESS_READ,
|
|
|
|
BGFX_ACCESS_WRITE,
|
|
|
|
BGFX_ACCESS_READWRITE,
|
2014-07-22 00:13:16 -04:00
|
|
|
|
2014-09-18 23:28:41 -04:00
|
|
|
BGFX_ACCESS_COUNT
|
2014-07-22 00:13:16 -04:00
|
|
|
|
|
|
|
} bgfx_access_t;
|
|
|
|
|
2014-05-31 18:50:01 -04:00
|
|
|
typedef enum bgfx_attrib
|
2014-05-31 03:18:45 -04:00
|
|
|
{
|
2014-06-01 00:02:37 -04:00
|
|
|
BGFX_ATTRIB_POSITION,
|
|
|
|
BGFX_ATTRIB_NORMAL,
|
|
|
|
BGFX_ATTRIB_TANGENT,
|
2014-08-17 20:20:15 -04:00
|
|
|
BGFX_ATTRIB_BITANGENT,
|
2014-06-01 00:02:37 -04:00
|
|
|
BGFX_ATTRIB_COLOR0,
|
|
|
|
BGFX_ATTRIB_COLOR1,
|
|
|
|
BGFX_ATTRIB_INDICES,
|
|
|
|
BGFX_ATTRIB_WEIGHT,
|
|
|
|
BGFX_ATTRIB_TEXCOORD0,
|
|
|
|
BGFX_ATTRIB_TEXCOORD1,
|
|
|
|
BGFX_ATTRIB_TEXCOORD2,
|
|
|
|
BGFX_ATTRIB_TEXCOORD3,
|
|
|
|
BGFX_ATTRIB_TEXCOORD4,
|
|
|
|
BGFX_ATTRIB_TEXCOORD5,
|
|
|
|
BGFX_ATTRIB_TEXCOORD6,
|
|
|
|
BGFX_ATTRIB_TEXCOORD7,
|
|
|
|
|
|
|
|
BGFX_ATTRIB_COUNT
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2014-05-31 18:50:01 -04:00
|
|
|
} bgfx_attrib_t;
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2014-05-31 18:50:01 -04:00
|
|
|
typedef enum bgfx_attrib_type
|
2014-05-31 03:18:45 -04:00
|
|
|
{
|
2014-06-01 00:02:37 -04:00
|
|
|
BGFX_ATTRIB_TYPE_UINT8,
|
2015-08-04 22:03:56 -04:00
|
|
|
BGFX_ATTRIB_TYPE_UINT10,
|
2014-06-01 00:02:37 -04:00
|
|
|
BGFX_ATTRIB_TYPE_INT16,
|
|
|
|
BGFX_ATTRIB_TYPE_HALF,
|
|
|
|
BGFX_ATTRIB_TYPE_FLOAT,
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2014-06-01 00:02:37 -04:00
|
|
|
BGFX_ATTRIB_TYPE_COUNT
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2014-05-31 18:50:01 -04:00
|
|
|
} bgfx_attrib_type_t;
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2014-05-31 18:50:01 -04:00
|
|
|
typedef enum bgfx_texture_format
|
2014-05-31 03:18:45 -04:00
|
|
|
{
|
2014-06-01 00:02:37 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_BC1,
|
|
|
|
BGFX_TEXTURE_FORMAT_BC2,
|
|
|
|
BGFX_TEXTURE_FORMAT_BC3,
|
|
|
|
BGFX_TEXTURE_FORMAT_BC4,
|
|
|
|
BGFX_TEXTURE_FORMAT_BC5,
|
2014-08-01 22:24:42 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_BC6H,
|
|
|
|
BGFX_TEXTURE_FORMAT_BC7,
|
2014-06-01 00:02:37 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_ETC1,
|
|
|
|
BGFX_TEXTURE_FORMAT_ETC2,
|
|
|
|
BGFX_TEXTURE_FORMAT_ETC2A,
|
|
|
|
BGFX_TEXTURE_FORMAT_ETC2A1,
|
|
|
|
BGFX_TEXTURE_FORMAT_PTC12,
|
|
|
|
BGFX_TEXTURE_FORMAT_PTC14,
|
|
|
|
BGFX_TEXTURE_FORMAT_PTC12A,
|
|
|
|
BGFX_TEXTURE_FORMAT_PTC14A,
|
|
|
|
BGFX_TEXTURE_FORMAT_PTC22,
|
|
|
|
BGFX_TEXTURE_FORMAT_PTC24,
|
|
|
|
|
|
|
|
BGFX_TEXTURE_FORMAT_UNKNOWN,
|
|
|
|
|
2014-08-13 00:47:01 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_R1,
|
2015-08-31 13:16:36 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_A8,
|
2014-06-01 00:02:37 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_R8,
|
2015-08-28 20:41:24 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_R8I,
|
|
|
|
BGFX_TEXTURE_FORMAT_R8U,
|
2015-08-27 19:35:27 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_R8S,
|
2015-08-28 20:41:24 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_R16,
|
|
|
|
BGFX_TEXTURE_FORMAT_R16I,
|
2015-08-28 17:48:51 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_R16U,
|
2014-06-01 00:02:37 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_R16F,
|
2015-08-27 19:35:27 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_R16S,
|
2015-08-31 13:16:36 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_R32I,
|
2015-08-28 17:48:51 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_R32U,
|
2014-07-22 00:13:16 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_R32F,
|
2014-07-26 02:16:11 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_RG8,
|
2015-08-28 20:41:24 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_RG8I,
|
|
|
|
BGFX_TEXTURE_FORMAT_RG8U,
|
2015-08-27 19:35:27 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_RG8S,
|
2014-07-22 00:13:16 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_RG16,
|
2015-08-28 20:41:24 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_RG16I,
|
|
|
|
BGFX_TEXTURE_FORMAT_RG16U,
|
2014-07-22 00:13:16 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_RG16F,
|
2015-08-27 19:35:27 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_RG16S,
|
2015-08-31 13:16:36 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_RG32I,
|
2015-08-28 17:48:51 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_RG32U,
|
2014-07-22 00:13:16 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_RG32F,
|
2014-06-01 00:02:37 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_BGRA8,
|
2015-03-05 20:44:56 -05:00
|
|
|
BGFX_TEXTURE_FORMAT_RGBA8,
|
2015-08-28 20:41:24 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_RGBA8I,
|
|
|
|
BGFX_TEXTURE_FORMAT_RGBA8U,
|
2015-08-27 19:35:27 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_RGBA8S,
|
2014-06-01 00:02:37 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_RGBA16,
|
2015-08-28 20:41:24 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_RGBA16I,
|
|
|
|
BGFX_TEXTURE_FORMAT_RGBA16U,
|
2014-06-01 00:02:37 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_RGBA16F,
|
2015-08-27 19:35:27 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_RGBA16S,
|
2015-08-31 13:16:36 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_RGBA32I,
|
2015-08-28 17:48:51 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_RGBA32U,
|
2014-07-22 00:13:16 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_RGBA32F,
|
2014-06-01 00:02:37 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_R5G6B5,
|
|
|
|
BGFX_TEXTURE_FORMAT_RGBA4,
|
|
|
|
BGFX_TEXTURE_FORMAT_RGB5A1,
|
|
|
|
BGFX_TEXTURE_FORMAT_RGB10A2,
|
2014-08-26 23:56:53 -04:00
|
|
|
BGFX_TEXTURE_FORMAT_R11G11B10F,
|
2014-06-01 00:02:37 -04:00
|
|
|
|
|
|
|
BGFX_TEXTURE_FORMAT_UNKNOWN_DEPTH,
|
|
|
|
|
|
|
|
BGFX_TEXTURE_FORMAT_D16,
|
|
|
|
BGFX_TEXTURE_FORMAT_D24,
|
|
|
|
BGFX_TEXTURE_FORMAT_D24S8,
|
|
|
|
BGFX_TEXTURE_FORMAT_D32,
|
|
|
|
BGFX_TEXTURE_FORMAT_D16F,
|
|
|
|
BGFX_TEXTURE_FORMAT_D24F,
|
|
|
|
BGFX_TEXTURE_FORMAT_D32F,
|
|
|
|
BGFX_TEXTURE_FORMAT_D0S8,
|
|
|
|
|
|
|
|
BGFX_TEXTURE_FORMAT_COUNT
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2014-05-31 18:50:01 -04:00
|
|
|
} bgfx_texture_format_t;
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2014-05-31 18:50:01 -04:00
|
|
|
typedef enum bgfx_uniform_type
|
2014-05-31 03:18:45 -04:00
|
|
|
{
|
2015-05-28 18:27:00 -04:00
|
|
|
BGFX_UNIFORM_TYPE_INT1,
|
2014-06-01 00:02:37 -04:00
|
|
|
BGFX_UNIFORM_TYPE_END,
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-28 18:27:00 -04:00
|
|
|
BGFX_UNIFORM_TYPE_VEC4,
|
|
|
|
BGFX_UNIFORM_TYPE_MAT3,
|
|
|
|
BGFX_UNIFORM_TYPE_MAT4,
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2014-06-01 00:02:37 -04:00
|
|
|
BGFX_UNIFORM_TYPE_COUNT
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2014-05-31 18:50:01 -04:00
|
|
|
} bgfx_uniform_type_t;
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-04-25 13:30:47 -04:00
|
|
|
typedef enum bgfx_backbuffer_ratio
|
|
|
|
{
|
|
|
|
BGFX_BACKBUFFER_RATIO_EQUAL,
|
|
|
|
BGFX_BACKBUFFER_RATIO_HALF,
|
|
|
|
BGFX_BACKBUFFER_RATIO_QUARTER,
|
|
|
|
BGFX_BACKBUFFER_RATIO_EIGHTH,
|
|
|
|
BGFX_BACKBUFFER_RATIO_SIXTEENTH,
|
2015-04-26 14:34:33 -04:00
|
|
|
BGFX_BACKBUFFER_RATIO_DOUBLE,
|
|
|
|
|
|
|
|
BGFX_BACKBUFFER_RATIO_COUNT
|
|
|
|
|
2015-04-25 13:30:47 -04:00
|
|
|
} bgfx_backbuffer_ratio_t;
|
|
|
|
|
2014-05-31 03:18:45 -04:00
|
|
|
#define BGFX_HANDLE_T(_name) \
|
2015-09-06 11:51:07 -04:00
|
|
|
typedef struct _name { uint16_t idx; } _name##_t
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-03 03:01:33 -04:00
|
|
|
BGFX_HANDLE_T(bgfx_indirect_buffer_handle);
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_HANDLE_T(bgfx_dynamic_index_buffer_handle);
|
|
|
|
BGFX_HANDLE_T(bgfx_dynamic_vertex_buffer_handle);
|
|
|
|
BGFX_HANDLE_T(bgfx_frame_buffer_handle);
|
|
|
|
BGFX_HANDLE_T(bgfx_index_buffer_handle);
|
|
|
|
BGFX_HANDLE_T(bgfx_program_handle);
|
|
|
|
BGFX_HANDLE_T(bgfx_shader_handle);
|
|
|
|
BGFX_HANDLE_T(bgfx_texture_handle);
|
|
|
|
BGFX_HANDLE_T(bgfx_uniform_handle);
|
|
|
|
BGFX_HANDLE_T(bgfx_vertex_buffer_handle);
|
|
|
|
BGFX_HANDLE_T(bgfx_vertex_decl_handle);
|
|
|
|
|
|
|
|
#undef BGFX_HANDLE_T
|
|
|
|
|
2015-05-15 00:16:33 -04:00
|
|
|
/**/
|
2015-04-02 02:58:36 -04:00
|
|
|
typedef void (*bgfx_release_fn_t)(void* _ptr, void* _userData);
|
|
|
|
|
2015-05-15 00:16:33 -04:00
|
|
|
/**/
|
2014-05-31 18:50:01 -04:00
|
|
|
typedef struct bgfx_memory
|
2014-05-31 03:18:45 -04:00
|
|
|
{
|
2014-06-01 00:02:37 -04:00
|
|
|
uint8_t* data;
|
|
|
|
uint32_t size;
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2014-05-31 18:50:01 -04:00
|
|
|
} bgfx_memory_t;
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-15 00:16:33 -04:00
|
|
|
/**/
|
2014-10-11 13:12:27 -04:00
|
|
|
typedef struct bgfx_transform
|
|
|
|
{
|
2014-10-29 01:08:55 -04:00
|
|
|
float* data;
|
|
|
|
uint16_t num;
|
2014-10-11 13:12:27 -04:00
|
|
|
|
|
|
|
} bgfx_transform_t;
|
|
|
|
|
2015-05-15 00:16:33 -04:00
|
|
|
/**/
|
2015-01-09 01:58:20 -05:00
|
|
|
typedef struct bgfx_hmd_eye
|
|
|
|
{
|
|
|
|
float rotation[4];
|
|
|
|
float translation[3];
|
|
|
|
float fov[4];
|
|
|
|
float adjust[3];
|
|
|
|
float pixelsPerTanAngle[2];
|
|
|
|
|
|
|
|
} bgfx_hmd_eye_t;
|
|
|
|
|
2015-05-15 00:16:33 -04:00
|
|
|
/**/
|
2014-10-29 01:08:55 -04:00
|
|
|
typedef struct bgfx_hmd
|
|
|
|
{
|
2015-01-09 01:58:20 -05:00
|
|
|
bgfx_hmd_eye_t eye[2];
|
2014-10-29 01:08:55 -04:00
|
|
|
uint16_t width;
|
|
|
|
uint16_t height;
|
2015-06-02 20:00:36 -04:00
|
|
|
uint32_t deviceWidth;
|
|
|
|
uint32_t deviceHeight;
|
|
|
|
uint8_t flags;
|
2015-01-09 01:58:20 -05:00
|
|
|
|
2014-10-29 01:08:55 -04:00
|
|
|
} bgfx_hmd_t;
|
|
|
|
|
2015-07-22 21:05:11 -04:00
|
|
|
/**/
|
|
|
|
typedef struct bgfx_stats
|
|
|
|
{
|
|
|
|
uint64_t cpuTime;
|
|
|
|
uint64_t cpuTimerFreq;
|
|
|
|
|
|
|
|
uint64_t gpuTime;
|
|
|
|
uint64_t gpuTimerFreq;
|
|
|
|
|
|
|
|
} bgfx_stats_t;
|
|
|
|
|
2015-05-15 00:16:33 -04:00
|
|
|
/**/
|
2014-05-31 18:50:01 -04:00
|
|
|
typedef struct bgfx_vertex_decl
|
2014-05-31 03:18:45 -04:00
|
|
|
{
|
2014-06-01 00:02:37 -04:00
|
|
|
uint32_t hash;
|
|
|
|
uint16_t stride;
|
|
|
|
uint16_t offset[BGFX_ATTRIB_COUNT];
|
2015-08-04 22:03:56 -04:00
|
|
|
uint16_t attributes[BGFX_ATTRIB_COUNT];
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2014-05-31 18:50:01 -04:00
|
|
|
} bgfx_vertex_decl_t;
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-15 00:16:33 -04:00
|
|
|
/**/
|
2014-05-31 18:50:01 -04:00
|
|
|
typedef struct bgfx_transient_index_buffer
|
2014-05-31 03:18:45 -04:00
|
|
|
{
|
2014-06-01 00:02:37 -04:00
|
|
|
uint8_t* data;
|
|
|
|
uint32_t size;
|
|
|
|
bgfx_index_buffer_handle_t handle;
|
|
|
|
uint32_t startIndex;
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2014-05-31 18:50:01 -04:00
|
|
|
} bgfx_transient_index_buffer_t;
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-15 00:16:33 -04:00
|
|
|
/**/
|
2014-05-31 18:50:01 -04:00
|
|
|
typedef struct bgfx_transient_vertex_buffer
|
2014-05-31 03:18:45 -04:00
|
|
|
{
|
2014-06-01 00:02:37 -04:00
|
|
|
uint8_t* data;
|
|
|
|
uint32_t size;
|
|
|
|
uint32_t startVertex;
|
|
|
|
uint16_t stride;
|
|
|
|
bgfx_vertex_buffer_handle_t handle;
|
|
|
|
bgfx_vertex_decl_handle_t decl;
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2014-05-31 18:50:01 -04:00
|
|
|
} bgfx_transient_vertex_buffer_t;
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-15 00:16:33 -04:00
|
|
|
/**/
|
2014-05-31 18:50:01 -04:00
|
|
|
typedef struct bgfx_instance_data_buffer
|
2014-05-31 03:18:45 -04:00
|
|
|
{
|
2014-06-01 00:02:37 -04:00
|
|
|
uint8_t* data;
|
|
|
|
uint32_t size;
|
|
|
|
uint32_t offset;
|
2014-12-10 02:19:53 -05:00
|
|
|
uint32_t num;
|
2014-06-01 00:02:37 -04:00
|
|
|
uint16_t stride;
|
|
|
|
bgfx_vertex_buffer_handle_t handle;
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2014-05-31 18:50:01 -04:00
|
|
|
} bgfx_instance_data_buffer_t;
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-15 00:16:33 -04:00
|
|
|
/**/
|
2014-05-31 18:50:01 -04:00
|
|
|
typedef struct bgfx_texture_info
|
2014-05-31 03:18:45 -04:00
|
|
|
{
|
2014-06-01 00:02:37 -04:00
|
|
|
bgfx_texture_format_t format;
|
|
|
|
uint32_t storageSize;
|
|
|
|
uint16_t width;
|
|
|
|
uint16_t height;
|
|
|
|
uint16_t depth;
|
|
|
|
uint8_t numMips;
|
|
|
|
uint8_t bitsPerPixel;
|
2015-02-09 14:24:59 -05:00
|
|
|
bool cubeMap;
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2014-05-31 18:50:01 -04:00
|
|
|
} bgfx_texture_info_t;
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-15 00:16:33 -04:00
|
|
|
/**/
|
2015-03-26 18:01:47 -04:00
|
|
|
typedef struct bgfx_caps_gpu
|
|
|
|
{
|
|
|
|
uint16_t vendorId;
|
|
|
|
uint16_t deviceId;
|
|
|
|
|
|
|
|
} bgfx_caps_gpu_t;
|
|
|
|
|
2015-05-15 00:16:33 -04:00
|
|
|
/**/
|
2014-06-01 00:02:37 -04:00
|
|
|
typedef struct bgfx_caps
|
|
|
|
{
|
|
|
|
bgfx_renderer_type_t rendererType;
|
|
|
|
|
|
|
|
uint64_t supported;
|
|
|
|
|
2015-05-15 00:16:33 -04:00
|
|
|
uint32_t maxDrawCalls;
|
|
|
|
uint16_t maxTextureSize;
|
|
|
|
uint16_t maxViews;
|
|
|
|
uint8_t maxFBAttachments;
|
|
|
|
uint8_t numGPUs;
|
|
|
|
|
|
|
|
uint16_t vendorId;
|
|
|
|
uint16_t deviceId;
|
|
|
|
bgfx_caps_gpu_t gpu[4];
|
|
|
|
|
2014-07-27 23:44:02 -04:00
|
|
|
uint8_t formats[BGFX_TEXTURE_FORMAT_COUNT];
|
|
|
|
|
2014-06-01 00:02:37 -04:00
|
|
|
} bgfx_caps_t;
|
|
|
|
|
2015-05-15 00:16:33 -04:00
|
|
|
/**/
|
2014-05-31 18:50:01 -04:00
|
|
|
typedef enum bgfx_fatal
|
2014-05-31 13:33:37 -04:00
|
|
|
{
|
2014-06-01 00:02:37 -04:00
|
|
|
BGFX_FATAL_DEBUG_CHECK,
|
|
|
|
BGFX_FATAL_MINIMUM_REQUIRED_SPECS,
|
|
|
|
BGFX_FATAL_INVALID_SHADER,
|
|
|
|
BGFX_FATAL_UNABLE_TO_INITIALIZE,
|
|
|
|
BGFX_FATAL_UNABLE_TO_CREATE_TEXTURE,
|
2014-10-01 00:16:24 -04:00
|
|
|
BGFX_FATAL_DEVICE_LOST,
|
|
|
|
|
|
|
|
BGFX_FATAL_COUNT
|
2014-05-31 13:33:37 -04:00
|
|
|
|
2014-05-31 18:50:01 -04:00
|
|
|
} bgfx_fatal_t;
|
2014-05-31 13:33:37 -04:00
|
|
|
|
2014-06-01 18:26:36 -04:00
|
|
|
#ifndef BGFX_SHARED_LIB_BUILD
|
|
|
|
# define BGFX_SHARED_LIB_BUILD 0
|
|
|
|
#endif // BGFX_SHARED_LIB_BUILD
|
|
|
|
|
|
|
|
#ifndef BGFX_SHARED_LIB_USE
|
|
|
|
# define BGFX_SHARED_LIB_USE 0
|
|
|
|
#endif // BGFX_SHARED_LIB_USE
|
|
|
|
|
2014-06-01 15:01:50 -04:00
|
|
|
#if defined(_MSC_VER)
|
2014-06-01 18:26:36 -04:00
|
|
|
# if BGFX_SHARED_LIB_BUILD
|
|
|
|
# define BGFX_SHARED_LIB_API __declspec(dllexport)
|
|
|
|
# elif BGFX_SHARED_LIB_USE
|
|
|
|
# define BGFX_SHARED_LIB_API __declspec(dllimport)
|
|
|
|
# else
|
|
|
|
# define BGFX_SHARED_LIB_API
|
|
|
|
# endif // BGFX_SHARED_LIB_*
|
2014-06-01 15:01:50 -04:00
|
|
|
#else
|
2014-06-01 18:26:36 -04:00
|
|
|
# define BGFX_SHARED_LIB_API
|
2014-06-01 15:01:50 -04:00
|
|
|
#endif // defined(_MSC_VER)
|
|
|
|
|
2014-06-01 18:26:36 -04:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
# define BGFX_C_API extern "C" BGFX_SHARED_LIB_API
|
|
|
|
#else
|
|
|
|
# define BGFX_C_API BGFX_SHARED_LIB_API
|
|
|
|
#endif // defined(__cplusplus)
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-06-01 15:01:50 -04:00
|
|
|
typedef struct bgfx_callback_interface
|
|
|
|
{
|
|
|
|
const struct bgfx_callback_vtbl* vtbl;
|
|
|
|
|
|
|
|
} bgfx_callback_interface_t;
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 18:50:01 -04:00
|
|
|
typedef struct bgfx_callback_vtbl
|
2014-05-31 13:33:37 -04:00
|
|
|
{
|
2015-06-09 22:57:10 -04:00
|
|
|
void (*fatal)(bgfx_callback_interface_t* _this, bgfx_fatal_t _code, const char* _str);
|
2015-07-24 21:02:17 -04:00
|
|
|
void (*trace_vargs)(bgfx_callback_interface_t* _this, const char* _filePath, uint16_t _line, const char* _format, va_list _argList);
|
2015-06-09 22:57:10 -04:00
|
|
|
uint32_t (*cache_read_size)(bgfx_callback_interface_t* _this, uint64_t _id);
|
|
|
|
bool (*cache_read)(bgfx_callback_interface_t* _this, uint64_t _id, void* _data, uint32_t _size);
|
|
|
|
void (*cache_write)(bgfx_callback_interface_t* _this, uint64_t _id, const void* _data, uint32_t _size);
|
|
|
|
void (*screen_shot)(bgfx_callback_interface_t* _this, const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _data, uint32_t _size, bool _yflip);
|
|
|
|
void (*capture_begin)(bgfx_callback_interface_t* _this, uint32_t _width, uint32_t _height, uint32_t _pitch, bgfx_texture_format_t _format, bool _yflip);
|
|
|
|
void (*capture_end)(bgfx_callback_interface_t* _this);
|
|
|
|
void (*capture_frame)(bgfx_callback_interface_t* _this, const void* _data, uint32_t _size);
|
2014-05-31 13:33:37 -04:00
|
|
|
|
2014-05-31 18:50:01 -04:00
|
|
|
} bgfx_callback_vtbl_t;
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-06-01 15:01:50 -04:00
|
|
|
typedef struct bgfx_reallocator_interface
|
2014-05-31 13:33:37 -04:00
|
|
|
{
|
2014-06-01 15:01:50 -04:00
|
|
|
const struct bgfx_reallocator_vtbl* vtbl;
|
2014-05-31 18:50:01 -04:00
|
|
|
|
2014-06-01 15:01:50 -04:00
|
|
|
} bgfx_reallocator_interface_t;
|
2014-05-31 13:33:37 -04:00
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 18:50:01 -04:00
|
|
|
typedef struct bgfx_reallocator_vtbl
|
2014-05-31 13:33:37 -04:00
|
|
|
{
|
2015-06-09 22:57:10 -04:00
|
|
|
void* (*alloc)(bgfx_reallocator_interface_t* _this, size_t _size, size_t _align, const char* _file, uint32_t _line);
|
|
|
|
void (*free)(bgfx_reallocator_interface_t* _this, void* _ptr, size_t _align, const char* _file, uint32_t _line);
|
|
|
|
void* (*realloc)(bgfx_reallocator_interface_t* _this, void* _ptr, size_t _size, size_t _align, const char* _file, uint32_t _line);
|
2014-05-31 18:50:01 -04:00
|
|
|
|
2014-06-01 15:01:50 -04:00
|
|
|
} bgfx_reallocator_vtbl_t;
|
2014-05-31 13:33:37 -04:00
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_vertex_decl_begin(bgfx_vertex_decl_t* _decl, bgfx_renderer_type_t _renderer);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_vertex_decl_add(bgfx_vertex_decl_t* _decl, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_vertex_decl_skip(bgfx_vertex_decl_t* _decl, uint8_t _num);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_vertex_decl_end(bgfx_vertex_decl_t* _decl);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-06-01 16:26:57 -04:00
|
|
|
BGFX_C_API void bgfx_vertex_pack(const float _input[4], bool _inputNormalized, bgfx_attrib_t _attr, const bgfx_vertex_decl_t* _decl, void* _data, uint32_t _index);
|
2014-06-01 16:25:31 -04:00
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-06-01 16:25:31 -04:00
|
|
|
BGFX_C_API void bgfx_vertex_unpack(float _output[4], bgfx_attrib_t _attr, const bgfx_vertex_decl_t* _decl, const void* _data, uint32_t _index);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-06-01 16:25:31 -04:00
|
|
|
BGFX_C_API void bgfx_vertex_convert(const bgfx_vertex_decl_t* _destDecl, void* _destData, const bgfx_vertex_decl_t* _srcDecl, const void* _srcData, uint32_t _num);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-06-01 16:25:31 -04:00
|
|
|
BGFX_C_API uint16_t bgfx_weld_vertices(uint16_t* _output, const bgfx_vertex_decl_t* _decl, const void* _data, uint16_t _num, float _epsilon);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-06-01 16:25:31 -04:00
|
|
|
BGFX_C_API void bgfx_image_swizzle_bgra8(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-06-01 16:25:31 -04:00
|
|
|
BGFX_C_API void bgfx_image_rgba8_downsample_2x2(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-06-01 16:25:31 -04:00
|
|
|
BGFX_C_API uint8_t bgfx_get_supported_renderers(bgfx_renderer_type_t _enum[BGFX_RENDERER_TYPE_COUNT]);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-06-01 16:25:31 -04:00
|
|
|
BGFX_C_API const char* bgfx_get_renderer_name(bgfx_renderer_type_t _type);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-07-30 21:36:12 -04:00
|
|
|
BGFX_C_API bool bgfx_init(bgfx_renderer_type_t _type, uint16_t _vendorId, uint16_t _deviceId, bgfx_callback_interface_t* _callback, bgfx_reallocator_interface_t* _allocator);
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_shutdown();
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_reset(uint32_t _width, uint32_t _height, uint32_t _flags);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API uint32_t bgfx_frame();
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API bgfx_renderer_type_t bgfx_get_renderer_type();
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-10-29 01:08:55 -04:00
|
|
|
BGFX_C_API const bgfx_caps_t* bgfx_get_caps();
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-10-29 01:08:55 -04:00
|
|
|
BGFX_C_API const bgfx_hmd_t* bgfx_get_hmd();
|
2014-06-01 16:25:31 -04:00
|
|
|
|
2015-07-22 21:05:11 -04:00
|
|
|
/**/
|
|
|
|
BGFX_C_API const bgfx_stats_t* bgfx_get_stats();
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API const bgfx_memory_t* bgfx_alloc(uint32_t _size);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API const bgfx_memory_t* bgfx_copy(const void* _data, uint32_t _size);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API const bgfx_memory_t* bgfx_make_ref(const void* _data, uint32_t _size);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-04-02 02:58:36 -04:00
|
|
|
BGFX_C_API const bgfx_memory_t* bgfx_make_ref_release(const void* _data, uint32_t _size, bgfx_release_fn_t _releaseFn, void* _userData);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_set_debug(uint32_t _debug);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_dbg_text_clear(uint8_t _attr, bool _small);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_dbg_text_printf(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, ...);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-12-04 23:32:19 -05:00
|
|
|
BGFX_C_API void bgfx_dbg_text_image(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const void* _data, uint16_t _pitch);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-05-14 14:37:32 -04:00
|
|
|
BGFX_C_API bgfx_index_buffer_handle_t bgfx_create_index_buffer(const bgfx_memory_t* _mem, uint16_t _flags);
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_destroy_index_buffer(bgfx_index_buffer_handle_t _handle);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-05-14 14:37:32 -04:00
|
|
|
BGFX_C_API bgfx_vertex_buffer_handle_t bgfx_create_vertex_buffer(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl, uint16_t _flags);
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_destroy_vertex_buffer(bgfx_vertex_buffer_handle_t _handle);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-05-14 14:37:32 -04:00
|
|
|
BGFX_C_API bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer(uint32_t _num, uint16_t _flags);
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-05-14 14:37:32 -04:00
|
|
|
BGFX_C_API bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer_mem(const bgfx_memory_t* _mem, uint16_t _flags);
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-06-23 19:40:38 -04:00
|
|
|
BGFX_C_API void bgfx_update_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _startIndex, const bgfx_memory_t* _mem);
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-05-14 14:37:32 -04:00
|
|
|
BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t* _decl, uint16_t _flags);
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-05-14 14:37:32 -04:00
|
|
|
BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer_mem(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl, uint16_t _flags);
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-06-23 19:40:38 -04:00
|
|
|
BGFX_C_API void bgfx_update_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, const bgfx_memory_t* _mem);
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_destroy_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API bool bgfx_check_avail_transient_index_buffer(uint32_t _num);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API bool bgfx_check_avail_transient_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t* _decl);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API bool bgfx_check_avail_instance_data_buffer(uint32_t _num, uint16_t _stride);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API bool bgfx_check_avail_transient_buffers(uint32_t _numVertices, const bgfx_vertex_decl_t* _decl, uint32_t _numIndices);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_alloc_transient_index_buffer(bgfx_transient_index_buffer_t* _tib, uint32_t _num);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_t* _tvb, uint32_t _num, const bgfx_vertex_decl_t* _decl);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-02-17 01:53:06 -05:00
|
|
|
BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t* _decl, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices);
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API const bgfx_instance_data_buffer_t* bgfx_alloc_instance_data_buffer(uint32_t _num, uint16_t _stride);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-05-03 03:01:33 -04:00
|
|
|
BGFX_C_API bgfx_indirect_buffer_handle_t bgfx_create_indirect_buffer(uint32_t _num);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-05-03 03:01:33 -04:00
|
|
|
BGFX_C_API void bgfx_destroy_indirect_buffer(bgfx_indirect_buffer_handle_t _handle);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API bgfx_shader_handle_t bgfx_create_shader(const bgfx_memory_t* _mem);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API uint16_t bgfx_get_shader_uniforms(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t* _uniforms, uint16_t _max);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_destroy_shader(bgfx_shader_handle_t _handle);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API bgfx_program_handle_t bgfx_create_program(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders);
|
|
|
|
|
2015-05-16 19:07:10 -04:00
|
|
|
/**/
|
|
|
|
BGFX_C_API bgfx_program_handle_t bgfx_create_compute_program(bgfx_shader_handle_t _csh, bool _destroyShaders);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_destroy_program(bgfx_program_handle_t _handle);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-02-09 14:24:59 -05:00
|
|
|
BGFX_C_API void bgfx_calc_texture_size(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, uint8_t _numMips, bgfx_texture_format_t _format);
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t* _mem, uint32_t _flags, uint8_t _skip, bgfx_texture_info_t* _info);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-04-25 13:30:47 -04:00
|
|
|
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_ratio_t _ratio, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_3d(uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_update_texture_3d(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t* _mem);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_destroy_texture(bgfx_texture_handle_t _handle);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint32_t _textureFlags);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-04-25 13:30:47 -04:00
|
|
|
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint32_t _textureFlags);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(uint8_t _num, bgfx_texture_handle_t* _handles, bool _destroyTextures);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-09-14 14:31:23 -04:00
|
|
|
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_nwh(void* _nwh, uint16_t _width, uint16_t _height, bgfx_texture_format_t _depthFormat);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_destroy_frame_buffer(bgfx_frame_buffer_handle_t _handle);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API bgfx_uniform_handle_t bgfx_create_uniform(const char* _name, bgfx_uniform_type_t _type, uint16_t _num);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_destroy_uniform(bgfx_uniform_handle_t _handle);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-09-01 14:24:51 -04:00
|
|
|
BGFX_C_API void bgfx_set_clear_color(uint8_t _index, const float _rgba[4]);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_set_view_name(uint8_t _id, const char* _name);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_set_view_rect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_set_view_scissor(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-01-11 21:00:08 -05:00
|
|
|
BGFX_C_API void bgfx_set_view_clear(uint8_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil);
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-01-11 21:00:08 -05:00
|
|
|
BGFX_C_API void bgfx_set_view_clear_mrt(uint8_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7);
|
2014-09-01 14:24:51 -04:00
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_set_view_seq(uint8_t _id, bool _enabled);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_set_view_frame_buffer(uint8_t _id, bgfx_frame_buffer_handle_t _handle);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_set_view_transform(uint8_t _id, const void* _view, const void* _proj);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-10-29 01:08:55 -04:00
|
|
|
BGFX_C_API void bgfx_set_view_transform_stereo(uint8_t _id, const void* _view, const void* _projL, uint8_t _flags, const void* _projR);
|
|
|
|
|
2015-06-27 19:47:07 -04:00
|
|
|
/**/
|
|
|
|
BGFX_C_API void bgfx_set_view_remap(uint8_t _id, uint8_t _num, const void* _remap);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_set_marker(const char* _marker);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_set_state(uint64_t _state, uint32_t _rgba);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_set_stencil(uint32_t _fstencil, uint32_t _bstencil);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API uint16_t bgfx_set_scissor(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_set_scissor_cached(uint16_t _cache);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API uint32_t bgfx_set_transform(const void* _mtx, uint16_t _num);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-10-11 13:12:27 -04:00
|
|
|
BGFX_C_API uint32_t bgfx_alloc_transform(bgfx_transform_t* _transform, uint16_t _num);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_set_transform_cached(uint32_t _cache, uint16_t _num);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_set_uniform(bgfx_uniform_handle_t _handle, const void* _value, uint16_t _num);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_set_index_buffer(bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_set_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_set_transient_index_buffer(const bgfx_transient_index_buffer_t* _tib, uint32_t _firstIndex, uint32_t _numIndices);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_set_vertex_buffer(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_set_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _numVertices);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_set_transient_vertex_buffer(const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-12-10 02:16:27 -05:00
|
|
|
BGFX_C_API void bgfx_set_instance_data_buffer(const bgfx_instance_data_buffer_t* _idb, uint32_t _num);
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-16 19:07:10 -04:00
|
|
|
/**/
|
|
|
|
BGFX_C_API void bgfx_set_instance_data_from_vertex_buffer(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num);
|
|
|
|
|
|
|
|
/**/
|
|
|
|
BGFX_C_API void bgfx_set_instance_data_from_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_set_texture(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_set_texture_from_frame_buffer(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, uint32_t _flags);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-07-22 21:05:11 -04:00
|
|
|
BGFX_C_API uint32_t bgfx_touch(uint8_t _id);
|
|
|
|
|
|
|
|
/**/
|
|
|
|
BGFX_C_API uint32_t bgfx_submit(uint8_t _id, bgfx_program_handle_t _handle, int32_t _depth);
|
2014-05-31 03:18:45 -04:00
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-07-22 21:05:11 -04:00
|
|
|
BGFX_C_API uint32_t bgfx_submit_indirect(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth);
|
2015-05-03 03:01:33 -04:00
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-02-23 20:25:06 -05:00
|
|
|
BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format);
|
2014-07-22 00:13:16 -04:00
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-02-23 20:25:06 -05:00
|
|
|
BGFX_C_API void bgfx_set_image_from_frame_buffer(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, bgfx_access_t _access, bgfx_texture_format_t _format);
|
2014-07-22 00:13:16 -04:00
|
|
|
|
2015-05-16 19:07:10 -04:00
|
|
|
/**/
|
|
|
|
BGFX_C_API void bgfx_set_compute_index_buffer(uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access);
|
|
|
|
|
|
|
|
/**/
|
|
|
|
BGFX_C_API void bgfx_set_compute_vertex_buffer(uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access);
|
|
|
|
|
|
|
|
/**/
|
|
|
|
BGFX_C_API void bgfx_set_compute_dynamic_index_buffer(uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access);
|
|
|
|
|
|
|
|
/**/
|
|
|
|
BGFX_C_API void bgfx_set_compute_dynamic_vertex_buffer(uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access);
|
|
|
|
|
|
|
|
/**/
|
|
|
|
BGFX_C_API void bgfx_set_compute_indirect_buffer(uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-05-03 03:01:33 -04:00
|
|
|
BGFX_C_API uint32_t bgfx_dispatch(uint8_t _id, bgfx_program_handle_t _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags);
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2015-05-03 03:01:33 -04:00
|
|
|
BGFX_C_API uint32_t bgfx_dispatch_indirect(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags);
|
2014-07-22 00:13:16 -04:00
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_discard();
|
|
|
|
|
2015-05-14 23:33:33 -04:00
|
|
|
/**/
|
2014-05-31 03:18:45 -04:00
|
|
|
BGFX_C_API void bgfx_save_screen_shot(const char* _filePath);
|
|
|
|
|
|
|
|
#endif // BGFX_C99_H_HEADER_GUARD
|