Skip to content

Commit

Permalink
Revert "Use a constexpr array for es3 copy conversion table."
Browse files Browse the repository at this point in the history
This reverts commit f30808d.

Reason for revert: build/android/gyp/assert_static_initializers.py thinks this adds a static initializer.

See https://ci.chromium.org/p/chromium/builders/try/android-marshmallow-arm64-rel/208664

Need to revert since this is blocking the roll.

Original change's description:
> Use a constexpr array for es3 copy conversion table.
> 
> With the relaxed C++14 constexpr rules allowed in Chromium, we can
> use a constexpr sorted array to store our table data. This can lead
> to very fast lookups while being more maintanable than using auto-
> generator scripts for every lookup table.
> 
> Note that to be sure this syntax is permitted, we should land this
> through the bots and let it sit for a little while.
> 
> Bug: angleproject:1389
> Change-Id: I9395c40276470108ce3e5786d8f1b8d85462c517
> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/777544
> Commit-Queue: Jamie Madill <jmadill@google.com>
> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>

TBR=ynovikov@chromium.org,jmadill@google.com,syoussefi@chromium.org,jmadill@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: angleproject:1389
Change-Id: I482729b6f16975896b0e5c29999f9a081056e800
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1506238
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
  • Loading branch information
null77 authored and Commit Bot committed Mar 6, 2019
1 parent 105bc9d commit 1412650
Show file tree
Hide file tree
Showing 8 changed files with 230 additions and 153 deletions.
6 changes: 6 additions & 0 deletions scripts/run_code_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ def auto_script(script):
auto_script('scripts/generate_loader.py'),
'GL/EGL entry points':
auto_script('scripts/generate_entry_points.py'),
'GL copy conversion table': {
'inputs': [
'src/libANGLE/es3_copy_conversion_formats.json',
],
'script': 'src/libANGLE/gen_copy_conversion_table.py',
},
'GL format map': {
'inputs': [
'src/libANGLE/es3_format_type_combinations.json',
Expand Down
4 changes: 4 additions & 0 deletions scripts/run_code_generation_hashes.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
"002ad46d144c51fe98d73478aa554ba7",
"Emulated HLSL functions:src/compiler/translator/gen_emulated_builtin_function_tables.py":
"6a00c1ba22c35a9b700a154efda6f861",
"GL copy conversion table:src/libANGLE/es3_copy_conversion_formats.json":
"54608f6f7d9aa7c59a8458ccf3ab9935",
"GL copy conversion table:src/libANGLE/gen_copy_conversion_table.py":
"ac1afe23d9578bd1d2ef74f4a7aa927a",
"GL format map:src/libANGLE/es3_format_type_combinations.json":
"a232823cd6430f14e28793ccabb968ee",
"GL format map:src/libANGLE/format_map_data.json":
Expand Down
102 changes: 0 additions & 102 deletions src/common/constexpr_array.h

This file was deleted.

44 changes: 44 additions & 0 deletions src/libANGLE/es3_copy_conversion_formats.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"From ES 3.0.1 spec, table 3.15":
[
[ "GL_ALPHA", "GL_RGBA" ],
[ "GL_LUMINANCE", "GL_RED" ],
[ "GL_LUMINANCE", "GL_RG" ],
[ "GL_LUMINANCE", "GL_RGB" ],
[ "GL_LUMINANCE", "GL_RGBA" ],
[ "GL_LUMINANCE_ALPHA", "GL_RGBA" ],
[ "GL_RED", "GL_RED" ],
[ "GL_RED", "GL_RG" ],
[ "GL_RED", "GL_RGB" ],
[ "GL_RED", "GL_RGBA" ],
[ "GL_RG", "GL_RG" ],
[ "GL_RG", "GL_RGB" ],
[ "GL_RG", "GL_RGBA" ],
[ "GL_RGB", "GL_RGB" ],
[ "GL_RGB", "GL_RGBA" ],
[ "GL_RGBA", "GL_RGBA" ]
],

"Necessary for ANGLE back-buffers":
[
[ "GL_ALPHA", "GL_BGRA_EXT" ],
[ "GL_LUMINANCE", "GL_BGRA_EXT" ],
[ "GL_LUMINANCE_ALPHA", "GL_BGRA_EXT" ],
[ "GL_RED", "GL_BGRA_EXT" ],
[ "GL_RG", "GL_BGRA_EXT" ],
[ "GL_RGB", "GL_BGRA_EXT" ],
[ "GL_RGBA", "GL_BGRA_EXT" ],
[ "GL_BGRA_EXT", "GL_BGRA_EXT" ],

[ "GL_RED_INTEGER", "GL_RED_INTEGER" ],
[ "GL_RED_INTEGER", "GL_RG_INTEGER" ],
[ "GL_RED_INTEGER", "GL_RGB_INTEGER" ],
[ "GL_RED_INTEGER", "GL_RGBA_INTEGER" ],
[ "GL_RG_INTEGER", "GL_RG_INTEGER" ],
[ "GL_RG_INTEGER", "GL_RGB_INTEGER" ],
[ "GL_RG_INTEGER", "GL_RGBA_INTEGER" ],
[ "GL_RGB_INTEGER", "GL_RGB_INTEGER" ],
[ "GL_RGB_INTEGER", "GL_RGBA_INTEGER" ],
[ "GL_RGBA_INTEGER", "GL_RGBA_INTEGER" ]
]
}
171 changes: 171 additions & 0 deletions src/libANGLE/es3_copy_conversion_table_autogen.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
// GENERATED FILE - DO NOT EDIT.
// Generated by gen_copy_conversion_table.py using data from es3_copy_conversion_formats.json.
//
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// format_map:
// Determining the sized internal format from a (format,type) pair.
// Also check es3 format combinations for validity.

#include "angle_gl.h"
#include "common/debug.h"

namespace gl
{

bool ValidES3CopyConversion(GLenum textureFormat, GLenum framebufferFormat)
{
switch (textureFormat)
{
case GL_ALPHA:
switch (framebufferFormat)
{
case GL_BGRA_EXT:
case GL_RGBA:
return true;
default:
break;
}
break;

case GL_BGRA_EXT:
switch (framebufferFormat)
{
case GL_BGRA_EXT:
return true;
default:
break;
}
break;

case GL_LUMINANCE:
switch (framebufferFormat)
{
case GL_BGRA_EXT:
case GL_RED:
case GL_RG:
case GL_RGB:
case GL_RGBA:
return true;
default:
break;
}
break;

case GL_LUMINANCE_ALPHA:
switch (framebufferFormat)
{
case GL_BGRA_EXT:
case GL_RGBA:
return true;
default:
break;
}
break;

case GL_RED:
switch (framebufferFormat)
{
case GL_BGRA_EXT:
case GL_RED:
case GL_RG:
case GL_RGB:
case GL_RGBA:
return true;
default:
break;
}
break;

case GL_RED_INTEGER:
switch (framebufferFormat)
{
case GL_RED_INTEGER:
case GL_RGBA_INTEGER:
case GL_RGB_INTEGER:
case GL_RG_INTEGER:
return true;
default:
break;
}
break;

case GL_RG:
switch (framebufferFormat)
{
case GL_BGRA_EXT:
case GL_RG:
case GL_RGB:
case GL_RGBA:
return true;
default:
break;
}
break;

case GL_RGB:
switch (framebufferFormat)
{
case GL_BGRA_EXT:
case GL_RGB:
case GL_RGBA:
return true;
default:
break;
}
break;

case GL_RGBA:
switch (framebufferFormat)
{
case GL_BGRA_EXT:
case GL_RGBA:
return true;
default:
break;
}
break;

case GL_RGBA_INTEGER:
switch (framebufferFormat)
{
case GL_RGBA_INTEGER:
return true;
default:
break;
}
break;

case GL_RGB_INTEGER:
switch (framebufferFormat)
{
case GL_RGBA_INTEGER:
case GL_RGB_INTEGER:
return true;
default:
break;
}
break;

case GL_RG_INTEGER:
switch (framebufferFormat)
{
case GL_RGBA_INTEGER:
case GL_RGB_INTEGER:
case GL_RG_INTEGER:
return true;
default:
break;
}
break;

default:
break;
}

return false;
}

} // namespace gl
4 changes: 4 additions & 0 deletions src/libANGLE/formatutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ bool ValidES3InternalFormat(GLenum internalFormat);
bool ValidES3Format(GLenum format);
bool ValidES3Type(GLenum type);
bool ValidES3FormatCombination(GLenum format, GLenum type, GLenum internalFormat);

// Implemented in es3_copy_conversion_table_autogen.cpp
bool ValidES3CopyConversion(GLenum textureFormat, GLenum framebufferFormat);

} // namespace gl

#endif // LIBANGLE_FORMATUTILS_H_
Loading

0 comments on commit 1412650

Please sign in to comment.