diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-10-23 02:02:06 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-10-23 02:02:06 +0000 |
| commit | c616fb6343e940f2240e1ed39ad46dd56069ba1d (patch) | |
| tree | c09fb83aa362a094b6c01b699bca976f8587aadb /Graphics/GraphicsEngineOpenGL | |
| parent | Renamed DRAW_FLAG_DYNAMIC_BUFFERS_INTACT to DRAW_FLAG_DYNAMIC_RESOURCE_BUFFER... (diff) | |
| download | DiligentCore-c616fb6343e940f2240e1ed39ad46dd56069ba1d.tar.gz DiligentCore-c616fb6343e940f2240e1ed39ad46dd56069ba1d.zip | |
D3D11 and GL backends: fixed instanced draw calls with one instance and non-zero FirstInstanceLocation
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
| -rw-r--r-- | Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp index aed3eac0..2a039c7e 100644 --- a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp @@ -678,9 +678,9 @@ namespace Diligent GLenum GlTopology; PrepareForDraw(Attribs.Flags, false, GlTopology); - if (Attribs.NumInstances > 1) + if (Attribs.NumInstances > 1 || Attribs.FirstInstanceLocation != 0) { - if (Attribs.FirstInstanceLocation) + if (Attribs.FirstInstanceLocation != 0) glDrawArraysInstancedBaseInstance(GlTopology, Attribs.StartVertexLocation, Attribs.NumVertices, Attribs.NumInstances, Attribs.FirstInstanceLocation); else glDrawArraysInstanced(GlTopology, Attribs.StartVertexLocation, Attribs.NumVertices, Attribs.NumInstances); @@ -710,18 +710,18 @@ namespace Diligent // errors in case instance data is read from the same stream as vertex data. Thus handling // such cases is left to the application - if (Attribs.NumInstances > 1) + if (Attribs.NumInstances > 1 || Attribs.FirstInstanceLocation != 0) { if (Attribs.BaseVertex > 0) { - if (Attribs.FirstInstanceLocation) + if (Attribs.FirstInstanceLocation != 0) glDrawElementsInstancedBaseVertexBaseInstance(GlTopology, Attribs.NumIndices, GLIndexType, reinterpret_cast<GLvoid*>( static_cast<size_t>(FirstIndexByteOffset) ), Attribs.NumInstances, Attribs.BaseVertex, Attribs.FirstInstanceLocation); else glDrawElementsInstancedBaseVertex(GlTopology, Attribs.NumIndices, GLIndexType, reinterpret_cast<GLvoid*>( static_cast<size_t>(FirstIndexByteOffset) ), Attribs.NumInstances, Attribs.BaseVertex); } else { - if (Attribs.FirstInstanceLocation) + if (Attribs.FirstInstanceLocation != 0) glDrawElementsInstancedBaseInstance(GlTopology, Attribs.NumIndices, GLIndexType, reinterpret_cast<GLvoid*>( static_cast<size_t>(FirstIndexByteOffset) ), Attribs.NumInstances, Attribs.FirstInstanceLocation); else glDrawElementsInstanced(GlTopology, Attribs.NumIndices, GLIndexType, reinterpret_cast<GLvoid*>( static_cast<size_t>(FirstIndexByteOffset) ), Attribs.NumInstances); |
