diff options
author | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-01-19 21:24:50 -0500 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-12-03 09:17:19 -0500 |
commit | a7c7152b054e6d2b9af36ed9db9a0df44731b279 (patch) | |
tree | f7cd2cce7bbafda6dea8e1f1459b5886c689a8c7 | |
parent | 28ae862c37f6874ba77e2f12642d286ac1ce7d9d (diff) | |
download | waffle-a7c7152b054e6d2b9af36ed9db9a0df44731b279.tar.gz |
remove NaCL backend
35 files changed, 17 insertions, 1723 deletions
diff --git a/Options.cmake b/Options.cmake index 8f9439e..f6ddcf8 100644 --- a/Options.cmake +++ b/Options.cmake @@ -31,11 +31,6 @@ if(waffle_on_linux) option(waffle_has_x11_egl "Build support for X11/EGL" ${x11_egl_default}) option(waffle_has_gbm "Build support for GBM" ${gbm_default}) option(waffle_has_surfaceless_egl "Build support for EGL_MESA_platform_surfaceless" ${surfaceless_egl_default}) - option(waffle_has_nacl "Build support for NaCl" OFF) - - # NaCl specific settings. - set(nacl_sdk_path "" CACHE STRING "Set nacl_sdk path here") - set(nacl_version "pepper_39" CACHE STRING "Set NaCl bundle here") endif() option(waffle_build_tests "Build tests" ON) diff --git a/cmake/Modules/WaffleDefineCompilerFlags.cmake b/cmake/Modules/WaffleDefineCompilerFlags.cmake index 6100ab4..74d2581 100644 --- a/cmake/Modules/WaffleDefineCompilerFlags.cmake +++ b/cmake/Modules/WaffleDefineCompilerFlags.cmake @@ -45,16 +45,13 @@ if (NOT MSVC) # enough for single-stepping. set(CMAKE_C_FLAGS_RELEASE "-g1 -O2 -DNDEBUG") - # These are disabled for NaCl because compilation against ppapi_simple would fail. - if(NOT waffle_has_nacl) - waffle_add_c_flag("-Werror=implicit-function-declaration" WERROR_IMPLICIT_FUNCTION_DECLARATION) - waffle_add_c_flag("-fvisibility=hidden" WITH_VISIBILITY_HIDDEN) - endif() + waffle_add_c_flag("-Werror=implicit-function-declaration" WERROR_IMPLICIT_FUNCTION_DECLARATION) + waffle_add_c_flag("-fvisibility=hidden" WITH_VISIBILITY_HIDDEN) waffle_add_c_flag("-Werror=incompatible-pointer-types" WERROR_INCOMPATIBLE_POINTER_TYPES) waffle_add_c_flag("-Werror=int-conversion" WERROR_INT_CONVERSION) - if(waffle_on_linux AND NOT waffle_has_nacl) + if(waffle_on_linux) # On MacOS, the SSE2 headers trigger this error. waffle_add_c_flag("-Werror=missing-prototypes" WERROR_MISSING_PROTOTYPES) endif() @@ -139,10 +136,6 @@ if(waffle_on_linux) add_definitions(-D_XOPEN_SOURCE=700) endif() -if(waffle_has_nacl) - add_definitions(-DWAFFLE_HAS_NACL) -endif() - if(waffle_on_windows) add_definitions(-DWAFFLE_HAS_WGL) endif() diff --git a/cmake/Modules/WaffleValidateOptions.cmake b/cmake/Modules/WaffleValidateOptions.cmake index 1409d96..006814b 100644 --- a/cmake/Modules/WaffleValidateOptions.cmake +++ b/cmake/Modules/WaffleValidateOptions.cmake @@ -47,39 +47,12 @@ endif() if(waffle_on_linux) if(NOT waffle_has_glx AND NOT waffle_has_wayland AND NOT waffle_has_x11_egl AND NOT waffle_has_gbm AND - NOT waffle_has_surfaceless_egl AND - NOT waffle_has_nacl) + NOT waffle_has_surfaceless_egl) message(FATAL_ERROR "Must enable at least one of: " "waffle_has_glx, waffle_has_wayland, " "waffle_has_x11_egl, waffle_has_gbm, " - "waffle_has_surfaceless_egl, " - "waffle_has_nacl") - endif() - if(waffle_has_nacl) - if(NOT EXISTS ${nacl_sdk_path}) - message(FATAL_ERROR "NaCl SDK path not found : ${nacl_sdk_path}") - endif() - - if(NOT EXISTS ${CMAKE_TOOLCHAIN_FILE}) - message(FATAL_ERROR "Toolchain for Nacl not found. This must be " - "configured using CMAKE_TOOLCHAIN_FILE.") - endif() - - # Warn the user that building tests is disabled. - if(waffle_build_tests) - message(WARNING "Building the tests with the NaCl backend " - "is not supported, skipping tests.") - set(waffle_build_tests OFF) - endif() - - # When building for NaCl, disable incompatible backends. - set(waffle_has_gbm OFF) - set(waffle_has_egl OFF) - set(waffle_has_glx OFF) - set(waffle_has_x11 OFF) - set(waffle_has_x11_egl OFF) - set(waffle_has_wayland OFF) + "waffle_has_surfaceless_egl") endif() if(waffle_has_gbm) if(NOT gbm_FOUND) diff --git a/cmake/toolchain-nacl-x86_32-glibc.cmake b/cmake/toolchain-nacl-x86_32-glibc.cmake deleted file mode 100644 index ec5779f..0000000 --- a/cmake/toolchain-nacl-x86_32-glibc.cmake +++ /dev/null @@ -1,41 +0,0 @@ -# -# NaCl toolchain file for 32bit x86 using glibc C library -# - -if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") - set(CMAKE_SYSTEM_NAME "Linux") - set(nacl_host_os "linux") -else() - message(FATAL_ERROR "TODO: NaCl support on ${CMAKE_HOST_SYSTEM_NAME}") -endif() - -set(nacl_target_arch "i686") -set(nacl_ports "glibc_x86_32") -set(nacl_toolchain "${nacl_host_os}_x86_glibc") - -# setup paths for nacl -set(nacl_root ${nacl_sdk_path}/${nacl_version}) -set(nacl_toolpath ${nacl_root}/toolchain/${nacl_toolchain}/bin) - -# setup compilers from toolchain -set(CMAKE_C_COMPILER ${nacl_toolpath}/${nacl_target_arch}-nacl-gcc) -set(CMAKE_CXX_COMPILER ${nacl_toolpath}/${nacl_target_arch}-nacl-g++) - -set(CMAKE_FIND_ROOT_PATH ${nacl_root}) - -# for FIND_LIBRARY|INCLUDE use ${nacl_root} only, -# for helper programs during build time, use host -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) - -# setup nacl includes and required libraries -set(nacl_INCLUDE_DIRS ${nacl_INCLUDE_DIRS} ${nacl_sdk_path}/${nacl_version}/include) -set(nacl_LIBS ${nacl_sdk_path}/${nacl_version}/lib/${nacl_ports}/${CMAKE_BUILD_TYPE}) -set(nacl_LDFLAGS - -L${nacl_LIBS} - -lppapi_cpp - -lppapi - -lpthread - -ldl - ) diff --git a/cmake/toolchain-nacl-x86_64-glibc.cmake b/cmake/toolchain-nacl-x86_64-glibc.cmake deleted file mode 100644 index f3109ab..0000000 --- a/cmake/toolchain-nacl-x86_64-glibc.cmake +++ /dev/null @@ -1,41 +0,0 @@ -# -# NaCl toolchain file for 64bit x86 using glibc C library -# - -if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") - set(CMAKE_SYSTEM_NAME "Linux") - set(nacl_host_os "linux") -else() - message(FATAL_ERROR "TODO: NaCl support on ${CMAKE_HOST_SYSTEM_NAME}") -endif() - -set(nacl_target_arch "x86_64") -set(nacl_ports "glibc_x86_64") -set(nacl_toolchain "${nacl_host_os}_x86_glibc") - -# setup paths for nacl -set(nacl_root ${nacl_sdk_path}/${nacl_version}) -set(nacl_toolpath ${nacl_root}/toolchain/${nacl_toolchain}/bin) - -# setup compilers from toolchain -set(CMAKE_C_COMPILER ${nacl_toolpath}/${nacl_target_arch}-nacl-gcc) -set(CMAKE_CXX_COMPILER ${nacl_toolpath}/${nacl_target_arch}-nacl-g++) - -set(CMAKE_FIND_ROOT_PATH ${nacl_root}) - -# for FIND_LIBRARY|INCLUDE use ${nacl_root} only, -# for helper programs during build time, use host -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) - -# setup nacl includes and required libraries -set(nacl_INCLUDE_DIRS ${nacl_INCLUDE_DIRS} ${nacl_sdk_path}/${nacl_version}/include) -set(nacl_LIBS ${nacl_sdk_path}/${nacl_version}/lib/${nacl_ports}/${CMAKE_BUILD_TYPE}) -set(nacl_LDFLAGS - -L${nacl_LIBS} - -lppapi_cpp - -lppapi - -lpthread - -ldl - ) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 31a909b..c700a72 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -17,59 +17,9 @@ if(waffle_on_linux AND waffle_has_x11_egl) endif() # ---------------------------------------------------------------------------- -# Target: gl_basic_nacl (executable + JSON manifest file) -# ---------------------------------------------------------------------------- -if (waffle_has_nacl) - add_executable(gl_basic_nacl.nexe gl_basic.c) - include_directories(${nacl_INCLUDE_DIRS}) - - # Set path where to create and copy required files. - set(nacl_example_path ${PROJECT_SOURCE_DIR}/html/gl_basic_nacl) - - file(MAKE_DIRECTORY ${nacl_example_path}) - - set_target_properties(gl_basic_nacl.nexe - PROPERTIES - RUNTIME_OUTPUT_DIRECTORY ${nacl_example_path} - ) - - target_link_libraries(gl_basic_nacl.nexe - ${waffle_libname} - ${nacl_LDFLAGS} - -lppapi_simple - -lnacl_io - ) - - # Create .nmf file that contains JSON manifest for the .nexe required by NaCl - # NOTE, this serves as example only and user might need to recreate nmf file - # suitable for the used environment. Extra entry for libppapi_gles2.so is added - # because we are not linking with it but require its presence during execution. - # --no-arch-prefix is used because '-x' has no option to set architecture for - # the extra entry. - add_custom_command( - OUTPUT gl_basic_nacl.nmf - COMMAND ${nacl_root}/tools/create_nmf.py --no-arch-prefix -x libppapi_gles2.so:libppapi_gles2.so -L${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ${nacl_example_path}/gl_basic_nacl.nexe -o ${nacl_example_path}/gl_basic_nacl.nmf - DEPENDS gl_basic_nacl.nexe - COMMENT "Create JSON manifest" - VERBATIM - ) - - add_custom_target(gl_basic_create_json_manifest ALL - DEPENDS gl_basic_nacl.nmf) - - # install index.html that loads gl_basic_nacl.nmf - file(INSTALL index.html DESTINATION ${nacl_example_path}) - -endif() - -# ---------------------------------------------------------------------------- # Target: gl_basic (executable) # ---------------------------------------------------------------------------- -if(waffle_has_nacl) - return() -endif() - add_executable(gl_basic gl_basic.c) target_link_libraries(gl_basic ${waffle_libname} ${GETOPT_LIBRARIES}) diff --git a/examples/gl_basic.c b/examples/gl_basic.c index ae952c6..e17042b 100644 --- a/examples/gl_basic.c +++ b/examples/gl_basic.c @@ -613,18 +613,9 @@ main(int argc, char **argv) cocoa_init(); #endif - #ifdef __native_client__ - // Fixed arguments for native client. - opts.context_api = WAFFLE_CONTEXT_OPENGL_ES2; - opts.platform = WAFFLE_PLATFORM_NACL; - opts.dl = WAFFLE_DL_OPENGL_ES2; - opts.context_profile = WAFFLE_NONE; - opts.context_version = -1; - #else ok = parse_args(argc, argv, &opts); if (!ok) exit(EXIT_FAILURE); - #endif i = 0; init_attrib_list[i++] = WAFFLE_PLATFORM; diff --git a/examples/index.html b/examples/index.html deleted file mode 100644 index ee57fef..0000000 --- a/examples/index.html +++ /dev/null @@ -1,43 +0,0 @@ -<!-- -// Copyright 2014 Intel Corporation -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---> - -<!DOCTYPE html> -<html> -<head> - <title>Waffle NaCl example</title> -</head> - -<body> - <!-- - NOTE - The example .nmf file makes assumption that required - libraries exist within same directory as the executable. If - this is not the case please recreate .nmf file suitable for - your environment. - --> - <embed id="waffle" src="gl_basic_nacl.nmf" type="application/x-nacl"/> -</body> -</html> diff --git a/examples/meson.build b/examples/meson.build index 68153ec..641a2d3 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -36,7 +36,6 @@ if build_x11_egl ) endif -# TODO: nacl if build_cgl # We need to force wflinfo.c to be compiled as if it were objc, to do that we # copy it into the build directory as a .m file diff --git a/include/waffle-1/waffle.h b/include/waffle-1/waffle.h index 0aa0d3a..71b829b 100644 --- a/include/waffle-1/waffle.h +++ b/include/waffle-1/waffle.h @@ -124,7 +124,6 @@ enum waffle_enum { WAFFLE_PLATFORM_X11_EGL = 0x0015, WAFFLE_PLATFORM_GBM = 0x0016, WAFFLE_PLATFORM_WGL = 0x0017, - WAFFLE_PLATFORM_NACL = 0x0018, WAFFLE_PLATFORM_SURFACELESS_EGL = 0x0019, // ------------------------------------------------------------------ diff --git a/man/waffle_init.3.xml b/man/waffle_init.3.xml index e443060..67acfdb 100644 --- a/man/waffle_init.3.xml +++ b/man/waffle_init.3.xml @@ -122,14 +122,6 @@ </listitem> </varlistentry> <varlistentry> - <term><constant>WAFFLE_PLATFORM_NACL</constant></term> - <listitem> - <para> - [Linux only, other systems not yet supported] - </para> - </listitem> - </varlistentry> - <varlistentry> <term><constant>WAFFLE_PLATFORM_SURFACELESS_EGL</constant></term> <listitem> <para> diff --git a/meson.build b/meson.build index 6c7da40..f80f401 100644 --- a/meson.build +++ b/meson.build @@ -42,14 +42,9 @@ build_wayland = false build_glx = false build_gbm = false build_surfaceless = false -build_nacl = get_option('nacl') build_wgl = ['windows', 'cygwin'].contains(host_machine.system()) build_cgl = host_machine.system() == 'darwin' -if build_nacl - add_languages('cpp') -endif - if build_cgl add_languages('objc') endif @@ -59,7 +54,6 @@ cc = meson.get_compiler('c') _dep_null = dependency('', required : false) dep_threads = dependency('threads') dep_dl = cc.find_library('dl', required : false) -dep_nacl = _dep_null dep_gl = _dep_null dep_drm = _dep_null dep_egl = _dep_null @@ -171,10 +165,6 @@ else endif endif -if build_nacl - add_project_arguments('-DWAFFLE_HAS_NACL', language : ['c', 'cpp']) -endif - if cc.get_argument_syntax() == 'gcc' if cc.compiles(''' static __thread int x; @@ -200,15 +190,6 @@ if cc.get_argument_syntax() == 'gcc' add_project_arguments('-D_XOPEN_SOURCE=700', language : ['c', 'cpp']) - if not build_nacl - add_project_arguments( - cc.get_supported_arguments([ - '-Werror=implicit-function-declaration', - ]), - language : ['c', 'cpp'], - ) - endif - add_project_arguments( cc.get_supported_arguments([ '-Wno-unused-parameter', @@ -227,7 +208,7 @@ if cc.get_argument_syntax() == 'gcc' ]), language : ['c', 'cpp'], ) - + if host_machine.system() == 'windows' if cc.has_argument('-static-libgcc') add_project_link_arguments('-static-libgcc', language : ['c', 'cpp']) @@ -251,10 +232,6 @@ elif cc.get_argument_syntax() == 'msvc' ] endif -if build_nacl - add_project_arguments('-DWAFFLE_HAS_NACL', language : ['c', 'cpp']) -endif - install_data('README.md', 'LICENSE.txt', 'HACKING.txt', install_dir : docdir) install_subdir('doc/release-notes', install_dir : docdir) diff --git a/meson_options.txt b/meson_options.txt index 49dcb5b..6138053 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -51,24 +51,6 @@ option( description : 'Build support for EGL_MESA_platform_surfaceless' ) -# Options specifically for ChromeOS -option( - 'nacl', - type : 'boolean', - value : false, - description : 'Build support for ChromeOS NaCl' -) -option( - 'nacl_sdk_path', - type : 'string', - description : 'Path for NaCl SDK') -option( - 'nacl_version', - type : 'string', - value : 'pepper_39', - description : 'Version of NaCL' -) - # Misc Options option( 'build-tests', diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index 22edc6e..9cb6cc7 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -2,10 +2,6 @@ # Target: wflinfo (executable) # ---------------------------------------------------------------------------- -if(waffle_has_nacl) - return() -endif() - add_executable(wflinfo wflinfo.c) target_link_libraries(wflinfo ${waffle_libname} ${GETOPT_LIBRARIES}) diff --git a/src/utils/meson.build b/src/utils/meson.build index bb802d5..48c2c97 100644 --- a/src/utils/meson.build +++ b/src/utils/meson.build @@ -35,17 +35,15 @@ else files_wflinfo = files('wflinfo.c') endif -if not build_nacl - wflinfo = executable( - 'wflinfo', - files_wflinfo, - include_directories : [inc_waffle, inc_include], - link_with : libwaffle, - dependencies : [dep_cocoa, idep_getopt], - install : true, - ) +wflinfo = executable( + 'wflinfo', + files_wflinfo, + include_directories : [inc_waffle, inc_include], + link_with : libwaffle, + dependencies : [dep_cocoa, idep_getopt], + install : true, +) - if meson.version().version_compare('>= 0.46.0') - meson.override_find_program('wflinfo', wflinfo) - endif +if meson.version().version_compare('>= 0.46.0') + meson.override_find_program('wflinfo', wflinfo) endif diff --git a/src/waffle/CMakeLists.txt b/src/waffle/CMakeLists.txt index 6415ccf..a3e733f 100644 --- a/src/waffle/CMakeLists.txt +++ b/src/waffle/CMakeLists.txt @@ -15,7 +15,6 @@ include_directories( egl glx linux - nacl surfaceless_egl wayland wgl @@ -54,12 +53,6 @@ if(waffle_on_linux) endif() endif() -if(waffle_has_nacl) - list(APPEND waffle_libdeps - ${nacl_LDFLAGS} - ) -endif() - set(waffle_sources api/api_priv.c api/waffle_attrib_list.c @@ -207,20 +200,6 @@ if(waffle_on_windows) ) endif() -if(waffle_has_nacl) - list(APPEND waffle_sources - nacl/nacl_config.c - nacl/nacl_context.c - nacl/nacl_display.c - nacl/nacl_dl.c - nacl/nacl_platform.c - nacl/nacl_window.c - ) - list(APPEND waffle_cxx_sources - nacl/nacl_container.cpp - ) -endif() - # CMake will pass to the C compiler only C sources. CMake does not recognize the # .m extension and ignores any such files in the source lists. To coerce CMake # to pass .m files to the compiler, we must lie and claim that they are diff --git a/src/waffle/api/waffle_init.c b/src/waffle/api/waffle_init.c index c9a16cf..e2cd983 100644 --- a/src/waffle/api/waffle_init.c +++ b/src/waffle/api/waffle_init.c @@ -35,7 +35,6 @@ struct wcore_platform* wayland_platform_create(void); struct wcore_platform* xegl_platform_create(void); struct wcore_platform* wgbm_platform_create(void); struct wcore_platform* wgl_platform_create(void); -struct wcore_platform* nacl_platform_create(void); struct wcore_platform* sl_platform_create(void); static bool @@ -106,12 +105,6 @@ waffle_init_parse_attrib_list( CASE_UNDEFINED_PLATFORM(WGL) #endif -#ifdef WAFFLE_HAS_NACL - CASE_DEFINED_PLATFORM(NACL) -#else - CASE_UNDEFINED_PLATFORM(NACL) -#endif - #ifdef WAFFLE_HAS_SURFACELESS_EGL CASE_DEFINED_PLATFORM(SURFACELESS_EGL) #else @@ -187,11 +180,6 @@ waffle_init_create_platform(int32_t waffle_platform) wc_platform = wgl_platform_create(); break; #endif -#ifdef WAFFLE_HAS_NACL - case WAFFLE_PLATFORM_NACL: - wc_platform = nacl_platform_create(); - break; -#endif #ifdef WAFFLE_HAS_SURFACELESS_EGL case WAFFLE_PLATFORM_SURFACELESS_EGL: wc_platform = sl_platform_create(); diff --git a/src/waffle/core/wcore_util.c b/src/waffle/core/wcore_util.c index 34defa8..217a719 100644 --- a/src/waffle/core/wcore_util.c +++ b/src/waffle/core/wcore_util.c @@ -102,7 +102,6 @@ wcore_enum_to_string(int32_t e) CASE(WAFFLE_PLATFORM_X11_EGL); CASE(WAFFLE_PLATFORM_GBM); CASE(WAFFLE_PLATFORM_WGL); - CASE(WAFFLE_PLATFORM_NACL); CASE(WAFFLE_PLATFORM_SURFACELESS_EGL); CASE(WAFFLE_CONTEXT_API); CASE(WAFFLE_CONTEXT_OPENGL); diff --git a/src/waffle/meson.build b/src/waffle/meson.build index fc754ec..20f7fb8 100644 --- a/src/waffle/meson.build +++ b/src/waffle/meson.build @@ -33,7 +33,6 @@ deps_for_waffle = [ dep_drm, dep_egl, dep_gbm, - dep_nacl, dep_wayland_client, dep_wayland_egl, dep_x11_xcb, @@ -154,18 +153,6 @@ if build_glx ) endif -if build_nacl - files_libwaffle += files( - 'nacl/nacl_config.c', - 'nacl/nacl_context.c', - 'nacl/nacl_display.c', - 'nacl/nacl_dl.c', - 'nacl/nacl_platform.c', - 'nacl/nacl_window.c', - 'nacl/nacl_container.cpp', - ) -endif - if build_wgl files_libwaffle += files( 'wgl/wgl_config.c', @@ -192,7 +179,7 @@ if build_cgl endif include_libwaffle = include_directories( - 'android', 'api', 'cgl', 'core', 'egl', 'glx', 'linux', 'nacl', + 'android', 'api', 'cgl', 'core', 'egl', 'glx', 'linux', 'surfaceless_egl', 'wayland', 'wgl', 'x11', 'xegl' ) diff --git a/src/waffle/nacl/nacl_config.c b/src/waffle/nacl/nacl_config.c deleted file mode 100644 index 668657b..0000000 --- a/src/waffle/nacl/nacl_config.c +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2014 Intel Corporation -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include "ppapi/c/pp_graphics_3d.h" - -#include "wcore_config_attrs.h" -#include "wcore_error.h" - -#include "nacl_config.h" - -bool -nacl_config_destroy(struct wcore_config *wc_self) -{ - bool ok = true; - - if (wc_self == NULL) - return ok; - - ok &= wcore_config_teardown(wc_self); - free(nacl_config(wc_self)); - return ok; -} - -struct wcore_config* -nacl_config_choose(struct wcore_platform *wc_plat, - struct wcore_display *wc_dpy, - const struct wcore_config_attrs *attrs) -{ - struct nacl_config *self; - bool ok = true; - - self = wcore_calloc(sizeof(*self)); - if (self == NULL) - return NULL; - - // Currently only OpenGL ES 2.0 is supported. - if (attrs->context_api != WAFFLE_CONTEXT_OPENGL_ES2) { - wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM, - "NaCl does no support context type %s.", - wcore_enum_to_string(attrs->context_api)); - goto error; - } - - if (attrs->context_robust) { - wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM, - "NaCl does not support robust contexts."); - goto error; - } - - unsigned attr = 0; - - // Max amount of attribs is hardcoded in nacl_config.h (64) -#define PUSH_ATTRIB(a, val) \ - if (val != WAFFLE_DONT_CARE) {\ - self->attribs[attr++] = a; \ - self->attribs[attr++] = val;\ - } - - PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_ALPHA_SIZE, attrs->alpha_size); - PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_BLUE_SIZE, attrs->blue_size); - PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_GREEN_SIZE, attrs->green_size); - PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_RED_SIZE, attrs->red_size); - PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_DEPTH_SIZE, attrs->depth_size); - PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_STENCIL_SIZE, attrs->stencil_size); - PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_SAMPLES, attrs->samples); - PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, attrs->sample_buffers); - - // Note, we have to have at least 1x1 size so that initial context - // backing surface creation will succeed without errors. Later on - // it is resized by window creation/resize. - PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_WIDTH, 1); - PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_HEIGHT, 1); - PUSH_ATTRIB(PP_GRAPHICS3DATTRIB_NONE, 0); - -#undef PUSH_ATTRIB - - ok = wcore_config_init(&self->wcore, wc_dpy, attrs); - if (!ok) - goto error; - - return &self->wcore; - -error: - nacl_config_destroy(&self->wcore); - self = NULL; - return NULL; -} diff --git a/src/waffle/nacl/nacl_config.h b/src/waffle/nacl/nacl_config.h deleted file mode 100644 index d461d43..0000000 --- a/src/waffle/nacl/nacl_config.h +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2014 Intel Corporation -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#pragma once - -#include <stdbool.h> -#include <stdint.h> - -#include "wcore_config.h" -#include "wcore_util.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct wcore_config_attrs; -struct wcore_platform; - -struct nacl_config { - struct wcore_config wcore; - int32_t attribs[64]; -}; - -DEFINE_CONTAINER_CAST_FUNC(nacl_config, - struct nacl_config, - struct wcore_config, - wcore) - -struct wcore_config* -nacl_config_choose(struct wcore_platform *wc_plat, - struct wcore_display *wc_dpy, - const struct wcore_config_attrs *attrs); - -bool -nacl_config_destroy(struct wcore_config *wc_self); - -#ifdef __cplusplus -} -#endif diff --git a/src/waffle/nacl/nacl_container.cpp b/src/waffle/nacl/nacl_container.cpp deleted file mode 100644 index e3d89fd..0000000 --- a/src/waffle/nacl/nacl_container.cpp +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright 2014 Intel Corporation -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include <dlfcn.h> - -#include "ppapi/cpp/graphics_3d.h" -#include "ppapi/cpp/instance.h" -#include "ppapi/cpp/module.h" -#include "ppapi/c/pp_errors.h" - -#include "wcore_error.h" - -#include "nacl_config.h" -#include "nacl_container.h" -#include "nacl_swap_thread.h" - -namespace waffle { - -struct nacl_container { - pp::Graphics3D *ctx; - NaclSwapThread *swapper; - - void *glapi; - bool (*glInitializePPAPI) (PPB_GetInterface); - void (*glSetCurrentContextPPAPI) (PP_Resource); - bool (*glTerminatePPAPI) (void); -}; - -static void -nacl_container_dtor(waffle::nacl_container *nc) -{ - if (!nc) - return; - - if (nc->glapi) - dlclose(nc->glapi); - - delete nc->swapper; - delete nc; -} - -static nacl_container* -nacl_container_ctor() -{ - nacl_container *nc = new nacl_container; - - if (!nc) - return NULL; - - return nc; -} - -static bool -nacl_container_context_init(waffle::nacl_container *nc, struct nacl_config *cfg) -{ - // There is no way currently to pass a pp::Instance for Waffle, so - // we fetch a map of all instances and if there's only one we select - // that one, otherwise we fail. - const pp::Module::InstanceMap instances = - pp::Module::Get()->current_instances(); - - if (instances.size() != 1) { - wcore_errorf(WAFFLE_ERROR_FATAL, - "Could not find a pp::Instance for Waffle to use."); - return false; - } - - pp::Instance *pp_instance = instances.begin()->second; - nc->ctx = new pp::Graphics3D(pp_instance, pp::Graphics3D(), cfg->attribs); - - if (nc->ctx->is_null()) { - wcore_errorf(WAFFLE_ERROR_FATAL, "Unable to create NaCl 3D context."); - return false; - } - - // We need to fetch NaCl specific init, makecurrent and terminate - // functions that communicate with the browser interface. As nacl_config - // currently supports only ES2, this is hardcoded for ES2. - nc->glapi = dlopen(NACL_GLES2_LIBRARY, RTLD_LAZY); - if (!nc->glapi) { - wcore_errorf(WAFFLE_ERROR_FATAL, "dlopen failed: %s", dlerror()); - return false; - } - -#define RESOLVE(func) \ - nc->func = (typeof(nc->func)) dlsym(nc->glapi, (#func)); \ - if (!nc->func) { \ - wcore_errorf(WAFFLE_ERROR_FATAL, "failed to resolve %s", #func); \ - return false; \ - } - - RESOLVE(glInitializePPAPI); - RESOLVE(glSetCurrentContextPPAPI); - RESOLVE(glTerminatePPAPI); - -#undef RESOLVE - - if (!nc->glInitializePPAPI(pp::Module::Get()->get_browser_interface())) { - wcore_errorf(WAFFLE_ERROR_FATAL, - "Unable to initialize GL PPAPI!"); - return false; - } - - if (!pp_instance->BindGraphics(*nc->ctx)) { - wcore_errorf(WAFFLE_ERROR_FATAL, "Unable to bind NaCl 3D context."); - return false; - } - - nc->swapper = new NaclSwapThread(pp_instance, nc->ctx); - return true; -} - -}; // namespace waffle ends - -extern "C" struct nacl_container* -nacl_container_init() -{ - return reinterpret_cast<nacl_container*>(waffle::nacl_container_ctor()); -} - -extern "C" void -nacl_container_teardown(nacl_container *nc) -{ - waffle::nacl_container_dtor(reinterpret_cast<waffle::nacl_container*>(nc)); -} - -extern "C" bool -nacl_container_context_init(struct nacl_container *nc, struct nacl_config *cfg) -{ - return waffle::nacl_container_context_init( - reinterpret_cast<waffle::nacl_container*>(nc), cfg); -} - -extern "C" void -nacl_container_context_fini(struct nacl_container *nc) -{ - waffle::nacl_container *cpp_nc = - reinterpret_cast<waffle::nacl_container*>(nc); - - delete cpp_nc->ctx; - cpp_nc->ctx = NULL; - - cpp_nc->glSetCurrentContextPPAPI(0); - cpp_nc->glTerminatePPAPI(); -} - -extern "C" bool -nacl_container_window_resize(struct nacl_container *nc, int32_t width, int32_t height) -{ - waffle::nacl_container *cpp_nc = - reinterpret_cast<waffle::nacl_container*>(nc); - - int32_t error = cpp_nc->ctx->ResizeBuffers(width, height); - - if (error == PP_OK) - return true; - - switch (error) { - case PP_ERROR_BADRESOURCE: - wcore_errorf(WAFFLE_ERROR_FATAL, "Invalid NaCl 3D context."); - break; - case PP_ERROR_BADARGUMENT: - wcore_errorf(WAFFLE_ERROR_BAD_PARAMETER, - "Invalid values given for resize (w %d h %d)", - width, height); - break; - default: - wcore_errorf(WAFFLE_ERROR_UNKNOWN, "NaCl resize failed."); - } - return false; -} - -extern "C" bool -nacl_container_context_makecurrent(nacl_container *nc, bool release) -{ - waffle::nacl_container *cpp_nc = - reinterpret_cast<waffle::nacl_container*>(nc); - - PP_Resource ctx = release ? 0 : cpp_nc->ctx->pp_resource(); - - cpp_nc->glSetCurrentContextPPAPI(ctx); - - return true; -} - -extern "C" bool -nacl_container_swapbuffere(nacl_container *nc) -{ - waffle::nacl_container *cpp_nc = - reinterpret_cast<waffle::nacl_container*>(nc); - return cpp_nc->swapper->swap(); -} diff --git a/src/waffle/nacl/nacl_container.h b/src/waffle/nacl/nacl_container.h deleted file mode 100644 index d047fa7..0000000 --- a/src/waffle/nacl/nacl_container.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2014 Intel Corporation -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#pragma once - -#include <stdbool.h> -#include <stdint.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define NACL_GLES2_LIBRARY "libppapi_gles2.so" - -struct nacl_container; -struct nacl_config; - -struct nacl_container *nacl_container_init(); -void nacl_container_teardown(struct nacl_container *nc); -bool nacl_container_context_init(struct nacl_container *nc, struct nacl_config *cfg); -bool nacl_container_window_resize(struct nacl_container *nc, int32_t width, int32_t height); -bool nacl_container_context_makecurrent(struct nacl_container *nc, bool release); -void nacl_container_context_fini(struct nacl_container *nc); -bool nacl_container_swapbuffere(struct nacl_container *nc); -#ifdef __cplusplus -}; -#endif diff --git a/src/waffle/nacl/nacl_context.c b/src/waffle/nacl/nacl_context.c deleted file mode 100644 index 52015c2..0000000 --- a/src/waffle/nacl/nacl_context.c +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2014 Intel Corporation -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include "nacl_config.h" -#include "nacl_container.h" -#include "nacl_context.h" -#include "nacl_platform.h" - -bool -nacl_context_destroy(struct wcore_context *wc_self) -{ - struct nacl_context *self = nacl_context(wc_self); - struct nacl_platform *plat; - bool ok = true; - - if (!wc_self) - return ok; - - plat = nacl_platform(wc_self->display->platform); - - nacl_container_context_fini(plat->nacl); - - ok &= wcore_context_teardown(wc_self); - free(self); - return ok; -} - -struct wcore_context* -nacl_context_create(struct wcore_platform *wc_plat, - struct wcore_config *wc_config, - struct wcore_context *wc_share_ctx) -{ - struct nacl_context *self; - struct nacl_config *config = nacl_config(wc_config); - struct nacl_platform *platform = nacl_platform(wc_plat); - bool ok = true; - - self = wcore_calloc(sizeof(*self)); - if (self == NULL) - return NULL; - - ok = wcore_context_init(&self->wcore, wc_config); - if (!ok) - goto error; - - ok = nacl_container_context_init(platform->nacl, config); - if (!ok) - goto error; - - return &self->wcore; - -error: - nacl_context_destroy(&self->wcore); - return NULL; -} diff --git a/src/waffle/nacl/nacl_context.h b/src/waffle/nacl/nacl_context.h deleted file mode 100644 index 1330e27..0000000 --- a/src/waffle/nacl/nacl_context.h +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2014 Intel Corporation -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#pragma once - -#include <stdbool.h> - -#include "wcore_context.h" -#include "wcore_util.h" - -struct wcore_config; -struct wcore_platform; - -struct nacl_context { - struct wcore_context wcore; -}; - -DEFINE_CONTAINER_CAST_FUNC(nacl_context, - struct nacl_context, - struct wcore_context, - wcore) - -struct wcore_context* -nacl_context_create(struct wcore_platform *wc_plat, - struct wcore_config *wc_config, - struct wcore_context *wc_share_ctx); - -bool -nacl_context_destroy(struct wcore_context *wc_self); diff --git a/src/waffle/nacl/nacl_display.c b/src/waffle/nacl/nacl_display.c deleted file mode 100644 index 41e6206..0000000 --- a/src/waffle/nacl/nacl_display.c +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2014 Intel Corporation -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include "wcore_error.h" - -#include "nacl_display.h" - -bool -nacl_display_destroy(struct wcore_display *wc_self) -{ - struct nacl_display *self = nacl_display(wc_self); - bool ok = true; - - if (!self) - return ok; - - ok &= wcore_display_teardown(&self->wcore); - - free(self); - return ok; -} - -struct wcore_display* -nacl_display_connect(struct wcore_platform *wc_plat, - const char *name) -{ - struct nacl_display *self; - bool ok = true; - - self = wcore_calloc(sizeof(*self)); - if (self == NULL) - return NULL; - - ok = wcore_display_init(&self->wcore, wc_plat); - if (!ok) - goto error; - - return &self->wcore; - -error: - nacl_display_destroy(&self->wcore); - return NULL; -} - -bool -nacl_display_supports_context_api(struct wcore_display *wc_self, - int32_t context_api) -{ - switch (context_api) { - case WAFFLE_CONTEXT_OPENGL_ES2: - return true; - case WAFFLE_CONTEXT_OPENGL: - case WAFFLE_CONTEXT_OPENGL_ES1: - case WAFFLE_CONTEXT_OPENGL_ES3: - return false; - default: - assert(false); - return false; - } -} diff --git a/src/waffle/nacl/nacl_display.h b/src/waffle/nacl/nacl_display.h deleted file mode 100644 index 9ae3b0a..0000000 --- a/src/waffle/nacl/nacl_display.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2014 Intel Corporation -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#pragma once - -#include <stdbool.h> -#include <stdint.h> - -#include "wcore_display.h" -#include "wcore_util.h" - -struct wcore_platform; - -struct nacl_display { - struct wcore_display wcore; -}; - -DEFINE_CONTAINER_CAST_FUNC(nacl_display, - struct nacl_display, - struct wcore_display, - wcore) - -struct wcore_display* -nacl_display_connect(struct wcore_platform *wc_plat, - const char *name); - -bool -nacl_display_destroy(struct wcore_display *wc_self); - -bool -nacl_display_supports_context_api(struct wcore_display *wc_self, - int32_t context_api); diff --git a/src/waffle/nacl/nacl_dl.c b/src/waffle/nacl/nacl_dl.c deleted file mode 100644 index 79958da..0000000 --- a/src/waffle/nacl/nacl_dl.c +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright 2012-2015 Intel Corporation -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include <assert.h> -#include <dlfcn.h> -#include <stdio.h> -#include <string.h> - -#include "wcore_error.h" - -#include "nacl_container.h" -#include "nacl_dl.h" -#include "nacl_platform.h" - - -static bool -nacl_dl_check_enum(int32_t waffle_dl) -{ - switch (waffle_dl) { - case WAFFLE_DL_OPENGL: - wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM, - "NACL does not support OpenGL"); - return false; - case WAFFLE_DL_OPENGL_ES1: - wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM, - "NACL does not support OpenGL ES1"); - return false; - case WAFFLE_DL_OPENGL_ES2: - return true; - case WAFFLE_DL_OPENGL_ES3: - wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM, - "NACL does not support OpenGL ES3"); - return false; - default: - assert(false); - return false; - } -} - -static bool -nacl_dl_open(struct nacl_platform *plat) -{ - plat->dl_gl = dlopen(NACL_GLES2_LIBRARY, RTLD_LAZY); - - if (!plat->dl_gl) { - wcore_errorf(WAFFLE_ERROR_UNKNOWN, - "dlopen(\"%s\") failed: %s", NACL_GLES2_LIBRARY, dlerror()); - return false; - } - - return true; -} - -bool -nacl_dl_can_open(struct wcore_platform *wc_plat, - int32_t waffle_dl) -{ - struct nacl_platform *plat = nacl_platform(wc_plat); - bool ok; - - WCORE_ERROR_DISABLED({ - ok = nacl_dl_check_enum(waffle_dl); - }); - - if (!ok) - return false; - - if (plat->dl_gl != NULL) - return true; - - WCORE_ERROR_DISABLED({ - nacl_dl_open(plat); - }); - - return plat->dl_gl != NULL; -} - -// Construct a string that maps GL function to NaCl function -// by concating given prefix and function name tail from 'src'. -static char * -nacl_dl_prefix(const char *src, const char *prefix) -{ - if (strncmp(src, "gl", 2) != 0) { - wcore_errorf(WAFFLE_ERROR_UNKNOWN, - "NACL symbol name does not start with \"gl\""); - return NULL; - } - - uint32_t len = strlen(src) + strlen(prefix); - - char *dst = wcore_calloc(len); - if (!dst) - return NULL; - - int n = snprintf(dst, len, "%s%s", prefix, src + 2); - if (n < 0 || n >= len) { - wcore_errorf(WAFFLE_ERROR_UNKNOWN, - "NACL cannot create symbol prefix"); - free(dst); - return NULL; - } - - return dst; -} - -void* -nacl_dl_sym(struct wcore_platform *wc_plat, - int32_t waffle_dl, - const char *name) -{ - struct nacl_platform *plat = nacl_platform(wc_plat); - - if (!nacl_dl_check_enum(waffle_dl)) - return NULL; - - if (plat->dl_gl == NULL) - nacl_dl_open(plat); - - if (plat->dl_gl == NULL) - return NULL; - - char *nacl_name = nacl_dl_prefix(name, "GLES2"); - if (!nacl_name) - return NULL; - - // Clear any previous error. - dlerror(); - - void *sym = dlsym(plat->dl_gl, name); - - if (sym) { - free(nacl_name); - return sym; - } - - // dlsym returned NULL. Check if an error occured. - const char *error = dlerror(); - if (error) { - wcore_errorf(WAFFLE_ERROR_UNKNOWN, - "dlsym(libname=\"%s\", symbol=\"%s\") failed: %s", - NACL_GLES2_LIBRARY, nacl_name, error); - } - free(nacl_name); - - return NULL; -} - -bool -nacl_dl_close(struct wcore_platform *wc_plat) -{ - struct nacl_platform *plat = nacl_platform(wc_plat); - - int error_code = 0; - const char *error_msg = NULL; - - if (!plat->dl_gl) - return true; - - error_code = dlclose(plat->dl_gl); - - if (!error_code) - return true; - - error_msg = dlerror(); - - if (error_msg) { - wcore_errorf(WAFFLE_ERROR_UNKNOWN, - "dlclose(libname=\"%s\") failed: %s", - NACL_GLES2_LIBRARY, error_msg); - } - else { - wcore_errorf(WAFFLE_ERROR_UNKNOWN, - "dlclose(libname=\"%s\") failed", - NACL_GLES2_LIBRARY); - } - - return false; -} diff --git a/src/waffle/nacl/nacl_dl.h b/src/waffle/nacl/nacl_dl.h deleted file mode 100644 index e7748f3..0000000 --- a/src/waffle/nacl/nacl_dl.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2012-2015 Intel Corporation -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#pragma once - -#include <stdbool.h> -#include <stdint.h> - -struct wcore_platform; - -bool -nacl_dl_can_open(struct wcore_platform *wc_plat, - int32_t waffle_dl); - -void* -nacl_dl_sym(struct wcore_platform *wc_plat, - int32_t waffle_dl, - const char *name); - -bool -nacl_dl_close(struct wcore_platform *wc_plat); diff --git a/src/waffle/nacl/nacl_platform.c b/src/waffle/nacl/nacl_platform.c deleted file mode 100644 index a3d7625..0000000 --- a/src/waffle/nacl/nacl_platform.c +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2014 Intel Corporation -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include <dlfcn.h> -#include <stdio.h> - -#include "nacl_config.h" -#include "nacl_container.h" -#include "nacl_context.h" -#include "nacl_display.h" -#include "nacl_dl.h" -#include "nacl_platform.h" -#include "nacl_window.h" - -static const struct wcore_platform_vtbl nacl_platform_vtbl; - -static bool -nacl_platform_destroy(struct wcore_platform *wc_self) -{ - struct nacl_platform *self = nacl_platform(wc_self); - bool ok = true; - - if (!self) - return true; - - ok &= wcore_platform_teardown(wc_self); - - nacl_container_teardown(self->nacl); - - if (self->dl_gl) - ok &= nacl_dl_close(&self->wcore); - - free(self); - return ok; -} - -static bool -nacl_platform_make_current(struct wcore_platform *wc_self, - struct wcore_display *wc_dpy, - struct wcore_window *wc_window, - struct wcore_context *wc_ctx) -{ - bool release = (!wc_window && !wc_ctx); - return nacl_container_context_makecurrent(nacl_platform(wc_self)->nacl, - release); -} - -struct wcore_platform* -nacl_platform_create(void) -{ - struct nacl_platform *self; - bool ok = true; - - self = wcore_calloc(sizeof(*self)); - if (self == NULL) - return NULL; - - ok = wcore_platform_init(&self->wcore); - if (!ok) - goto error; - - self->nacl = nacl_container_init(); - if (!self->nacl) - goto error; - - self->wcore.vtbl = &nacl_platform_vtbl; - return &self->wcore; - -error: - nacl_platform_destroy(&self->wcore); - return NULL; -} - -static const struct wcore_platform_vtbl nacl_platform_vtbl = { - .destroy = nacl_platform_destroy, - - .make_current = nacl_platform_make_current, - .dl_can_open = nacl_dl_can_open, - .dl_sym = nacl_dl_sym, - - .display = { - .connect = nacl_display_connect, - .destroy = nacl_display_destroy, - .supports_context_api = nacl_display_supports_context_api, - .get_native = NULL, - }, - - .config = { - .choose = nacl_config_choose, - .destroy = nacl_config_destroy, - .get_native = NULL, - }, - - .context = { - .create = nacl_context_create, - .destroy = nacl_context_destroy, - .get_native = NULL, - }, - - .window = { - .create = nacl_window_create, - .destroy = nacl_window_destroy, - .show = nacl_window_show, - .swap_buffers = nacl_window_swap_buffers, - .resize = nacl_window_resize, - .get_native = NULL, - }, -}; diff --git a/src/waffle/nacl/nacl_platform.h b/src/waffle/nacl/nacl_platform.h deleted file mode 100644 index 259bea9..0000000 --- a/src/waffle/nacl/nacl_platform.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2014 Intel Corporation -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#pragma once - -#include "wcore_platform.h" -#include "wcore_util.h" - -struct nacl_platform { - struct wcore_platform wcore; - struct nacl_container *nacl; - void *dl_gl; -}; - -DEFINE_CONTAINER_CAST_FUNC(nacl_platform, - struct nacl_platform, - struct wcore_platform, - wcore) - -struct wcore_platform* -nacl_platform_create(void); diff --git a/src/waffle/nacl/nacl_swap_thread.h b/src/waffle/nacl/nacl_swap_thread.h deleted file mode 100644 index ce115b3..0000000 --- a/src/waffle/nacl/nacl_swap_thread.h +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2014 Intel Corporation -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#pragma once - -#include "ppapi/cpp/graphics_3d.h" -#include "ppapi/cpp/instance.h" -#include "ppapi/utility/completion_callback_factory.h" -#include "ppapi/utility/threading/simple_thread.h" -#include "wcore_error.h" -#include <semaphore.h> - -// Thread takes care that we do not issue another buffer -// swap before previous swap has completed. -class NaclSwapThread : public pp::SimpleThread -{ -public: - explicit NaclSwapThread(const pp::InstanceHandle &instance, - pp::Graphics3D *_ctx) : - pp::SimpleThread(instance), - ctx(_ctx), - cbf(this) - { - Start(); - sem_init(&sem, 0, 0); - } - - ~NaclSwapThread() - { - sem_destroy(&sem); - message_loop().PostQuit(true); - } - - bool swap() - { - pp::CompletionCallback cb = - cbf.NewCallback(&NaclSwapThread::swap_buffers); - - if (message_loop().PostWork(cb) != PP_OK) - return false; - - sem_wait(&sem); - - return true; - } - -private: - - void swap_buffers(int32_t result) - { - int32_t error = ctx->SwapBuffers(pp::BlockUntilComplete()); - switch (error) { - case PP_OK: - break; - case PP_ERROR_NOMEMORY: - wcore_errorf(WAFFLE_ERROR_BAD_ALLOC, - "pp::Graphics3D::SwapBuffers: Out of memory."); - break; - case PP_ERROR_CONTEXT_LOST: - wcore_errorf(WAFFLE_ERROR_FATAL, - "pp::Graphics3D::SwapBuffers: 3D context lost."); - break; - default: - wcore_errorf(WAFFLE_ERROR_UNKNOWN, - "pp::Graphics3D::SwapBuffers: Unknown error."); - break; - } - sem_post(&sem); - } - - pp::Graphics3D *ctx; - pp::CompletionCallbackFactory<NaclSwapThread> cbf; - sem_t sem; -}; diff --git a/src/waffle/nacl/nacl_window.c b/src/waffle/nacl/nacl_window.c deleted file mode 100644 index 1191f51..0000000 --- a/src/waffle/nacl/nacl_window.c +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2014 Intel Corporation -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include "wcore_attrib_list.h" -#include "wcore_error.h" - -#include "nacl_container.h" -#include "nacl_window.h" -#include "nacl_platform.h" - -bool -nacl_window_destroy(struct wcore_window *wc_self) -{ - struct nacl_window *self = nacl_window(wc_self); - bool ok = true; - - if (!wc_self) - return ok; - - ok &= wcore_window_teardown(wc_self); - free(self); - return ok; -} - -struct wcore_window* -nacl_window_create(struct wcore_platform *wc_plat, - struct wcore_config *wc_config, - int width, - int height, - const intptr_t attrib_list[]) - -{ - struct nacl_window *self; - struct nacl_platform *nplat = nacl_platform(wc_plat); - bool ok = true; - - if (width == -1 && height == -1) { - wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM, - "fullscreen window not supported"); - return NULL; - } - - if (wcore_attrib_list_length(attrib_list) > 0) { - wcore_error_bad_attribute(attrib_list[0]); - return NULL; - } - - self = wcore_calloc(sizeof(*self)); - if (self == NULL) - return NULL; - - ok = wcore_window_init(&self->wcore, wc_config); - if (!ok) - goto error; - - // Set requested dimensions for the backing surface. - if (!nacl_container_window_resize(nplat->nacl, width, height)) - goto error; - - return &self->wcore; - -error: - nacl_window_destroy(&self->wcore); - return NULL; -} - -bool -nacl_window_show(struct wcore_window *wc_self) -{ - return true; -} - -bool -nacl_window_resize(struct wcore_window *wc_self, - int32_t width, int32_t height) -{ - struct nacl_platform *plat = nacl_platform(wc_self->display->platform); - return nacl_container_window_resize(plat->nacl, width, height); -} - -bool -nacl_window_swap_buffers(struct wcore_window *wc_self) -{ - struct nacl_platform *plat = nacl_platform(wc_self->display->platform); - return nacl_container_swapbuffere(plat->nacl); -} diff --git a/src/waffle/nacl/nacl_window.h b/src/waffle/nacl/nacl_window.h deleted file mode 100644 index c3e9957..0000000 --- a/src/waffle/nacl/nacl_window.h +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2014 Intel Corporation -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#pragma once - -#include <stdbool.h> - -#include "wcore_window.h" -#include "wcore_util.h" - -struct wcore_platform; - -struct nacl_window { - struct wcore_window wcore; -}; - -DEFINE_CONTAINER_CAST_FUNC(nacl_window, - struct nacl_window, - struct wcore_window, - wcore) -struct wcore_window* -nacl_window_create(struct wcore_platform *wc_plat, - struct wcore_config *wc_config, - int width, - int height, - const intptr_t attrib_list[]); - -bool -nacl_window_destroy(struct wcore_window *wc_self); - -bool -nacl_window_show(struct wcore_window *wc_self); - -bool -nacl_window_resize(struct wcore_window *wc_self, - int32_t width, int32_t height); - -bool -nacl_window_swap_buffers(struct wcore_window *wc_self); diff --git a/www/features.html b/www/features.html index 5a6e86b..6e2a47f 100644 --- a/www/features.html +++ b/www/features.html @@ -22,7 +22,6 @@ <li>gbm</em></li> <li>GLX</li> <li>surfaceless</li> - <li>NACL</li> <li>X11/EGL</li> <li>Wayland</li> </ul> |