Changeset 1082


Ignore:
Timestamp:
Nov 21, 2011, 1:49:47 AM (11 years ago)
Author:
sam
Message:

core: port all code to NativeClient. Nothing runs for now, but it builds.

Location:
trunk
Files:
4 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/.gitignore

    r1054 r1082  
    77*.elf
    88*.self
     9*.nexe
    910*.userprefs
    1011*.usertasks
  • trunk/build/lol-build

    r1025 r1082  
    1616#  - linux-i386
    1717#  - linux-amd64
     18#  - nacl-amd64
    1819#  - ios-arm
    1920#  - osx-amd64
     
    118119            cd monsterz/android
    119120            android update project --path .
     121            ;;
     122        nacl-amd64)
     123            # no need for "-u _ZN2pp12CreateModuleEv" but it could be helpful
     124            ./configure CXX=x86_64-nacl-g++ CC=x86_64-nacl-gcc ac_cv_exeext=.nexe --host=none LOL_LIBS="-lppapi -lppapi_gles2 -lppapi_cpp"
    120125            ;;
    121126        ps3-ppu)
     
    179184        ps3-ppu)
    180185            ;;
     186        nacl-*)
     187            ;;
    181188        windows-i386)
    182189            # If neither $MSYSTEM or $DISPLAY are set, and xvfb-run
  • trunk/configure.ac

    r1043 r1082  
    129129  GL_LIBS="${GL_LIBS} ${GLES2_LIBS}"],
    130130 [:])
     131AC_CHECK_HEADER(GLES2/gl2.h,
     132 [AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
     133  ac_cv_my_have_gl="yes"])
    131134
    132135PKG_CHECK_MODULES(GL, gl,
     
    153156AC_CHECK_HEADER(PSGL/psgl.h,
    154157 [ac_cv_my_have_gl="yes"])
     158
    155159if test "${ac_cv_my_have_gl}" = "no"; then
    156160  AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]])
  • trunk/src/Makefile.am

    r1053 r1082  
    2020    \
    2121    $(ps3_sources) \
     22    $(nacl_sources) \
    2223    $(sdl_sources) \
    2324    \
     
    3940liblol_a_CPPFLAGS = @LOL_CFLAGS@
    4041
    41 sdl_sources =  \
     42sdl_sources = \
    4243    platform/sdl/sdlapp.cpp platform/sdl/sdlapp.h \
    4344    platform/sdl/sdlinput.cpp platform/sdl/sdlinput.h
     45
     46nacl_sources = \
     47    platform/nacl/naclapp.cpp platform/nacl/naclapp.h
    4448
    4549if HAVE_PS3
  • trunk/src/application/application.cpp

    r1063 r1082  
    1818#if defined __CELLOS_LV2__
    1919#   include "platform/ps3/ps3app.h"
     20#elif defined __native_client__
     21#   include "platform/nacl/naclapp.h"
    2022#elif defined HAVE_GLES_2X
    2123#   include "eglapp.h"
     
    4042#if defined __CELLOS_LV2__
    4143    Ps3App app;
     44#elif defined __native_client__
     45    NaClApp app;
    4246#elif defined HAVE_GLES_2X
    4347    /* FIXME: this macro is only deactivated if we include "lolgl.h" */
  • trunk/src/debug/quad.cpp

    r1051 r1082  
    154154    if (!data->initialised && !IsDestroying())
    155155    {
    156 #if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__
     156#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__
    157157        glGenVertexArrays(NUM_ARRAYS, data->array);
    158158#endif
     
    184184    else if (data->initialised && IsDestroying())
    185185    {
    186 #if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__
     186#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__
    187187        glDeleteVertexArrays(NUM_ARRAYS, data->array);
    188188#endif
     
    495495     * Renders an orange square.
    496496     */
    497 #if !defined __ANDROID__ && !defined __APPLE__
     497#if !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__
    498498    glColor4f(orange.x, orange.y, orange.z, orange.w);
    499499    glEnableClientState(GL_VERTEX_ARRAY);
     
    513513     * Renders a green sine wave made of 1-pixel points.
    514514     */
    515 #if !defined __ANDROID__ && !defined __APPLE__
     515#if !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__
    516516    glColor4f(0.0f, 1.0f, 0.0f, 1.0f);
    517517    glPointSize(1.0f);
     
    532532     * Renders a multicoloured square with varying colors.
    533533     */
    534 #if !defined __ANDROID__ && !defined __APPLE__
     534#if !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__
    535535    glEnableClientState(GL_VERTEX_ARRAY);
    536536    glEnableClientState(GL_COLOR_ARRAY);
     
    553553     * animated distorted checkerboard.
    554554     */
    555 #if !defined __ANDROID__ && !defined __APPLE__
     555#if !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__
    556556    glEnable(GL_TEXTURE_2D);
    557557    glBindTexture(GL_TEXTURE_2D, data->texture[0]);
     
    581581     * Renders an orange square.
    582582     */
    583 #if !defined __ANDROID__ && !defined __APPLE__
     583#if !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__
    584584    if (!shader[0])
    585585#if !defined __CELLOS_LV2__
     
    627627     * Renders an orange square.
    628628     */
    629 #if !defined __ANDROID__ && !defined __APPLE__
     629#if !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__
    630630    if (!shader[0])
    631631    {
     
    680680     * Renders a static, coloured and tiled pattern.
    681681     */
    682 #if !defined __ANDROID__ && !defined __APPLE__
     682#if !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__
    683683    if (!shader[0])
    684684#if !defined __CELLOS_LV2__
     
    733733     * Renders a multicoloured square with varying colors.
    734734     */
    735 #if !defined __ANDROID__ && !defined __APPLE__
     735#if !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__
    736736    if (!shader[0])
    737737    {
     
    797797     * Renders an antialiased green sine wave made of 1-pixel points.
    798798     */
    799 #if !defined __ANDROID__ && !defined __APPLE__ && !defined __CELLOS_LV2__
     799#if !defined __ANDROID__ && !defined __APPLE__ && !defined __CELLOS_LV2__ && !defined __native_client__
    800800    if (!shader[0])
    801801        shader[0] = Shader::Create(
     
    843843     * animated distorted checkerboard.
    844844     */
    845 #if !defined __ANDROID__ && !defined __APPLE__
     845#if !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__
    846846    if (!shader[0])
    847847#if !defined __CELLOS_LV2__
     
    916916     * animated distorted checkerboard.
    917917     */
    918 #if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__
     918#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__
    919919    if (!shader[0])
    920920    {
     
    986986     * animated distorted checkerboard.
    987987     */
    988 #if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__
     988#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__
    989989    if (!shader[0])
    990990    {
     
    10741074#endif
    10751075
    1076 #if !defined __ANDROID__ && !defined __APPLE__
     1076#if !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__
    10771077    glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    10781078#endif
     
    10831083    glClientActiveTexture(GL_TEXTURE0);
    10841084#endif
    1085 #if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__
     1085#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__
    10861086    glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_FALSE);
    10871087#endif
     
    10891089
    10901090    glDisable(GL_BLEND);
    1091 #if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__
     1091#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__
    10921092    glDisable(GL_POINT_SPRITE);
    10931093#endif
     
    11011101#endif
    11021102
    1103 #if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__
     1103#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__
    11041104    glDisable(GL_VERTEX_PROGRAM_POINT_SIZE);
    11051105#endif
  • trunk/src/real.h

    r1029 r1082  
    1818
    1919#include <stdint.h>
     20
     21/* Avoid issues with NaCl headers */
     22#undef log2
    2023
    2124namespace lol
  • trunk/src/timer.cpp

    r968 r1082  
    1616#include <stdint.h>
    1717
    18 #if defined __linux__ || defined __APPLE__
     18#if defined __linux__ || defined __native_client__ || defined __APPLE__
    1919#   include <sys/time.h>
    2020#   include <unistd.h>
     
    4949    TimerData()
    5050    {
    51 #if defined __linux__ || defined __APPLE__
     51#if defined __linux__ || defined __native_client__ || defined __APPLE__
    5252        gettimeofday(&tv0, NULL);
    5353#elif defined _WIN32
     
    6464    {
    6565        float ret, towait;
    66 #if defined __linux__ || defined __APPLE__
     66#if defined __linux__ || defined __native_client__ || defined __APPLE__
    6767        struct timeval tv;
    6868        gettimeofday(&tv, NULL);
     
    109109    static float GetMsPerCycle()
    110110    {
    111 #if defined __linux__ || defined __APPLE__
     111#if defined __linux__ || defined __native_client__ || defined __APPLE__
    112112        return 1.0f;
    113113#elif defined _WIN32
     
    122122    }
    123123
    124 #if defined __linux__ || defined __APPLE__
     124#if defined __linux__ || defined __native_client__ || defined __APPLE__
    125125    struct timeval tv0;
    126126#elif defined _WIN32
  • trunk/test/benchmark/trig.cpp

    r964 r1082  
    7474        timer.GetMs();
    7575        for (size_t i = 0; i < TRIG_TABLE_SIZE; i++)
    76 #if defined HAVE_FASTMATH_H
     76#if defined HAVE_FASTMATH_H && !defined __native_client__
    7777            pf2[i] = f_sinf(pf[i]);
    7878#else
     
    100100        timer.GetMs();
    101101        for (size_t i = 0; i < TRIG_TABLE_SIZE; i++)
    102 #if defined HAVE_FASTMATH_H
     102#if defined HAVE_FASTMATH_H && !defined __native_client__
    103103            pf2[i] = f_cosf(pf[i]);
    104104#else
     
    131131        for (size_t i = 0; i < TRIG_TABLE_SIZE; i++)
    132132        {
    133 #if defined HAVE_FASTMATH_H
     133#if defined HAVE_FASTMATH_H && !defined __native_client__
    134134            pf2[i] = f_sinf(pf[i]);
    135135            pf3[i] = f_cosf(pf[i]);
     
    160160        timer.GetMs();
    161161        for (size_t i = 0; i < TRIG_TABLE_SIZE; i++)
    162 #if defined HAVE_FASTMATH_H
     162#if defined HAVE_FASTMATH_H && !defined __native_client__
    163163            pf2[i] = f_tanf(pf[i]);
    164164#else
  • trunk/test/tutorial/tut03.cpp

    r1079 r1082  
    3535static GLenum const TEXTURE_FORMAT = GL_BGRA;
    3636static GLenum const TEXTURE_TYPE = GL_UNSIGNED_INT_8_8_8_8_REV;
     37#elif defined __native_client__
     38static GLint const INTERNAL_FORMAT = GL_RGBA;
     39static GLenum const TEXTURE_FORMAT = GL_RGBA;
     40static GLenum const TEXTURE_TYPE = GL_UNSIGNED_BYTE;
    3741#else
    3842/* Seems efficient for little endian textures */
Note: See TracChangeset for help on using the changeset viewer.