diff --git a/Common/GPU/OpenGL/GLQueueRunner.cpp b/Common/GPU/OpenGL/GLQueueRunner.cpp index 2c15f5f2d9..b4fa20438c 100644 --- a/Common/GPU/OpenGL/GLQueueRunner.cpp +++ b/Common/GPU/OpenGL/GLQueueRunner.cpp @@ -1187,20 +1187,21 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step, bool first, bool last CHECK_GL_ERROR_IF_DEBUG(); break; } - case GLRRenderCommand::GENMIPS: - // TODO: Should we include the texture handle in the command? - // Also, should this not be an init command? - glGenerateMipmap(GL_TEXTURE_2D); - break; case GLRRenderCommand::DRAW: - glDrawArrays(c.draw.mode, c.draw.first, c.draw.count); - break; - case GLRRenderCommand::DRAW_INDEXED: - if (c.draw.instances == 1) { + if (c.draw.indexType == 0) { + glDrawArrays(c.draw.mode, c.draw.first, c.draw.count); + } else if (c.draw.instances == 1) { glDrawElements(c.draw.mode, c.draw.count, c.draw.indexType, c.draw.indices); } else { glDrawElementsInstanced(c.draw.mode, c.draw.count, c.draw.indexType, c.draw.indices, c.draw.instances); } + CHECK_GL_ERROR_IF_DEBUG(); + break; + case GLRRenderCommand::GENMIPS: + // TODO: Should we include the texture handle in the command? + // Also, should this not be an init command? + glGenerateMipmap(GL_TEXTURE_2D); + CHECK_GL_ERROR_IF_DEBUG(); break; case GLRRenderCommand::TEXTURESAMPLER: { diff --git a/Common/GPU/OpenGL/GLQueueRunner.h b/Common/GPU/OpenGL/GLQueueRunner.h index a7b67c48d9..abd8b94b38 100644 --- a/Common/GPU/OpenGL/GLQueueRunner.h +++ b/Common/GPU/OpenGL/GLQueueRunner.h @@ -63,7 +63,6 @@ enum class GLRRenderCommand : uint8_t { BIND_VERTEX_BUFFER, GENMIPS, DRAW, - DRAW_INDEXED, TEXTURE_SUBIMAGE, }; @@ -111,9 +110,9 @@ struct GLRRenderData { GLenum mode; // primitive GLint first; GLint count; + GLint indexType; void *indices; GLint instances; - GLint indexType; } draw; struct { const char *name; // if null, use loc diff --git a/Common/GPU/OpenGL/GLRenderManager.h b/Common/GPU/OpenGL/GLRenderManager.h index 2c2aa93614..538f023149 100644 --- a/Common/GPU/OpenGL/GLRenderManager.h +++ b/Common/GPU/OpenGL/GLRenderManager.h @@ -923,18 +923,18 @@ public: data.draw.mode = mode; data.draw.first = first; data.draw.count = count; - data.draw.indices = nullptr; + data.draw.indexType = 0; curRenderStep_->commands.push_back(data); curRenderStep_->render.numDraws++; } void DrawIndexed(GLenum mode, int count, GLenum indexType, void *indices, int instances = 1) { _dbg_assert_(curRenderStep_ && curRenderStep_->stepType == GLRStepType::RENDER); - GLRRenderData data{ GLRRenderCommand::DRAW_INDEXED }; + GLRRenderData data{ GLRRenderCommand::DRAW }; data.draw.mode = mode; data.draw.count = count; - data.draw.indices = indices; data.draw.indexType = indexType; + data.draw.indices = indices; data.draw.instances = instances; curRenderStep_->commands.push_back(data); curRenderStep_->render.numDraws++; diff --git a/Common/VR/PPSSPPVR.cpp b/Common/VR/PPSSPPVR.cpp index 65acd261a7..e580a6af80 100644 --- a/Common/VR/PPSSPPVR.cpp +++ b/Common/VR/PPSSPPVR.cpp @@ -574,7 +574,7 @@ void PreprocessSkyplane(GLRStep* step) { for (auto& command : step->commands) { if (command.cmd == GLRRenderCommand::DEPTH) { depthEnabled = command.depth.enabled; - } else if ((command.cmd == GLRRenderCommand::DRAW_INDEXED) && !depthEnabled) { + } else if ((command.cmd == GLRRenderCommand::DRAW && command.draw.indices != nullptr) && !depthEnabled) { command.draw.count = 0; } }