summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.mk4
-rw-r--r--CMakeLists.txt12
-rw-r--r--Options.cmake5
-rw-r--r--cmake/Modules/FindWaffle.cmake78
-rw-r--r--cmake/Modules/WaffleDefineCompilerFlags.cmake4
-rw-r--r--cmake/Modules/WaffleDefineVersion.cmake2
-rw-r--r--cmake/Modules/WaffleValidateOptions.cmake31
-rw-r--r--cmake/toolchain-nacl-x86_32-glibc.cmake41
-rw-r--r--cmake/toolchain-nacl-x86_64-glibc.cmake41
-rw-r--r--examples/CMakeLists.txt6
-rw-r--r--include/waffle/waffle.h1
-rw-r--r--man/waffle_enum.3.xml1
-rw-r--r--man/waffle_init.3.xml8
-rw-r--r--pkg/archlinux/lib32-waffle-1.3.0/PKGBUILD63
-rw-r--r--pkg/archlinux/mingw-w64-waffle/PKGBUILD86
-rw-r--r--pkg/archlinux/waffle-1.3.0/PKGBUILD55
-rw-r--r--pkg/archlinux/waffle-1.4.0/.gitignore7
-rw-r--r--pkg/archlinux/waffle-1.4.0/PKGBUILD56
-rw-r--r--pkg/archlinux/waffle-1.4.1/PKGBUILD51
-rw-r--r--pkg/archlinux/waffle-git/.gitignore6
-rw-r--r--pkg/archlinux/waffle-git/PKGBUILD64
-rw-r--r--src/utils/CMakeLists.txt4
-rw-r--r--src/waffle/CMakeLists.txt23
-rw-r--r--src/waffle/api/waffle_init.c11
-rw-r--r--src/waffle/core/wcore_util.c1
-rw-r--r--src/waffle/nacl/nacl_config.c63
-rw-r--r--src/waffle/nacl/nacl_config.h49
-rw-r--r--src/waffle/nacl/nacl_container.cpp66
-rw-r--r--src/waffle/nacl/nacl_container.h38
-rw-r--r--src/waffle/nacl/nacl_context.c65
-rw-r--r--src/waffle/nacl/nacl_context.h52
-rw-r--r--src/waffle/nacl/nacl_display.c70
-rw-r--r--src/waffle/nacl/nacl_display.h52
-rw-r--r--src/waffle/nacl/nacl_platform.c134
-rw-r--r--src/waffle/nacl/nacl_platform.h49
-rw-r--r--src/waffle/nacl/nacl_window.c90
-rw-r--r--src/waffle/nacl/nacl_window.h59
37 files changed, 966 insertions, 482 deletions
diff --git a/Android.mk b/Android.mk
index 810508f..427d840 100644
--- a/Android.mk
+++ b/Android.mk
@@ -8,8 +8,8 @@ waffle_top := $(LOCAL_PATH)
#
waffle_major_version := 1
waffle_minor_version := 5
-waffle_patch_version := 1
-waffle_api_version := 0x0105
+waffle_patch_version := 90
+waffle_api_version := 0x0106
waffle_android_major_version := $(word 1, $(subst ., , $(PLATFORM_VERSION)))
waffle_android_minor_version := $(word 2, $(subst ., , $(PLATFORM_VERSION)))
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6fabb54..02e995e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,7 +23,7 @@
# 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.
-project(waffle1 C)
+project(waffle1 C CXX)
cmake_minimum_required(VERSION 2.8.11)
@@ -128,8 +128,8 @@ if(waffle_build_examples)
endif()
# ------------------------------------------------------------------------------
-# Install packaging files: waffle.pc, FindWaffle.cmake,
-# WaffleConfigVersion.cmake, and WaffleConfig.cmake
+# Install packaging files: waffle.pc WaffleConfigVersion.cmake, and
+# WaffleConfig.cmake
# ------------------------------------------------------------------------------
configure_file(waffle.pc.in ${waffle_libname}.pc @ONLY)
@@ -140,12 +140,6 @@ install(
COMPONENT pkgconfig
)
-install(
- FILES cmake/Modules/FindWaffle.cmake
- DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/cmake/Modules"
- COMPONENT cmakefind
- )
-
set(ConfigPackageLocation "${CMAKE_INSTALL_LIBDIR}/cmake/Waffle")
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
diff --git a/Options.cmake b/Options.cmake
index c316070..4f097a0 100644
--- a/Options.cmake
+++ b/Options.cmake
@@ -28,6 +28,11 @@ if(waffle_on_linux)
option(waffle_has_wayland "Build support for Wayland" ${wayland_default})
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_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/FindWaffle.cmake b/cmake/Modules/FindWaffle.cmake
deleted file mode 100644
index 4e16c4e..0000000
--- a/cmake/Modules/FindWaffle.cmake
+++ /dev/null
@@ -1,78 +0,0 @@
-# - Locate the Waffle library and headers.
-# This module defines the following variables:
-# WAFFLE_INCLUDE_DIRS Full path to directory of the main Waffle header, waffle.h.
-# WAFFLE_LIBRARIES Full path to the Waffle library.
-# WAFFLE_FOUND True if Waffle was found.
-# WAFFLE_VERSION_STRING Waffle's version in form "Major.Minor.Patch".
-
-#=============================================================================
-# Copyright 2012 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.
-#=============================================================================
-
-# See /usr/share/cmake/Modules/readme.txt for CMake official guidelines for
-# FindXXX.cmake files.
-
-if(NOT DEFINED WAFFLE_FIND_VERSION_MAJOR)
- set(WAFFLE_FIND_VERSION_MAJOR 1)
-endif()
-
-find_path(WAFFLE_INCLUDE_DIRS
- NAMES waffle.h
- PATH_SUFFIXES "waffle-${WAFFLE_FIND_VERSION_MAJOR}"
- )
-
-find_library(WAFFLE_LIBRARIES
- NAMES "waffle-${WAFFLE_FIND_VERSION_MAJOR}"
-)
-
-if(WAFFLE_INCLUDE_DIRS AND EXISTS "${WAFFLE_INCLUDE_DIRS}/waffle_version.h")
- file(STRINGS "${WAFFLE_INCLUDE_DIRS}/waffle_version.h" WAFFLE_VERSION_H)
- string(REGEX REPLACE "^.*WAFFLE_MAJOR_VERSION ([0-9]+).*$" "\\1" WAFFLE_MAJOR_VERSION "${WAFFLE_VERSION_H}")
- string(REGEX REPLACE "^.*WAFFLE_MINOR_VERSION ([0-9]+).*$" "\\1" WAFFLE_MINOR_VERSION "${WAFFLE_VERSION_H}")
- string(REGEX REPLACE "^.*WAFFLE_PATCH_VERSION ([0-9]+).*$" "\\1" WAFFLE_PATCH_VERSION "${WAFFLE_VERSION_H}")
- set(WAFFLE_VERSION_STRING "${WAFFLE_MAJOR_VERSION}.${WAFFLE_MINOR_VERSION}.${WAFFLE_PATCH_VERSION}")
-endif()
-
-# handle the 'QUIETLY' and 'REQUIRED' arguments and
-# set 'WAFFLE_FOUND' to TRUE if all listed variables are TRUE
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Waffle
- REQUIRED_VARS WAFFLE_LIBRARIES WAFFLE_INCLUDE_DIRS
- VERSION_VAR WAFFLE_VERSION_STRING
- )
-
-mark_as_advanced(WAFFLE_LIBRARIES WAFFLE_INCLUDE_DIRS)
-
-# Don't expose these variables.
-#
-# Some were set in the cache and some were not. To be safe, remove the
-# variables from the cache *and* local scope.
-#
-unset(WAFFLE_FIND_VERSION_MAJOR CACHE)
-unset(WAFFLE_VERSION_H CACHE)
-
-unset(WAFFLE_FIND_VERSION_MAJOR)
-unset(WAFFLE_VERSION_H)
diff --git a/cmake/Modules/WaffleDefineCompilerFlags.cmake b/cmake/Modules/WaffleDefineCompilerFlags.cmake
index 710b7e0..7532a91 100644
--- a/cmake/Modules/WaffleDefineCompilerFlags.cmake
+++ b/cmake/Modules/WaffleDefineCompilerFlags.cmake
@@ -125,6 +125,10 @@ if(waffle_on_linux)
add_definitions(-D_XOPEN_SOURCE=600)
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/WaffleDefineVersion.cmake b/cmake/Modules/WaffleDefineVersion.cmake
index a9f41ca..cbb3aaa 100644
--- a/cmake/Modules/WaffleDefineVersion.cmake
+++ b/cmake/Modules/WaffleDefineVersion.cmake
@@ -40,7 +40,7 @@
#
set(waffle_major_version "1")
set(waffle_minor_version "5")
-set(waffle_patch_version "1")
+set(waffle_patch_version "90")
set(waffle_version "${waffle_major_version}.${waffle_minor_version}.${waffle_patch_version}")
diff --git a/cmake/Modules/WaffleValidateOptions.cmake b/cmake/Modules/WaffleValidateOptions.cmake
index ea60b0e..1275463 100644
--- a/cmake/Modules/WaffleValidateOptions.cmake
+++ b/cmake/Modules/WaffleValidateOptions.cmake
@@ -46,11 +46,38 @@ 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)
+ NOT waffle_has_x11_egl AND NOT waffle_has_gbm AND
+ NOT waffle_has_nacl)
message(FATAL_ERROR
"Must enable at least one of: "
"waffle_has_glx, waffle_has_wayland, "
- "waffle_has_x11_egl, waffle_has_gbm.")
+ "waffle_has_x11_egl, waffle_has_gbm, "
+ "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)
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
new file mode 100644
index 0000000..ec5779f
--- /dev/null
+++ b/cmake/toolchain-nacl-x86_32-glibc.cmake
@@ -0,0 +1,41 @@
+#
+# 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
new file mode 100644
index 0000000..f3109ab
--- /dev/null
+++ b/cmake/toolchain-nacl-x86_64-glibc.cmake
@@ -0,0 +1,41 @@
+#
+# 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 281ef47..fc0bda2 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -11,7 +11,7 @@ install(
# Target: simple-x11-egl (executable)
# ----------------------------------------------------------------------------
-if(waffle_on_linux)
+if(waffle_on_linux AND waffle_has_x11_egl)
add_executable(simple-x11-egl simple-x11-egl.c)
target_link_libraries(simple-x11-egl ${waffle_libname})
endif()
@@ -20,6 +20,10 @@ 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/include/waffle/waffle.h b/include/waffle/waffle.h
index e04b23f..77885a4 100644
--- a/include/waffle/waffle.h
+++ b/include/waffle/waffle.h
@@ -104,6 +104,7 @@ enum waffle_enum {
WAFFLE_PLATFORM_X11_EGL = 0x0015,
WAFFLE_PLATFORM_GBM = 0x0016,
WAFFLE_PLATFORM_WGL = 0x0017,
+ WAFFLE_PLATFORM_NACL = 0x0018,
// ------------------------------------------------------------------
// For waffle_config_choose()
diff --git a/man/waffle_enum.3.xml b/man/waffle_enum.3.xml
index a96bd20..07edd6c 100644
--- a/man/waffle_enum.3.xml
+++ b/man/waffle_enum.3.xml
@@ -101,6 +101,7 @@ enum waffle_enum {
WAFFLE_PLATFORM_X11_EGL = 0x0015,
WAFFLE_PLATFORM_GBM = 0x0016,
WAFFLE_PLATFORM_WGL = 0x0017,
+ WAFFLE_PLATFORM_NACL = 0x0018,
// ------------------------------------------------------------------
// For waffle_config_choose()
diff --git a/man/waffle_init.3.xml b/man/waffle_init.3.xml
index a22723d..d74601a 100644
--- a/man/waffle_init.3.xml
+++ b/man/waffle_init.3.xml
@@ -121,6 +121,14 @@
</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_WAYLAND</constant></term>
<listitem>
<para>
diff --git a/pkg/archlinux/lib32-waffle-1.3.0/PKGBUILD b/pkg/archlinux/lib32-waffle-1.3.0/PKGBUILD
deleted file mode 100644
index 5e16f68..0000000
--- a/pkg/archlinux/lib32-waffle-1.3.0/PKGBUILD
+++ /dev/null
@@ -1,63 +0,0 @@
-# Maintainer: Chad Versace <chad.versace@linux.intel.com>
-
-pkgbase='waffle'
-pkgname="lib32-$pkgbase"
-pkgver='1.3.0'
-pkgrel=1
-pkgdesc='a library for choosing window system and OpenGL API at runtime (32 bits)'
-arch=('x86_64')
-url='http://www.waffle-gl.org'
-license=('BSD')
-
-depends=(
- 'lib32-libgl' # for GLX
- 'lib32-libegl'
- 'lib32-libgbm'
- 'lib32-libx11'
- 'lib32-libxcb'
- 'lib32-wayland'
-
- "$pkgbase=$pkgver"
- )
-makedepends=(
- 'gcc-multilib'
- 'cmake'
- 'xcb-proto'
- )
-
-source=("http://www.waffle-gl.org/files/release/$pkgbase-$pkgver/$pkgbase-$pkgver.tar.xz")
-sha256sums=('340ee04172dba878249469018cd7ec9d1ecd41af26b612c741b8b52e713bca8e')
-
-build() {
- cd "$srcdir/$pkgbase-$pkgver"
-
- export CC='gcc -m32'
- export CXX='g++ -m32'
- export PKG_CONFIG_PATH='/usr/lib32/pkgconfig'
-
- cmake \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DCMAKE_INSTALL_LIBDIR=/usr/lib32 \
- -DCMAKE_BUILD_TYPE=Release \
- -Dwaffle_has_gbm=1 \
- -Dwaffle_has_glx=1 \
- -Dwaffle_has_x11_egl=1 \
- -Dwaffle_has_wayland=1 \
- -Dwaffle_build_manpages=0 \
- -Dwaffle_build_htmldocs=0 \
- -Dwaffle_build_examples=0
- make
-}
-
-package() {
- cd "$srcdir/$pkgbase-$pkgver"
- make DESTDIR="$pkgdir/" install
-
- rm -rf "$pkgdir/usr/include"
- rm -rf "$pkgdir/usr/share"
-
- install -m755 -d "$pkgdir/usr/share/licenses"
- ln -s $pkgbase "$pkgdir/usr/share/licenses/$pkgname"
-}
-
-# vim:set ts=2 sw=2 et:
diff --git a/pkg/archlinux/mingw-w64-waffle/PKGBUILD b/pkg/archlinux/mingw-w64-waffle/PKGBUILD
deleted file mode 100644
index c563948..0000000
--- a/pkg/archlinux/mingw-w64-waffle/PKGBUILD
+++ /dev/null
@@ -1,86 +0,0 @@
-# Maintainer: Chad Versace <chad.versace@linux.intel.com>
-
-pkgname='mingw-w64-waffle'
-pkgver='1.3.0'
-pkgrel=1
-pkgdesc='a library for choosing window system and OpenGL API at runtime (mingw-w64)'
-arch=('any')
-url='http://waffle-gl.github.io'
-license=('BSD')
-
-depends=(
- 'mingw-w64-crt>=3.1.0-3'
- )
-makedepends=(
- 'mingw-w64-cmake'
-
- # For building the docs.
-# XXX: Add as soon as we enable docs/manpages
-# 'libxslt'
-# 'docbook-xsl'
-
- )
-
-options=('!strip' '!buildflags' 'staticlibs')
-_architectures="i686-w64-mingw32 x86_64-w64-mingw32"
-
-if [[ ! -v _srcroot ]]; then
- msg "Environment variable _srcroot is unset"
- msg "Fall back to using git worktree for _srcroot ..."
- _srcroot="$(git rev-parse --show-toplevel)" || exit
- msg "Using _srcroot=$_srcroot"
-fi
-
-build() {
- unset LDFLAGS
- cd "${_srcroot}"
- msg "Building mingw-w64-waffle for cross-building"
- for _arch in ${_architectures}; do
- mkdir -p build-${_arch} && pushd build-${_arch}
- ${_arch}-cmake .. \
- -DCMAKE_INSTALL_PREFIX=/usr/${_arch} \
- -DCMAKE_INSTALL_LIBDIR=/usr/${_arch}/lib \
- -DCMAKE_BUILD_TYPE=Release \
- \
- -Dwaffle_build_tests=0 \
- -Dwaffle_build_manpages=0 \
- -Dwaffle_build_htmldocs=0 \
- -Dwaffle_build_examples=1
- make
- popd
- done
-
- # There should be a better way to do this
- msg "Building mingw-w64-waffle for native builds"
- for _arch in ${_architectures}; do
- mkdir -p "build-${_arch}-win" && pushd "build-${_arch}-win"
- ${_arch}-cmake .. \
- -DCMAKE_INSTALL_PREFIX="" \
- -DCMAKE_INSTALL_LIBDIR="lib" \
- -DCMAKE_BUILD_TYPE=Release \
- \
- -Dwaffle_build_tests=0 \
- -Dwaffle_build_manpages=0 \
- -Dwaffle_build_htmldocs=0 \
- -Dwaffle_build_examples=1
- make
- popd
- done
-}
-
-package() {
- for _arch in ${_architectures}; do
- cd "${_srcroot}/build-${_arch}"
- make DESTDIR="${pkgdir}" install
-# ${_arch}-strip --strip-unneeded "$pkgdir"/usr/${_arch}/bin/*.dll
-# ${_arch}-strip -g "$pkgdir"/usr/${_arch}/lib/*.a
- done
-
- for _arch in ${_architectures}; do
- cd "${_srcroot}/build-${_arch}-win"
- # Create Windows zip archives
- make package
- done
-}
-
-# vim:set ts=2 sw=2 et:
diff --git a/pkg/archlinux/waffle-1.3.0/PKGBUILD b/pkg/archlinux/waffle-1.3.0/PKGBUILD
deleted file mode 100644
index e2fa153..0000000
--- a/pkg/archlinux/waffle-1.3.0/PKGBUILD
+++ /dev/null
@@ -1,55 +0,0 @@
-# Maintainer: Chad Versace <chad.versace@linux.intel.com>
-
-pkgname='waffle'
-pkgver='1.3.0'
-pkgrel=1
-pkgdesc='a library for choosing window system and OpenGL API at runtime'
-arch=('i686' 'x86_64')
-url='http://www.waffle-gl.org'
-license=('BSD')
-
-depends=(
- 'libgl' # for GLX
- 'libegl'
- 'libgbm'
- 'libx11'
- 'libxcb'
- 'wayland'
- )
-makedepends=(
- 'cmake'
- 'xcb-proto'
-
- # For building the docs.
- 'libxslt'
- 'docbook-xsl'
- )
-source=("http://www.waffle-gl.org/files/release/$pkgname-$pkgver/$pkgname-$pkgver.tar.xz")
-sha256sums=('340ee04172dba878249469018cd7ec9d1ecd41af26b612c741b8b52e713bca8e')
-
-build() {
- cd "$srcdir/$pkgname-$pkgver"
-
- cmake \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DCMAKE_INSTALL_LIBDIR=/usr/lib \
- -DCMAKE_BUILD_TYPE=Release \
- -Dwaffle_has_gbm=1 \
- -Dwaffle_has_glx=1 \
- -Dwaffle_has_x11_egl=1 \
- -Dwaffle_has_wayland=1 \
- -Dwaffle_build_manpages=1 \
- -Dwaffle_build_htmldocs=1 \
- -Dwaffle_build_examples=0
- make
-}
-
-package() {
- cd "$srcdir/$pkgname-$pkgver"
- make DESTDIR="$pkgdir/" install
- install -m755 -d "$pkgdir/usr/share/licenses/$pkgname"
- install -m644 "$pkgdir/usr/share/doc/waffle1/LICENSE.txt" \
- "$pkgdir/usr/share/licenses/$pkgname/LICENSE.txt"
-}
-
-# vim:set ts=2 sw=2 et:
diff --git a/pkg/archlinux/waffle-1.4.0/.gitignore b/pkg/archlinux/waffle-1.4.0/.gitignore
deleted file mode 100644
index f69628a..0000000
--- a/pkg/archlinux/waffle-1.4.0/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-pkg/
-src/
-waffle/
-
-*.gz
-*.sig
-*.xz
diff --git a/pkg/archlinux/waffle-1.4.0/PKGBUILD b/pkg/archlinux/waffle-1.4.0/PKGBUILD
deleted file mode 100644
index 61cd7ab..0000000
--- a/pkg/archlinux/waffle-1.4.0/PKGBUILD
+++ /dev/null
@@ -1,56 +0,0 @@
-# maintainer: chad versace <chad.versace@linux.intel.com>
-
-pkgname='waffle'
-pkgver='1.4.0'
-pkgrel=1
-pkgdesc='a library for choosing window system and OpenGL API at runtime'
-arch=('i686' 'x86_64')
-url='http://www.waffle-gl.org'
-license=('BSD')
-
-depends=(
- 'libgl' # for glx
- 'libegl'
- 'libgbm'
- 'libx11'
- 'libxcb'
- 'wayland'
- )
-makedepends=(
- 'cmake'
- 'xcb-proto'
-
- # for building the docs.
- 'libxslt'
- 'docbook-xsl'
- )
-source=("http://www.waffle-gl.org/files/release/${pkgname}-${pkgver}/${pkgname}-${pkgver}.tar.xz")
-sha256sums=('3238b3da5d066750084c7cdd7b3e185bd8dce3a974cb1f804ccf0a8c87600923')
-
-_unpackdir="${pkgname}-${pkgver}"
-
-build() {
- cd "$srcdir/$_unpackdir"
- cmake \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DCMAKE_INSTALL_LIBDIR=/usr/lib \
- -DCMAKE_BUILD_TYPE=Release \
- -Dwaffle_has_glx=1 \
- -Dwaffle_has_x11_egl=1 \
- -Dwaffle_has_wayland=1 \
- -Dwaffle_has_gbm=1 \
- -Dwaffle_build_manpages=1 \
- -Dwaffle_build_htmldocs=1 \
- -Dwaffle_build_examples=0
- make
-}
-
-package() {
- cd "$srcdir/${_unpackdir}"
- make DESTDIR="$pkgdir/" install
- install -m755 -d "$pkgdir/usr/share/licenses/$pkgname"
- install -m644 "$pkgdir/usr/share/doc/waffle1/LICENSE.txt" \
- "$pkgdir/usr/share/licenses/$pkgname/LICENSE.txt"
-}
-
-# vim:set ts=2 sw=2 et:
diff --git a/pkg/archlinux/waffle-1.4.1/PKGBUILD b/pkg/archlinux/waffle-1.4.1/PKGBUILD
deleted file mode 100644
index 5426e4b..0000000
--- a/pkg/archlinux/waffle-1.4.1/PKGBUILD
+++ /dev/null
@@ -1,51 +0,0 @@
-# Maintainer: Chad Versace <chad.versace@linux.intel.com>
-
-pkgname='waffle'
-pkgver='1.4.1'
-pkgrel=2
-pkgdesc='a library for choosing window system and OpenGL API at runtime'
-arch=('i686' 'x86_64')
-url='http://www.waffle-gl.org'
-license=('BSD')
-
-depends=(
- 'libgl' # for GLX
- 'libegl'
- 'libgbm'
- 'libx11'
- 'libxcb'
- 'wayland'
- )
-makedepends=(
- 'cmake'
- 'xcb-proto'
-
- # For building the docs.
- 'libxslt'
- 'docbook-xsl'
- )
-source=("http://www.waffle-gl.org/files/release/$pkgname-$pkgver/$pkgname-$pkgver.tar.xz")
-sha256sums=('66b3240b94abc30cd18c644ffc145024ad60e5b8a8a7d1e718c265b4c24351c9')
-
-build() {
- cd "$srcdir/$pkgname-$pkgver"
-
- cmake \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DCMAKE_INSTALL_LIBDIR=/usr/lib \
- -DCMAKE_BUILD_TYPE=Release \
- -Dwaffle_build_manpages=1 \
- -Dwaffle_build_htmldocs=1 \
- -Dwaffle_build_examples=0
- make
-}
-
-package() {
- cd "$srcdir/$pkgname-$pkgver"
- make DESTDIR="$pkgdir/" install
- install -m755 -d "$pkgdir/usr/share/licenses/$pkgname"
- install -m644 "$pkgdir/usr/share/doc/waffle1/LICENSE.txt" \
- "$pkgdir/usr/share/licenses/$pkgname/LICENSE.txt"
-}
-
-# vim:set ts=2 sw=2 et:
diff --git a/pkg/archlinux/waffle-git/.gitignore b/pkg/archlinux/waffle-git/.gitignore
deleted file mode 100644
index 965f3ae..0000000
--- a/pkg/archlinux/waffle-git/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-src/
-pkg/
-waffle/
-
-*.xz
-*.sig
diff --git a/pkg/archlinux/waffle-git/PKGBUILD b/pkg/archlinux/waffle-git/PKGBUILD
deleted file mode 100644
index 932595c..0000000
--- a/pkg/archlinux/waffle-git/PKGBUILD
+++ /dev/null
@@ -1,64 +0,0 @@
-# maintainer: chad versace <chad.versace@linux.intel.com>
-
-pkgname='waffle-git'
-pkgver=1.4.0.rc1.r3.ge7bbe42
-pkgrel=1
-pkgdesc='a library for choosing window system and OpenGL API at runtime'
-arch=('i686' 'x86_64')
-url='http://www.waffle-gl.org'
-license=('BSD')
-
-provides=(waffle)
-conflicts=(waffle)
-depends=(
- 'libgl' # for glx
- 'libx11'
- 'libxcb'
- 'wayland'
- )
-makedepends=(
- 'cmake'
- 'xcb-proto'
-
- 'libegl'
- 'libgbm'
-
- # for building the docs.
- 'libxslt'
- 'docbook-xsl'
- )
-source=("git://github.com/waffle-gl/waffle")
-sha256sums=('SKIP')
-
-_unpackdir='waffle'
-
-pkgver() {
- cd "$srcdir/$_unpackdir"
- git describe --long --match 'v*' |
- sed -r 's/^v//;s/([^-]*-g)/r\1/;s/-/./g;'
-}
-
-build() {
- cd "$srcdir/$_unpackdir"
- cmake \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DCMAKE_INSTALL_LIBDIR=/usr/lib \
- -DCMAKE_BUILD_TYPE=Release \
- -Dwaffle_build_manpages=1 \
- -Dwaffle_build_htmldocs=1 \
- -Dwaffle_build_examples=0
- make
-}
-
-package() {
- optdepends=('libegl: for x11_egl, gbm or wayland support')
- optdepends=('libgbm: for gbm support')
-
- cd "$srcdir/${_unpackdir}"
- make DESTDIR="$pkgdir/" install
- install -m755 -d "$pkgdir/usr/share/licenses/$pkgname"
- install -m644 "$pkgdir/usr/share/doc/waffle1/LICENSE.txt" \
- "$pkgdir/usr/share/licenses/$pkgname/LICENSE.txt"
-}
-
-# vim:set ts=2 sw=2 et:
diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt
index 9cb6cc7..22edc6e 100644
--- a/src/utils/CMakeLists.txt
+++ b/src/utils/CMakeLists.txt
@@ -2,6 +2,10 @@
# 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/waffle/CMakeLists.txt b/src/waffle/CMakeLists.txt
index d76e029..ac9b415 100644
--- a/src/waffle/CMakeLists.txt
+++ b/src/waffle/CMakeLists.txt
@@ -15,6 +15,7 @@ include_directories(
egl
glx
linux
+ nacl
wayland
wgl
x11
@@ -25,6 +26,7 @@ include_directories(
${gl_INCLUDE_DIRS}
${GLEXT_INCLUDE_DIR}
${libudev_INCLUDE_DIRS}
+ ${nacl_INCLUDE_DIRS}
${wayland-client_INCLUDE_DIRS}
${wayland-egl_INCLUDE_DIRS}
${x11-xcb_INCLUDE_DIRS}
@@ -57,6 +59,12 @@ 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
@@ -173,6 +181,19 @@ 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_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
@@ -202,7 +223,7 @@ include_directories(
${XCB_INCLUDE_DIRS}
)
-add_library(${waffle_libname} SHARED ${waffle_sources})
+add_library(${waffle_libname} SHARED ${waffle_sources} ${waffle_cxx_sources})
# Debian's packaging system emits warnings if wflinfo directly links to any
# library that it doesn't directly use. Silence the warnings by annotating
diff --git a/src/waffle/api/waffle_init.c b/src/waffle/api/waffle_init.c
index ebc6cd5..fcf8456 100644
--- a/src/waffle/api/waffle_init.c
+++ b/src/waffle/api/waffle_init.c
@@ -35,6 +35,7 @@ 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);
static bool
waffle_init_parse_attrib_list(
@@ -104,6 +105,12 @@ waffle_init_parse_attrib_list(
CASE_UNDEFINED_PLATFORM(WGL)
#endif
+#ifdef WAFFLE_HAS_NACL
+ CASE_DEFINED_PLATFORM(NACL)
+#else
+ CASE_UNDEFINED_PLATFORM(NACL)
+#endif
+
default:
wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE,
"WAFFLE_PLATFORM has bad value 0x%x",
@@ -164,6 +171,10 @@ waffle_init_create_platform(int32_t waffle_platform)
case WAFFLE_PLATFORM_WGL:
return wgl_platform_create();
#endif
+#ifdef WAFFLE_HAS_NACL
+ case WAFFLE_PLATFORM_NACL:
+ return nacl_platform_create();
+#endif
default:
assert(false);
return NULL;
diff --git a/src/waffle/core/wcore_util.c b/src/waffle/core/wcore_util.c
index deee1bf..b2dafe4 100644
--- a/src/waffle/core/wcore_util.c
+++ b/src/waffle/core/wcore_util.c
@@ -62,6 +62,7 @@ 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_CONTEXT_API);
CASE(WAFFLE_CONTEXT_OPENGL);
CASE(WAFFLE_CONTEXT_OPENGL_ES1);
diff --git a/src/waffle/nacl/nacl_config.c b/src/waffle/nacl/nacl_config.c
new file mode 100644
index 0000000..27a75e1
--- /dev/null
+++ b/src/waffle/nacl/nacl_config.c
@@ -0,0 +1,63 @@
+// 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"
+
+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;
+
+ 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
new file mode 100644
index 0000000..3270179
--- /dev/null
+++ b/src/waffle/nacl/nacl_config.h
@@ -0,0 +1,49 @@
+// 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_config.h"
+#include "wcore_util.h"
+
+struct wcore_config_attrs;
+struct wcore_platform;
+
+struct nacl_config {
+ struct wcore_config wcore;
+};
+
+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);
diff --git a/src/waffle/nacl/nacl_container.cpp b/src/waffle/nacl/nacl_container.cpp
new file mode 100644
index 0000000..3e8073c
--- /dev/null
+++ b/src/waffle/nacl/nacl_container.cpp
@@ -0,0 +1,66 @@
+// 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/cpp/graphics_3d.h"
+#include "nacl_container.h"
+
+namespace waffle {
+
+struct nacl_container {
+ pp::Graphics3D ctx;
+};
+
+static void
+nacl_container_dtor(waffle::nacl_container *nc)
+{
+ if (!nc)
+ return;
+ delete nc;
+}
+
+static nacl_container*
+nacl_container_ctor()
+{
+ nacl_container *nc = new nacl_container;
+
+ if (!nc)
+ return NULL;
+
+ return nc;
+}
+
+}; // namespace waffle ends
+
+extern "C" struct nacl_container*
+nacl_init()
+{
+ return reinterpret_cast<nacl_container*>(waffle::nacl_container_ctor());
+}
+
+extern "C" void
+nacl_teardown(nacl_container *nc)
+{
+ waffle::nacl_container_dtor(reinterpret_cast<waffle::nacl_container*>(nc));
+}
diff --git a/src/waffle/nacl/nacl_container.h b/src/waffle/nacl/nacl_container.h
new file mode 100644
index 0000000..61d935c
--- /dev/null
+++ b/src/waffle/nacl/nacl_container.h
@@ -0,0 +1,38 @@
+// 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.
+
+#ifdef __cplusplus
+
+extern "C" {
+#endif
+
+struct nacl_container;
+
+struct nacl_container *nacl_init();
+void nacl_teardown(struct nacl_container *nc);
+
+#ifdef __cplusplus
+};
+#endif
diff --git a/src/waffle/nacl/nacl_context.c b/src/waffle/nacl/nacl_context.c
new file mode 100644
index 0000000..2e68a64
--- /dev/null
+++ b/src/waffle/nacl/nacl_context.c
@@ -0,0 +1,65 @@
+// 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_context.h"
+
+bool
+nacl_context_destroy(struct wcore_context *wc_self)
+{
+ struct nacl_context *self;
+ bool ok = true;
+
+ if (!wc_self)
+ return ok;
+
+ self = nacl_context(wc_self);
+
+ 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;
+ 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;
+
+ 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
new file mode 100644
index 0000000..bb4481a
--- /dev/null
+++ b/src/waffle/nacl/nacl_context.h
@@ -0,0 +1,52 @@
+// 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_context.h"
+#include "wcore_util.h"
+
+#include "nacl_display.h"
+#include "nacl_platform.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
new file mode 100644
index 0000000..2d1162e
--- /dev/null
+++ b/src/waffle/nacl/nacl_display.c
@@ -0,0 +1,70 @@
+// 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_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)
+{
+ return false;
+}
diff --git a/src/waffle/nacl/nacl_display.h b/src/waffle/nacl/nacl_display.h
new file mode 100644
index 0000000..34eee21
--- /dev/null
+++ b/src/waffle/nacl/nacl_display.h
@@ -0,0 +1,52 @@
+// 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_display.h"
+#include "wcore_error.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_platform.c b/src/waffle/nacl/nacl_platform.c
new file mode 100644
index 0000000..b4df9d9
--- /dev/null
+++ b/src/waffle/nacl/nacl_platform.c
@@ -0,0 +1,134 @@
+// 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_platform.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_teardown(self->nacl);
+
+ free(self);
+ return ok;
+}
+
+static bool
+nacl_platform_dl_can_open(struct wcore_platform *wc_self,
+ int32_t waffle_dl)
+{
+ return false;
+}
+
+static void*
+nacl_platform_dl_sym(struct wcore_platform *wc_self,
+ int32_t waffle_dl,
+ const char *name)
+{
+ return NULL;
+}
+
+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)
+{
+ return false;
+}
+
+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_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_platform_dl_can_open,
+ .dl_sym = nacl_platform_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
new file mode 100644
index 0000000..ba58de5
--- /dev/null
+++ b/src/waffle/nacl/nacl_platform.h
@@ -0,0 +1,49 @@
+// 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_error.h"
+#include "wcore_util.h"
+
+#include "nacl_config.h"
+#include "nacl_container.h"
+#include "nacl_context.h"
+#include "nacl_display.h"
+#include "nacl_window.h"
+
+struct nacl_platform {
+ struct wcore_platform wcore;
+ struct nacl_container *nacl;
+};
+
+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_window.c b/src/waffle/nacl/nacl_window.c
new file mode 100644
index 0000000..c5ba4e0
--- /dev/null
+++ b/src/waffle/nacl/nacl_window.c
@@ -0,0 +1,90 @@
+// 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_config.h"
+#include "nacl_display.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)
+{
+ struct nacl_window *self;
+ bool ok = true;
+
+ self = wcore_calloc(sizeof(*self));
+ if (self == NULL)
+ return NULL;
+
+ ok = wcore_window_init(&self->wcore, wc_config);
+ if (!ok)
+ goto error;
+
+ if (!ok)
+ 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)
+{
+ return false;
+}
+
+bool
+nacl_window_swap_buffers(struct wcore_window *wc_self)
+{
+ return false;
+}
diff --git a/src/waffle/nacl/nacl_window.h b/src/waffle/nacl/nacl_window.h
new file mode 100644
index 0000000..5f0906d
--- /dev/null
+++ b/src/waffle/nacl/nacl_window.h
@@ -0,0 +1,59 @@
+// 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_window.h"
+#include "wcore_util.h"
+#include "nacl_platform.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);
+
+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);