mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-10-25 10:20:52 +00:00
This commit is contained in:
@@ -4100,6 +4100,12 @@ namespace bgfx
|
||||
BGFX_CHECK_HANDLE("setVertexBuffer", s_ctx->m_dynamicVertexBufferHandle, _handle);
|
||||
BGFX_CHECK_HANDLE_INVALID_OK("setVertexBuffer", s_ctx->m_layoutHandle, _layoutHandle);
|
||||
const DynamicVertexBuffer& dvb = s_ctx->m_dynamicVertexBuffers[_handle.idx];
|
||||
BX_ASSERT(!isValid(_layoutHandle)
|
||||
|| s_ctx->m_vertexLayoutRef.m_stride[_layoutHandle.idx] == dvb.m_stride
|
||||
, "Vertex layout override stride (%d) must match dynamic vertex buffer layout stride (%d)."
|
||||
, s_ctx->m_vertexLayoutRef.m_stride[_layoutHandle.idx]
|
||||
, dvb.m_stride
|
||||
);
|
||||
BGFX_ENCODER(setVertexBuffer(_stream, dvb, _startVertex, _numVertices, _layoutHandle) );
|
||||
}
|
||||
|
||||
@@ -4119,6 +4125,12 @@ namespace bgfx
|
||||
BX_ASSERT(NULL != _tvb, "_tvb can't be NULL");
|
||||
BGFX_CHECK_HANDLE("setVertexBuffer", s_ctx->m_vertexBufferHandle, _tvb->handle);
|
||||
BGFX_CHECK_HANDLE_INVALID_OK("setVertexBuffer", s_ctx->m_layoutHandle, _layoutHandle);
|
||||
BX_ASSERT(!isValid(_layoutHandle)
|
||||
|| s_ctx->m_vertexLayoutRef.m_stride[_layoutHandle.idx] == _tvb->stride
|
||||
, "Vertex layout override stride (%d) must match transient vertex buffer stride (%d)."
|
||||
, s_ctx->m_vertexLayoutRef.m_stride[_layoutHandle.idx]
|
||||
, _tvb->stride
|
||||
);
|
||||
BGFX_ENCODER(setVertexBuffer(_stream, _tvb, _startVertex, _numVertices, _layoutHandle) );
|
||||
}
|
||||
|
||||
|
||||
@@ -3249,6 +3249,7 @@ namespace bgfx
|
||||
void init()
|
||||
{
|
||||
bx::memSet(m_refCount, 0, sizeof(m_refCount) );
|
||||
bx::memSet(m_stride, 0, sizeof(m_stride) );
|
||||
bx::memSet(m_vertexBufferRef, 0xff, sizeof(m_vertexBufferRef) );
|
||||
bx::memSet(m_dynamicVertexBufferRef, 0xff, sizeof(m_dynamicVertexBufferRef) );
|
||||
}
|
||||
@@ -3333,6 +3334,7 @@ namespace bgfx
|
||||
VertexLayoutMap m_vertexLayoutMap;
|
||||
|
||||
uint16_t m_refCount[BGFX_CONFIG_MAX_VERTEX_LAYOUTS];
|
||||
uint16_t m_stride[BGFX_CONFIG_MAX_VERTEX_LAYOUTS];
|
||||
VertexLayoutHandle m_vertexBufferRef[BGFX_CONFIG_MAX_VERTEX_BUFFERS];
|
||||
VertexLayoutHandle m_dynamicVertexBufferRef[BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS];
|
||||
};
|
||||
@@ -4150,6 +4152,8 @@ namespace bgfx
|
||||
return BGFX_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
m_vertexLayoutRef.m_stride[layoutHandle.idx] = _layout.m_stride;
|
||||
|
||||
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateVertexLayout);
|
||||
cmdbuf.write(layoutHandle);
|
||||
cmdbuf.write(_layout);
|
||||
|
||||
Reference in New Issue
Block a user