Commit 2348e21a by Geoff Lang Committed by Commit Bot

Make GL_OES_get_program_binary enableable.

BUG=angleproject:1523 Change-Id: Iad002e8cbc354b9a9d08a30ba57a293f889ecffb Reviewed-on: https://chromium-review.googlesource.com/688640 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent b8d2664f
......@@ -616,7 +616,7 @@ const ExtensionInfoMap &GetExtensionInfoMap()
ExtensionInfoMap map;
map["GL_OES_element_index_uint"] = enableableExtension(&Extensions::elementIndexUint);
map["GL_OES_packed_depth_stencil"] = esOnlyExtension(&Extensions::packedDepthStencil);
map["GL_OES_get_program_binary"] = esOnlyExtension(&Extensions::getProgramBinary);
map["GL_OES_get_program_binary"] = enableableExtension(&Extensions::getProgramBinary);
map["GL_OES_rgb8_rgba8"] = enableableExtension(&Extensions::rgb8rgba8);
map["GL_EXT_texture_format_BGRA8888"] = enableableExtension(&Extensions::textureFormatBGRA8888);
map["GL_EXT_read_format_bgra"] = esOnlyExtension(&Extensions::readFormatBGRA);
......
......@@ -153,12 +153,6 @@ bool ValidationContext::getQueryParameterInfo(GLenum pname, GLenum *type, unsign
*numParams = static_cast<unsigned int>(getCaps().compressedTextureFormats.size());
return true;
}
case GL_PROGRAM_BINARY_FORMATS_OES:
{
*type = GL_INT;
*numParams = static_cast<unsigned int>(getCaps().programBinaryFormats.size());
return true;
}
case GL_SHADER_BINARY_FORMATS:
{
*type = GL_INT;
......@@ -227,7 +221,6 @@ bool ValidationContext::getQueryParameterInfo(GLenum pname, GLenum *type, unsign
case GL_TEXTURE_BINDING_2D:
case GL_TEXTURE_BINDING_CUBE_MAP:
case GL_RESET_NOTIFICATION_STRATEGY_EXT:
case GL_NUM_PROGRAM_BINARY_FORMATS_OES:
{
*type = GL_INT;
*numParams = 1;
......@@ -468,6 +461,24 @@ bool ValidationContext::getQueryParameterInfo(GLenum pname, GLenum *type, unsign
// Check for ES3.0+ parameter names which are also exposed as ES2 extensions
switch (pname)
{
case GL_NUM_PROGRAM_BINARY_FORMATS_OES:
if ((getClientMajorVersion() < 3) && !getExtensions().getProgramBinary)
{
return false;
}
*type = GL_INT;
*numParams = 1;
return true;
case GL_PROGRAM_BINARY_FORMATS_OES:
if ((getClientMajorVersion() < 3) && !getExtensions().getProgramBinary)
{
return false;
}
*type = GL_INT;
*numParams = static_cast<unsigned int>(getCaps().programBinaryFormats.size());
return true;
case GL_PACK_ROW_LENGTH:
case GL_PACK_SKIP_ROWS:
case GL_PACK_SKIP_PIXELS:
......
......@@ -890,6 +890,68 @@ TEST_P(WebGLCompatibilityTest, EnableRGB8RGBA8Extension)
}
}
// Test enabling the GL_OES_get_program_binary extension
TEST_P(WebGLCompatibilityTest, EnableProgramBinaryExtension)
{
EXPECT_FALSE(extensionEnabled("GL_OES_get_program_binary"));
// This extensions become core in in ES3/WebGL2.
ANGLE_SKIP_TEST_IF(getClientMajorVersion() >= 3);
GLint result = 0;
glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &result);
EXPECT_GL_ERROR(GL_INVALID_ENUM);
glGetIntegerv(GL_PROGRAM_BINARY_FORMATS, &result);
EXPECT_GL_ERROR(GL_INVALID_ENUM);
const std::string &vert =
"void main()\n"
"{\n"
" gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n"
"}\n";
const std::string &frag =
"precision highp float;\n"
"void main()\n"
"{\n"
" gl_FragColor = vec4(1.0);\n"
"}\n";
ANGLE_GL_PROGRAM(program, vert, frag);
glGetProgramiv(program, GL_PROGRAM_BINARY_LENGTH, &result);
EXPECT_GL_ERROR(GL_INVALID_ENUM);
uint8_t tempArray[512];
GLenum tempFormat = 0;
GLsizei tempLength = 0;
glGetProgramBinaryOES(program, static_cast<GLsizei>(ArraySize(tempArray)), &tempLength,
&tempFormat, tempArray);
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
if (extensionRequestable("GL_OES_get_program_binary"))
{
glRequestExtensionANGLE("GL_OES_get_program_binary");
EXPECT_GL_NO_ERROR();
glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &result);
glGetIntegerv(GL_PROGRAM_BINARY_FORMATS, &result);
EXPECT_GL_NO_ERROR();
GLint binaryLength = 0;
glGetProgramiv(program, GL_PROGRAM_BINARY_LENGTH, &binaryLength);
EXPECT_GL_NO_ERROR();
GLenum binaryFormat;
GLsizei writeLength = 0;
std::vector<uint8_t> binary(binaryLength);
glGetProgramBinaryOES(program, binaryLength, &writeLength, &binaryFormat, binary.data());
EXPECT_GL_NO_ERROR();
glProgramBinaryOES(program, binaryFormat, binary.data(), binaryLength);
EXPECT_GL_NO_ERROR();
}
}
// Verify that the context generates the correct error when the framebuffer attachments are
// different sizes
TEST_P(WebGLCompatibilityTest, FramebufferAttachmentSizeMismatch)
......
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