Commit d6e50872 by Geoff Lang

Add a StateManagerGL method to sync state required for a draw call.

BUG=angle:883 Change-Id: Iabeb25aef2228a1900bd0209422ddce21771c688 Reviewed-on: https://chromium-review.googlesource.com/252802Reviewed-by: 's avatarKenneth Russell <kbr@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent ba4c4a85
......@@ -58,16 +58,25 @@ gl::Error RendererGL::finish()
gl::Error RendererGL::drawArrays(const gl::Data &data, GLenum mode,
GLint first, GLsizei count, GLsizei instances)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
mStateManager->setDrawState(*data.state);
mFunctions->drawArrays(mode, first, count);
return gl::Error(GL_NO_ERROR);
}
gl::Error RendererGL::drawElements(const gl::Data &data, GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices, GLsizei instances,
const RangeUI &indexRange)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
if (instances > 0)
{
UNIMPLEMENTED();
}
mStateManager->setDrawState(*data.state);
mFunctions->drawElements(mode, count, type, indices);
return gl::Error(GL_NO_ERROR);
}
CompilerImpl *RendererGL::createCompiler(const gl::Data &data)
......
......@@ -8,7 +8,11 @@
#include "libANGLE/renderer/gl/StateManagerGL.h"
#include "libANGLE/Data.h"
#include "libANGLE/VertexArray.h"
#include "libANGLE/renderer/gl/FunctionsGL.h"
#include "libANGLE/renderer/gl/ProgramGL.h"
#include "libANGLE/renderer/gl/VertexArrayGL.h"
namespace rx
{
......@@ -49,4 +53,15 @@ void StateManagerGL::bindBuffer(GLenum type, GLuint buffer)
}
}
void StateManagerGL::setDrawState(const gl::State &state)
{
const gl::VertexArray *vao = state.getVertexArray();
const VertexArrayGL *vaoGL = GetImplAs<VertexArrayGL>(vao);
bindVertexArray(vaoGL->getVertexArrayID());
const gl::Program *program = state.getProgram();
const ProgramGL *programGL = GetImplAs<ProgramGL>(program);
useProgram(programGL->getProgramID());
}
}
......@@ -14,6 +14,11 @@
#include <map>
namespace gl
{
class State;
}
namespace rx
{
......@@ -28,6 +33,8 @@ class StateManagerGL
void bindVertexArray(GLuint vao);
void bindBuffer(GLenum type, GLuint buffer);
void setDrawState(const gl::State &state);
private:
DISALLOW_COPY_AND_ASSIGN(StateManagerGL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment