Skip to content

Instantly share code, notes, and snippets.

@sherjilozair
Created June 12, 2019 22:06
Show Gist options
  • Save sherjilozair/ab836185580ef4e7a685da429b672414 to your computer and use it in GitHub Desktop.
Save sherjilozair/ab836185580ef4e7a685da429b672414 to your computer and use it in GitHub Desktop.
void Flush()
{
GraphicsDevice.UpdateBuffer(vertexBuffer, 0, Vertices);
GraphicsDevice.UpdateBuffer(indexBuffer, 0, Indices);
CommandList.Begin();
CommandList.SetFramebuffer(Framebuffer);
if (Framebuffer.DepthTarget != null)
CommandList.ClearDepthStencil(1.0f);
CommandList.UpdateBuffer(MVP, 0, Matrix);
CommandList.SetVertexBuffer(0, vertexBuffer);
CommandList.SetIndexBuffer(indexBuffer, IndexFormat.UInt16);
CommandList.SetPipeline(Pipeline);
CommandList.SetGraphicsResourceSet(0, _textureResourceSet);
CommandList.SetGraphicsResourceSet(1, _uniformResourceSet);
CommandList.DrawIndexed(
indexCount: (uint)IndicesIndex,
instanceCount: 1,
indexStart: 0,
vertexOffset: 0,
instanceStart: 0);
CommandList.End();
GraphicsDevice.SubmitCommands(CommandList);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment