Texture override internal now returns 0 to signal that internal texture is not yet created.

This commit is contained in:
Branimir Karadžić
2016-02-05 18:41:01 -08:00
parent 55e72a2dd1
commit cf6ccace77
4 changed files with 32 additions and 15 deletions

View File

@@ -6,7 +6,7 @@
#ifndef BGFX_DEFINES_H_HEADER_GUARD
#define BGFX_DEFINES_H_HEADER_GUARD
#define BGFX_API_VERSION UINT32_C(6)
#define BGFX_API_VERSION UINT32_C(7)
///
#define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) //!< Enable RGB write.

View File

@@ -91,11 +91,14 @@ namespace bgfx
/// @param[in] _handle Texture handle.
/// @param[in] _ptr Native API pointer to texture.
///
/// @returns Native API pointer to texture. If result is 0, texture is not created yet from the
/// main thread.
///
/// @warning Must be called only on render thread.
///
/// @attention C99 equivalent is `bgfx_override_internal_texture_ptr`.
///
void overrideInternal(TextureHandle _handle, uintptr_t _ptr);
uintptr_t overrideInternal(TextureHandle _handle, uintptr_t _ptr);
/// Override internal texture by creating new texture. Previously created
/// internal texture will released.
@@ -115,7 +118,8 @@ namespace bgfx
/// - `BGFX_TEXTURE_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
/// sampling.
///
/// @returns Native API pointer to texture.
/// @returns Native API pointer to texture. If result is 0, texture is not created yet from the
/// main thread.
///
/// @warning Must be called only on render thread.
///

View File

@@ -47,7 +47,7 @@ BGFX_C_API void bgfx_set_platform_data(const bgfx_platform_data_t* _data);
typedef struct bgfx_internal_data
{
const struct bgfx_caps* caps;
const struct bgfx_caps* caps;
void* context;
} bgfx_internal_data_t;
@@ -56,7 +56,7 @@ typedef struct bgfx_internal_data
BGFX_C_API const bgfx_internal_data_t* bgfx_get_internal_data();
/**/
BGFX_C_API void bgfx_override_internal_texture_ptr(bgfx_texture_handle_t _handle, uintptr_t _ptr);
BGFX_C_API uintptr_t bgfx_override_internal_texture_ptr(bgfx_texture_handle_t _handle, uintptr_t _ptr);
/**/
BGFX_C_API uintptr_t bgfx_override_internal_texture(bgfx_texture_handle_t _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags);
@@ -67,8 +67,8 @@ typedef struct bgfx_interface_vtbl
bgfx_render_frame_t (*render_frame)();
void (*set_platform_data)(const bgfx_platform_data_t* _data);
const bgfx_internal_data_t* (*get_internal_data)();
void (*override_internal_texture_ptr)(bgfx_texture_handle_t _handle, uintptr_t _ptr);
uintptr_t (*override_internal_texture)(bgfx_texture_handle_t _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags);
uintptr_t (*override_internal_texture_ptr)(bgfx_texture_handle_t _handle, uintptr_t _ptr);
uintptr_t (*override_internal_texture)(bgfx_texture_handle_t _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags);
void (*vertex_decl_begin)(bgfx_vertex_decl_t* _decl, bgfx_renderer_type_t _renderer);
void (*vertex_decl_add)(bgfx_vertex_decl_t* _decl, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt);
void (*vertex_decl_skip)(bgfx_vertex_decl_t* _decl, uint8_t _num);