From 524b28a9f7c4ba76e66566db82a063d4121f4374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Fri, 30 Jan 2015 10:31:50 -0800 Subject: [PATCH] Cleanup. --- include/bgfx.h | 2 +- src/bgfx.cpp | 8 ++++---- src/bgfx_p.h | 4 ++-- src/renderer_d3d11.cpp | 6 ++---- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/bgfx.h b/include/bgfx.h index 8d3f5fdc..c81a51e0 100644 --- a/include/bgfx.h +++ b/include/bgfx.h @@ -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); diff --git a/src/bgfx.cpp b/src/bgfx.cpp index ea0de73a..f254ac7b 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -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) diff --git a/src/bgfx_p.h b/src/bgfx_p.h index b929c567..00bbf9e8 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -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); diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index dde20bc7..78fe4927 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -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);