Pull Context dependencies out of applyVertexBuffer().

TRAC #22016 Signed-off-by: Daniel Koch Signed-off-by: Shannon Woods Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1473 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 1dd557ae
...@@ -1854,12 +1854,10 @@ void Context::applyState(GLenum drawMode) ...@@ -1854,12 +1854,10 @@ void Context::applyState(GLenum drawMode)
mState.rasterizer.frontFace == GL_CCW, stencilSize); mState.rasterizer.frontFace == GL_CCW, stencilSize);
} }
GLenum Context::applyVertexBuffer(GLint first, GLsizei count, GLsizei instances, GLsizei *repeatDraw) GLenum Context::applyVertexBuffer(ProgramBinary *programBinary, VertexAttributeArray &vertexAttributes, GLint first, GLsizei count, GLsizei instances, GLsizei *repeatDraw)
{ {
TranslatedAttribute attributes[MAX_VERTEX_ATTRIBS]; TranslatedAttribute attributes[MAX_VERTEX_ATTRIBS];
GLenum err = mVertexDataManager->prepareVertexData(vertexAttributes, programBinary, first, count, attributes, instances);
ProgramBinary *programBinary = getCurrentProgramBinary();
GLenum err = mVertexDataManager->prepareVertexData(mState.vertexAttribute, programBinary, first, count, attributes, instances);
if (err != GL_NO_ERROR) if (err != GL_NO_ERROR)
{ {
return err; return err;
...@@ -2266,8 +2264,10 @@ void Context::drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instan ...@@ -2266,8 +2264,10 @@ void Context::drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instan
applyState(mode); applyState(mode);
ProgramBinary *programBinary = getCurrentProgramBinary();
GLsizei repeatDraw = 1; GLsizei repeatDraw = 1;
GLenum err = applyVertexBuffer(first, count, instances, &repeatDraw); GLenum err = applyVertexBuffer(programBinary, mState.vertexAttribute, first, count, instances, &repeatDraw);
if (err != GL_NO_ERROR) if (err != GL_NO_ERROR)
{ {
return error(err); return error(err);
...@@ -2276,7 +2276,7 @@ void Context::drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instan ...@@ -2276,7 +2276,7 @@ void Context::drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instan
applyShaders(); applyShaders();
applyTextures(); applyTextures();
if (!getCurrentProgramBinary()->validateSamplers(NULL)) if (!programBinary->validateSamplers(NULL))
{ {
return error(GL_INVALID_OPERATION); return error(GL_INVALID_OPERATION);
} }
...@@ -2355,9 +2355,11 @@ void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid ...@@ -2355,9 +2355,11 @@ void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid
return error(err); return error(err);
} }
ProgramBinary *programBinary = getCurrentProgramBinary();
GLsizei vertexCount = indexInfo.maxIndex - indexInfo.minIndex + 1; GLsizei vertexCount = indexInfo.maxIndex - indexInfo.minIndex + 1;
GLsizei repeatDraw = 1; GLsizei repeatDraw = 1;
err = applyVertexBuffer(indexInfo.minIndex, vertexCount, instances, &repeatDraw); err = applyVertexBuffer(programBinary, mState.vertexAttribute, indexInfo.minIndex, vertexCount, instances, &repeatDraw);
if (err != GL_NO_ERROR) if (err != GL_NO_ERROR)
{ {
return error(err); return error(err);
...@@ -2366,7 +2368,7 @@ void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid ...@@ -2366,7 +2368,7 @@ void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid
applyShaders(); applyShaders();
applyTextures(); applyTextures();
if (!getCurrentProgramBinary()->validateSamplers(NULL)) if (!programBinary->validateSamplers(NULL))
{ {
return error(GL_INVALID_OPERATION); return error(GL_INVALID_OPERATION);
} }
......
...@@ -471,7 +471,7 @@ class Context ...@@ -471,7 +471,7 @@ class Context
bool applyRenderTarget(bool ignoreViewport); bool applyRenderTarget(bool ignoreViewport);
void applyState(GLenum drawMode); void applyState(GLenum drawMode);
GLenum applyVertexBuffer(GLint first, GLsizei count, GLsizei instances, GLsizei *repeatDraw); GLenum applyVertexBuffer(ProgramBinary *programBinary, VertexAttributeArray &vertexAttributes, GLint first, GLsizei count, GLsizei instances, GLsizei *repeatDraw);
GLenum applyIndexBuffer(const GLvoid *indices, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo); GLenum applyIndexBuffer(const GLvoid *indices, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
void applyShaders(); void applyShaders();
void applyTextures(); void applyTextures();
......
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