ensure buffer is 16-byte aligned (#826)
This commit is contained in:
parent
3feceda054
commit
5a3672e7a2
10
src/bgfx_p.h
10
src/bgfx_p.h
@ -2627,8 +2627,9 @@ namespace bgfx
|
|||||||
uint16_t flags = BGFX_BUFFER_NONE;
|
uint16_t flags = BGFX_BUFFER_NONE;
|
||||||
cmdbuf.write(flags);
|
cmdbuf.write(flags);
|
||||||
|
|
||||||
tib = (TransientIndexBuffer*)BX_ALLOC(g_allocator, sizeof(TransientIndexBuffer)+_size);
|
size_t size = BX_ALIGN_16(sizeof(TransientIndexBuffer)) + BX_ALIGN_16(_size);
|
||||||
tib->data = (uint8_t*)&tib[1];
|
tib = (TransientIndexBuffer*)BX_ALIGNED_ALLOC(g_allocator, size, 16);
|
||||||
|
tib->data = (uint8_t *)((size_t)tib + BX_ALIGN_16(sizeof(TransientIndexBuffer)));
|
||||||
tib->size = _size;
|
tib->size = _size;
|
||||||
tib->handle = handle;
|
tib->handle = handle;
|
||||||
}
|
}
|
||||||
@ -2683,8 +2684,9 @@ namespace bgfx
|
|||||||
uint16_t flags = BGFX_BUFFER_NONE;
|
uint16_t flags = BGFX_BUFFER_NONE;
|
||||||
cmdbuf.write(flags);
|
cmdbuf.write(flags);
|
||||||
|
|
||||||
tvb = (TransientVertexBuffer*)BX_ALLOC(g_allocator, sizeof(TransientVertexBuffer)+_size);
|
size_t size = BX_ALIGN_16(sizeof(TransientVertexBuffer)) + BX_ALIGN_16(_size);
|
||||||
tvb->data = (uint8_t*)&tvb[1];
|
tvb = (TransientVertexBuffer*)BX_ALIGNED_ALLOC(g_allocator, size, 16);
|
||||||
|
tvb->data = (uint8_t *)((size_t)tvb + BX_ALIGN_16(sizeof(TransientVertexBuffer)));
|
||||||
tvb->size = _size;
|
tvb->size = _size;
|
||||||
tvb->startVertex = 0;
|
tvb->startVertex = 0;
|
||||||
tvb->stride = stride;
|
tvb->stride = stride;
|
||||||
|
Loading…
Reference in New Issue
Block a user