Commit d04908bc by Jamie Madill Committed by Commit Bot

Refactor ProgramBinary entry points.

These will need to set dirty bits for the program, and this is best done via the Context. BUG=angleproject:747 Change-Id: I1379d2d4be0e94206c0aa7cb1546aa1a591f23ff Reviewed-on: https://chromium-review.googlesource.com/529767Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 2648d929
...@@ -4701,4 +4701,24 @@ void Context::validateProgram(GLuint program) ...@@ -4701,4 +4701,24 @@ void Context::validateProgram(GLuint program)
programObject->validate(mCaps); programObject->validate(mCaps);
} }
void Context::getProgramBinary(GLuint program,
GLsizei bufSize,
GLsizei *length,
GLenum *binaryFormat,
void *binary)
{
Program *programObject = getProgram(program);
ASSERT(programObject != nullptr);
handleError(programObject->saveBinary(this, binaryFormat, binary, bufSize, length));
}
void Context::programBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length)
{
Program *programObject = getProgram(program);
ASSERT(programObject != nullptr);
handleError(programObject->loadBinary(this, binaryFormat, binary, length));
}
} // namespace gl } // namespace gl
...@@ -748,6 +748,13 @@ class Context final : public ValidationContext ...@@ -748,6 +748,13 @@ class Context final : public ValidationContext
void uniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); void uniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
void validateProgram(GLuint program); void validateProgram(GLuint program);
void getProgramBinary(GLuint program,
GLsizei bufSize,
GLsizei *length,
GLenum *binaryFormat,
void *binary);
void programBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
void handleError(const Error &error) override; void handleError(const Error &error) override;
GLenum getError(); GLenum getError();
......
...@@ -796,20 +796,13 @@ void GL_APIENTRY GetProgramBinaryOES(GLuint program, ...@@ -796,20 +796,13 @@ void GL_APIENTRY GetProgramBinaryOES(GLuint program,
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
if (!ValidateGetProgramBinaryOES(context, program, bufSize, length, binaryFormat, binary)) if (!context->skipValidation() &&
!ValidateGetProgramBinaryOES(context, program, bufSize, length, binaryFormat, binary))
{ {
return; return;
} }
Program *programObject = context->getProgram(program); context->getProgramBinary(program, bufSize, length, binaryFormat, binary);
ASSERT(programObject != nullptr);
Error error = programObject->saveBinary(context, binaryFormat, binary, bufSize, length);
if (error.isError())
{
context->handleError(error);
return;
}
} }
} }
...@@ -824,20 +817,13 @@ void GL_APIENTRY ProgramBinaryOES(GLuint program, ...@@ -824,20 +817,13 @@ void GL_APIENTRY ProgramBinaryOES(GLuint program,
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
if (!ValidateProgramBinaryOES(context, program, binaryFormat, binary, length)) if (!context->skipValidation() &&
!ValidateProgramBinaryOES(context, program, binaryFormat, binary, length))
{ {
return; return;
} }
Program *programObject = context->getProgram(program); context->programBinary(program, binaryFormat, binary, length);
ASSERT(programObject != nullptr);
Error error = programObject->loadBinary(context, binaryFormat, binary, length);
if (error.isError())
{
context->handleError(error);
return;
}
} }
} }
......
...@@ -2312,20 +2312,13 @@ void GL_APIENTRY GetProgramBinary(GLuint program, ...@@ -2312,20 +2312,13 @@ void GL_APIENTRY GetProgramBinary(GLuint program,
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
if (!ValidateGetProgramBinary(context, program, bufSize, length, binaryFormat, binary)) if (!context->skipValidation() &&
!ValidateGetProgramBinary(context, program, bufSize, length, binaryFormat, binary))
{ {
return; return;
} }
Program *programObject = context->getProgram(program); context->getProgramBinary(program, bufSize, length, binaryFormat, binary);
ASSERT(programObject != nullptr);
Error error = programObject->saveBinary(context, binaryFormat, binary, bufSize, length);
if (error.isError())
{
context->handleError(error);
return;
}
} }
} }
...@@ -2342,20 +2335,13 @@ void GL_APIENTRY ProgramBinary(GLuint program, ...@@ -2342,20 +2335,13 @@ void GL_APIENTRY ProgramBinary(GLuint program,
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
if (!ValidateProgramBinary(context, program, binaryFormat, binary, length)) if (!context->skipValidation() &&
!ValidateProgramBinary(context, program, binaryFormat, binary, length))
{ {
return; return;
} }
Program *programObject = context->getProgram(program); context->programBinary(program, binaryFormat, binary, length);
ASSERT(programObject != nullptr);
Error error = programObject->loadBinary(context, binaryFormat, binary, length);
if (error.isError())
{
context->handleError(error);
return;
}
} }
} }
......
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