Replaced checkAvail* with getAvail* API.

This commit is contained in:
Branimir Karadžić
2016-12-22 16:18:44 -08:00
parent 0d93dd074d
commit 07aae82d16
19 changed files with 86 additions and 101 deletions

View File

@@ -148,7 +148,7 @@ struct BgfxCallback : public bgfx::CallbackI
bx::Error err;
if (bx::open(reader, filePath, &err) )
{
uint32_t size = bx::getSize(reader);
uint32_t size = (uint32_t)bx::getSize(reader);
bx::close(reader);
// Return size of shader file.
return size;

View File

@@ -36,7 +36,7 @@ bgfx::VertexDecl PosColorTexCoord0Vertex::ms_decl;
void screenSpaceQuad(float _textureWidth, float _textureHeight, bool _originBottomLeft = false, float _width = 1.0f, float _height = 1.0f)
{
if (bgfx::checkAvailTransientVertexBuffer(3, PosColorTexCoord0Vertex::ms_decl) )
if (3 == bgfx::getAvailTransientVertexBuffer(3, PosColorTexCoord0Vertex::ms_decl) )
{
bgfx::TransientVertexBuffer vb;
bgfx::allocTransientVertexBuffer(&vb, 3, PosColorTexCoord0Vertex::ms_decl);

View File

@@ -1057,7 +1057,7 @@ bgfx::VertexDecl PosColorTexCoord0Vertex::ms_decl;
void screenSpaceQuad(float _textureWidth, float _textureHeight, bool _originBottomLeft = true, float _width = 1.0f, float _height = 1.0f)
{
if (bgfx::checkAvailTransientVertexBuffer(3, PosColorTexCoord0Vertex::ms_decl) )
if (3 == bgfx::getAvailTransientVertexBuffer(3, PosColorTexCoord0Vertex::ms_decl) )
{
bgfx::TransientVertexBuffer vb;
bgfx::allocTransientVertexBuffer(&vb, 3, PosColorTexCoord0Vertex::ms_decl);
@@ -2691,7 +2691,7 @@ int _main_(int _argc, char** _argv)
// Craft stencil mask for point light shadow map packing.
if(LightType::PointLight == settings.m_lightType && settings.m_stencilPack)
{
if (bgfx::checkAvailTransientVertexBuffer(6, posDecl) )
if (6 == bgfx::getAvailTransientVertexBuffer(6, posDecl) )
{
struct Pos
{

View File

@@ -89,7 +89,7 @@ bgfx::VertexDecl PosColorTexCoord0Vertex::ms_decl;
void screenSpaceQuad(float _textureWidth, float _textureHeight, bool _originBottomLeft = false, float _width = 1.0f, float _height = 1.0f)
{
if (bgfx::checkAvailTransientVertexBuffer(3, PosColorTexCoord0Vertex::ms_decl) )
if (3 == bgfx::getAvailTransientVertexBuffer(3, PosColorTexCoord0Vertex::ms_decl) )
{
bgfx::TransientVertexBuffer vb;
bgfx::allocTransientVertexBuffer(&vb, 3, PosColorTexCoord0Vertex::ms_decl);

View File

@@ -90,7 +90,7 @@ inline void mtxProj(float* _result, float _fovy, float _aspect, float _near, flo
void screenSpaceQuad(float _textureWidth, float _textureHeight, bool _originBottomLeft = false, float _width = 1.0f, float _height = 1.0f)
{
if (bgfx::checkAvailTransientVertexBuffer(3, PosColorTexCoord0Vertex::ms_decl) )
if (3 == bgfx::getAvailTransientVertexBuffer(3, PosColorTexCoord0Vertex::ms_decl) )
{
bgfx::TransientVertexBuffer vb;
bgfx::allocTransientVertexBuffer(&vb, 3, PosColorTexCoord0Vertex::ms_decl);

View File

@@ -159,7 +159,7 @@ static const uint16_t s_cubeIndices[36] =
void screenSpaceQuad(float _textureWidth, float _textureHeight, float _texelHalf, bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f)
{
if (bgfx::checkAvailTransientVertexBuffer(3, PosTexCoord0Vertex::ms_decl) )
if (3 == bgfx::getAvailTransientVertexBuffer(3, PosTexCoord0Vertex::ms_decl) )
{
bgfx::TransientVertexBuffer vb;
bgfx::allocTransientVertexBuffer(&vb, 3, PosTexCoord0Vertex::ms_decl);

View File

@@ -741,7 +741,7 @@ void VectorDisplay::getSize(float* _outWidth, float* _outHeight)
void VectorDisplay::screenSpaceQuad(float _textureWidth, float _textureHeight, float _width, float _height)
{
if (bgfx::checkAvailTransientVertexBuffer(3, PosColorUvVertex::ms_decl) )
if (3 == getAvailTransientVertexBuffer(3, PosColorUvVertex::ms_decl) )
{
bgfx::TransientVertexBuffer vb;
bgfx::allocTransientVertexBuffer(&vb, 3, PosColorUvVertex::ms_decl);

View File

@@ -127,7 +127,7 @@ bgfx::VertexDecl PosTexCoord0Vertex::ms_decl;
// Utility function to draw a screen space quad for deferred rendering
void screenSpaceQuad(float _textureWidth, float _textureHeight, float _texelHalf, bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f)
{
if (bgfx::checkAvailTransientVertexBuffer(3, PosTexCoord0Vertex::ms_decl) )
if (3 == bgfx::getAvailTransientVertexBuffer(3, PosTexCoord0Vertex::ms_decl) )
{
bgfx::TransientVertexBuffer vb;
bgfx::allocTransientVertexBuffer(&vb, 3, PosTexCoord0Vertex::ms_decl);

View File

@@ -15,6 +15,20 @@ bgfx::ProgramHandle loadProgram(const char* _vsName, const char* _fsName);
bgfx::TextureHandle loadTexture(const char* _name, uint32_t _flags = BGFX_TEXTURE_NONE, uint8_t _skip = 0, bgfx::TextureInfo* _info = NULL);
void calcTangents(void* _vertices, uint16_t _numVertices, bgfx::VertexDecl _decl, const uint16_t* _indices, uint32_t _numIndices);
/// Returns true if both internal transient index and vertex buffer have
/// enough space.
///
/// @param[in] _numVertices Number of vertices.
/// @param[in] _decl Vertex declaration.
/// @param[in] _numIndices Number of indices.
///
inline bool checkAvailTransientBuffers(uint32_t _numVertices, const bgfx::VertexDecl& _decl, uint32_t _numIndices)
{
return _numVertices == bgfx::getAvailTransientVertexBuffer(_numVertices, _decl)
&& _numIndices == bgfx::getAvailTransientIndexBuffer(_numIndices)
;
}
struct MeshState
{
struct Texture

View File

@@ -6,6 +6,7 @@
#include <bgfx/bgfx.h>
#include <bgfx/embedded_shader.h>
#include "debugdraw.h"
#include "../bgfx_utils.h"
#include "../packrect.h"
#include <bx/fpumath.h>
@@ -1838,7 +1839,7 @@ private:
{
if (0 != m_pos)
{
if (bgfx::checkAvailTransientBuffers(m_pos, DebugVertex::ms_decl, m_indexPos) )
if (checkAvailTransientBuffers(m_pos, DebugVertex::ms_decl, m_indexPos) )
{
bgfx::TransientVertexBuffer tvb;
bgfx::allocTransientVertexBuffer(&tvb, m_pos, DebugVertex::ms_decl);
@@ -1876,7 +1877,7 @@ private:
if (0 != m_posQuad)
{
const uint32_t numIndices = m_posQuad/4*6;
if (bgfx::checkAvailTransientBuffers(m_posQuad, DebugUvVertex::ms_decl, numIndices) )
if (checkAvailTransientBuffers(m_posQuad, DebugUvVertex::ms_decl, numIndices) )
{
bgfx::TransientVertexBuffer tvb;
bgfx::allocTransientVertexBuffer(&tvb, m_posQuad, DebugUvVertex::ms_decl);

View File

@@ -32,6 +32,7 @@
#include "imgui.h"
#include "ocornut_imgui.h"
#include "../bgfx_utils.h"
#include "../nanovg/nanovg.h"
#include <bgfx/embedded_shader.h>
@@ -1800,7 +1801,7 @@ struct Imgui
const uint32_t numVertices = 14;
const uint32_t numIndices = 36;
if (bgfx::checkAvailTransientBuffers(numVertices, PosNormalVertex::ms_decl, numIndices) )
if (checkAvailTransientBuffers(numVertices, PosNormalVertex::ms_decl, numIndices) )
{
bgfx::TransientVertexBuffer tvb;
bgfx::allocTransientVertexBuffer(&tvb, numVertices, PosNormalVertex::ms_decl);
@@ -2335,7 +2336,7 @@ struct Imgui
}
uint32_t numVertices = _numCoords*6 + (_numCoords-2)*3;
if (bgfx::checkAvailTransientVertexBuffer(numVertices, PosColorVertex::ms_decl) )
if (numVertices == bgfx::getAvailTransientVertexBuffer(numVertices, PosColorVertex::ms_decl) )
{
bgfx::TransientVertexBuffer tvb;
bgfx::allocTransientVertexBuffer(&tvb, numVertices, PosColorVertex::ms_decl);
@@ -2622,7 +2623,7 @@ struct Imgui
getTextLength(m_fonts[m_currentFontIdx].m_cdata, _text, numVertices);
}
if (bgfx::checkAvailTransientVertexBuffer(numVertices, PosColorUvVertex::ms_decl) )
if (numVertices == bgfx::getAvailTransientVertexBuffer(numVertices, PosColorUvVertex::ms_decl) )
{
bgfx::TransientVertexBuffer tvb;
bgfx::allocTransientVertexBuffer(&tvb, numVertices, PosColorUvVertex::ms_decl);
@@ -2712,7 +2713,7 @@ struct Imgui
bool screenQuad(int32_t _x, int32_t _y, int32_t _width, uint32_t _height, bool _originBottomLeft = false)
{
if (bgfx::checkAvailTransientVertexBuffer(6, PosUvVertex::ms_decl) )
if (6 == bgfx::getAvailTransientVertexBuffer(6, PosUvVertex::ms_decl) )
{
bgfx::TransientVertexBuffer vb;
bgfx::allocTransientVertexBuffer(&vb, 6, PosUvVertex::ms_decl);

View File

@@ -11,6 +11,7 @@
#include <ocornut-imgui/imgui.h>
#include "imgui.h"
#include "ocornut_imgui.h"
#include "../bgfx_utils.h"
#ifndef USE_ENTRY
# if defined(SCI_NAMESPACE)
@@ -86,8 +87,7 @@ struct OcornutImguiContext
uint32_t numVertices = (uint32_t)drawList->VtxBuffer.size();
uint32_t numIndices = (uint32_t)drawList->IdxBuffer.size();
if (!bgfx::checkAvailTransientVertexBuffer(numVertices, m_decl)
|| !bgfx::checkAvailTransientIndexBuffer(numIndices) )
if (!checkAvailTransientBuffers(numVertices, m_decl, numIndices) )
{
// not enough space in transient buffer just quit drawing the rest...
break;

View File

@@ -1391,46 +1391,31 @@ namespace bgfx
///
void destroyDynamicVertexBuffer(DynamicVertexBufferHandle _handle);
/// Returns true if internal transient index buffer has enough space.
/// Returns number of available indices.
///
/// @param[in] _num Number of indices.
/// @param[in] _num Number of required indices.
///
/// @attention C99 equivalent is `bgfx_check_avail_transient_index_buffer`.
/// @attention C99 equivalent is `bgfx_get_avail_transient_index_buffer`.
///
bool checkAvailTransientIndexBuffer(uint32_t _num);
uint32_t getAvailTransientIndexBuffer(uint32_t _num);
/// Returns true if internal transient vertex buffer has enough space.
/// Returns number of available vertices.
///
/// @param[in] _num Number of vertices.
/// @param[in] _num Number of required vertices.
/// @param[in] _decl Vertex declaration.
///
/// @attention C99 equivalent is `bgfx_check_avail_transient_vertex_buffer`.
///
bool checkAvailTransientVertexBuffer(uint32_t _num, const VertexDecl& _decl);
uint32_t getAvailTransientVertexBuffer(uint32_t _num, const VertexDecl& _decl);
/// Returns true if internal instance data buffer has enough space.
/// Returns number of available instance buffer slots.
///
/// @param[in] _num Number of instances.
/// @param[in] _num Number of required instances.
/// @param[in] _stride Stride per instance.
///
/// @attention C99 equivalent is `bgfx_check_avail_instance_data_buffer`.
///
bool checkAvailInstanceDataBuffer(uint32_t _num, uint16_t _stride);
/// Returns true if both internal transient index and vertex buffer have
/// enough space.
///
/// @param[in] _numVertices Number of vertices.
/// @param[in] _decl Vertex declaration.
/// @param[in] _numIndices Number of indices.
///
/// @attention C99 equivalent is `bgfx_check_avail_transient_buffers`.
///
bool checkAvailTransientBuffers(
uint32_t _numVertices
, const VertexDecl& _decl
, uint32_t _numIndices
);
uint32_t getAvailInstanceDataBuffer(uint32_t _num, uint16_t _stride);
/// Allocate transient index buffer.
///

View File

@@ -648,16 +648,13 @@ BGFX_C_API void bgfx_update_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_han
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 uint32_t bgfx_get_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 uint32_t bgfx_get_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 uint32_t bgfx_get_avail_instance_data_buffer(uint32_t _num, uint16_t _stride);
/**/
BGFX_C_API void bgfx_alloc_transient_index_buffer(bgfx_transient_index_buffer_t* _tib, uint32_t _num);

View File

@@ -113,10 +113,9 @@ typedef struct bgfx_interface_vtbl
bgfx_dynamic_vertex_buffer_handle_t (*create_dynamic_vertex_buffer_mem)(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl, uint16_t _flags);
void (*update_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, const bgfx_memory_t* _mem);
void (*destroy_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle);
bool (*check_avail_transient_index_buffer)(uint32_t _num);
bool (*check_avail_transient_vertex_buffer)(uint32_t _num, const bgfx_vertex_decl_t* _decl);
bool (*check_avail_instance_data_buffer)(uint32_t _num, uint16_t _stride);
bool (*check_avail_transient_buffers)(uint32_t _numVertices, const bgfx_vertex_decl_t* _decl, uint32_t _numIndices);
uint32_t (*get_avail_transient_index_buffer)(uint32_t _num);
uint32_t (*get_avail_transient_vertex_buffer)(uint32_t _num, const bgfx_vertex_decl_t* _decl);
uint32_t (*get_avail_instance_data_buffer)(uint32_t _num, uint16_t _stride);
void (*alloc_transient_index_buffer)(bgfx_transient_index_buffer_t* _tib, uint32_t _num);
void (*alloc_transient_vertex_buffer)(bgfx_transient_vertex_buffer_t* _tvb, uint32_t _num, const bgfx_vertex_decl_t* _decl);
bool (*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);

View File

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

View File

@@ -2862,34 +2862,26 @@ error:
s_ctx->destroyDynamicVertexBuffer(_handle);
}
bool checkAvailTransientIndexBuffer(uint32_t _num)
uint32_t getAvailTransientIndexBuffer(uint32_t _num)
{
BGFX_CHECK_MAIN_THREAD();
BX_CHECK(0 < _num, "Requesting 0 indices.");
return s_ctx->checkAvailTransientIndexBuffer(_num);
return s_ctx->getAvailTransientIndexBuffer(_num);
}
bool checkAvailTransientVertexBuffer(uint32_t _num, const VertexDecl& _decl)
uint32_t getAvailTransientVertexBuffer(uint32_t _num, const VertexDecl& _decl)
{
BGFX_CHECK_MAIN_THREAD();
BX_CHECK(0 < _num, "Requesting 0 vertices.");
BX_CHECK(0 != _decl.m_stride, "Invalid VertexDecl.");
return s_ctx->checkAvailTransientVertexBuffer(_num, _decl.m_stride);
return s_ctx->getAvailTransientVertexBuffer(_num, _decl.m_stride);
}
bool checkAvailInstanceDataBuffer(uint32_t _num, uint16_t _stride)
uint32_t getAvailInstanceDataBuffer(uint32_t _num, uint16_t _stride)
{
BGFX_CHECK_MAIN_THREAD();
BX_CHECK(0 < _num, "Requesting 0 instances.");
return s_ctx->checkAvailTransientVertexBuffer(_num, _stride);
}
bool checkAvailTransientBuffers(uint32_t _numVertices, const VertexDecl& _decl, uint32_t _numIndices)
{
BX_CHECK(0 != _decl.m_stride, "Invalid VertexDecl.");
return checkAvailTransientVertexBuffer(_numVertices, _decl)
&& checkAvailTransientIndexBuffer(_numIndices)
;
return s_ctx->getAvailTransientVertexBuffer(_num, _stride);
}
void allocTransientIndexBuffer(TransientIndexBuffer* _tib, uint32_t _num)
@@ -2920,7 +2912,8 @@ error:
bool allocTransientBuffers(bgfx::TransientVertexBuffer* _tvb, const bgfx::VertexDecl& _decl, uint32_t _numVertices, bgfx::TransientIndexBuffer* _tib, uint32_t _numIndices)
{
if (checkAvailTransientBuffers(_numVertices, _decl, _numIndices) )
if (_numVertices == getAvailTransientVertexBuffer(_numVertices, _decl)
&& _numIndices == getAvailTransientIndexBuffer(_numIndices) )
{
allocTransientVertexBuffer(_tvb, _numVertices, _decl);
allocTransientIndexBuffer(_tib, _numIndices);
@@ -4274,26 +4267,20 @@ BGFX_C_API void bgfx_destroy_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_ha
bgfx::destroyDynamicVertexBuffer(handle.cpp);
}
BGFX_C_API bool bgfx_check_avail_transient_index_buffer(uint32_t _num)
BGFX_C_API uint32_t bgfx_get_avail_transient_index_buffer(uint32_t _num)
{
return bgfx::checkAvailTransientIndexBuffer(_num);
return bgfx::getAvailTransientIndexBuffer(_num);
}
BGFX_C_API bool bgfx_check_avail_transient_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t* _decl)
BGFX_C_API uint32_t bgfx_get_avail_transient_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t* _decl)
{
const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl;
return bgfx::checkAvailTransientVertexBuffer(_num, decl);
return bgfx::getAvailTransientVertexBuffer(_num, decl);
}
BGFX_C_API bool bgfx_check_avail_instance_data_buffer(uint32_t _num, uint16_t _stride)
BGFX_C_API uint32_t bgfx_get_avail_instance_data_buffer(uint32_t _num, uint16_t _stride)
{
return bgfx::checkAvailInstanceDataBuffer(_num, _stride);
}
BGFX_C_API bool bgfx_check_avail_transient_buffers(uint32_t _numVertices, const bgfx_vertex_decl_t* _decl, uint32_t _numIndices)
{
const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl;
return bgfx::checkAvailTransientBuffers(_numVertices, decl, _numIndices);
return bgfx::getAvailInstanceDataBuffer(_num, _stride);
}
BGFX_C_API void bgfx_alloc_transient_index_buffer(bgfx_transient_index_buffer_t* _tib, uint32_t _num)
@@ -4886,10 +4873,9 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
BGFX_IMPORT_FUNC(create_dynamic_vertex_buffer_mem) \
BGFX_IMPORT_FUNC(update_dynamic_vertex_buffer) \
BGFX_IMPORT_FUNC(destroy_dynamic_vertex_buffer) \
BGFX_IMPORT_FUNC(check_avail_transient_index_buffer) \
BGFX_IMPORT_FUNC(check_avail_transient_vertex_buffer) \
BGFX_IMPORT_FUNC(check_avail_instance_data_buffer) \
BGFX_IMPORT_FUNC(check_avail_transient_buffers) \
BGFX_IMPORT_FUNC(get_avail_transient_index_buffer) \
BGFX_IMPORT_FUNC(get_avail_transient_vertex_buffer) \
BGFX_IMPORT_FUNC(get_avail_instance_data_buffer) \
BGFX_IMPORT_FUNC(alloc_transient_index_buffer) \
BGFX_IMPORT_FUNC(alloc_transient_vertex_buffer) \
BGFX_IMPORT_FUNC(alloc_transient_buffers) \

View File

@@ -1701,39 +1701,41 @@ namespace bgfx
void sort();
bool checkAvailTransientIndexBuffer(uint32_t _num)
uint32_t getAvailTransientIndexBuffer(uint32_t _num)
{
uint32_t offset = m_iboffset;
uint32_t offset = bx::strideAlign(m_iboffset, sizeof(uint16_t) );
uint32_t iboffset = offset + _num*sizeof(uint16_t);
iboffset = bx::uint32_min(iboffset, BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE);
uint32_t num = (iboffset-offset)/sizeof(uint16_t);
return num == _num;
return num;
}
uint32_t allocTransientIndexBuffer(uint32_t& _num)
{
uint32_t offset = bx::strideAlign(m_iboffset, sizeof(uint16_t) );
m_iboffset = offset + _num*sizeof(uint16_t);
m_iboffset = bx::uint32_min(m_iboffset, BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE);
_num = (m_iboffset-offset)/sizeof(uint16_t);
uint32_t num = getAvailTransientIndexBuffer(_num);
m_iboffset = offset + num*sizeof(uint16_t);
_num = num;
return offset;
}
bool checkAvailTransientVertexBuffer(uint32_t _num, uint16_t _stride)
uint32_t getAvailTransientVertexBuffer(uint32_t _num, uint16_t _stride)
{
uint32_t offset = bx::strideAlign(m_vboffset, _stride);
uint32_t offset = bx::strideAlign(m_vboffset, _stride);
uint32_t vboffset = offset + _num * _stride;
vboffset = bx::uint32_min(vboffset, BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE);
uint32_t num = (vboffset-offset)/_stride;
return num == _num;
return num;
}
uint32_t allocTransientVertexBuffer(uint32_t& _num, uint16_t _stride)
{
uint32_t offset = bx::strideAlign(m_vboffset, _stride);
m_vboffset = offset + _num * _stride;
m_vboffset = bx::uint32_min(m_vboffset, BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE);
_num = (m_vboffset-offset)/_stride;
uint32_t num = getAvailTransientVertexBuffer(_num, _stride);
m_vboffset = offset + num * _stride;
_num = num;
return offset;
}
@@ -2689,14 +2691,14 @@ namespace bgfx
m_dynamicVertexBufferHandle.free(_handle.idx);
}
BGFX_API_FUNC(bool checkAvailTransientIndexBuffer(uint32_t _num) const)
BGFX_API_FUNC(uint32_t getAvailTransientIndexBuffer(uint32_t _num) const)
{
return m_submit->checkAvailTransientIndexBuffer(_num);
return m_submit->getAvailTransientIndexBuffer(_num);
}
BGFX_API_FUNC(bool checkAvailTransientVertexBuffer(uint32_t _num, uint16_t _stride) const)
BGFX_API_FUNC(uint32_t getAvailTransientVertexBuffer(uint32_t _num, uint16_t _stride) const)
{
return m_submit->checkAvailTransientVertexBuffer(_num, _stride);
return m_submit->getAvailTransientVertexBuffer(_num, _stride);
}
TransientIndexBuffer* createTransientIndexBuffer(uint32_t _size)

View File

@@ -384,7 +384,7 @@ bgfx::VertexDecl PosUvColorVertex::ms_decl;
bool screenQuad(int32_t _x, int32_t _y, int32_t _width, uint32_t _height, uint32_t _abgr, bool _originBottomLeft = false)
{
if (bgfx::checkAvailTransientVertexBuffer(6, PosUvColorVertex::ms_decl) )
if (6 == bgfx::getAvailTransientVertexBuffer(6, PosUvColorVertex::ms_decl) )
{
bgfx::TransientVertexBuffer vb;
bgfx::allocTransientVertexBuffer(&vb, 6, PosUvColorVertex::ms_decl);