mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- fix model rendering glitch
This commit is contained in:
parent
d413581ee2
commit
85b754b9ca
2 changed files with 9 additions and 4 deletions
|
@ -476,12 +476,16 @@ void VkRenderState::ApplyMatrices()
|
|||
|
||||
void VkRenderState::ApplyVertexBuffers()
|
||||
{
|
||||
if (mVertexBuffer != mLastVertexBuffer && mVertexBuffer)
|
||||
if ((mVertexBuffer != mLastVertexBuffer || mVertexOffsets[0] != mLastVertexOffsets[0] || mVertexOffsets[1] != mLastVertexOffsets[1]) && mVertexBuffer)
|
||||
{
|
||||
VkBuffer vertexBuffers[] = { static_cast<VKVertexBuffer*>(mVertexBuffer)->mBuffer->buffer };
|
||||
VkDeviceSize offsets[] = { 0 };
|
||||
mCommandBuffer->bindVertexBuffers(0, 1, vertexBuffers, offsets);
|
||||
auto vkbuf = static_cast<VKVertexBuffer*>(mVertexBuffer);
|
||||
const auto &format = GetVulkanFrameBuffer()->GetRenderPassManager()->VertexFormats[vkbuf->VertexFormat];
|
||||
VkBuffer vertexBuffers[2] = { vkbuf->mBuffer->buffer, vkbuf->mBuffer->buffer };
|
||||
VkDeviceSize offsets[] = { mVertexOffsets[0] * format.Stride, mVertexOffsets[1] * format.Stride };
|
||||
mCommandBuffer->bindVertexBuffers(0, 2, vertexBuffers, offsets);
|
||||
mLastVertexBuffer = mVertexBuffer;
|
||||
mLastVertexOffsets[0] = mVertexOffsets[0];
|
||||
mLastVertexOffsets[1] = mVertexOffsets[1];
|
||||
}
|
||||
|
||||
if (mIndexBuffer != mLastIndexBuffer && mIndexBuffer)
|
||||
|
|
|
@ -105,6 +105,7 @@ protected:
|
|||
|
||||
VSMatrix mIdentityMatrix;
|
||||
|
||||
int mLastVertexOffsets[2] = { 0, 0 };
|
||||
IVertexBuffer *mLastVertexBuffer = nullptr;
|
||||
IIndexBuffer *mLastIndexBuffer = nullptr;
|
||||
|
||||
|
|
Loading…
Reference in a new issue