Renderer: Implement firstIndex on DrawIndexed command for OpenGL
This commit is contained in:
@@ -96,8 +96,10 @@ namespace Nz
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, DrawIndexedData>)
|
||||
{
|
||||
const UInt8* origin = 0; //< For an easy way to cast an integer to a pointer
|
||||
|
||||
ApplyStates(*context, command.states);
|
||||
context->glDrawElementsInstanced(ToOpenGL(command.states.pipeline->GetPipelineInfo().primitiveMode), command.indexCount, GL_UNSIGNED_SHORT, nullptr, command.instanceCount);
|
||||
context->glDrawElementsInstanced(ToOpenGL(command.states.pipeline->GetPipelineInfo().primitiveMode), command.indexCount, GL_UNSIGNED_SHORT, origin + command.firstIndex * sizeof(UInt16), command.instanceCount);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, EndDebugRegionData>)
|
||||
{
|
||||
|
||||
@@ -80,9 +80,9 @@ namespace Nz
|
||||
m_commandBuffer.Draw(vertexCount, instanceCount, firstVertex, firstInstance);
|
||||
}
|
||||
|
||||
void OpenGLCommandBufferBuilder::DrawIndexed(UInt32 indexCount, UInt32 instanceCount, UInt32 firstVertex, UInt32 firstInstance)
|
||||
void OpenGLCommandBufferBuilder::DrawIndexed(UInt32 indexCount, UInt32 instanceCount, UInt32 firstIndex, UInt32 firstInstance)
|
||||
{
|
||||
m_commandBuffer.DrawIndexed(indexCount, instanceCount, firstVertex, firstInstance);
|
||||
m_commandBuffer.DrawIndexed(indexCount, instanceCount, firstIndex, firstInstance);
|
||||
}
|
||||
|
||||
void OpenGLCommandBufferBuilder::EndDebugRegion()
|
||||
|
||||
@@ -131,9 +131,9 @@ namespace Nz
|
||||
m_commandBuffer.Draw(vertexCount, instanceCount, firstVertex, firstInstance);
|
||||
}
|
||||
|
||||
void VulkanCommandBufferBuilder::DrawIndexed(UInt32 indexCount, UInt32 instanceCount, UInt32 firstVertex, UInt32 firstInstance)
|
||||
void VulkanCommandBufferBuilder::DrawIndexed(UInt32 indexCount, UInt32 instanceCount, UInt32 firstIndex, UInt32 firstInstance)
|
||||
{
|
||||
m_commandBuffer.DrawIndexed(indexCount, instanceCount, firstVertex, 0, firstInstance);
|
||||
m_commandBuffer.DrawIndexed(indexCount, instanceCount, firstIndex, 0, firstInstance);
|
||||
}
|
||||
|
||||
void VulkanCommandBufferBuilder::EndDebugRegion()
|
||||
|
||||
Reference in New Issue
Block a user