mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-13 07:57:51 +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()
|
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 };
|
auto vkbuf = static_cast<VKVertexBuffer*>(mVertexBuffer);
|
||||||
VkDeviceSize offsets[] = { 0 };
|
const auto &format = GetVulkanFrameBuffer()->GetRenderPassManager()->VertexFormats[vkbuf->VertexFormat];
|
||||||
mCommandBuffer->bindVertexBuffers(0, 1, vertexBuffers, offsets);
|
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;
|
mLastVertexBuffer = mVertexBuffer;
|
||||||
|
mLastVertexOffsets[0] = mVertexOffsets[0];
|
||||||
|
mLastVertexOffsets[1] = mVertexOffsets[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mIndexBuffer != mLastIndexBuffer && mIndexBuffer)
|
if (mIndexBuffer != mLastIndexBuffer && mIndexBuffer)
|
||||||
|
|
|
@ -105,6 +105,7 @@ protected:
|
||||||
|
|
||||||
VSMatrix mIdentityMatrix;
|
VSMatrix mIdentityMatrix;
|
||||||
|
|
||||||
|
int mLastVertexOffsets[2] = { 0, 0 };
|
||||||
IVertexBuffer *mLastVertexBuffer = nullptr;
|
IVertexBuffer *mLastVertexBuffer = nullptr;
|
||||||
IIndexBuffer *mLastIndexBuffer = nullptr;
|
IIndexBuffer *mLastIndexBuffer = nullptr;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue