mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 00:58:30 -05:00
Cleanup.
This commit is contained in:
parent
a1d50d6ea4
commit
524b28a9f7
4 changed files with 9 additions and 11 deletions
|
@ -692,7 +692,7 @@ namespace bgfx
|
|||
/// @param _mem Vertex buffer data.
|
||||
/// @param _decl Vertex declaration.
|
||||
///
|
||||
DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexDecl& _decl);
|
||||
DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint8_t _flags = BGFX_BUFFER_NONE);
|
||||
|
||||
/// Update dynamic vertex buffer.
|
||||
void updateDynamicVertexBuffer(DynamicVertexBufferHandle _handle, const Memory* _mem);
|
||||
|
|
|
@ -2144,19 +2144,19 @@ again:
|
|||
s_ctx->destroyDynamicIndexBuffer(_handle);
|
||||
}
|
||||
|
||||
DynamicVertexBufferHandle createDynamicVertexBuffer(uint16_t _num, const VertexDecl& _decl, uint8_t _compute)
|
||||
DynamicVertexBufferHandle createDynamicVertexBuffer(uint16_t _num, const VertexDecl& _decl, uint8_t _flags)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
BX_CHECK(0 != _decl.m_stride, "Invalid VertexDecl.");
|
||||
return s_ctx->createDynamicVertexBuffer(_num, _decl, _compute);
|
||||
return s_ctx->createDynamicVertexBuffer(_num, _decl, _flags);
|
||||
}
|
||||
|
||||
DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexDecl& _decl)
|
||||
DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint8_t _flags)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
BX_CHECK(NULL != _mem, "_mem can't be NULL");
|
||||
BX_CHECK(0 != _decl.m_stride, "Invalid VertexDecl.");
|
||||
return s_ctx->createDynamicVertexBuffer(_mem, _decl);
|
||||
return s_ctx->createDynamicVertexBuffer(_mem, _decl, _flags);
|
||||
}
|
||||
|
||||
void updateDynamicVertexBuffer(DynamicVertexBufferHandle _handle, const Memory* _mem)
|
||||
|
|
|
@ -2222,11 +2222,11 @@ namespace bgfx
|
|||
return handle;
|
||||
}
|
||||
|
||||
BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexDecl& _decl) )
|
||||
BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint8_t _flags) )
|
||||
{
|
||||
uint32_t numVertices = _mem->size/_decl.m_stride;
|
||||
BX_CHECK(numVertices <= UINT16_MAX, "Num vertices exceeds maximum (num %d, max %d).", numVertices, UINT16_MAX);
|
||||
DynamicVertexBufferHandle handle = createDynamicVertexBuffer(uint16_t(numVertices), _decl, BGFX_BUFFER_NONE);
|
||||
DynamicVertexBufferHandle handle = createDynamicVertexBuffer(uint16_t(numVertices), _decl, _flags);
|
||||
if (isValid(handle) )
|
||||
{
|
||||
updateDynamicVertexBuffer(handle, _mem);
|
||||
|
|
|
@ -2364,10 +2364,8 @@ namespace bgfx
|
|||
BX_CHECK(m_dynamic, "Must be dynamic!");
|
||||
|
||||
D3D11_MAPPED_SUBRESOURCE mapped;
|
||||
D3D11_MAP type = m_dynamic && ( (0 == _offset && m_size == _size) || _discard)
|
||||
? D3D11_MAP_WRITE_DISCARD
|
||||
: D3D11_MAP_WRITE_NO_OVERWRITE
|
||||
;
|
||||
BX_UNUSED(_discard);
|
||||
D3D11_MAP type = D3D11_MAP_WRITE_DISCARD;
|
||||
DX_CHECK(deviceCtx->Map(m_ptr, 0, type, 0, &mapped));
|
||||
memcpy((uint8_t*)mapped.pData + _offset, _data, _size);
|
||||
deviceCtx->Unmap(m_ptr, 0);
|
||||
|
|
Loading…
Reference in a new issue