Added bgfx library, precompiled for linux-gcc-64

This commit is contained in:
2015-09-07 17:41:50 +02:00
parent 7c92b6aef7
commit c7f17c8ef0
8 changed files with 3557 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
find_path(BGFX_INCLUDE_DIR bgfx.h)
find_library(BGFX_LIBRARY NAMES bgfx)
set(BGFX_INCLUDE_DIRS ${BGFX_INCLUDE_DIR})
set(BGFX_LIBRARIES ${BGFX_LIBRARY})
find_package_handle_standard_args(BGFX DEFAULT_MSG BGFX_LIBRARY BGFX_INCLUDE_DIR)
mark_as_advanced(BGFX_FOUND BGFX_INCLUDE_DIR BGFX_LIBRARY)
+775
View File
@@ -0,0 +1,775 @@
/*
* Copyright 2011-2015 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
*
* vim: set tabstop=4 expandtab:
*/
#ifndef BGFX_C99_H_HEADER_GUARD
#define BGFX_C99_H_HEADER_GUARD
#include <stdarg.h> // va_list
#include <stdbool.h> // bool
#include <stdint.h> // uint32_t
#include <stdlib.h> // size_t
#include "bgfxdefines.h"
typedef enum bgfx_renderer_type
{
BGFX_RENDERER_TYPE_NULL,
BGFX_RENDERER_TYPE_DIRECT3D9,
BGFX_RENDERER_TYPE_DIRECT3D11,
BGFX_RENDERER_TYPE_DIRECT3D12,
BGFX_RENDERER_TYPE_METAL,
BGFX_RENDERER_TYPE_OPENGLES,
BGFX_RENDERER_TYPE_OPENGL,
BGFX_RENDERER_TYPE_VULKAN,
BGFX_RENDERER_TYPE_COUNT
} bgfx_renderer_type_t;
typedef enum bgfx_access
{
BGFX_ACCESS_READ,
BGFX_ACCESS_WRITE,
BGFX_ACCESS_READWRITE,
BGFX_ACCESS_COUNT
} bgfx_access_t;
typedef enum bgfx_attrib
{
BGFX_ATTRIB_POSITION,
BGFX_ATTRIB_NORMAL,
BGFX_ATTRIB_TANGENT,
BGFX_ATTRIB_BITANGENT,
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
} bgfx_attrib_t;
typedef enum bgfx_attrib_type
{
BGFX_ATTRIB_TYPE_UINT8,
BGFX_ATTRIB_TYPE_UINT10,
BGFX_ATTRIB_TYPE_INT16,
BGFX_ATTRIB_TYPE_HALF,
BGFX_ATTRIB_TYPE_FLOAT,
BGFX_ATTRIB_TYPE_COUNT
} bgfx_attrib_type_t;
typedef enum bgfx_texture_format
{
BGFX_TEXTURE_FORMAT_BC1,
BGFX_TEXTURE_FORMAT_BC2,
BGFX_TEXTURE_FORMAT_BC3,
BGFX_TEXTURE_FORMAT_BC4,
BGFX_TEXTURE_FORMAT_BC5,
BGFX_TEXTURE_FORMAT_BC6H,
BGFX_TEXTURE_FORMAT_BC7,
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,
BGFX_TEXTURE_FORMAT_R1,
BGFX_TEXTURE_FORMAT_A8,
BGFX_TEXTURE_FORMAT_R8,
BGFX_TEXTURE_FORMAT_R8I,
BGFX_TEXTURE_FORMAT_R8U,
BGFX_TEXTURE_FORMAT_R8S,
BGFX_TEXTURE_FORMAT_R16,
BGFX_TEXTURE_FORMAT_R16I,
BGFX_TEXTURE_FORMAT_R16U,
BGFX_TEXTURE_FORMAT_R16F,
BGFX_TEXTURE_FORMAT_R16S,
BGFX_TEXTURE_FORMAT_R32I,
BGFX_TEXTURE_FORMAT_R32U,
BGFX_TEXTURE_FORMAT_R32F,
BGFX_TEXTURE_FORMAT_RG8,
BGFX_TEXTURE_FORMAT_RG8I,
BGFX_TEXTURE_FORMAT_RG8U,
BGFX_TEXTURE_FORMAT_RG8S,
BGFX_TEXTURE_FORMAT_RG16,
BGFX_TEXTURE_FORMAT_RG16I,
BGFX_TEXTURE_FORMAT_RG16U,
BGFX_TEXTURE_FORMAT_RG16F,
BGFX_TEXTURE_FORMAT_RG16S,
BGFX_TEXTURE_FORMAT_RG32I,
BGFX_TEXTURE_FORMAT_RG32U,
BGFX_TEXTURE_FORMAT_RG32F,
BGFX_TEXTURE_FORMAT_BGRA8,
BGFX_TEXTURE_FORMAT_RGBA8,
BGFX_TEXTURE_FORMAT_RGBA8I,
BGFX_TEXTURE_FORMAT_RGBA8U,
BGFX_TEXTURE_FORMAT_RGBA8S,
BGFX_TEXTURE_FORMAT_RGBA16,
BGFX_TEXTURE_FORMAT_RGBA16I,
BGFX_TEXTURE_FORMAT_RGBA16U,
BGFX_TEXTURE_FORMAT_RGBA16F,
BGFX_TEXTURE_FORMAT_RGBA16S,
BGFX_TEXTURE_FORMAT_RGBA32I,
BGFX_TEXTURE_FORMAT_RGBA32U,
BGFX_TEXTURE_FORMAT_RGBA32F,
BGFX_TEXTURE_FORMAT_R5G6B5,
BGFX_TEXTURE_FORMAT_RGBA4,
BGFX_TEXTURE_FORMAT_RGB5A1,
BGFX_TEXTURE_FORMAT_RGB10A2,
BGFX_TEXTURE_FORMAT_R11G11B10F,
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
} bgfx_texture_format_t;
typedef enum bgfx_uniform_type
{
BGFX_UNIFORM_TYPE_INT1,
BGFX_UNIFORM_TYPE_END,
BGFX_UNIFORM_TYPE_VEC4,
BGFX_UNIFORM_TYPE_MAT3,
BGFX_UNIFORM_TYPE_MAT4,
BGFX_UNIFORM_TYPE_COUNT
} bgfx_uniform_type_t;
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,
BGFX_BACKBUFFER_RATIO_DOUBLE,
BGFX_BACKBUFFER_RATIO_COUNT
} bgfx_backbuffer_ratio_t;
#define BGFX_HANDLE_T(_name) \
typedef struct _name { uint16_t idx; } _name##_t;
BGFX_HANDLE_T(bgfx_indirect_buffer_handle);
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
/**/
typedef void (*bgfx_release_fn_t)(void* _ptr, void* _userData);
/**/
typedef struct bgfx_memory
{
uint8_t* data;
uint32_t size;
} bgfx_memory_t;
/**/
typedef struct bgfx_transform
{
float* data;
uint16_t num;
} bgfx_transform_t;
/**/
typedef struct bgfx_hmd_eye
{
float rotation[4];
float translation[3];
float fov[4];
float adjust[3];
float pixelsPerTanAngle[2];
} bgfx_hmd_eye_t;
/**/
typedef struct bgfx_hmd
{
bgfx_hmd_eye_t eye[2];
uint16_t width;
uint16_t height;
uint32_t deviceWidth;
uint32_t deviceHeight;
uint8_t flags;
} bgfx_hmd_t;
/**/
typedef struct bgfx_stats
{
uint64_t cpuTime;
uint64_t cpuTimerFreq;
uint64_t gpuTime;
uint64_t gpuTimerFreq;
} bgfx_stats_t;
/**/
typedef struct bgfx_vertex_decl
{
uint32_t hash;
uint16_t stride;
uint16_t offset[BGFX_ATTRIB_COUNT];
uint16_t attributes[BGFX_ATTRIB_COUNT];
} bgfx_vertex_decl_t;
/**/
typedef struct bgfx_transient_index_buffer
{
uint8_t* data;
uint32_t size;
bgfx_index_buffer_handle_t handle;
uint32_t startIndex;
} bgfx_transient_index_buffer_t;
/**/
typedef struct bgfx_transient_vertex_buffer
{
uint8_t* data;
uint32_t size;
uint32_t startVertex;
uint16_t stride;
bgfx_vertex_buffer_handle_t handle;
bgfx_vertex_decl_handle_t decl;
} bgfx_transient_vertex_buffer_t;
/**/
typedef struct bgfx_instance_data_buffer
{
uint8_t* data;
uint32_t size;
uint32_t offset;
uint32_t num;
uint16_t stride;
bgfx_vertex_buffer_handle_t handle;
} bgfx_instance_data_buffer_t;
/**/
typedef struct bgfx_texture_info
{
bgfx_texture_format_t format;
uint32_t storageSize;
uint16_t width;
uint16_t height;
uint16_t depth;
uint8_t numMips;
uint8_t bitsPerPixel;
bool cubeMap;
} bgfx_texture_info_t;
/**/
typedef struct bgfx_caps_gpu
{
uint16_t vendorId;
uint16_t deviceId;
} bgfx_caps_gpu_t;
/**/
typedef struct bgfx_caps
{
bgfx_renderer_type_t rendererType;
uint64_t supported;
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];
uint8_t formats[BGFX_TEXTURE_FORMAT_COUNT];
} bgfx_caps_t;
/**/
typedef enum bgfx_fatal
{
BGFX_FATAL_DEBUG_CHECK,
BGFX_FATAL_MINIMUM_REQUIRED_SPECS,
BGFX_FATAL_INVALID_SHADER,
BGFX_FATAL_UNABLE_TO_INITIALIZE,
BGFX_FATAL_UNABLE_TO_CREATE_TEXTURE,
BGFX_FATAL_DEVICE_LOST,
BGFX_FATAL_COUNT
} bgfx_fatal_t;
#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
#if defined(_MSC_VER)
# 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_*
#else
# define BGFX_SHARED_LIB_API
#endif // defined(_MSC_VER)
#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)
/**/
typedef struct bgfx_callback_interface
{
const struct bgfx_callback_vtbl* vtbl;
} bgfx_callback_interface_t;
/**/
typedef struct bgfx_callback_vtbl
{
void (*fatal)(bgfx_callback_interface_t* _this, bgfx_fatal_t _code, const char* _str);
void (*trace_vargs)(bgfx_callback_interface_t* _this, const char* _filePath, uint16_t _line, const char* _format, va_list _argList);
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);
} bgfx_callback_vtbl_t;
/**/
typedef struct bgfx_reallocator_interface
{
const struct bgfx_reallocator_vtbl* vtbl;
} bgfx_reallocator_interface_t;
/**/
typedef struct bgfx_reallocator_vtbl
{
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);
} bgfx_reallocator_vtbl_t;
/**/
BGFX_C_API void bgfx_vertex_decl_begin(bgfx_vertex_decl_t* _decl, bgfx_renderer_type_t _renderer);
/**/
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);
/**/
BGFX_C_API void bgfx_vertex_decl_skip(bgfx_vertex_decl_t* _decl, uint8_t _num);
/**/
BGFX_C_API void bgfx_vertex_decl_end(bgfx_vertex_decl_t* _decl);
/**/
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);
/**/
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);
/**/
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);
/**/
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);
/**/
BGFX_C_API void bgfx_image_swizzle_bgra8(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
/**/
BGFX_C_API void bgfx_image_rgba8_downsample_2x2(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
/**/
BGFX_C_API uint8_t bgfx_get_supported_renderers(bgfx_renderer_type_t _enum[BGFX_RENDERER_TYPE_COUNT]);
/**/
BGFX_C_API const char* bgfx_get_renderer_name(bgfx_renderer_type_t _type);
/**/
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);
/**/
BGFX_C_API void bgfx_shutdown();
/**/
BGFX_C_API void bgfx_reset(uint32_t _width, uint32_t _height, uint32_t _flags);
/**/
BGFX_C_API uint32_t bgfx_frame();
/**/
BGFX_C_API bgfx_renderer_type_t bgfx_get_renderer_type();
/**/
BGFX_C_API const bgfx_caps_t* bgfx_get_caps();
/**/
BGFX_C_API const bgfx_hmd_t* bgfx_get_hmd();
/**/
BGFX_C_API const bgfx_stats_t* bgfx_get_stats();
/**/
BGFX_C_API const bgfx_memory_t* bgfx_alloc(uint32_t _size);
/**/
BGFX_C_API const bgfx_memory_t* bgfx_copy(const void* _data, uint32_t _size);
/**/
BGFX_C_API const bgfx_memory_t* bgfx_make_ref(const void* _data, uint32_t _size);
/**/
BGFX_C_API const bgfx_memory_t* bgfx_make_ref_release(const void* _data, uint32_t _size, bgfx_release_fn_t _releaseFn, void* _userData);
/**/
BGFX_C_API void bgfx_set_debug(uint32_t _debug);
/**/
BGFX_C_API void bgfx_dbg_text_clear(uint8_t _attr, bool _small);
/**/
BGFX_C_API void bgfx_dbg_text_printf(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, ...);
/**/
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);
/**/
BGFX_C_API bgfx_index_buffer_handle_t bgfx_create_index_buffer(const bgfx_memory_t* _mem, uint16_t _flags);
/**/
BGFX_C_API void bgfx_destroy_index_buffer(bgfx_index_buffer_handle_t _handle);
/**/
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);
/**/
BGFX_C_API void bgfx_destroy_vertex_buffer(bgfx_vertex_buffer_handle_t _handle);
/**/
BGFX_C_API bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer(uint32_t _num, uint16_t _flags);
/**/
BGFX_C_API bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer_mem(const bgfx_memory_t* _mem, uint16_t _flags);
/**/
BGFX_C_API void bgfx_update_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _startIndex, const bgfx_memory_t* _mem);
/**/
BGFX_C_API void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle);
/**/
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);
/**/
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);
/**/
BGFX_C_API void bgfx_update_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, const bgfx_memory_t* _mem);
/**/
BGFX_C_API void bgfx_destroy_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle);
/**/
BGFX_C_API bool bgfx_check_avail_transient_index_buffer(uint32_t _num);
/**/
BGFX_C_API bool bgfx_check_avail_transient_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t* _decl);
/**/
BGFX_C_API bool bgfx_check_avail_instance_data_buffer(uint32_t _num, uint16_t _stride);
/**/
BGFX_C_API bool bgfx_check_avail_transient_buffers(uint32_t _numVertices, const bgfx_vertex_decl_t* _decl, uint32_t _numIndices);
/**/
BGFX_C_API void bgfx_alloc_transient_index_buffer(bgfx_transient_index_buffer_t* _tib, uint32_t _num);
/**/
BGFX_C_API void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_t* _tvb, uint32_t _num, const bgfx_vertex_decl_t* _decl);
/**/
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);
/**/
BGFX_C_API const bgfx_instance_data_buffer_t* bgfx_alloc_instance_data_buffer(uint32_t _num, uint16_t _stride);
/**/
BGFX_C_API bgfx_indirect_buffer_handle_t bgfx_create_indirect_buffer(uint32_t _num);
/**/
BGFX_C_API void bgfx_destroy_indirect_buffer(bgfx_indirect_buffer_handle_t _handle);
/**/
BGFX_C_API bgfx_shader_handle_t bgfx_create_shader(const bgfx_memory_t* _mem);
/**/
BGFX_C_API uint16_t bgfx_get_shader_uniforms(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t* _uniforms, uint16_t _max);
/**/
BGFX_C_API void bgfx_destroy_shader(bgfx_shader_handle_t _handle);
/**/
BGFX_C_API bgfx_program_handle_t bgfx_create_program(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders);
/**/
BGFX_C_API bgfx_program_handle_t bgfx_create_compute_program(bgfx_shader_handle_t _csh, bool _destroyShaders);
/**/
BGFX_C_API void bgfx_destroy_program(bgfx_program_handle_t _handle);
/**/
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);
/**/
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);
/**/
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);
/**/
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);
/**/
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);
/**/
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);
/**/
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);
/**/
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);
/**/
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);
/**/
BGFX_C_API void bgfx_destroy_texture(bgfx_texture_handle_t _handle);
/**/
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);
/**/
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);
/**/
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(uint8_t _num, bgfx_texture_handle_t* _handles, bool _destroyTextures);
/**/
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);
/**/
BGFX_C_API void bgfx_destroy_frame_buffer(bgfx_frame_buffer_handle_t _handle);
/**/
BGFX_C_API bgfx_uniform_handle_t bgfx_create_uniform(const char* _name, bgfx_uniform_type_t _type, uint16_t _num);
/**/
BGFX_C_API void bgfx_destroy_uniform(bgfx_uniform_handle_t _handle);
/**/
BGFX_C_API void bgfx_set_clear_color(uint8_t _index, const float _rgba[4]);
/**/
BGFX_C_API void bgfx_set_view_name(uint8_t _id, const char* _name);
/**/
BGFX_C_API void bgfx_set_view_rect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
/**/
BGFX_C_API void bgfx_set_view_scissor(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
/**/
BGFX_C_API void bgfx_set_view_clear(uint8_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil);
/**/
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);
/**/
BGFX_C_API void bgfx_set_view_seq(uint8_t _id, bool _enabled);
/**/
BGFX_C_API void bgfx_set_view_frame_buffer(uint8_t _id, bgfx_frame_buffer_handle_t _handle);
/**/
BGFX_C_API void bgfx_set_view_transform(uint8_t _id, const void* _view, const void* _proj);
/**/
BGFX_C_API void bgfx_set_view_transform_stereo(uint8_t _id, const void* _view, const void* _projL, uint8_t _flags, const void* _projR);
/**/
BGFX_C_API void bgfx_set_view_remap(uint8_t _id, uint8_t _num, const void* _remap);
/**/
BGFX_C_API void bgfx_set_marker(const char* _marker);
/**/
BGFX_C_API void bgfx_set_state(uint64_t _state, uint32_t _rgba);
/**/
BGFX_C_API void bgfx_set_stencil(uint32_t _fstencil, uint32_t _bstencil);
/**/
BGFX_C_API uint16_t bgfx_set_scissor(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
/**/
BGFX_C_API void bgfx_set_scissor_cached(uint16_t _cache);
/**/
BGFX_C_API uint32_t bgfx_set_transform(const void* _mtx, uint16_t _num);
/**/
BGFX_C_API uint32_t bgfx_alloc_transform(bgfx_transform_t* _transform, uint16_t _num);
/**/
BGFX_C_API void bgfx_set_transform_cached(uint32_t _cache, uint16_t _num);
/**/
BGFX_C_API void bgfx_set_uniform(bgfx_uniform_handle_t _handle, const void* _value, uint16_t _num);
/**/
BGFX_C_API void bgfx_set_index_buffer(bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices);
/**/
BGFX_C_API void bgfx_set_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices);
/**/
BGFX_C_API void bgfx_set_transient_index_buffer(const bgfx_transient_index_buffer_t* _tib, uint32_t _firstIndex, uint32_t _numIndices);
/**/
BGFX_C_API void bgfx_set_vertex_buffer(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices);
/**/
BGFX_C_API void bgfx_set_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _numVertices);
/**/
BGFX_C_API void bgfx_set_transient_vertex_buffer(const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices);
/**/
BGFX_C_API void bgfx_set_instance_data_buffer(const bgfx_instance_data_buffer_t* _idb, uint32_t _num);
/**/
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);
/**/
BGFX_C_API void bgfx_set_texture(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags);
/**/
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);
/**/
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);
/**/
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);
/**/
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);
/**/
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);
/**/
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);
/**/
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);
/**/
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);
/**/
BGFX_C_API void bgfx_discard();
/**/
BGFX_C_API void bgfx_save_screen_shot(const char* _filePath);
#endif // BGFX_C99_H_HEADER_GUARD
+2061
View File
File diff suppressed because it is too large Load Diff
+394
View File
@@ -0,0 +1,394 @@
/*
* Copyright 2011-2015 Branimir Karadzic. All rights reserved.
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#ifndef BGFX_DEFINES_H_HEADER_GUARD
#define BGFX_DEFINES_H_HEADER_GUARD
///
#define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) //!< Enable RGB write.
#define BGFX_STATE_ALPHA_WRITE UINT64_C(0x0000000000000002) //!< Enable alpha write.
#define BGFX_STATE_DEPTH_WRITE UINT64_C(0x0000000000000004) //!< Enable depth write.
#define BGFX_STATE_DEPTH_TEST_LESS UINT64_C(0x0000000000000010) //!< Enable depth test, less.
#define BGFX_STATE_DEPTH_TEST_LEQUAL UINT64_C(0x0000000000000020) //!< Enable depth test, less equal.
#define BGFX_STATE_DEPTH_TEST_EQUAL UINT64_C(0x0000000000000030) //!<
#define BGFX_STATE_DEPTH_TEST_GEQUAL UINT64_C(0x0000000000000040) //!<
#define BGFX_STATE_DEPTH_TEST_GREATER UINT64_C(0x0000000000000050) //!<
#define BGFX_STATE_DEPTH_TEST_NOTEQUAL UINT64_C(0x0000000000000060) //!<
#define BGFX_STATE_DEPTH_TEST_NEVER UINT64_C(0x0000000000000070) //!<
#define BGFX_STATE_DEPTH_TEST_ALWAYS UINT64_C(0x0000000000000080) //!<
#define BGFX_STATE_DEPTH_TEST_SHIFT 4
#define BGFX_STATE_DEPTH_TEST_MASK UINT64_C(0x00000000000000f0) //!< Depth test state bit mask.
#define BGFX_STATE_BLEND_ZERO UINT64_C(0x0000000000001000) //!<
#define BGFX_STATE_BLEND_ONE UINT64_C(0x0000000000002000) //!<
#define BGFX_STATE_BLEND_SRC_COLOR UINT64_C(0x0000000000003000) //!<
#define BGFX_STATE_BLEND_INV_SRC_COLOR UINT64_C(0x0000000000004000) //!<
#define BGFX_STATE_BLEND_SRC_ALPHA UINT64_C(0x0000000000005000) //!<
#define BGFX_STATE_BLEND_INV_SRC_ALPHA UINT64_C(0x0000000000006000) //!<
#define BGFX_STATE_BLEND_DST_ALPHA UINT64_C(0x0000000000007000) //!<
#define BGFX_STATE_BLEND_INV_DST_ALPHA UINT64_C(0x0000000000008000) //!<
#define BGFX_STATE_BLEND_DST_COLOR UINT64_C(0x0000000000009000) //!<
#define BGFX_STATE_BLEND_INV_DST_COLOR UINT64_C(0x000000000000a000) //!<
#define BGFX_STATE_BLEND_SRC_ALPHA_SAT UINT64_C(0x000000000000b000) //!<
#define BGFX_STATE_BLEND_FACTOR UINT64_C(0x000000000000c000) //!<
#define BGFX_STATE_BLEND_INV_FACTOR UINT64_C(0x000000000000d000) //!<
#define BGFX_STATE_BLEND_SHIFT 12 //!< Blend state bit shift.
#define BGFX_STATE_BLEND_MASK UINT64_C(0x000000000ffff000) //!< Blend state bit mask.
#define BGFX_STATE_BLEND_EQUATION_ADD UINT64_C(0x0000000000000000) //!<
#define BGFX_STATE_BLEND_EQUATION_SUB UINT64_C(0x0000000010000000) //!<
#define BGFX_STATE_BLEND_EQUATION_REVSUB UINT64_C(0x0000000020000000) //!<
#define BGFX_STATE_BLEND_EQUATION_MIN UINT64_C(0x0000000030000000) //!<
#define BGFX_STATE_BLEND_EQUATION_MAX UINT64_C(0x0000000040000000) //!<
#define BGFX_STATE_BLEND_EQUATION_SHIFT 28 //!< Blend equation bit shift.
#define BGFX_STATE_BLEND_EQUATION_MASK UINT64_C(0x00000003f0000000) //!< Blend equation bit mask.
#define BGFX_STATE_BLEND_INDEPENDENT UINT64_C(0x0000000400000000) //!< Enable blend independent.
#define BGFX_STATE_CULL_CW UINT64_C(0x0000001000000000) //!< Cull clockwise triangles.
#define BGFX_STATE_CULL_CCW UINT64_C(0x0000002000000000) //!< Cull counter-clockwise triangles.
#define BGFX_STATE_CULL_SHIFT 36 //!< Culling mode bit shift.
#define BGFX_STATE_CULL_MASK UINT64_C(0x0000003000000000) //!< Culling mode bit mask.
#define BGFX_STATE_ALPHA_REF_SHIFT 40 //!<
#define BGFX_STATE_ALPHA_REF_MASK UINT64_C(0x0000ff0000000000) //!<
#define BGFX_STATE_PT_TRISTRIP UINT64_C(0x0001000000000000) //!< Tristrip.
#define BGFX_STATE_PT_LINES UINT64_C(0x0002000000000000) //!< Lines.
#define BGFX_STATE_PT_LINESTRIP UINT64_C(0x0003000000000000) //!< Line strip.
#define BGFX_STATE_PT_POINTS UINT64_C(0x0004000000000000) //!< Points.
#define BGFX_STATE_PT_SHIFT 48 //!< Primitive type bit shift.
#define BGFX_STATE_PT_MASK UINT64_C(0x0007000000000000) //!< Primitive type bit mask.
#define BGFX_STATE_POINT_SIZE_SHIFT 52 //!<
#define BGFX_STATE_POINT_SIZE_MASK UINT64_C(0x0ff0000000000000) //!<
/// Enable MSAA write when writing into MSAA frame buffer. This flag is ignored when not writing into
/// MSAA frame buffer.
#define BGFX_STATE_MSAA UINT64_C(0x1000000000000000) //!<
#define BGFX_STATE_RESERVED_MASK UINT64_C(0xe000000000000000) //!<
#define BGFX_STATE_NONE UINT64_C(0x0000000000000000) //!<
#define BGFX_STATE_MASK UINT64_C(0xffffffffffffffff) //!<
/// Default state is write to RGB, alpha, and depth with depth test less enabled, with clockwise
/// culling and MSAA (when writing into MSAA frame buffer, otherwise this flag is ignored).
#define BGFX_STATE_DEFAULT (0 \
| BGFX_STATE_RGB_WRITE \
| BGFX_STATE_ALPHA_WRITE \
| BGFX_STATE_DEPTH_TEST_LESS \
| BGFX_STATE_DEPTH_WRITE \
| BGFX_STATE_CULL_CW \
| BGFX_STATE_MSAA \
)
#define BGFX_STATE_ALPHA_REF(_ref) ( ( (uint64_t)(_ref )<<BGFX_STATE_ALPHA_REF_SHIFT )&BGFX_STATE_ALPHA_REF_MASK)
#define BGFX_STATE_POINT_SIZE(_size) ( ( (uint64_t)(_size)<<BGFX_STATE_POINT_SIZE_SHIFT)&BGFX_STATE_POINT_SIZE_MASK)
///
#define BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA) (UINT64_C(0) \
| ( ( (uint64_t)(_srcRGB)|( (uint64_t)(_dstRGB)<<4) ) ) \
| ( ( (uint64_t)(_srcA )|( (uint64_t)(_dstA )<<4) )<<8) \
)
#define BGFX_STATE_BLEND_EQUATION_SEPARATE(_rgb, _a) ( (uint64_t)(_rgb)|( (uint64_t)(_a)<<3) )
///
#define BGFX_STATE_BLEND_FUNC(_src, _dst) BGFX_STATE_BLEND_FUNC_SEPARATE(_src, _dst, _src, _dst)
#define BGFX_STATE_BLEND_EQUATION(_equation) BGFX_STATE_BLEND_EQUATION_SEPARATE(_equation, _equation)
#define BGFX_STATE_BLEND_ADD (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE ) )
#define BGFX_STATE_BLEND_ALPHA (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA) )
#define BGFX_STATE_BLEND_DARKEN (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE ) | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_MIN) )
#define BGFX_STATE_BLEND_LIGHTEN (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE ) | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_MAX) )
#define BGFX_STATE_BLEND_MULTIPLY (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_ZERO ) )
#define BGFX_STATE_BLEND_NORMAL (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_ALPHA) )
#define BGFX_STATE_BLEND_SCREEN (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_COLOR) )
#define BGFX_STATE_BLEND_LINEAR_BURN (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_INV_DST_COLOR) | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_SUB) )
///
#define BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst) (0 \
| ( uint32_t( (_src)>>BGFX_STATE_BLEND_SHIFT) \
| ( uint32_t( (_dst)>>BGFX_STATE_BLEND_SHIFT)<<4) ) \
)
#define BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation) (0 \
| BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst) \
| ( uint32_t( (_equation)>>BGFX_STATE_BLEND_EQUATION_SHIFT)<<8) \
)
#define BGFX_STATE_BLEND_FUNC_RT_1(_src, _dst) (BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst)<< 0)
#define BGFX_STATE_BLEND_FUNC_RT_2(_src, _dst) (BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst)<<11)
#define BGFX_STATE_BLEND_FUNC_RT_3(_src, _dst) (BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst)<<22)
#define BGFX_STATE_BLEND_FUNC_RT_1E(_src, _dst, _equation) (BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation)<< 0)
#define BGFX_STATE_BLEND_FUNC_RT_2E(_src, _dst, _equation) (BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation)<<11)
#define BGFX_STATE_BLEND_FUNC_RT_3E(_src, _dst, _equation) (BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation)<<22)
///
#define BGFX_STENCIL_FUNC_REF_SHIFT 0 //!<
#define BGFX_STENCIL_FUNC_REF_MASK UINT32_C(0x000000ff) //!<
#define BGFX_STENCIL_FUNC_RMASK_SHIFT 8 //!<
#define BGFX_STENCIL_FUNC_RMASK_MASK UINT32_C(0x0000ff00) //!<
#define BGFX_STENCIL_TEST_LESS UINT32_C(0x00010000) //!< Enable stencil test, less.
#define BGFX_STENCIL_TEST_LEQUAL UINT32_C(0x00020000) //!<
#define BGFX_STENCIL_TEST_EQUAL UINT32_C(0x00030000) //!<
#define BGFX_STENCIL_TEST_GEQUAL UINT32_C(0x00040000) //!<
#define BGFX_STENCIL_TEST_GREATER UINT32_C(0x00050000) //!<
#define BGFX_STENCIL_TEST_NOTEQUAL UINT32_C(0x00060000) //!<
#define BGFX_STENCIL_TEST_NEVER UINT32_C(0x00070000) //!<
#define BGFX_STENCIL_TEST_ALWAYS UINT32_C(0x00080000) //!<
#define BGFX_STENCIL_TEST_SHIFT 16 //!<
#define BGFX_STENCIL_TEST_MASK UINT32_C(0x000f0000) //!<
#define BGFX_STENCIL_OP_FAIL_S_ZERO UINT32_C(0x00000000) //!<
#define BGFX_STENCIL_OP_FAIL_S_KEEP UINT32_C(0x00100000) //!<
#define BGFX_STENCIL_OP_FAIL_S_REPLACE UINT32_C(0x00200000) //!<
#define BGFX_STENCIL_OP_FAIL_S_INCR UINT32_C(0x00300000) //!<
#define BGFX_STENCIL_OP_FAIL_S_INCRSAT UINT32_C(0x00400000) //!<
#define BGFX_STENCIL_OP_FAIL_S_DECR UINT32_C(0x00500000) //!<
#define BGFX_STENCIL_OP_FAIL_S_DECRSAT UINT32_C(0x00600000) //!<
#define BGFX_STENCIL_OP_FAIL_S_INVERT UINT32_C(0x00700000) //!<
#define BGFX_STENCIL_OP_FAIL_S_SHIFT 20 //!<
#define BGFX_STENCIL_OP_FAIL_S_MASK UINT32_C(0x00f00000) //!<
#define BGFX_STENCIL_OP_FAIL_Z_ZERO UINT32_C(0x00000000) //!<
#define BGFX_STENCIL_OP_FAIL_Z_KEEP UINT32_C(0x01000000) //!<
#define BGFX_STENCIL_OP_FAIL_Z_REPLACE UINT32_C(0x02000000) //!<
#define BGFX_STENCIL_OP_FAIL_Z_INCR UINT32_C(0x03000000) //!<
#define BGFX_STENCIL_OP_FAIL_Z_INCRSAT UINT32_C(0x04000000) //!<
#define BGFX_STENCIL_OP_FAIL_Z_DECR UINT32_C(0x05000000) //!<
#define BGFX_STENCIL_OP_FAIL_Z_DECRSAT UINT32_C(0x06000000) //!<
#define BGFX_STENCIL_OP_FAIL_Z_INVERT UINT32_C(0x07000000) //!<
#define BGFX_STENCIL_OP_FAIL_Z_SHIFT 24 //!<
#define BGFX_STENCIL_OP_FAIL_Z_MASK UINT32_C(0x0f000000) //!<
#define BGFX_STENCIL_OP_PASS_Z_ZERO UINT32_C(0x00000000) //!<
#define BGFX_STENCIL_OP_PASS_Z_KEEP UINT32_C(0x10000000) //!<
#define BGFX_STENCIL_OP_PASS_Z_REPLACE UINT32_C(0x20000000) //!<
#define BGFX_STENCIL_OP_PASS_Z_INCR UINT32_C(0x30000000) //!<
#define BGFX_STENCIL_OP_PASS_Z_INCRSAT UINT32_C(0x40000000) //!<
#define BGFX_STENCIL_OP_PASS_Z_DECR UINT32_C(0x50000000) //!<
#define BGFX_STENCIL_OP_PASS_Z_DECRSAT UINT32_C(0x60000000) //!<
#define BGFX_STENCIL_OP_PASS_Z_INVERT UINT32_C(0x70000000) //!<
#define BGFX_STENCIL_OP_PASS_Z_SHIFT 28 //!<
#define BGFX_STENCIL_OP_PASS_Z_MASK UINT32_C(0xf0000000) //!<
#define BGFX_STENCIL_NONE UINT32_C(0x00000000) //!<
#define BGFX_STENCIL_MASK UINT32_C(0xffffffff) //!<
#define BGFX_STENCIL_DEFAULT UINT32_C(0x00000000) //!<
/// Set stencil ref value.
#define BGFX_STENCIL_FUNC_REF(_ref) ( (uint32_t(_ref)<<BGFX_STENCIL_FUNC_REF_SHIFT)&BGFX_STENCIL_FUNC_REF_MASK)
/// Set stencil rmask value.
#define BGFX_STENCIL_FUNC_RMASK(_mask) ( (uint32_t(_mask)<<BGFX_STENCIL_FUNC_RMASK_SHIFT)&BGFX_STENCIL_FUNC_RMASK_MASK)
///
#define BGFX_CLEAR_NONE UINT16_C(0x0000) //!< No clear flags.
#define BGFX_CLEAR_COLOR UINT16_C(0x0001) //!< Clear color.
#define BGFX_CLEAR_DEPTH UINT16_C(0x0002) //!< Clear depth.
#define BGFX_CLEAR_STENCIL UINT16_C(0x0004) //!< Clear stencil.
#define BGFX_CLEAR_DISCARD_COLOR_0 UINT16_C(0x0008) //!< Discard frame buffer attachment 0.
#define BGFX_CLEAR_DISCARD_COLOR_1 UINT16_C(0x0010) //!< Discard frame buffer attachment 1.
#define BGFX_CLEAR_DISCARD_COLOR_2 UINT16_C(0x0020) //!< Discard frame buffer attachment 2.
#define BGFX_CLEAR_DISCARD_COLOR_3 UINT16_C(0x0040) //!< Discard frame buffer attachment 3.
#define BGFX_CLEAR_DISCARD_COLOR_4 UINT16_C(0x0080) //!< Discard frame buffer attachment 4.
#define BGFX_CLEAR_DISCARD_COLOR_5 UINT16_C(0x0100) //!< Discard frame buffer attachment 5.
#define BGFX_CLEAR_DISCARD_COLOR_6 UINT16_C(0x0200) //!< Discard frame buffer attachment 6.
#define BGFX_CLEAR_DISCARD_COLOR_7 UINT16_C(0x0400) //!< Discard frame buffer attachment 7.
#define BGFX_CLEAR_DISCARD_DEPTH UINT16_C(0x0800) //!< Discard frame buffer depth attachment.
#define BGFX_CLEAR_DISCARD_STENCIL UINT16_C(0x1000) //!< Discard frame buffer stencil attachment.
#define BGFX_CLEAR_DISCARD_COLOR_MASK (0 \
| BGFX_CLEAR_DISCARD_COLOR_0 \
| BGFX_CLEAR_DISCARD_COLOR_1 \
| BGFX_CLEAR_DISCARD_COLOR_2 \
| BGFX_CLEAR_DISCARD_COLOR_3 \
| BGFX_CLEAR_DISCARD_COLOR_4 \
| BGFX_CLEAR_DISCARD_COLOR_5 \
| BGFX_CLEAR_DISCARD_COLOR_6 \
| BGFX_CLEAR_DISCARD_COLOR_7 \
)
#define BGFX_CLEAR_DISCARD_MASK (0 \
| BGFX_CLEAR_DISCARD_COLOR_MASK \
| BGFX_CLEAR_DISCARD_DEPTH \
| BGFX_CLEAR_DISCARD_STENCIL \
)
#define BGFX_DEBUG_NONE UINT32_C(0x00000000) //!< No debug.
#define BGFX_DEBUG_WIREFRAME UINT32_C(0x00000001) //!< Enable wireframe for all primitives.
#define BGFX_DEBUG_IFH UINT32_C(0x00000002) //!< Enable infinitely fast hardware test. No draw calls will be submitted to driver. Its useful when profiling to quickly assess bottleneck between CPU and GPU.
#define BGFX_DEBUG_STATS UINT32_C(0x00000004) //!< Enable statistics display.
#define BGFX_DEBUG_TEXT UINT32_C(0x00000008) //!< Enable debug text display.
///
#define BGFX_BUFFER_NONE UINT16_C(0x0000) //!<
#define BGFX_BUFFER_COMPUTE_FORMAT_8x1 UINT16_C(0x0001) //!<
#define BGFX_BUFFER_COMPUTE_FORMAT_8x2 UINT16_C(0x0002) //!<
#define BGFX_BUFFER_COMPUTE_FORMAT_8x4 UINT16_C(0x0003) //!<
#define BGFX_BUFFER_COMPUTE_FORMAT_16x1 UINT16_C(0x0004) //!<
#define BGFX_BUFFER_COMPUTE_FORMAT_16x2 UINT16_C(0x0005) //!<
#define BGFX_BUFFER_COMPUTE_FORMAT_16x4 UINT16_C(0x0006) //!<
#define BGFX_BUFFER_COMPUTE_FORMAT_32x1 UINT16_C(0x0007) //!<
#define BGFX_BUFFER_COMPUTE_FORMAT_32x2 UINT16_C(0x0008) //!<
#define BGFX_BUFFER_COMPUTE_FORMAT_32x4 UINT16_C(0x0009) //!<
#define BGFX_BUFFER_COMPUTE_FORMAT_SHIFT 0 //!<
#define BGFX_BUFFER_COMPUTE_FORMAT_MASK UINT16_C(0x000f) //!<
#define BGFX_BUFFER_COMPUTE_TYPE_UINT UINT16_C(0x0010) //!<
#define BGFX_BUFFER_COMPUTE_TYPE_INT UINT16_C(0x0020) //!<
#define BGFX_BUFFER_COMPUTE_TYPE_FLOAT UINT16_C(0x0030) //!<
#define BGFX_BUFFER_COMPUTE_TYPE_SHIFT 4 //!<
#define BGFX_BUFFER_COMPUTE_TYPE_MASK UINT16_C(0x0030) //!<
#define BGFX_BUFFER_COMPUTE_READ UINT16_C(0x0100) //!<
#define BGFX_BUFFER_COMPUTE_WRITE UINT16_C(0x0200) //!<
#define BGFX_BUFFER_DRAW_INDIRECT UINT16_C(0x0400) //!<
#define BGFX_BUFFER_ALLOW_RESIZE UINT16_C(0x0800) //!<
#define BGFX_BUFFER_INDEX32 UINT16_C(0x1000) //!<
#define BGFX_BUFFER_COMPUTE_READ_WRITE (0 \
| BGFX_BUFFER_COMPUTE_READ \
| BGFX_BUFFER_COMPUTE_WRITE \
)
///
#define BGFX_TEXTURE_NONE UINT32_C(0x00000000) //!<
#define BGFX_TEXTURE_U_MIRROR UINT32_C(0x00000001) //!<
#define BGFX_TEXTURE_U_CLAMP UINT32_C(0x00000002) //!<
#define BGFX_TEXTURE_U_SHIFT 0 //!<
#define BGFX_TEXTURE_U_MASK UINT32_C(0x00000003) //!<
#define BGFX_TEXTURE_V_MIRROR UINT32_C(0x00000004) //!<
#define BGFX_TEXTURE_V_CLAMP UINT32_C(0x00000008) //!<
#define BGFX_TEXTURE_V_SHIFT 2 //!<
#define BGFX_TEXTURE_V_MASK UINT32_C(0x0000000c) //!<
#define BGFX_TEXTURE_W_MIRROR UINT32_C(0x00000010) //!<
#define BGFX_TEXTURE_W_CLAMP UINT32_C(0x00000020) //!<
#define BGFX_TEXTURE_W_SHIFT 4 //!<
#define BGFX_TEXTURE_W_MASK UINT32_C(0x00000030) //!<
#define BGFX_TEXTURE_MIN_POINT UINT32_C(0x00000040) //!<
#define BGFX_TEXTURE_MIN_ANISOTROPIC UINT32_C(0x00000080) //!<
#define BGFX_TEXTURE_MIN_SHIFT 6 //!<
#define BGFX_TEXTURE_MIN_MASK UINT32_C(0x000000c0) //!<
#define BGFX_TEXTURE_MAG_POINT UINT32_C(0x00000100) //!<
#define BGFX_TEXTURE_MAG_ANISOTROPIC UINT32_C(0x00000200) //!<
#define BGFX_TEXTURE_MAG_SHIFT 8 //!<
#define BGFX_TEXTURE_MAG_MASK UINT32_C(0x00000300) //!<
#define BGFX_TEXTURE_MIP_POINT UINT32_C(0x00000400) //!<
#define BGFX_TEXTURE_MIP_SHIFT 10 //!<
#define BGFX_TEXTURE_MIP_MASK UINT32_C(0x00000400) //!<
#define BGFX_TEXTURE_RT UINT32_C(0x00001000) //!<
#define BGFX_TEXTURE_RT_MSAA_X2 UINT32_C(0x00002000) //!<
#define BGFX_TEXTURE_RT_MSAA_X4 UINT32_C(0x00003000) //!<
#define BGFX_TEXTURE_RT_MSAA_X8 UINT32_C(0x00004000) //!<
#define BGFX_TEXTURE_RT_MSAA_X16 UINT32_C(0x00005000) //!<
#define BGFX_TEXTURE_RT_MSAA_SHIFT 12 //!<
#define BGFX_TEXTURE_RT_MSAA_MASK UINT32_C(0x00007000) //!<
#define BGFX_TEXTURE_RT_BUFFER_ONLY UINT32_C(0x00008000) //!<
#define BGFX_TEXTURE_RT_MASK UINT32_C(0x0000f000) //!<
#define BGFX_TEXTURE_COMPARE_LESS UINT32_C(0x00010000) //!<
#define BGFX_TEXTURE_COMPARE_LEQUAL UINT32_C(0x00020000) //!<
#define BGFX_TEXTURE_COMPARE_EQUAL UINT32_C(0x00030000) //!<
#define BGFX_TEXTURE_COMPARE_GEQUAL UINT32_C(0x00040000) //!<
#define BGFX_TEXTURE_COMPARE_GREATER UINT32_C(0x00050000) //!<
#define BGFX_TEXTURE_COMPARE_NOTEQUAL UINT32_C(0x00060000) //!<
#define BGFX_TEXTURE_COMPARE_NEVER UINT32_C(0x00070000) //!<
#define BGFX_TEXTURE_COMPARE_ALWAYS UINT32_C(0x00080000) //!<
#define BGFX_TEXTURE_COMPARE_SHIFT 16 //!<
#define BGFX_TEXTURE_COMPARE_MASK UINT32_C(0x000f0000) //!<
#define BGFX_TEXTURE_COMPUTE_WRITE UINT32_C(0x00100000) //!<
#define BGFX_TEXTURE_SRGB UINT32_C(0x00200000) //!<
#define BGFX_TEXTURE_RESERVED_SHIFT 24 //!<
#define BGFX_TEXTURE_RESERVED_MASK UINT32_C(0xff000000) //!<
#define BGFX_TEXTURE_SAMPLER_BITS_MASK (0 \
| BGFX_TEXTURE_U_MASK \
| BGFX_TEXTURE_V_MASK \
| BGFX_TEXTURE_W_MASK \
| BGFX_TEXTURE_MIN_MASK \
| BGFX_TEXTURE_MAG_MASK \
| BGFX_TEXTURE_MIP_MASK \
| BGFX_TEXTURE_COMPARE_MASK \
)
///
#define BGFX_RESET_NONE UINT32_C(0x00000000) //!< No reset flags.
#define BGFX_RESET_FULLSCREEN UINT32_C(0x00000001) //!< Not supported yet.
#define BGFX_RESET_FULLSCREEN_SHIFT 0 //!< Fullscreen bit shift.
#define BGFX_RESET_FULLSCREEN_MASK UINT32_C(0x00000001) //!< Fullscreen bit mask.
#define BGFX_RESET_MSAA_X2 UINT32_C(0x00000010) //!< Enable 2x MSAA.
#define BGFX_RESET_MSAA_X4 UINT32_C(0x00000020) //!< Enable 4x MSAA.
#define BGFX_RESET_MSAA_X8 UINT32_C(0x00000030) //!< Enable 8x MSAA.
#define BGFX_RESET_MSAA_X16 UINT32_C(0x00000040) //!< Enable 16x MSAA.
#define BGFX_RESET_MSAA_SHIFT 4 //!< MSAA mode bit shift.
#define BGFX_RESET_MSAA_MASK UINT32_C(0x00000070) //!< MSAA mode bit mask.
#define BGFX_RESET_VSYNC UINT32_C(0x00000080) //!< Enable V-Sync.
#define BGFX_RESET_MAXANISOTROPY UINT32_C(0x00000100) //!< Turn on/off max anisotropy.
#define BGFX_RESET_CAPTURE UINT32_C(0x00000200) //!< Begin screen capture.
#define BGFX_RESET_HMD UINT32_C(0x00000400) //!< HMD stereo rendering.
#define BGFX_RESET_HMD_DEBUG UINT32_C(0x00000800) //!< HMD stereo rendering debug mode.
#define BGFX_RESET_HMD_RECENTER UINT32_C(0x00001000) //!< HMD calibration.
#define BGFX_RESET_FLUSH_AFTER_RENDER UINT32_C(0x00002000) //!< Flush rendering after submitting to GPU.
#define BGFX_RESET_FLIP_AFTER_RENDER UINT32_C(0x00004000) //!< This flag specifies where flip occurs. Default behavior is that flip occurs before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
#define BGFX_RESET_SRGB_BACKBUFFER UINT32_C(0x00008000) //!< Enable sRGB backbuffer.
#define BGFX_RESET_HIDPI UINT32_C(0x00010000) //!< Enable HiDPI rendering.
///
#define BGFX_CAPS_TEXTURE_COMPARE_LEQUAL UINT64_C(0x0000000000000001) //!< Texture compare less equal mode is supported.
#define BGFX_CAPS_TEXTURE_COMPARE_ALL UINT64_C(0x0000000000000003) //!< All texture compare modes are supported.
#define BGFX_CAPS_TEXTURE_3D UINT64_C(0x0000000000000004) //!< 3D textures are supported.
#define BGFX_CAPS_VERTEX_ATTRIB_HALF UINT64_C(0x0000000000000008) //!< Vertex attribute half-float is supported.
#define BGFX_CAPS_VERTEX_ATTRIB_UINT10 UINT64_C(0x0000000000000010) //!< Vertex attribute 10_10_10_2 is supported.
#define BGFX_CAPS_INSTANCING UINT64_C(0x0000000000000020) //!< Instancing is supported.
#define BGFX_CAPS_RENDERER_MULTITHREADED UINT64_C(0x0000000000000040) //!< Renderer is on separate thread.
#define BGFX_CAPS_FRAGMENT_DEPTH UINT64_C(0x0000000000000080) //!< Fragment depth is accessible in fragment shader.
#define BGFX_CAPS_BLEND_INDEPENDENT UINT64_C(0x0000000000000100) //!< Blend independent is supported.
#define BGFX_CAPS_COMPUTE UINT64_C(0x0000000000000200) //!< Compute shaders are supported.
#define BGFX_CAPS_FRAGMENT_ORDERING UINT64_C(0x0000000000000400) //!< Fragment ordering is available in fragment shader.
#define BGFX_CAPS_SWAP_CHAIN UINT64_C(0x0000000000000800) //!< Multiple windows are supported.
#define BGFX_CAPS_HMD UINT64_C(0x0000000000001000) //!< Head Mounted Display is available.
#define BGFX_CAPS_INDEX32 UINT64_C(0x0000000000002000) //!< 32-bit indices are supported.
#define BGFX_CAPS_DRAW_INDIRECT UINT64_C(0x0000000000004000) //!< Draw indirect is supported.
#define BGFX_CAPS_HIDPI UINT64_C(0x0000000000008000) //!< HiDPI rendering is supported.
///
#define BGFX_CAPS_FORMAT_TEXTURE_NONE UINT8_C(0x00) //!< Texture format is not supported.
#define BGFX_CAPS_FORMAT_TEXTURE_COLOR UINT8_C(0x01) //!< Texture format is supported.
#define BGFX_CAPS_FORMAT_TEXTURE_COLOR_SRGB UINT8_C(0x02) //!< Texture as sRGB format is supported.
#define BGFX_CAPS_FORMAT_TEXTURE_EMULATED UINT8_C(0x04) //!< Texture format is emulated.
#define BGFX_CAPS_FORMAT_TEXTURE_VERTEX UINT8_C(0x08) //!< Texture format can be used from vertex shader.
#define BGFX_CAPS_FORMAT_TEXTURE_IMAGE UINT8_C(0x10) //!< Texture format can be used as image from compute shader.
#define BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER UINT8_C(0x20) //!< Texture format can be used as frame buffer.
#define BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA UINT8_C(0x40) //!< Texture format can be used as MSAA frame buffer.
#define BGFX_CAPS_FORMAT_TEXTURE_MSAA UINT8_C(0x80) //!< Texture can be sampled as MSAA.
///
#define BGFX_VIEW_NONE UINT8_C(0x00) //!<
#define BGFX_VIEW_STEREO UINT8_C(0x01) //!<
///
#define BGFX_SUBMIT_EYE_LEFT UINT8_C(0x01) //!<
#define BGFX_SUBMIT_EYE_RIGHT UINT8_C(0x02) //!<
#define BGFX_SUBMIT_EYE_MASK UINT8_C(0x03) //!<
#define BGFX_SUBMIT_EYE_FIRST BGFX_SUBMIT_EYE_LEFT
///
#define BGFX_PCI_ID_NONE UINT16_C(0x0000) //!< Autoselect adapter.
#define BGFX_PCI_ID_SOFTWARE_RASTERIZER UINT16_C(0x0001) //!< Software rasterizer.
#define BGFX_PCI_ID_AMD UINT16_C(0x1002) //!< AMD adapter.
#define BGFX_PCI_ID_INTEL UINT16_C(0x8086) //!< Intel adapter.
#define BGFX_PCI_ID_NVIDIA UINT16_C(0x10de) //!< nVidia adapter.
///
#define BGFX_HMD_NONE UINT8_C(0x00) //!< None.
#define BGFX_HMD_DEVICE_RESOLUTION UINT8_C(0x01) //!< Has HMD native resolution.
#define BGFX_HMD_RENDERING UINT8_C(0x02) //!< Rendering to HMD.
#endif // BGFX_DEFINES_H_HEADER_GUARD
+46
View File
@@ -0,0 +1,46 @@
/*
* Copyright 2011-2015 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
*
* vim: set tabstop=4 expandtab:
*/
#ifndef BGFX_PLATFORM_C99_H_HEADER_GUARD
#define BGFX_PLATFORM_C99_H_HEADER_GUARD
// NOTICE:
// This header file contains platform specific interfaces. It is only
// necessary to use this header in conjunction with creating windows.
#include <bx/platform.h>
typedef enum bgfx_render_frame
{
BGFX_RENDER_FRAME_NO_CONTEXT,
BGFX_RENDER_FRAME_RENDER,
BGFX_RENDER_FRAME_EXITING,
BGFX_RENDER_FRAME_COUNT
} bgfx_render_frame_t;
/**
* WARNING: This call should be only used on platforms that don't
* allow creating separate rendering thread. If it is called before
* to bgfx_init, render thread won't be created by bgfx_init call.
*/
BGFX_C_API bgfx_render_frame_t bgfx_render_frame();
typedef struct bgfx_platform_data
{
void* ndt;
void* nwh;
void* context;
void* backBuffer;
void* backBufferDS;
} bgfx_platform_data_t;
BGFX_C_API void bgfx_set_platform_data(bgfx_platform_data_t* _pd);
#endif // BGFX_PLATFORM_C99_H_HEADER_GUARD
+269
View File
@@ -0,0 +1,269 @@
/*
* Copyright 2011-2015 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
*/
#ifndef BGFX_PLATFORM_H_HEADER_GUARD
#define BGFX_PLATFORM_H_HEADER_GUARD
// NOTICE:
// This header file contains platform specific interfaces. It is only
// necessary to use this header in conjunction with creating windows.
#include <bx/platform.h>
namespace bgfx
{
/// Render frame enum.
///
/// @attention C99 equivalent is `bgfx_render_frame_t`.
///
struct RenderFrame
{
enum Enum
{
NoContext,
Render,
Exiting,
Count
};
};
/// Render frame.
///
/// @returns Current renderer state. See: `bgfx::RenderFrame`.
///
/// @warning This call should be only used on platforms that don't
/// allow creating separate rendering thread. If it is called before
/// to bgfx::init, render thread won't be created by bgfx::init call.
RenderFrame::Enum renderFrame();
/// Platform data.
///
/// @attention C99 equivalent is `bgfx_platform_data_t`.
///
struct PlatformData
{
void* ndt; //!< Native display type
void* nwh; //!< Native window handle
void* context; //!< GL context, or D3D device
void* backBuffer; //!< GL backbuffer, or D3D render target view
void* backBufferDS; //!< Backbuffer depth/stencil.
};
/// Set platform data.
///
/// @warning Must be called before `bgfx::init`.
///
/// @attention C99 equivalent is `bgfx_set_platform_data`.
///
void setPlatformData(const PlatformData& _hooks);
} // namespace bgfx
#if BX_PLATFORM_ANDROID
# include <android/native_window.h>
namespace bgfx
{
///
inline void androidSetWindow(::ANativeWindow* _window)
{
PlatformData pd;
pd.ndt = NULL;
pd.nwh = _window;
pd.context = NULL;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
setPlatformData(pd);
}
} // namespace bgfx
#elif BX_PLATFORM_IOS
namespace bgfx
{
///
inline void iosSetEaglLayer(void* _window)
{
PlatformData pd;
pd.ndt = NULL;
pd.nwh = _window;
pd.context = NULL;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
setPlatformData(pd);
}
} // namespace bgfx
#elif BX_PLATFORM_FREEBSD || BX_PLATFORM_LINUX || BX_PLATFORM_RPI
namespace bgfx
{
///
inline void x11SetDisplayWindow(void* _display, uint32_t _window, void* _glx = NULL)
{
PlatformData pd;
pd.ndt = _display;
pd.nwh = (void*)(uintptr_t)_window;
pd.context = _glx;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
setPlatformData(pd);
}
} // namespace bgfx
#elif BX_PLATFORM_NACL
# include <ppapi/c/ppb_graphics_3d.h>
# include <ppapi/c/ppb_instance.h>
namespace bgfx
{
typedef void (*PostSwapBuffersFn)(uint32_t _width, uint32_t _height);
///
bool naclSetInterfaces(::PP_Instance, const ::PPB_Instance*, const ::PPB_Graphics3D*, PostSwapBuffersFn);
} // namespace bgfx
#elif BX_PLATFORM_OSX
namespace bgfx
{
///
inline void osxSetNSWindow(void* _window, void* _nsgl = NULL)
{
PlatformData pd;
pd.ndt = NULL;
pd.nwh = _window;
pd.context = _nsgl;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
setPlatformData(pd);
}
} // namespace bgfx
#elif BX_PLATFORM_WINDOWS
# include <windows.h>
namespace bgfx
{
///
inline void winSetHwnd(::HWND _window)
{
PlatformData pd;
pd.ndt = NULL;
pd.nwh = _window;
pd.context = NULL;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
setPlatformData(pd);
}
} // namespace bgfx
#elif BX_PLATFORM_WINRT
# include <Unknwn.h>
namespace bgfx
{
///
inline void winrtSetWindow(::IUnknown* _window)
{
PlatformData pd;
pd.ndt = NULL;
pd.nwh = _window;
pd.context = NULL;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
setPlatformData(pd);
}
} // namespace bgfx
#endif // BX_PLATFORM_
#if defined(_SDL_syswm_h)
// If SDL_syswm.h is included before bgfxplatform.h we can enable SDL window
// interop convenience code.
namespace bgfx
{
///
inline bool sdlSetWindow(SDL_Window* _window)
{
SDL_SysWMinfo wmi;
SDL_VERSION(&wmi.version);
if (!SDL_GetWindowWMInfo(_window, &wmi) )
{
return false;
}
PlatformData pd;
# if BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
pd.ndt = wmi.info.x11.display;
pd.nwh = (void*)(uintptr_t)wmi.info.x11.window;
# elif BX_PLATFORM_OSX
pd.ndt = NULL;
pd.nwh = wmi.info.cocoa.window;
# elif BX_PLATFORM_WINDOWS
pd.ndt = NULL;
pd.nwh = wmi.info.win.window;
# endif // BX_PLATFORM_
pd.context = NULL;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
setPlatformData(pd);
return true;
}
} // namespace bgfx
#elif defined(_glfw3_h_)
// If GLFW/glfw3.h is included before bgfxplatform.h we can enable GLFW3
// window interop convenience code.
# if BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
# define GLFW_EXPOSE_NATIVE_X11
# define GLFW_EXPOSE_NATIVE_GLX
# elif BX_PLATFORM_OSX
# define GLFW_EXPOSE_NATIVE_COCOA
# define GLFW_EXPOSE_NATIVE_NSGL
# elif BX_PLATFORM_WINDOWS
# define GLFW_EXPOSE_NATIVE_WIN32
# define GLFW_EXPOSE_NATIVE_WGL
# endif //
# include <GLFW/glfw3native.h>
namespace bgfx
{
inline void glfwSetWindow(GLFWwindow* _window)
{
PlatformData pd;
# if BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
pd.ndt = glfwGetX11Display();
pd.nwh = (void*)(uintptr_t)glfwGetX11Window(_window);
pd.context = glfwGetGLXContext(_window);
# elif BX_PLATFORM_OSX
pd.ndt = NULL;
pd.nwh = glfwGetCocoaWindow(_window);
pd.context = glfwGetNSGLContext(_window);
# elif BX_PLATFORM_WINDOWS
pd.ndt = NULL;
pd.nwh = glfwGetWin32Window(_window);
pd.context = NULL;
# endif // BX_PLATFORM_WINDOWS
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
setPlatformData(pd);
}
} // namespace bgfx
#endif // defined(_SDL_H)
#endif // BGFX_PLATFORM_H_HEADER_GUARD
Binary file not shown.
+4
View File
@@ -7,6 +7,7 @@ find_package(Boost REQUIRED COMPONENTS system filesystem thread chrono)
find_package(assimp REQUIRED)
find_package(ZLIB REQUIRED)
find_package(PNG REQUIRED)
find_package(BGFX REQUIRED)
# GLM
set(INCLUDE_PATH ${CMAKE_SOURCE_DIR}/include)
@@ -18,6 +19,7 @@ include_directories(
${Boost_INCLUDE_DIRS}
${assimp_INCLUDE_DIRS}
${PNG_INCLUDE_DIRS}
${BGFX_INCLUDE_DIRS}
)
file(GLOB SOURCE_FILES_Core
@@ -68,6 +70,7 @@ target_link_libraries(game
${Boost_LIBRARIES}
${assimp_LIBRARIES}
${PNG_LIBRARIES}
${BGFX_LIBRARIES}
)
add_executable(breakout
@@ -81,5 +84,6 @@ target_link_libraries(breakout
${Boost_LIBRARIES}
${assimp_LIBRARIES}
${PNG_LIBRARIES}
${BGFX_LIBRARIES}
)