Commit 5641d193 by Julien Isorce Committed by Commit Bot

Move generic code from rx::DisplayAndroid/Ozone to rx::DisplayEGL

This CL is intended to move and factorize code only. Move DisplayAndroid::generateConfigs to DisplayEGL::generateConfigs because the code is generic and not Android specific. It will be useful later to provide a default implementation of rx::DisplayEGL. Same for createWindowSurface and createPbufferSurface, they have been moved without changes from DisplayAndroid to DisplayEGL. Unimplemented functions in DisplayOzone and DisplayAndroid have been moved to DisplayEGL. Bug: angleproject:4328 Change-Id: Ibbd36f99ea457cbd69391beb4a83f23403bc40fb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2038286 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com>
parent a44d96dc
...@@ -197,17 +197,13 @@ if (_use_copy_compiler_dll) { ...@@ -197,17 +197,13 @@ if (_use_copy_compiler_dll) {
exec_script("scripts/file_exists.py", [ _old_compiler ], "value") exec_script("scripts/file_exists.py", [ _old_compiler ], "value")
copy("copy_compiler_dll") { copy("copy_compiler_dll") {
sources = [ sources = [ "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll" ]
"$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll",
]
if (_has_old_compiler) { if (_has_old_compiler) {
sources += [ _old_compiler ] sources += [ _old_compiler ]
} }
outputs = [ outputs = [ "$root_out_dir/{{source_file_part}}" ]
"$root_out_dir/{{source_file_part}}",
]
} }
} }
...@@ -263,12 +259,8 @@ angle_source_set("xxhash") { ...@@ -263,12 +259,8 @@ angle_source_set("xxhash") {
if (angle_has_build) { if (angle_has_build) {
fuzzer_test("xxhash_fuzzer") { fuzzer_test("xxhash_fuzzer") {
sources = [ sources = [ "src/common/third_party/xxhash/xxhash_fuzzer.cpp" ]
"src/common/third_party/xxhash/xxhash_fuzzer.cpp", deps = [ ":xxhash" ]
]
deps = [
":xxhash",
]
} }
} }
...@@ -280,9 +272,7 @@ angle_static_library("angle_common") { ...@@ -280,9 +272,7 @@ angle_static_library("angle_common") {
":debug_annotations_config", ":debug_annotations_config",
] ]
deps = [ deps = [ ":xxhash" ]
":xxhash",
]
public_deps = [ public_deps = [
":angle_system_utils", ":angle_system_utils",
...@@ -304,17 +294,13 @@ config("angle_image_util_config") { ...@@ -304,17 +294,13 @@ config("angle_image_util_config") {
angle_source_set("angle_image_util_headers") { angle_source_set("angle_image_util_headers") {
sources = libangle_image_util_headers sources = libangle_image_util_headers
public_deps = [ public_deps = [ ":angle_common" ]
":angle_common",
]
} }
angle_static_library("angle_image_util") { angle_static_library("angle_image_util") {
sources = libangle_image_util_sources sources = libangle_image_util_sources
public_configs += [ ":angle_image_util_config" ] public_configs += [ ":angle_image_util_config" ]
public_deps = [ public_deps = [ ":angle_image_util_headers" ]
":angle_image_util_headers",
]
} }
config("angle_gl_visibility_config") { config("angle_gl_visibility_config") {
...@@ -343,9 +329,7 @@ angle_static_library("angle_gpu_info_util") { ...@@ -343,9 +329,7 @@ angle_static_library("angle_gpu_info_util") {
":angle_gpu_info_util_config", ":angle_gpu_info_util_config",
":angle_backend_config", ":angle_backend_config",
] ]
public_deps = [ public_deps = [ ":angle_common" ]
":angle_common",
]
sources = libangle_gpu_info_util_sources sources = libangle_gpu_info_util_sources
deps = [] deps = []
libs = [] libs = []
...@@ -407,9 +391,7 @@ angle_static_library("angle_gpu_info_util") { ...@@ -407,9 +391,7 @@ angle_static_library("angle_gpu_info_util") {
angle_source_set("angle_translator_headers") { angle_source_set("angle_translator_headers") {
sources = angle_translator_exported_headers sources = angle_translator_exported_headers
public_deps = [ public_deps = [ ":includes" ]
":includes",
]
} }
angle_static_library("translator") { angle_static_library("translator") {
...@@ -469,18 +451,14 @@ angle_static_library("translator") { ...@@ -469,18 +451,14 @@ angle_static_library("translator") {
} }
angle_source_set("translator_fuzzer") { angle_source_set("translator_fuzzer") {
sources = [ sources = [ "src/compiler/fuzz/translator_fuzzer.cpp" ]
"src/compiler/fuzz/translator_fuzzer.cpp",
]
include_dirs = [ include_dirs = [
"include", "include",
"src", "src",
] ]
deps = [ deps = [ ":translator" ]
":translator",
]
} }
config("commit_id_config") { config("commit_id_config") {
...@@ -492,14 +470,10 @@ commit_id_output_file = "$root_gen_dir/angle/id/commit.h" ...@@ -492,14 +470,10 @@ commit_id_output_file = "$root_gen_dir/angle/id/commit.h"
if (angle_use_commit_id) { if (angle_use_commit_id) {
action("commit_id") { action("commit_id") {
script = "src/commit_id.py" script = "src/commit_id.py"
outputs = [ outputs = [ commit_id_output_file ]
commit_id_output_file,
]
# commit id should depend on angle's HEAD revision # commit id should depend on angle's HEAD revision
inputs = [ inputs = [ ".git/HEAD" ]
".git/HEAD",
]
args = [ args = [
"gen", "gen",
...@@ -511,23 +485,15 @@ if (angle_use_commit_id) { ...@@ -511,23 +485,15 @@ if (angle_use_commit_id) {
} }
} else { } else {
copy("commit_id") { copy("commit_id") {
sources = [ sources = [ "src/commit.h" ]
"src/commit.h", outputs = [ commit_id_output_file ]
]
outputs = [
commit_id_output_file,
]
public_configs = [ ":commit_id_config" ] public_configs = [ ":commit_id_config" ]
} }
} }
angle_source_set("angle_version") { angle_source_set("angle_version") {
sources = [ sources = [ "src/common/version.h" ]
"src/common/version.h", public_deps = [ ":commit_id" ]
]
public_deps = [
":commit_id",
]
} }
config("angle_backend_config") { config("angle_backend_config") {
...@@ -571,7 +537,8 @@ config("libANGLE_config") { ...@@ -571,7 +537,8 @@ config("libANGLE_config") {
defines += [ "LIBANGLE_IMPLEMENTATION" ] defines += [ "LIBANGLE_IMPLEMENTATION" ]
if (is_win) { if (is_win) {
cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics are not enabled. cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics
# are not enabled.
} }
if (is_android && (angle_enable_gl || angle_enable_vulkan)) { if (is_android && (angle_enable_gl || angle_enable_vulkan)) {
...@@ -723,12 +690,14 @@ angle_source_set("libANGLE_base") { ...@@ -723,12 +690,14 @@ angle_source_set("libANGLE_base") {
sources += libangle_gl_egl_dl_sources sources += libangle_gl_egl_dl_sources
sources += libangle_gl_egl_android_sources sources += libangle_gl_egl_android_sources
} }
if (is_linux) {
sources += libangle_gl_egl_sources
sources += libangle_gl_egl_dl_sources
}
if (ozone_platform_gbm) { if (ozone_platform_gbm) {
configs += [ ":libdrm" ] configs += [ ":libdrm" ]
defines += [ "ANGLE_USE_OZONE" ] defines += [ "ANGLE_USE_OZONE" ]
deps += [ "//third_party/minigbm" ] deps += [ "//third_party/minigbm" ]
sources += libangle_gl_egl_sources
sources += libangle_gl_egl_dl_sources
sources += libangle_gl_ozone_sources sources += libangle_gl_ozone_sources
} }
} }
...@@ -754,9 +723,7 @@ angle_source_set("libANGLE_base") { ...@@ -754,9 +723,7 @@ angle_source_set("libANGLE_base") {
# Windows ARM64 is available since 10.0.16299 so no need to copy # Windows ARM64 is available since 10.0.16299 so no need to copy
# d3dcompiler_47.dll because this file is available as inbox. # d3dcompiler_47.dll because this file is available as inbox.
if (_use_copy_compiler_dll) { if (_use_copy_compiler_dll) {
data_deps = [ data_deps = [ ":copy_compiler_dll" ]
":copy_compiler_dll",
]
} }
} }
...@@ -769,13 +736,9 @@ config("angle_frame_capture_enabled") { ...@@ -769,13 +736,9 @@ config("angle_frame_capture_enabled") {
} }
angle_source_set("libANGLE") { angle_source_set("libANGLE") {
public_deps = [ public_deps = [ ":libANGLE_base" ]
":libANGLE_base",
]
public_configs = [ ":angle_frame_capture_disabled" ] public_configs = [ ":angle_frame_capture_disabled" ]
sources = [ sources = [ "src/libANGLE/FrameCapture_mock.cpp" ]
"src/libANGLE/FrameCapture_mock.cpp",
]
# gl_enum_utils defaults included in with_capture build # gl_enum_utils defaults included in with_capture build
deps = [] deps = []
...@@ -785,9 +748,7 @@ angle_source_set("libANGLE") { ...@@ -785,9 +748,7 @@ angle_source_set("libANGLE") {
} }
angle_source_set("angle_gl_enum_utils") { angle_source_set("angle_gl_enum_utils") {
public_deps = [ public_deps = [ ":libANGLE_base" ]
":libANGLE_base",
]
sources = [ sources = [
"src/libANGLE/gl_enum_utils.cpp", "src/libANGLE/gl_enum_utils.cpp",
"src/libANGLE/gl_enum_utils_autogen.cpp", "src/libANGLE/gl_enum_utils_autogen.cpp",
...@@ -795,9 +756,7 @@ angle_source_set("angle_gl_enum_utils") { ...@@ -795,9 +756,7 @@ angle_source_set("angle_gl_enum_utils") {
} }
angle_source_set("libANGLE_with_capture") { angle_source_set("libANGLE_with_capture") {
public_deps = [ public_deps = [ ":libANGLE_base" ]
":libANGLE_base",
]
public_configs = [ ":angle_frame_capture_enabled" ] public_configs = [ ":angle_frame_capture_enabled" ]
sources = libangle_capture_sources sources = libangle_capture_sources
} }
...@@ -866,35 +825,25 @@ template("angle_libGLESv2") { ...@@ -866,35 +825,25 @@ template("angle_libGLESv2") {
deps = invoker.deps + [ ":includes" ] deps = invoker.deps + [ ":includes" ]
public_deps = [ public_deps = [ ":angle_version" ]
":angle_version",
]
} }
} }
angle_libGLESv2("libGLESv2") { angle_libGLESv2("libGLESv2") {
if (angle_with_capture_by_default) { if (angle_with_capture_by_default) {
deps = [ deps = [ ":libANGLE_with_capture" ]
":libANGLE_with_capture",
]
} else { } else {
deps = [ deps = [ ":libANGLE" ]
":libANGLE",
]
} }
} }
# Output capture lib when `angle_with_capture_by_default` disabled, vice versa. # Output capture lib when `angle_with_capture_by_default` disabled, vice versa.
angle_libGLESv2("libGLESv2_capture_complement") { angle_libGLESv2("libGLESv2_capture_complement") {
if (angle_with_capture_by_default) { if (angle_with_capture_by_default) {
deps = [ deps = [ ":libANGLE" ]
":libANGLE",
]
output_name += "_no_capture" output_name += "_no_capture"
} else { } else {
deps = [ deps = [ ":libANGLE_with_capture" ]
":libANGLE_with_capture",
]
output_name += "_with_capture" output_name += "_with_capture"
} }
} }
...@@ -922,9 +871,7 @@ if (is_win && !angle_is_winuwp) { ...@@ -922,9 +871,7 @@ if (is_win && !angle_is_winuwp) {
":libANGLE", ":libANGLE",
] ]
public_deps = [ public_deps = [ ":angle_version" ]
":angle_version",
]
} }
} }
...@@ -932,12 +879,8 @@ angle_static_library("libGLESv2_static") { ...@@ -932,12 +879,8 @@ angle_static_library("libGLESv2_static") {
sources = libglesv2_sources sources = libglesv2_sources
configs += [ ":debug_annotations_config" ] configs += [ ":debug_annotations_config" ]
public_configs += [ ":angle_static" ] public_configs += [ ":angle_static" ]
deps = [ deps = [ ":includes" ]
":includes", public_deps = [ ":libANGLE" ]
]
public_deps = [
":libANGLE",
]
} }
angle_shared_library("libGLESv1_CM") { angle_shared_library("libGLESv1_CM") {
...@@ -983,9 +926,7 @@ angle_source_set("libEGL_egl_loader") { ...@@ -983,9 +926,7 @@ angle_source_set("libEGL_egl_loader") {
":gl_prototypes", ":gl_prototypes",
] ]
deps = [ deps = [ ":includes" ]
":includes",
]
} }
angle_shared_library("libEGL") { angle_shared_library("libEGL") {
...@@ -1015,13 +956,9 @@ angle_shared_library("libEGL") { ...@@ -1015,13 +956,9 @@ angle_shared_library("libEGL") {
":libEGL_egl_loader", ":libEGL_egl_loader",
] ]
public_deps = [ public_deps = [ ":includes" ]
":includes",
]
data_deps = [ data_deps = [ ":libGLESv2" ]
":libGLESv2",
]
} }
angle_static_library("libEGL_static") { angle_static_library("libEGL_static") {
...@@ -1045,13 +982,9 @@ angle_static_library("libEGL_static") { ...@@ -1045,13 +982,9 @@ angle_static_library("libEGL_static") {
angle_executable("angle_shader_translator") { angle_executable("angle_shader_translator") {
testonly = true testonly = true
sources = [ sources = [ "samples/shader_translator/shader_translator.cpp" ]
"samples/shader_translator/shader_translator.cpp",
]
deps = [ deps = [ ":translator" ]
":translator",
]
} }
if (angle_has_build) { if (angle_has_build) {
...@@ -1125,9 +1058,7 @@ if (!is_component_build && is_android && symbol_level != 0) { ...@@ -1125,9 +1058,7 @@ if (!is_component_build && is_android && symbol_level != 0) {
} }
} }
outputs = [ outputs = [ "$root_out_dir/lib.compressed/{{source_file_part}}" ]
"$root_out_dir/lib.compressed/{{source_file_part}}",
]
android_nm = "${android_tool_prefix}nm" android_nm = "${android_tool_prefix}nm"
android_strip = "${android_tool_prefix}strip" android_strip = "${android_tool_prefix}strip"
...@@ -1156,16 +1087,14 @@ if (build_with_chromium && !is_component_build && is_android && ...@@ -1156,16 +1087,14 @@ if (build_with_chromium && !is_component_build && is_android &&
} }
group("angle_apks") { group("angle_apks") {
deps = [ deps = [ ":angle_chromium_apk" ]
":angle_chromium_apk",
]
} }
} }
group("angle") { group("angle") {
data_deps = [ data_deps = [
":libEGL",
":libGLESv1_CM", ":libGLESv1_CM",
":libGLESv2", ":libGLESv2",
":libEGL",
] ]
} }
...@@ -8,16 +8,18 @@ ...@@ -8,16 +8,18 @@
#include "libANGLE/renderer/gl/egl/DisplayEGL.h" #include "libANGLE/renderer/gl/egl/DisplayEGL.h"
#include "libANGLE/Surface.h"
#include "libANGLE/renderer/gl/egl/ImageEGL.h" #include "libANGLE/renderer/gl/egl/ImageEGL.h"
#include "libANGLE/renderer/gl/egl/PbufferSurfaceEGL.h"
#include "libANGLE/renderer/gl/egl/RendererEGL.h"
#include "libANGLE/renderer/gl/egl/SyncEGL.h" #include "libANGLE/renderer/gl/egl/SyncEGL.h"
#include "libANGLE/renderer/gl/egl/WindowSurfaceEGL.h"
namespace rx namespace rx
{ {
#define EGL_NO_CONFIG ((EGLConfig)0)
DisplayEGL::DisplayEGL(const egl::DisplayState &state) DisplayEGL::DisplayEGL(const egl::DisplayState &state)
: DisplayGL(state), mEGL(nullptr), mConfig(EGL_NO_CONFIG) : DisplayGL(state), mRenderer(nullptr), mEGL(nullptr), mConfig(EGL_NO_CONFIG_KHR)
{} {}
DisplayEGL::~DisplayEGL() {} DisplayEGL::~DisplayEGL() {}
...@@ -111,6 +113,252 @@ egl::Error DisplayEGL::initializeContext(EGLContext shareContext, ...@@ -111,6 +113,252 @@ egl::Error DisplayEGL::initializeContext(EGLContext shareContext,
return egl::Error(mEGL->getError(), "eglCreateContext failed"); return egl::Error(mEGL->getError(), "eglCreateContext failed");
} }
SurfaceImpl *DisplayEGL::createWindowSurface(const egl::SurfaceState &state,
EGLNativeWindowType window,
const egl::AttributeMap &attribs)
{
EGLConfig config;
EGLint numConfig;
EGLBoolean success;
const EGLint configAttribList[] = {EGL_CONFIG_ID, mConfigIds[state.config->configID], EGL_NONE};
success = mEGL->chooseConfig(configAttribList, &config, 1, &numConfig);
ASSERT(success && numConfig == 1);
return new WindowSurfaceEGL(state, mEGL, config, window);
}
SurfaceImpl *DisplayEGL::createPbufferSurface(const egl::SurfaceState &state,
const egl::AttributeMap &attribs)
{
EGLConfig config;
EGLint numConfig;
EGLBoolean success;
const EGLint configAttribList[] = {EGL_CONFIG_ID, mConfigIds[state.config->configID], EGL_NONE};
success = mEGL->chooseConfig(configAttribList, &config, 1, &numConfig);
ASSERT(success && numConfig == 1);
return new PbufferSurfaceEGL(state, mEGL, config);
}
SurfaceImpl *DisplayEGL::createPbufferFromClientBuffer(const egl::SurfaceState &state,
EGLenum buftype,
EGLClientBuffer clientBuffer,
const egl::AttributeMap &attribs)
{
UNIMPLEMENTED();
return nullptr;
}
SurfaceImpl *DisplayEGL::createPixmapSurface(const egl::SurfaceState &state,
NativePixmapType nativePixmap,
const egl::AttributeMap &attribs)
{
UNIMPLEMENTED();
return nullptr;
}
template <typename T>
void DisplayEGL::getConfigAttrib(EGLConfig config, EGLint attribute, T *value) const
{
EGLint tmp;
EGLBoolean success = mEGL->getConfigAttrib(config, attribute, &tmp);
ASSERT(success == EGL_TRUE);
*value = tmp;
}
template <typename T, typename U>
void DisplayEGL::getConfigAttribIfExtension(EGLConfig config,
EGLint attribute,
T *value,
const char *extension,
const U &defaultValue) const
{
if (mEGL->hasExtension(extension))
{
getConfigAttrib(config, attribute, value);
}
else
{
*value = static_cast<T>(defaultValue);
}
}
egl::ConfigSet DisplayEGL::generateConfigs()
{
egl::ConfigSet configSet;
mConfigIds.clear();
EGLint numConfigs;
EGLBoolean success = mEGL->chooseConfig(mConfigAttribList.data(), nullptr, 0, &numConfigs);
ASSERT(success == EGL_TRUE && numConfigs > 0);
std::vector<EGLConfig> configs(numConfigs);
EGLint numConfigs2;
success =
mEGL->chooseConfig(mConfigAttribList.data(), configs.data(), numConfigs, &numConfigs2);
ASSERT(success == EGL_TRUE && numConfigs2 == numConfigs);
for (int i = 0; i < numConfigs; i++)
{
egl::Config config;
getConfigAttrib(configs[i], EGL_BUFFER_SIZE, &config.bufferSize);
getConfigAttrib(configs[i], EGL_RED_SIZE, &config.redSize);
getConfigAttrib(configs[i], EGL_GREEN_SIZE, &config.greenSize);
getConfigAttrib(configs[i], EGL_BLUE_SIZE, &config.blueSize);
getConfigAttrib(configs[i], EGL_LUMINANCE_SIZE, &config.luminanceSize);
getConfigAttrib(configs[i], EGL_ALPHA_SIZE, &config.alphaSize);
getConfigAttrib(configs[i], EGL_ALPHA_MASK_SIZE, &config.alphaMaskSize);
getConfigAttrib(configs[i], EGL_BIND_TO_TEXTURE_RGB, &config.bindToTextureRGB);
getConfigAttrib(configs[i], EGL_BIND_TO_TEXTURE_RGBA, &config.bindToTextureRGBA);
getConfigAttrib(configs[i], EGL_COLOR_BUFFER_TYPE, &config.colorBufferType);
getConfigAttrib(configs[i], EGL_CONFIG_CAVEAT, &config.configCaveat);
getConfigAttrib(configs[i], EGL_CONFIG_ID, &config.configID);
getConfigAttrib(configs[i], EGL_CONFORMANT, &config.conformant);
getConfigAttrib(configs[i], EGL_DEPTH_SIZE, &config.depthSize);
getConfigAttrib(configs[i], EGL_LEVEL, &config.level);
getConfigAttrib(configs[i], EGL_MAX_PBUFFER_WIDTH, &config.maxPBufferWidth);
getConfigAttrib(configs[i], EGL_MAX_PBUFFER_HEIGHT, &config.maxPBufferHeight);
getConfigAttrib(configs[i], EGL_MAX_PBUFFER_PIXELS, &config.maxPBufferPixels);
getConfigAttrib(configs[i], EGL_MAX_SWAP_INTERVAL, &config.maxSwapInterval);
getConfigAttrib(configs[i], EGL_MIN_SWAP_INTERVAL, &config.minSwapInterval);
getConfigAttrib(configs[i], EGL_NATIVE_RENDERABLE, &config.nativeRenderable);
getConfigAttrib(configs[i], EGL_NATIVE_VISUAL_ID, &config.nativeVisualID);
getConfigAttrib(configs[i], EGL_NATIVE_VISUAL_TYPE, &config.nativeVisualType);
getConfigAttrib(configs[i], EGL_RENDERABLE_TYPE, &config.renderableType);
getConfigAttrib(configs[i], EGL_SAMPLE_BUFFERS, &config.sampleBuffers);
getConfigAttrib(configs[i], EGL_SAMPLES, &config.samples);
getConfigAttrib(configs[i], EGL_STENCIL_SIZE, &config.stencilSize);
getConfigAttrib(configs[i], EGL_SURFACE_TYPE, &config.surfaceType);
getConfigAttrib(configs[i], EGL_TRANSPARENT_TYPE, &config.transparentType);
getConfigAttrib(configs[i], EGL_TRANSPARENT_RED_VALUE, &config.transparentRedValue);
getConfigAttrib(configs[i], EGL_TRANSPARENT_GREEN_VALUE, &config.transparentGreenValue);
getConfigAttrib(configs[i], EGL_TRANSPARENT_BLUE_VALUE, &config.transparentBlueValue);
getConfigAttribIfExtension(configs[i], EGL_COLOR_COMPONENT_TYPE_EXT,
&config.colorComponentType, "EGL_EXT_pixel_format_float",
EGL_COLOR_COMPONENT_TYPE_FIXED_EXT);
if (config.colorBufferType == EGL_RGB_BUFFER)
{
ASSERT(config.colorComponentType == EGL_COLOR_COMPONENT_TYPE_FIXED_EXT);
if (config.redSize == 8 && config.greenSize == 8 && config.blueSize == 8 &&
config.alphaSize == 8)
{
config.renderTargetFormat = GL_RGBA8;
}
else if (config.redSize == 8 && config.greenSize == 8 && config.blueSize == 8 &&
config.alphaSize == 0)
{
config.renderTargetFormat = GL_RGB8;
}
else if (config.redSize == 5 && config.greenSize == 6 && config.blueSize == 5 &&
config.alphaSize == 0)
{
config.renderTargetFormat = GL_RGB565;
}
else if (config.redSize == 5 && config.greenSize == 5 && config.blueSize == 5 &&
config.alphaSize == 1)
{
config.renderTargetFormat = GL_RGB5_A1;
}
else if (config.redSize == 4 && config.greenSize == 4 && config.blueSize == 4 &&
config.alphaSize == 4)
{
config.renderTargetFormat = GL_RGBA4;
}
else
{
ERR() << "RGBA(" << config.redSize << "," << config.greenSize << ","
<< config.blueSize << "," << config.alphaSize << ") not handled";
UNREACHABLE();
}
}
else
{
UNREACHABLE();
}
if (config.depthSize == 0 && config.stencilSize == 0)
{
config.depthStencilFormat = GL_ZERO;
}
else if (config.depthSize == 16 && config.stencilSize == 0)
{
config.depthStencilFormat = GL_DEPTH_COMPONENT16;
}
else if (config.depthSize == 24 && config.stencilSize == 0)
{
config.depthStencilFormat = GL_DEPTH_COMPONENT24;
}
else if (config.depthSize == 24 && config.stencilSize == 8)
{
config.depthStencilFormat = GL_DEPTH24_STENCIL8;
}
else if (config.depthSize == 0 && config.stencilSize == 8)
{
config.depthStencilFormat = GL_STENCIL_INDEX8;
}
else
{
UNREACHABLE();
}
config.matchNativePixmap = EGL_NONE;
config.optimalOrientation = 0;
int internalId = configSet.add(config);
mConfigIds[internalId] = config.configID;
}
return configSet;
}
bool DisplayEGL::testDeviceLost()
{
return false;
}
egl::Error DisplayEGL::restoreLostDevice(const egl::Display *display)
{
UNIMPLEMENTED();
return egl::NoError();
}
bool DisplayEGL::isValidNativeWindow(EGLNativeWindowType window) const
{
return true;
}
DeviceImpl *DisplayEGL::createDevice()
{
UNIMPLEMENTED();
return nullptr;
}
egl::Error DisplayEGL::waitClient(const gl::Context *context)
{
UNIMPLEMENTED();
return egl::NoError();
}
egl::Error DisplayEGL::waitNative(const gl::Context *context, EGLint engine)
{
UNIMPLEMENTED();
return egl::NoError();
}
gl::Version DisplayEGL::getMaxSupportedESVersion() const
{
return mRenderer->getMaxSupportedESVersion();
}
void DisplayEGL::destroyNativeContext(EGLContext context)
{
mEGL->destroyContext(context);
}
void DisplayEGL::generateExtensions(egl::DisplayExtensions *outExtensions) const void DisplayEGL::generateExtensions(egl::DisplayExtensions *outExtensions) const
{ {
gl::Version eglVersion(mEGL->majorVersion, mEGL->minorVersion); gl::Version eglVersion(mEGL->majorVersion, mEGL->minorVersion);
...@@ -186,4 +434,21 @@ void DisplayEGL::setBlobCacheFuncs(EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDR ...@@ -186,4 +434,21 @@ void DisplayEGL::setBlobCacheFuncs(EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDR
} }
} }
egl::Error DisplayEGL::makeCurrentSurfaceless(gl::Context *context)
{
// Nothing to do because EGL always uses the same context and the previous surface can be left
// current.
return egl::NoError();
}
void DisplayEGL::initializeFrontendFeatures(angle::FrontendFeatures *features) const
{
mRenderer->initializeFrontendFeatures(features);
}
void DisplayEGL::populateFeatureList(angle::FeatureList *features)
{
mRenderer->getFeatures().populateFeatureList(features);
}
} // namespace rx } // namespace rx
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
#ifndef LIBANGLE_RENDERER_GL_EGL_DISPLAYEGL_H_ #ifndef LIBANGLE_RENDERER_GL_EGL_DISPLAYEGL_H_
#define LIBANGLE_RENDERER_GL_EGL_DISPLAYEGL_H_ #define LIBANGLE_RENDERER_GL_EGL_DISPLAYEGL_H_
#include <map>
#include <string>
#include <vector>
#include "libANGLE/renderer/gl/DisplayGL.h" #include "libANGLE/renderer/gl/DisplayGL.h"
#include "libANGLE/renderer/gl/egl/FunctionsEGL.h" #include "libANGLE/renderer/gl/egl/FunctionsEGL.h"
#include "libANGLE/renderer/gl/egl/egl_utils.h" #include "libANGLE/renderer/gl/egl/egl_utils.h"
...@@ -16,6 +20,7 @@ ...@@ -16,6 +20,7 @@
namespace rx namespace rx
{ {
class RendererEGL;
class WorkerContext; class WorkerContext;
class DisplayEGL : public DisplayGL class DisplayEGL : public DisplayGL
...@@ -35,12 +40,43 @@ class DisplayEGL : public DisplayGL ...@@ -35,12 +40,43 @@ class DisplayEGL : public DisplayGL
void setBlobCacheFuncs(EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get) override; void setBlobCacheFuncs(EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get) override;
virtual void destroyNativeContext(EGLContext context) = 0; virtual void destroyNativeContext(EGLContext context);
virtual WorkerContext *createWorkerContext(std::string *infoLog, virtual WorkerContext *createWorkerContext(std::string *infoLog,
EGLContext sharedContext, EGLContext sharedContext,
const native_egl::AttributeVector workerAttribs) = 0; const native_egl::AttributeVector workerAttribs) = 0;
SurfaceImpl *createWindowSurface(const egl::SurfaceState &state,
EGLNativeWindowType window,
const egl::AttributeMap &attribs) override;
SurfaceImpl *createPbufferSurface(const egl::SurfaceState &state,
const egl::AttributeMap &attribs) override;
SurfaceImpl *createPbufferFromClientBuffer(const egl::SurfaceState &state,
EGLenum buftype,
EGLClientBuffer clientBuffer,
const egl::AttributeMap &attribs) override;
SurfaceImpl *createPixmapSurface(const egl::SurfaceState &state,
NativePixmapType nativePixmap,
const egl::AttributeMap &attribs) override;
egl::ConfigSet generateConfigs() override;
bool testDeviceLost() override;
egl::Error restoreLostDevice(const egl::Display *display) override;
bool isValidNativeWindow(EGLNativeWindowType window) const override;
DeviceImpl *createDevice() override;
egl::Error waitClient(const gl::Context *context) override;
egl::Error waitNative(const gl::Context *context, EGLint engine) override;
gl::Version getMaxSupportedESVersion() const override;
void initializeFrontendFeatures(angle::FrontendFeatures *features) const override;
void populateFeatureList(angle::FeatureList *features) override;
protected: protected:
egl::Error initializeContext(EGLContext shareContext, egl::Error initializeContext(EGLContext shareContext,
const egl::AttributeMap &eglAttributes, const egl::AttributeMap &eglAttributes,
...@@ -49,13 +85,30 @@ class DisplayEGL : public DisplayGL ...@@ -49,13 +85,30 @@ class DisplayEGL : public DisplayGL
void generateExtensions(egl::DisplayExtensions *outExtensions) const override; void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
egl::Error makeCurrentSurfaceless(gl::Context *context) override;
template <typename T>
void getConfigAttrib(EGLConfig config, EGLint attribute, T *value) const;
template <typename T, typename U>
void getConfigAttribIfExtension(EGLConfig config,
EGLint attribute,
T *value,
const char *extension,
const U &defaultValue) const;
std::shared_ptr<RendererEGL> mRenderer;
FunctionsEGL *mEGL; FunctionsEGL *mEGL;
EGLConfig mConfig; EGLConfig mConfig;
egl::AttributeMap mDisplayAttributes;
std::vector<EGLint> mConfigAttribList;
private: private:
void generateCaps(egl::Caps *outCaps) const override; void generateCaps(egl::Caps *outCaps) const override;
std::map<EGLint, EGLint> mConfigIds;
}; };
} // namespace rx } // namespace rx
#endif /* LIBANGLE_RENDERER_GL_EGL_DISPLAYEGL_H_ */ #endif // LIBANGLE_RENDERER_GL_EGL_DISPLAYEGL_H_
...@@ -19,9 +19,8 @@ ...@@ -19,9 +19,8 @@
#include "libANGLE/renderer/gl/RendererGL.h" #include "libANGLE/renderer/gl/RendererGL.h"
#include "libANGLE/renderer/gl/egl/ContextEGL.h" #include "libANGLE/renderer/gl/egl/ContextEGL.h"
#include "libANGLE/renderer/gl/egl/FunctionsEGLDL.h" #include "libANGLE/renderer/gl/egl/FunctionsEGLDL.h"
#include "libANGLE/renderer/gl/egl/PbufferSurfaceEGL.h"
#include "libANGLE/renderer/gl/egl/RendererEGL.h" #include "libANGLE/renderer/gl/egl/RendererEGL.h"
#include "libANGLE/renderer/gl/egl/WindowSurfaceEGL.h" #include "libANGLE/renderer/gl/egl/SurfaceEGL.h"
#include "libANGLE/renderer/gl/egl/android/NativeBufferImageSiblingAndroid.h" #include "libANGLE/renderer/gl/egl/android/NativeBufferImageSiblingAndroid.h"
#include "libANGLE/renderer/gl/renderergl_utils.h" #include "libANGLE/renderer/gl/renderergl_utils.h"
...@@ -200,52 +199,6 @@ void DisplayAndroid::terminate() ...@@ -200,52 +199,6 @@ void DisplayAndroid::terminate()
SafeDelete(mEGL); SafeDelete(mEGL);
} }
SurfaceImpl *DisplayAndroid::createWindowSurface(const egl::SurfaceState &state,
EGLNativeWindowType window,
const egl::AttributeMap &attribs)
{
EGLConfig config;
EGLint numConfig;
EGLBoolean success;
const EGLint configAttribList[] = {EGL_CONFIG_ID, mConfigIds[state.config->configID], EGL_NONE};
success = mEGL->chooseConfig(configAttribList, &config, 1, &numConfig);
ASSERT(success && numConfig == 1);
return new WindowSurfaceEGL(state, mEGL, config, window);
}
SurfaceImpl *DisplayAndroid::createPbufferSurface(const egl::SurfaceState &state,
const egl::AttributeMap &attribs)
{
EGLConfig config;
EGLint numConfig;
EGLBoolean success;
const EGLint configAttribList[] = {EGL_CONFIG_ID, mConfigIds[state.config->configID], EGL_NONE};
success = mEGL->chooseConfig(configAttribList, &config, 1, &numConfig);
ASSERT(success && numConfig == 1);
return new PbufferSurfaceEGL(state, mEGL, config);
}
SurfaceImpl *DisplayAndroid::createPbufferFromClientBuffer(const egl::SurfaceState &state,
EGLenum buftype,
EGLClientBuffer clientBuffer,
const egl::AttributeMap &attribs)
{
UNIMPLEMENTED();
return nullptr;
}
SurfaceImpl *DisplayAndroid::createPixmapSurface(const egl::SurfaceState &state,
NativePixmapType nativePixmap,
const egl::AttributeMap &attribs)
{
UNIMPLEMENTED();
return nullptr;
}
ContextImpl *DisplayAndroid::createContext(const gl::State &state, ContextImpl *DisplayAndroid::createContext(const gl::State &state,
gl::ErrorSet *errorSet, gl::ErrorSet *errorSet,
const egl::Config *configuration, const egl::Config *configuration,
...@@ -280,173 +233,6 @@ ContextImpl *DisplayAndroid::createContext(const gl::State &state, ...@@ -280,173 +233,6 @@ ContextImpl *DisplayAndroid::createContext(const gl::State &state,
return new ContextEGL(state, errorSet, renderer); return new ContextEGL(state, errorSet, renderer);
} }
template <typename T>
void DisplayAndroid::getConfigAttrib(EGLConfig config, EGLint attribute, T *value) const
{
EGLint tmp;
EGLBoolean success = mEGL->getConfigAttrib(config, attribute, &tmp);
ASSERT(success == EGL_TRUE);
*value = tmp;
}
template <typename T, typename U>
void DisplayAndroid::getConfigAttribIfExtension(EGLConfig config,
EGLint attribute,
T *value,
const char *extension,
const U &defaultValue) const
{
if (mEGL->hasExtension(extension))
{
getConfigAttrib(config, attribute, value);
}
else
{
*value = static_cast<T>(defaultValue);
}
}
egl::ConfigSet DisplayAndroid::generateConfigs()
{
egl::ConfigSet configSet;
mConfigIds.clear();
EGLint numConfigs;
EGLBoolean success = mEGL->chooseConfig(mConfigAttribList.data(), nullptr, 0, &numConfigs);
ASSERT(success == EGL_TRUE && numConfigs > 0);
std::vector<EGLConfig> configs(numConfigs);
EGLint numConfigs2;
success =
mEGL->chooseConfig(mConfigAttribList.data(), configs.data(), numConfigs, &numConfigs2);
ASSERT(success == EGL_TRUE && numConfigs2 == numConfigs);
for (int i = 0; i < numConfigs; i++)
{
egl::Config config;
getConfigAttrib(configs[i], EGL_BUFFER_SIZE, &config.bufferSize);
getConfigAttrib(configs[i], EGL_RED_SIZE, &config.redSize);
getConfigAttrib(configs[i], EGL_GREEN_SIZE, &config.greenSize);
getConfigAttrib(configs[i], EGL_BLUE_SIZE, &config.blueSize);
getConfigAttrib(configs[i], EGL_LUMINANCE_SIZE, &config.luminanceSize);
getConfigAttrib(configs[i], EGL_ALPHA_SIZE, &config.alphaSize);
getConfigAttrib(configs[i], EGL_ALPHA_MASK_SIZE, &config.alphaMaskSize);
getConfigAttrib(configs[i], EGL_BIND_TO_TEXTURE_RGB, &config.bindToTextureRGB);
getConfigAttrib(configs[i], EGL_BIND_TO_TEXTURE_RGBA, &config.bindToTextureRGBA);
getConfigAttrib(configs[i], EGL_COLOR_BUFFER_TYPE, &config.colorBufferType);
getConfigAttrib(configs[i], EGL_CONFIG_CAVEAT, &config.configCaveat);
getConfigAttrib(configs[i], EGL_CONFIG_ID, &config.configID);
getConfigAttrib(configs[i], EGL_CONFORMANT, &config.conformant);
getConfigAttrib(configs[i], EGL_DEPTH_SIZE, &config.depthSize);
getConfigAttrib(configs[i], EGL_LEVEL, &config.level);
getConfigAttrib(configs[i], EGL_MAX_PBUFFER_WIDTH, &config.maxPBufferWidth);
getConfigAttrib(configs[i], EGL_MAX_PBUFFER_HEIGHT, &config.maxPBufferHeight);
getConfigAttrib(configs[i], EGL_MAX_PBUFFER_PIXELS, &config.maxPBufferPixels);
getConfigAttrib(configs[i], EGL_MAX_SWAP_INTERVAL, &config.maxSwapInterval);
getConfigAttrib(configs[i], EGL_MIN_SWAP_INTERVAL, &config.minSwapInterval);
getConfigAttrib(configs[i], EGL_NATIVE_RENDERABLE, &config.nativeRenderable);
getConfigAttrib(configs[i], EGL_NATIVE_VISUAL_ID, &config.nativeVisualID);
getConfigAttrib(configs[i], EGL_NATIVE_VISUAL_TYPE, &config.nativeVisualType);
getConfigAttrib(configs[i], EGL_RENDERABLE_TYPE, &config.renderableType);
getConfigAttrib(configs[i], EGL_SAMPLE_BUFFERS, &config.sampleBuffers);
getConfigAttrib(configs[i], EGL_SAMPLES, &config.samples);
getConfigAttrib(configs[i], EGL_STENCIL_SIZE, &config.stencilSize);
getConfigAttrib(configs[i], EGL_SURFACE_TYPE, &config.surfaceType);
getConfigAttrib(configs[i], EGL_TRANSPARENT_TYPE, &config.transparentType);
getConfigAttrib(configs[i], EGL_TRANSPARENT_RED_VALUE, &config.transparentRedValue);
getConfigAttrib(configs[i], EGL_TRANSPARENT_GREEN_VALUE, &config.transparentGreenValue);
getConfigAttrib(configs[i], EGL_TRANSPARENT_BLUE_VALUE, &config.transparentBlueValue);
getConfigAttribIfExtension(configs[i], EGL_COLOR_COMPONENT_TYPE_EXT,
&config.colorComponentType, "EGL_EXT_pixel_format_float",
EGL_COLOR_COMPONENT_TYPE_FIXED_EXT);
if (config.colorBufferType == EGL_RGB_BUFFER)
{
ASSERT(config.colorComponentType == EGL_COLOR_COMPONENT_TYPE_FIXED_EXT);
if (config.redSize == 8 && config.greenSize == 8 && config.blueSize == 8 &&
config.alphaSize == 8)
{
config.renderTargetFormat = GL_RGBA8;
}
else if (config.redSize == 8 && config.greenSize == 8 && config.blueSize == 8 &&
config.alphaSize == 0)
{
config.renderTargetFormat = GL_RGB8;
}
else if (config.redSize == 5 && config.greenSize == 6 && config.blueSize == 5 &&
config.alphaSize == 0)
{
config.renderTargetFormat = GL_RGB565;
}
else if (config.redSize == 5 && config.greenSize == 5 && config.blueSize == 5 &&
config.alphaSize == 1)
{
config.renderTargetFormat = GL_RGB5_A1;
}
else if (config.redSize == 4 && config.greenSize == 4 && config.blueSize == 4 &&
config.alphaSize == 4)
{
config.renderTargetFormat = GL_RGBA4;
}
else
{
ERR() << "RGBA(" << config.redSize << "," << config.greenSize << ","
<< config.blueSize << "," << config.alphaSize << ") not handled";
UNREACHABLE();
}
}
else
{
UNREACHABLE();
}
if (config.depthSize == 0 && config.stencilSize == 0)
{
config.depthStencilFormat = GL_ZERO;
}
else if (config.depthSize == 16 && config.stencilSize == 0)
{
config.depthStencilFormat = GL_DEPTH_COMPONENT16;
}
else if (config.depthSize == 24 && config.stencilSize == 0)
{
config.depthStencilFormat = GL_DEPTH_COMPONENT24;
}
else if (config.depthSize == 24 && config.stencilSize == 8)
{
config.depthStencilFormat = GL_DEPTH24_STENCIL8;
}
else if (config.depthSize == 0 && config.stencilSize == 8)
{
config.depthStencilFormat = GL_STENCIL_INDEX8;
}
else
{
UNREACHABLE();
}
config.matchNativePixmap = EGL_NONE;
config.optimalOrientation = 0;
int internalId = configSet.add(config);
mConfigIds[internalId] = config.configID;
}
return configSet;
}
bool DisplayAndroid::testDeviceLost()
{
return false;
}
egl::Error DisplayAndroid::restoreLostDevice(const egl::Display *display)
{
UNIMPLEMENTED();
return egl::NoError();
}
bool DisplayAndroid::isValidNativeWindow(EGLNativeWindowType window) const bool DisplayAndroid::isValidNativeWindow(EGLNativeWindowType window) const
{ {
return ANativeWindow_getFormat(window) >= 0; return ANativeWindow_getFormat(window) >= 0;
...@@ -483,24 +269,6 @@ ExternalImageSiblingImpl *DisplayAndroid::createExternalImageSibling( ...@@ -483,24 +269,6 @@ ExternalImageSiblingImpl *DisplayAndroid::createExternalImageSibling(
} }
} }
DeviceImpl *DisplayAndroid::createDevice()
{
UNIMPLEMENTED();
return nullptr;
}
egl::Error DisplayAndroid::waitClient(const gl::Context *context)
{
UNIMPLEMENTED();
return egl::NoError();
}
egl::Error DisplayAndroid::waitNative(const gl::Context *context, EGLint engine)
{
UNIMPLEMENTED();
return egl::NoError();
}
egl::Error DisplayAndroid::makeCurrent(egl::Surface *drawSurface, egl::Error DisplayAndroid::makeCurrent(egl::Surface *drawSurface,
egl::Surface *readSurface, egl::Surface *readSurface,
gl::Context *context) gl::Context *context)
...@@ -560,14 +328,9 @@ egl::Error DisplayAndroid::makeCurrent(egl::Surface *drawSurface, ...@@ -560,14 +328,9 @@ egl::Error DisplayAndroid::makeCurrent(egl::Surface *drawSurface,
return DisplayGL::makeCurrent(drawSurface, readSurface, context); return DisplayGL::makeCurrent(drawSurface, readSurface, context);
} }
gl::Version DisplayAndroid::getMaxSupportedESVersion() const
{
return mRenderer->getMaxSupportedESVersion();
}
void DisplayAndroid::destroyNativeContext(EGLContext context) void DisplayAndroid::destroyNativeContext(EGLContext context)
{ {
mEGL->destroyContext(context); DisplayEGL::destroyNativeContext(context);
// If this context is current, remove it from the tracking of current contexts to make sure we // If this context is current, remove it from the tracking of current contexts to make sure we
// don't try to make it current again. // don't try to make it current again.
...@@ -590,13 +353,6 @@ void DisplayAndroid::generateExtensions(egl::DisplayExtensions *outExtensions) c ...@@ -590,13 +353,6 @@ void DisplayAndroid::generateExtensions(egl::DisplayExtensions *outExtensions) c
DisplayEGL::generateExtensions(outExtensions); DisplayEGL::generateExtensions(outExtensions);
} }
egl::Error DisplayAndroid::makeCurrentSurfaceless(gl::Context *context)
{
// Nothing to do because EGL always uses the same context and the previous surface can be left
// current.
return egl::NoError();
}
egl::Error DisplayAndroid::createRenderer(EGLContext shareContext, egl::Error DisplayAndroid::createRenderer(EGLContext shareContext,
bool makeNewContextCurrent, bool makeNewContextCurrent,
std::shared_ptr<RendererEGL> *outRenderer) std::shared_ptr<RendererEGL> *outRenderer)
...@@ -690,14 +446,4 @@ WorkerContext *DisplayAndroid::createWorkerContext(std::string *infoLog, ...@@ -690,14 +446,4 @@ WorkerContext *DisplayAndroid::createWorkerContext(std::string *infoLog,
return new WorkerContextAndroid(context, mEGL, mDummyPbuffer); return new WorkerContextAndroid(context, mEGL, mDummyPbuffer);
} }
void DisplayAndroid::initializeFrontendFeatures(angle::FrontendFeatures *features) const
{
mRenderer->initializeFrontendFeatures(features);
}
void DisplayAndroid::populateFeatureList(angle::FeatureList *features)
{
mRenderer->getFeatures().populateFeatureList(features);
}
} // namespace rx } // namespace rx
...@@ -30,30 +30,12 @@ class DisplayAndroid : public DisplayEGL ...@@ -30,30 +30,12 @@ class DisplayAndroid : public DisplayEGL
egl::Error initialize(egl::Display *display) override; egl::Error initialize(egl::Display *display) override;
void terminate() override; void terminate() override;
SurfaceImpl *createWindowSurface(const egl::SurfaceState &state,
EGLNativeWindowType window,
const egl::AttributeMap &attribs) override;
SurfaceImpl *createPbufferSurface(const egl::SurfaceState &state,
const egl::AttributeMap &attribs) override;
SurfaceImpl *createPbufferFromClientBuffer(const egl::SurfaceState &state,
EGLenum buftype,
EGLClientBuffer clientBuffer,
const egl::AttributeMap &attribs) override;
SurfaceImpl *createPixmapSurface(const egl::SurfaceState &state,
NativePixmapType nativePixmap,
const egl::AttributeMap &attribs) override;
ContextImpl *createContext(const gl::State &state, ContextImpl *createContext(const gl::State &state,
gl::ErrorSet *errorSet, gl::ErrorSet *errorSet,
const egl::Config *configuration, const egl::Config *configuration,
const gl::Context *shareContext, const gl::Context *shareContext,
const egl::AttributeMap &attribs) override; const egl::AttributeMap &attribs) override;
egl::ConfigSet generateConfigs() override;
bool testDeviceLost() override;
egl::Error restoreLostDevice(const egl::Display *display) override;
bool isValidNativeWindow(EGLNativeWindowType window) const override; bool isValidNativeWindow(EGLNativeWindowType window) const override;
egl::Error validateImageClientBuffer(const gl::Context *context, egl::Error validateImageClientBuffer(const gl::Context *context,
EGLenum target, EGLenum target,
...@@ -65,27 +47,16 @@ class DisplayAndroid : public DisplayEGL ...@@ -65,27 +47,16 @@ class DisplayAndroid : public DisplayEGL
EGLClientBuffer buffer, EGLClientBuffer buffer,
const egl::AttributeMap &attribs) override; const egl::AttributeMap &attribs) override;
DeviceImpl *createDevice() override;
egl::Error waitClient(const gl::Context *context) override;
egl::Error waitNative(const gl::Context *context, EGLint engine) override;
egl::Error makeCurrent(egl::Surface *drawSurface, egl::Error makeCurrent(egl::Surface *drawSurface,
egl::Surface *readSurface, egl::Surface *readSurface,
gl::Context *context) override; gl::Context *context) override;
gl::Version getMaxSupportedESVersion() const override;
void destroyNativeContext(EGLContext context) override; void destroyNativeContext(EGLContext context) override;
WorkerContext *createWorkerContext(std::string *infoLog, WorkerContext *createWorkerContext(std::string *infoLog,
EGLContext sharedContext, EGLContext sharedContext,
const native_egl::AttributeVector workerAttribs) override; const native_egl::AttributeVector workerAttribs) override;
void initializeFrontendFeatures(angle::FrontendFeatures *features) const override;
void populateFeatureList(angle::FeatureList *features) override;
private: private:
void generateExtensions(egl::DisplayExtensions *outExtensions) const override; void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
...@@ -93,27 +64,10 @@ class DisplayAndroid : public DisplayEGL ...@@ -93,27 +64,10 @@ class DisplayAndroid : public DisplayEGL
bool makeNewContextCurrent, bool makeNewContextCurrent,
std::shared_ptr<RendererEGL> *outRenderer); std::shared_ptr<RendererEGL> *outRenderer);
egl::Error makeCurrentSurfaceless(gl::Context *context) override;
template <typename T>
void getConfigAttrib(EGLConfig config, EGLint attribute, T *value) const;
template <typename T, typename U>
void getConfigAttribIfExtension(EGLConfig config,
EGLint attribute,
T *value,
const char *extension,
const U &defaultValue) const;
bool mVirtualizedContexts; bool mVirtualizedContexts;
std::shared_ptr<RendererEGL> mRenderer;
egl::AttributeMap mDisplayAttributes;
bool mSupportsSurfaceless; bool mSupportsSurfaceless;
std::vector<EGLint> mConfigAttribList;
std::map<EGLint, EGLint> mConfigIds;
EGLSurface mDummyPbuffer; EGLSurface mDummyPbuffer;
struct CurrentNativeContext struct CurrentNativeContext
......
...@@ -351,7 +351,6 @@ bool DisplayOzone::Buffer::createRenderbuffers() ...@@ -351,7 +351,6 @@ bool DisplayOzone::Buffer::createRenderbuffers()
DisplayOzone::DisplayOzone(const egl::DisplayState &state) DisplayOzone::DisplayOzone(const egl::DisplayState &state)
: DisplayEGL(state), : DisplayEGL(state),
mRenderer(nullptr),
mGBM(nullptr), mGBM(nullptr),
mConnector(nullptr), mConnector(nullptr),
mMode(nullptr), mMode(nullptr),
...@@ -911,23 +910,6 @@ SurfaceImpl *DisplayOzone::createPbufferSurface(const egl::SurfaceState &state, ...@@ -911,23 +910,6 @@ SurfaceImpl *DisplayOzone::createPbufferSurface(const egl::SurfaceState &state,
return new SurfaceOzone(state, buffer); return new SurfaceOzone(state, buffer);
} }
SurfaceImpl *DisplayOzone::createPbufferFromClientBuffer(const egl::SurfaceState &state,
EGLenum buftype,
EGLClientBuffer clientBuffer,
const egl::AttributeMap &attribs)
{
UNIMPLEMENTED();
return nullptr;
}
SurfaceImpl *DisplayOzone::createPixmapSurface(const egl::SurfaceState &state,
NativePixmapType nativePixmap,
const egl::AttributeMap &attribs)
{
UNIMPLEMENTED();
return nullptr;
}
ContextImpl *DisplayOzone::createContext(const gl::State &state, ContextImpl *DisplayOzone::createContext(const gl::State &state,
gl::ErrorSet *errorSet, gl::ErrorSet *errorSet,
const egl::Config *configuration, const egl::Config *configuration,
...@@ -938,12 +920,6 @@ ContextImpl *DisplayOzone::createContext(const gl::State &state, ...@@ -938,12 +920,6 @@ ContextImpl *DisplayOzone::createContext(const gl::State &state,
return new ContextEGL(state, errorSet, mRenderer); return new ContextEGL(state, errorSet, mRenderer);
} }
DeviceImpl *DisplayOzone::createDevice()
{
UNIMPLEMENTED();
return nullptr;
}
egl::ConfigSet DisplayOzone::generateConfigs() egl::ConfigSet DisplayOzone::generateConfigs()
{ {
egl::ConfigSet configs; egl::ConfigSet configs;
...@@ -965,44 +941,11 @@ egl::ConfigSet DisplayOzone::generateConfigs() ...@@ -965,44 +941,11 @@ egl::ConfigSet DisplayOzone::generateConfigs()
return configs; return configs;
} }
bool DisplayOzone::testDeviceLost()
{
return false;
}
egl::Error DisplayOzone::restoreLostDevice(const egl::Display *display)
{
UNIMPLEMENTED();
return egl::EglBadDisplay();
}
bool DisplayOzone::isValidNativeWindow(EGLNativeWindowType window) const bool DisplayOzone::isValidNativeWindow(EGLNativeWindowType window) const
{ {
return true; return true;
} }
egl::Error DisplayOzone::waitClient(const gl::Context *context)
{
// TODO(fjhenigman) Implement this.
return egl::NoError();
}
egl::Error DisplayOzone::waitNative(const gl::Context *context, EGLint engine)
{
// TODO(fjhenigman) Implement this.
return egl::NoError();
}
gl::Version DisplayOzone::getMaxSupportedESVersion() const
{
return mRenderer->getMaxSupportedESVersion();
}
void DisplayOzone::destroyNativeContext(EGLContext context)
{
mEGL->destroyContext(context);
}
void DisplayOzone::setSwapInterval(EGLSurface drawable, SwapControlData *data) void DisplayOzone::setSwapInterval(EGLSurface drawable, SwapControlData *data)
{ {
ASSERT(data != nullptr); ASSERT(data != nullptr);
...@@ -1016,12 +959,6 @@ void DisplayOzone::generateExtensions(egl::DisplayExtensions *outExtensions) con ...@@ -1016,12 +959,6 @@ void DisplayOzone::generateExtensions(egl::DisplayExtensions *outExtensions) con
DisplayEGL::generateExtensions(outExtensions); DisplayEGL::generateExtensions(outExtensions);
} }
egl::Error DisplayOzone::makeCurrentSurfaceless(gl::Context *context)
{
// Nothing to do, handled in the GL layers
return egl::NoError();
}
class WorkerContextOzone final : public WorkerContext class WorkerContextOzone final : public WorkerContext
{ {
public: public:
...@@ -1073,14 +1010,4 @@ WorkerContext *DisplayOzone::createWorkerContext(std::string *infoLog, ...@@ -1073,14 +1010,4 @@ WorkerContext *DisplayOzone::createWorkerContext(std::string *infoLog,
return new WorkerContextOzone(context, mEGL); return new WorkerContextOzone(context, mEGL);
} }
void DisplayOzone::initializeFrontendFeatures(angle::FrontendFeatures *features) const
{
mRenderer->initializeFrontendFeatures(features);
}
void DisplayOzone::populateFeatureList(angle::FeatureList *features)
{
mRenderer->getFeatures().populateFeatureList(features);
}
} // namespace rx } // namespace rx
...@@ -120,13 +120,6 @@ class DisplayOzone final : public DisplayEGL ...@@ -120,13 +120,6 @@ class DisplayOzone final : public DisplayEGL
const egl::AttributeMap &attribs) override; const egl::AttributeMap &attribs) override;
SurfaceImpl *createPbufferSurface(const egl::SurfaceState &state, SurfaceImpl *createPbufferSurface(const egl::SurfaceState &state,
const egl::AttributeMap &attribs) override; const egl::AttributeMap &attribs) override;
SurfaceImpl *createPbufferFromClientBuffer(const egl::SurfaceState &state,
EGLenum buftype,
EGLClientBuffer clientBuffer,
const egl::AttributeMap &attribs) override;
SurfaceImpl *createPixmapSurface(const egl::SurfaceState &state,
NativePixmapType nativePixmap,
const egl::AttributeMap &attribs) override;
ContextImpl *createContext(const gl::State &state, ContextImpl *createContext(const gl::State &state,
gl::ErrorSet *errorSet, gl::ErrorSet *errorSet,
...@@ -136,20 +129,8 @@ class DisplayOzone final : public DisplayEGL ...@@ -136,20 +129,8 @@ class DisplayOzone final : public DisplayEGL
egl::ConfigSet generateConfigs() override; egl::ConfigSet generateConfigs() override;
bool testDeviceLost() override;
egl::Error restoreLostDevice(const egl::Display *display) override;
bool isValidNativeWindow(EGLNativeWindowType window) const override; bool isValidNativeWindow(EGLNativeWindowType window) const override;
DeviceImpl *createDevice() override;
egl::Error waitClient(const gl::Context *context) override;
egl::Error waitNative(const gl::Context *context, EGLint engine) override;
gl::Version getMaxSupportedESVersion() const override;
void destroyNativeContext(EGLContext context) override;
// TODO(fjhenigman) Implement this. // TODO(fjhenigman) Implement this.
// Swap interval can be set globally or per drawable. // Swap interval can be set globally or per drawable.
// This function will make sure the drawable's swap interval is the // This function will make sure the drawable's swap interval is the
...@@ -160,15 +141,9 @@ class DisplayOzone final : public DisplayEGL ...@@ -160,15 +141,9 @@ class DisplayOzone final : public DisplayEGL
EGLContext sharedContext, EGLContext sharedContext,
const native_egl::AttributeVector workerAttribs) override; const native_egl::AttributeVector workerAttribs) override;
void initializeFrontendFeatures(angle::FrontendFeatures *features) const override;
void populateFeatureList(angle::FeatureList *features) override;
private: private:
void generateExtensions(egl::DisplayExtensions *outExtensions) const override; void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
egl::Error makeCurrentSurfaceless(gl::Context *context) override;
GLuint makeShader(GLuint type, const char *src); GLuint makeShader(GLuint type, const char *src);
void drawBuffer(const gl::Context *context, Buffer *buffer); void drawBuffer(const gl::Context *context, Buffer *buffer);
void drawWithTexture(const gl::Context *context, Buffer *buffer); void drawWithTexture(const gl::Context *context, Buffer *buffer);
...@@ -182,8 +157,6 @@ class DisplayOzone final : public DisplayEGL ...@@ -182,8 +157,6 @@ class DisplayOzone final : public DisplayEGL
void *data); void *data);
void pageFlipHandler(unsigned int sequence, uint64_t tv); void pageFlipHandler(unsigned int sequence, uint64_t tv);
std::shared_ptr<RendererEGL> mRenderer;
gbm_device *mGBM; gbm_device *mGBM;
drmModeConnectorPtr mConnector; drmModeConnectorPtr mConnector;
drmModeModeInfoPtr mMode; drmModeModeInfoPtr mMode;
......
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