mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
Updating C99 API to support scaled textures.
This commit is contained in:
parent
36ca5cbd18
commit
9677f4a37c
2 changed files with 44 additions and 0 deletions
|
@ -150,6 +150,17 @@ typedef enum bgfx_uniform_type
|
|||
|
||||
} bgfx_uniform_type_t;
|
||||
|
||||
typedef enum bgfx_backbuffer_ratio
|
||||
{
|
||||
BGFX_BACKBUFFER_RATIO_NONE,
|
||||
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_t;
|
||||
|
||||
#define BGFX_HANDLE_T(_name) \
|
||||
typedef struct _name { uint16_t idx; } _name##_t;
|
||||
|
||||
|
@ -935,6 +946,16 @@ BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t* _mem,
|
|||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* Create 2D texture that scales with backbuffer size.
|
||||
*
|
||||
* @param _ratio
|
||||
* @param _numMips
|
||||
* @param _format
|
||||
* @param _flags
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* Create 3D texture.
|
||||
*
|
||||
|
@ -1039,6 +1060,15 @@ 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);
|
||||
|
||||
/**
|
||||
* Create frame buffer that scales with backbuffer size.
|
||||
*
|
||||
* @param _ratio Backbuffer ratio.
|
||||
* @param _format Texture format.
|
||||
* @param _textureFlags Texture flags.
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* Create frame buffer.
|
||||
*
|
||||
|
|
14
src/bgfx.cpp
14
src/bgfx.cpp
|
@ -3343,6 +3343,13 @@ BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_
|
|||
return handle.c;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle;
|
||||
handle.cpp = bgfx::createTexture2D(bgfx::BackbufferRatio::Enum(_ratio), _numMips, bgfx::TextureFormat::Enum(_format), _flags);
|
||||
return handle.c;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle;
|
||||
|
@ -3388,6 +3395,13 @@ BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(uint16_t _width,
|
|||
return handle.c;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle;
|
||||
handle.cpp = bgfx::createFrameBuffer(bgfx::BackbufferRatio::Enum(_ratio), bgfx::TextureFormat::Enum(_format), _textureFlags);
|
||||
return handle.c;
|
||||
}
|
||||
|
||||
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(uint8_t _num, bgfx_texture_handle_t* _handles, bool _destroyTextures)
|
||||
{
|
||||
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle;
|
||||
|
|
Loading…
Reference in a new issue