Store uniform block bindings in program binaries.

This affects all back-ends - we weren't saving this. Note that
bindings can only be set after program linking. The spec is fairly
clear in that any programs saved must be loadable and runnable under
the same set of state, which would include block bindings.

Also add validation for zero binary formats in GetProgramBinary.

Also add a workaround for AMD where the block bindings were not
applied properly after link, similarly to our original bug.

This CL also includes a few fixups for GLProgram (raii).

BUG=angleproject:1637

Change-Id: Iae068eb4e1e4c763aa9f9332c033e38708026c8f
Reviewed-on: https://chromium-review.googlesource.com/418393
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Jamie Madill
2016-12-13 15:08:19 -05:00
committed by Commit Bot
parent e1faacb110
commit a7d12dc7f5
21 changed files with 246 additions and 76 deletions

View File

@@ -79,6 +79,9 @@ GLuint CompileShaderFromFile(GLenum type, const std::string &sourcePath)
GLuint CheckLinkStatusAndReturnProgram(GLuint program, bool outputErrorMessages)
{
if (glGetError() != GL_NO_ERROR)
return 0;
GLint linkStatus;
glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
if (linkStatus == 0)
@@ -189,3 +192,17 @@ GLuint CompileComputeProgram(const std::string &csSource, bool outputErrorMessag
return CheckLinkStatusAndReturnProgram(program, outputErrorMessages);
}
GLuint LoadBinaryProgramOES(const std::vector<uint8_t> &binary, GLenum binaryFormat)
{
GLuint program = glCreateProgram();
glProgramBinaryOES(program, binaryFormat, binary.data(), static_cast<GLint>(binary.size()));
return CheckLinkStatusAndReturnProgram(program, true);
}
GLuint LoadBinaryProgramES3(const std::vector<uint8_t> &binary, GLenum binaryFormat)
{
GLuint program = glCreateProgram();
glProgramBinary(program, binaryFormat, binary.data(), static_cast<GLint>(binary.size()));
return CheckLinkStatusAndReturnProgram(program, true);
}