@@ -6,6 +6,7 @@ | |||||
*.exe | *.exe | ||||
*.elf | *.elf | ||||
*.self | *.self | ||||
*.nexe | |||||
*.userprefs | *.userprefs | ||||
*.usertasks | *.usertasks | ||||
*.pidb | *.pidb | ||||
@@ -0,0 +1,10 @@ | |||||
#!/bin/sh | |||||
# This can't hurt | |||||
make distclean | |||||
set -e | |||||
./build/lol-build bootstrap nacl-amd64 | |||||
./build/lol-build configure nacl-amd64 | |||||
./build/lol-build build nacl-amd64 | |||||
@@ -15,6 +15,7 @@ | |||||
# And <platform> is one of: | # And <platform> is one of: | ||||
# - linux-i386 | # - linux-i386 | ||||
# - linux-amd64 | # - linux-amd64 | ||||
# - nacl-amd64 | |||||
# - ios-arm | # - ios-arm | ||||
# - osx-amd64 | # - osx-amd64 | ||||
# - android-arm | # - android-arm | ||||
@@ -118,6 +119,10 @@ configure() | |||||
cd monsterz/android | cd monsterz/android | ||||
android update project --path . | android update project --path . | ||||
;; | ;; | ||||
nacl-amd64) | |||||
# no need for "-u _ZN2pp12CreateModuleEv" but it could be helpful | |||||
./configure CXX=x86_64-nacl-g++ CC=x86_64-nacl-gcc ac_cv_exeext=.nexe --host=none LOL_LIBS="-lppapi -lppapi_gles2 -lppapi_cpp" | |||||
;; | |||||
ps3-ppu) | ps3-ppu) | ||||
PATH="$PATH" ./configure CXX=ppu-lv2-g++ CC=ppu-lv2-gcc ac_cv_exeext=.elf --host=none | PATH="$PATH" ./configure CXX=ppu-lv2-g++ CC=ppu-lv2-gcc ac_cv_exeext=.elf --host=none | ||||
;; | ;; | ||||
@@ -178,6 +183,8 @@ check() | |||||
;; | ;; | ||||
ps3-ppu) | ps3-ppu) | ||||
;; | ;; | ||||
nacl-*) | |||||
;; | |||||
windows-i386) | windows-i386) | ||||
# If neither $MSYSTEM or $DISPLAY are set, and xvfb-run | # If neither $MSYSTEM or $DISPLAY are set, and xvfb-run | ||||
# exists, use it to run the test suite. | # exists, use it to run the test suite. | ||||
@@ -128,6 +128,9 @@ PKG_CHECK_MODULES(GLES2, glesv2, | |||||
GL_CFLAGS="${GL_CFLAGS} ${GLES2_CFLAGS}" | GL_CFLAGS="${GL_CFLAGS} ${GLES2_CFLAGS}" | ||||
GL_LIBS="${GL_LIBS} ${GLES2_LIBS}"], | GL_LIBS="${GL_LIBS} ${GLES2_LIBS}"], | ||||
[:]) | [:]) | ||||
AC_CHECK_HEADER(GLES2/gl2.h, | |||||
[AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available) | |||||
ac_cv_my_have_gl="yes"]) | |||||
PKG_CHECK_MODULES(GL, gl, | PKG_CHECK_MODULES(GL, gl, | ||||
[ac_cv_my_have_gl="yes" | [ac_cv_my_have_gl="yes" | ||||
@@ -152,6 +155,7 @@ AC_CHECK_HEADER(GL/gl.h, | |||||
LIBS="$LIBS_save"]) | LIBS="$LIBS_save"]) | ||||
AC_CHECK_HEADER(PSGL/psgl.h, | AC_CHECK_HEADER(PSGL/psgl.h, | ||||
[ac_cv_my_have_gl="yes"]) | [ac_cv_my_have_gl="yes"]) | ||||
if test "${ac_cv_my_have_gl}" = "no"; then | if test "${ac_cv_my_have_gl}" = "no"; then | ||||
AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]]) | AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]]) | ||||
fi | fi | ||||
@@ -19,6 +19,7 @@ liblol_a_SOURCES = \ | |||||
eglapp.cpp eglapp.h \ | eglapp.cpp eglapp.h \ | ||||
\ | \ | ||||
$(ps3_sources) \ | $(ps3_sources) \ | ||||
$(nacl_sources) \ | |||||
$(sdl_sources) \ | $(sdl_sources) \ | ||||
\ | \ | ||||
shader/shader.cpp shader/shader.h \ | shader/shader.cpp shader/shader.h \ | ||||
@@ -38,10 +39,13 @@ liblol_a_SOURCES = \ | |||||
debug/quad.cpp debug/quad.h | debug/quad.cpp debug/quad.h | ||||
liblol_a_CPPFLAGS = @LOL_CFLAGS@ | liblol_a_CPPFLAGS = @LOL_CFLAGS@ | ||||
sdl_sources = \ | |||||
sdl_sources = \ | |||||
platform/sdl/sdlapp.cpp platform/sdl/sdlapp.h \ | platform/sdl/sdlapp.cpp platform/sdl/sdlapp.h \ | ||||
platform/sdl/sdlinput.cpp platform/sdl/sdlinput.h | platform/sdl/sdlinput.cpp platform/sdl/sdlinput.h | ||||
nacl_sources = \ | |||||
platform/nacl/naclapp.cpp platform/nacl/naclapp.h | |||||
if HAVE_PS3 | if HAVE_PS3 | ||||
ps3_sources = \ | ps3_sources = \ | ||||
platform/ps3/ps3app.cpp platform/ps3/ps3app.h \ | platform/ps3/ps3app.cpp platform/ps3/ps3app.h \ | ||||
@@ -17,6 +17,8 @@ | |||||
#if defined __CELLOS_LV2__ | #if defined __CELLOS_LV2__ | ||||
# include "platform/ps3/ps3app.h" | # include "platform/ps3/ps3app.h" | ||||
#elif defined __native_client__ | |||||
# include "platform/nacl/naclapp.h" | |||||
#elif defined HAVE_GLES_2X | #elif defined HAVE_GLES_2X | ||||
# include "eglapp.h" | # include "eglapp.h" | ||||
#else | #else | ||||
@@ -39,6 +41,8 @@ class ApplicationData | |||||
#if defined __CELLOS_LV2__ | #if defined __CELLOS_LV2__ | ||||
Ps3App app; | Ps3App app; | ||||
#elif defined __native_client__ | |||||
NaClApp app; | |||||
#elif defined HAVE_GLES_2X | #elif defined HAVE_GLES_2X | ||||
/* FIXME: this macro is only deactivated if we include "lolgl.h" */ | /* FIXME: this macro is only deactivated if we include "lolgl.h" */ | ||||
EglApp app; | EglApp app; | ||||
@@ -153,7 +153,7 @@ void DebugQuad::TickDraw(float deltams) | |||||
if (!data->initialised && !IsDestroying()) | if (!data->initialised && !IsDestroying()) | ||||
{ | { | ||||
#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ | |||||
#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__ | |||||
glGenVertexArrays(NUM_ARRAYS, data->array); | glGenVertexArrays(NUM_ARRAYS, data->array); | ||||
#endif | #endif | ||||
glGenBuffers(NUM_BUFFERS, data->buffer); | glGenBuffers(NUM_BUFFERS, data->buffer); | ||||
@@ -183,7 +183,7 @@ void DebugQuad::TickDraw(float deltams) | |||||
} | } | ||||
else if (data->initialised && IsDestroying()) | else if (data->initialised && IsDestroying()) | ||||
{ | { | ||||
#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ | |||||
#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__ | |||||
glDeleteVertexArrays(NUM_ARRAYS, data->array); | glDeleteVertexArrays(NUM_ARRAYS, data->array); | ||||
#endif | #endif | ||||
glDeleteBuffers(NUM_BUFFERS, data->buffer); | glDeleteBuffers(NUM_BUFFERS, data->buffer); | ||||
@@ -494,7 +494,7 @@ void DebugQuad::TickDraw(float deltams) | |||||
* | * | ||||
* Renders an orange square. | * Renders an orange square. | ||||
*/ | */ | ||||
#if !defined __ANDROID__ && !defined __APPLE__ | |||||
#if !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__ | |||||
glColor4f(orange.x, orange.y, orange.z, orange.w); | glColor4f(orange.x, orange.y, orange.z, orange.w); | ||||
glEnableClientState(GL_VERTEX_ARRAY); | glEnableClientState(GL_VERTEX_ARRAY); | ||||
@@ -512,7 +512,7 @@ void DebugQuad::TickDraw(float deltams) | |||||
* | * | ||||
* Renders a green sine wave made of 1-pixel points. | * Renders a green sine wave made of 1-pixel points. | ||||
*/ | */ | ||||
#if !defined __ANDROID__ && !defined __APPLE__ | |||||
#if !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__ | |||||
glColor4f(0.0f, 1.0f, 0.0f, 1.0f); | glColor4f(0.0f, 1.0f, 0.0f, 1.0f); | ||||
glPointSize(1.0f); | glPointSize(1.0f); | ||||
glEnableClientState(GL_VERTEX_ARRAY); | glEnableClientState(GL_VERTEX_ARRAY); | ||||
@@ -531,7 +531,7 @@ void DebugQuad::TickDraw(float deltams) | |||||
* | * | ||||
* Renders a multicoloured square with varying colors. | * Renders a multicoloured square with varying colors. | ||||
*/ | */ | ||||
#if !defined __ANDROID__ && !defined __APPLE__ | |||||
#if !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__ | |||||
glEnableClientState(GL_VERTEX_ARRAY); | glEnableClientState(GL_VERTEX_ARRAY); | ||||
glEnableClientState(GL_COLOR_ARRAY); | glEnableClientState(GL_COLOR_ARRAY); | ||||
@@ -552,7 +552,7 @@ void DebugQuad::TickDraw(float deltams) | |||||
* Renders a multicoloured square with varying colors multiplied with an | * Renders a multicoloured square with varying colors multiplied with an | ||||
* animated distorted checkerboard. | * animated distorted checkerboard. | ||||
*/ | */ | ||||
#if !defined __ANDROID__ && !defined __APPLE__ | |||||
#if !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__ | |||||
glEnable(GL_TEXTURE_2D); | glEnable(GL_TEXTURE_2D); | ||||
glBindTexture(GL_TEXTURE_2D, data->texture[0]); | glBindTexture(GL_TEXTURE_2D, data->texture[0]); | ||||
glEnableClientState(GL_VERTEX_ARRAY); | glEnableClientState(GL_VERTEX_ARRAY); | ||||
@@ -580,7 +580,7 @@ void DebugQuad::TickDraw(float deltams) | |||||
* | * | ||||
* Renders an orange square. | * Renders an orange square. | ||||
*/ | */ | ||||
#if !defined __ANDROID__ && !defined __APPLE__ | |||||
#if !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__ | |||||
if (!shader[0]) | if (!shader[0]) | ||||
#if !defined __CELLOS_LV2__ | #if !defined __CELLOS_LV2__ | ||||
shader[0] = Shader::Create( | shader[0] = Shader::Create( | ||||
@@ -626,7 +626,7 @@ void DebugQuad::TickDraw(float deltams) | |||||
* | * | ||||
* Renders an orange square. | * Renders an orange square. | ||||
*/ | */ | ||||
#if !defined __ANDROID__ && !defined __APPLE__ | |||||
#if !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__ | |||||
if (!shader[0]) | if (!shader[0]) | ||||
{ | { | ||||
#if !defined __CELLOS_LV2__ | #if !defined __CELLOS_LV2__ | ||||
@@ -679,7 +679,7 @@ void DebugQuad::TickDraw(float deltams) | |||||
* | * | ||||
* Renders a static, coloured and tiled pattern. | * Renders a static, coloured and tiled pattern. | ||||
*/ | */ | ||||
#if !defined __ANDROID__ && !defined __APPLE__ | |||||
#if !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__ | |||||
if (!shader[0]) | if (!shader[0]) | ||||
#if !defined __CELLOS_LV2__ | #if !defined __CELLOS_LV2__ | ||||
shader[0] = Shader::Create( | shader[0] = Shader::Create( | ||||
@@ -732,7 +732,7 @@ void DebugQuad::TickDraw(float deltams) | |||||
* | * | ||||
* Renders a multicoloured square with varying colors. | * Renders a multicoloured square with varying colors. | ||||
*/ | */ | ||||
#if !defined __ANDROID__ && !defined __APPLE__ | |||||
#if !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__ | |||||
if (!shader[0]) | if (!shader[0]) | ||||
{ | { | ||||
#if !defined __CELLOS_LV2__ | #if !defined __CELLOS_LV2__ | ||||
@@ -796,7 +796,7 @@ void DebugQuad::TickDraw(float deltams) | |||||
* | * | ||||
* Renders an antialiased green sine wave made of 1-pixel points. | * Renders an antialiased green sine wave made of 1-pixel points. | ||||
*/ | */ | ||||
#if !defined __ANDROID__ && !defined __APPLE__ && !defined __CELLOS_LV2__ | |||||
#if !defined __ANDROID__ && !defined __APPLE__ && !defined __CELLOS_LV2__ && !defined __native_client__ | |||||
if (!shader[0]) | if (!shader[0]) | ||||
shader[0] = Shader::Create( | shader[0] = Shader::Create( | ||||
"#version 120\n" | "#version 120\n" | ||||
@@ -842,7 +842,7 @@ void DebugQuad::TickDraw(float deltams) | |||||
* Renders a multicoloured square with varying colors xored with an | * Renders a multicoloured square with varying colors xored with an | ||||
* animated distorted checkerboard. | * animated distorted checkerboard. | ||||
*/ | */ | ||||
#if !defined __ANDROID__ && !defined __APPLE__ | |||||
#if !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__ | |||||
if (!shader[0]) | if (!shader[0]) | ||||
#if !defined __CELLOS_LV2__ | #if !defined __CELLOS_LV2__ | ||||
shader[0] = Shader::Create( | shader[0] = Shader::Create( | ||||
@@ -915,7 +915,7 @@ void DebugQuad::TickDraw(float deltams) | |||||
* Renders a multicoloured square with varying colors xored with an | * Renders a multicoloured square with varying colors xored with an | ||||
* animated distorted checkerboard. | * animated distorted checkerboard. | ||||
*/ | */ | ||||
#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ | |||||
#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__ | |||||
if (!shader[0]) | if (!shader[0]) | ||||
{ | { | ||||
shader[0] = Shader::Create( | shader[0] = Shader::Create( | ||||
@@ -985,7 +985,7 @@ void DebugQuad::TickDraw(float deltams) | |||||
* Renders a multicoloured square with varying colors xored with an | * Renders a multicoloured square with varying colors xored with an | ||||
* animated distorted checkerboard. | * animated distorted checkerboard. | ||||
*/ | */ | ||||
#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ | |||||
#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__ | |||||
if (!shader[0]) | if (!shader[0]) | ||||
{ | { | ||||
shader[0] = Shader::Create( | shader[0] = Shader::Create( | ||||
@@ -1073,7 +1073,7 @@ void DebugQuad::ResetState() | |||||
glLoadIdentity(); | glLoadIdentity(); | ||||
#endif | #endif | ||||
#if !defined __ANDROID__ && !defined __APPLE__ | |||||
#if !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__ | |||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f); | glColor4f(1.0f, 1.0f, 1.0f, 1.0f); | ||||
#endif | #endif | ||||
@@ -1082,13 +1082,13 @@ void DebugQuad::ResetState() | |||||
#if defined HAVE_GLBEGIN || defined USE_GLEW || defined __CELLOS_LV2__ | #if defined HAVE_GLBEGIN || defined USE_GLEW || defined __CELLOS_LV2__ | ||||
glClientActiveTexture(GL_TEXTURE0); | glClientActiveTexture(GL_TEXTURE0); | ||||
#endif | #endif | ||||
#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ | |||||
#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__ | |||||
glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_FALSE); | glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_FALSE); | ||||
#endif | #endif | ||||
glDisable(GL_TEXTURE_2D); | glDisable(GL_TEXTURE_2D); | ||||
glDisable(GL_BLEND); | glDisable(GL_BLEND); | ||||
#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ | |||||
#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__ | |||||
glDisable(GL_POINT_SPRITE); | glDisable(GL_POINT_SPRITE); | ||||
#endif | #endif | ||||
@@ -1100,7 +1100,7 @@ void DebugQuad::ResetState() | |||||
cgGLDisableProfile(cgGLGetLatestProfile(CG_GL_FRAGMENT)); | cgGLDisableProfile(cgGLGetLatestProfile(CG_GL_FRAGMENT)); | ||||
#endif | #endif | ||||
#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ | |||||
#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__ | |||||
glDisable(GL_VERTEX_PROGRAM_POINT_SIZE); | glDisable(GL_VERTEX_PROGRAM_POINT_SIZE); | ||||
#endif | #endif | ||||
} | } | ||||
@@ -0,0 +1,82 @@ | |||||
// | |||||
// Lol Engine | |||||
// | |||||
// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
// This program is free software; you can redistribute it and/or | |||||
// modify it under the terms of the Do What The Fuck You Want To | |||||
// Public License, Version 2, as published by Sam Hocevar. See | |||||
// http://sam.zoy.org/projects/COPYING.WTFPL for more details. | |||||
// | |||||
#if defined HAVE_CONFIG_H | |||||
# include "config.h" | |||||
#endif | |||||
#if defined __native_client__ | |||||
# include "ppapi/cpp/instance.h" | |||||
# include "ppapi/cpp/module.h" | |||||
# include "ppapi/cpp/var.h" | |||||
#endif | |||||
#include "core.h" | |||||
#include "lolgl.h" | |||||
#include "naclapp.h" | |||||
namespace lol | |||||
{ | |||||
/* | |||||
* PS3 App implementation class | |||||
*/ | |||||
class NaClAppData | |||||
{ | |||||
friend class NaClApp; | |||||
private: | |||||
#if defined __native_client__ | |||||
#endif | |||||
}; | |||||
/* | |||||
* Public NaClApp class | |||||
*/ | |||||
NaClApp::NaClApp(char const *title, ivec2 res, float fps) : | |||||
data(new NaClAppData()) | |||||
{ | |||||
#if defined __native_client__ | |||||
#endif | |||||
} | |||||
void NaClApp::ShowPointer(bool show) | |||||
{ | |||||
; | |||||
} | |||||
void NaClApp::Run() | |||||
{ | |||||
while (!Ticker::Finished()) | |||||
{ | |||||
/* Tick the game */ | |||||
Ticker::TickGame(); | |||||
/* Tick the renderer, show the frame and clamp to desired framerate. */ | |||||
Ticker::TickDraw(); | |||||
#if defined __native_client__ | |||||
#endif | |||||
Ticker::ClampFps(); | |||||
} | |||||
} | |||||
NaClApp::~NaClApp() | |||||
{ | |||||
#if defined __native_client__ | |||||
#endif | |||||
delete data; | |||||
} | |||||
} /* namespace lol */ | |||||
@@ -0,0 +1,42 @@ | |||||
// | |||||
// Lol Engine | |||||
// | |||||
// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
// This program is free software; you can redistribute it and/or | |||||
// modify it under the terms of the Do What The Fuck You Want To | |||||
// Public License, Version 2, as published by Sam Hocevar. See | |||||
// http://sam.zoy.org/projects/COPYING.WTFPL for more details. | |||||
// | |||||
// | |||||
// The NaClApp class | |||||
// ----------------- | |||||
// | |||||
#if !defined __LOL_NACLAPP_H__ | |||||
#define __LOL_NACLAPP_H__ | |||||
#include "matrix.h" | |||||
namespace lol | |||||
{ | |||||
class NaClAppData; | |||||
class NaClApp | |||||
{ | |||||
public: | |||||
NaClApp(char const *title, ivec2 res, float fps); | |||||
virtual ~NaClApp(); | |||||
void ShowPointer(bool show); | |||||
void Run(); | |||||
private: | |||||
NaClAppData *data; | |||||
}; | |||||
} /* namespace lol */ | |||||
#endif // __LOL_NACLAPP_H__ | |||||
@@ -18,6 +18,9 @@ | |||||
#include <stdint.h> | #include <stdint.h> | ||||
/* Avoid issues with NaCl headers */ | |||||
#undef log2 | |||||
namespace lol | namespace lol | ||||
{ | { | ||||
@@ -15,7 +15,7 @@ | |||||
#include <cstdlib> | #include <cstdlib> | ||||
#include <stdint.h> | #include <stdint.h> | ||||
#if defined __linux__ || defined __APPLE__ | |||||
#if defined __linux__ || defined __native_client__ || defined __APPLE__ | |||||
# include <sys/time.h> | # include <sys/time.h> | ||||
# include <unistd.h> | # include <unistd.h> | ||||
#elif defined _XBOX | #elif defined _XBOX | ||||
@@ -48,7 +48,7 @@ class TimerData | |||||
private: | private: | ||||
TimerData() | TimerData() | ||||
{ | { | ||||
#if defined __linux__ || defined __APPLE__ | |||||
#if defined __linux__ || defined __native_client__ || defined __APPLE__ | |||||
gettimeofday(&tv0, NULL); | gettimeofday(&tv0, NULL); | ||||
#elif defined _WIN32 | #elif defined _WIN32 | ||||
QueryPerformanceCounter(&cycles0); | QueryPerformanceCounter(&cycles0); | ||||
@@ -63,7 +63,7 @@ private: | |||||
float GetOrWait(float deltams, bool update) | float GetOrWait(float deltams, bool update) | ||||
{ | { | ||||
float ret, towait; | float ret, towait; | ||||
#if defined __linux__ || defined __APPLE__ | |||||
#if defined __linux__ || defined __native_client__ || defined __APPLE__ | |||||
struct timeval tv; | struct timeval tv; | ||||
gettimeofday(&tv, NULL); | gettimeofday(&tv, NULL); | ||||
ret = 1e-3f * (tv.tv_usec - tv0.tv_usec) | ret = 1e-3f * (tv.tv_usec - tv0.tv_usec) | ||||
@@ -108,7 +108,7 @@ private: | |||||
static float GetMsPerCycle() | static float GetMsPerCycle() | ||||
{ | { | ||||
#if defined __linux__ || defined __APPLE__ | |||||
#if defined __linux__ || defined __native_client__ || defined __APPLE__ | |||||
return 1.0f; | return 1.0f; | ||||
#elif defined _WIN32 | #elif defined _WIN32 | ||||
LARGE_INTEGER tmp; | LARGE_INTEGER tmp; | ||||
@@ -121,7 +121,7 @@ private: | |||||
#endif | #endif | ||||
} | } | ||||
#if defined __linux__ || defined __APPLE__ | |||||
#if defined __linux__ || defined __native_client__ || defined __APPLE__ | |||||
struct timeval tv0; | struct timeval tv0; | ||||
#elif defined _WIN32 | #elif defined _WIN32 | ||||
LARGE_INTEGER cycles0; | LARGE_INTEGER cycles0; | ||||
@@ -73,7 +73,7 @@ void bench_trig(int mode) | |||||
/* Fast sin */ | /* Fast sin */ | ||||
timer.GetMs(); | timer.GetMs(); | ||||
for (size_t i = 0; i < TRIG_TABLE_SIZE; i++) | for (size_t i = 0; i < TRIG_TABLE_SIZE; i++) | ||||
#if defined HAVE_FASTMATH_H | |||||
#if defined HAVE_FASTMATH_H && !defined __native_client__ | |||||
pf2[i] = f_sinf(pf[i]); | pf2[i] = f_sinf(pf[i]); | ||||
#else | #else | ||||
pf2[i] = sinf(pf[i]); | pf2[i] = sinf(pf[i]); | ||||
@@ -99,7 +99,7 @@ void bench_trig(int mode) | |||||
/* Fast cos */ | /* Fast cos */ | ||||
timer.GetMs(); | timer.GetMs(); | ||||
for (size_t i = 0; i < TRIG_TABLE_SIZE; i++) | for (size_t i = 0; i < TRIG_TABLE_SIZE; i++) | ||||
#if defined HAVE_FASTMATH_H | |||||
#if defined HAVE_FASTMATH_H && !defined __native_client__ | |||||
pf2[i] = f_cosf(pf[i]); | pf2[i] = f_cosf(pf[i]); | ||||
#else | #else | ||||
pf2[i] = cosf(pf[i]); | pf2[i] = cosf(pf[i]); | ||||
@@ -130,7 +130,7 @@ void bench_trig(int mode) | |||||
timer.GetMs(); | timer.GetMs(); | ||||
for (size_t i = 0; i < TRIG_TABLE_SIZE; i++) | for (size_t i = 0; i < TRIG_TABLE_SIZE; i++) | ||||
{ | { | ||||
#if defined HAVE_FASTMATH_H | |||||
#if defined HAVE_FASTMATH_H && !defined __native_client__ | |||||
pf2[i] = f_sinf(pf[i]); | pf2[i] = f_sinf(pf[i]); | ||||
pf3[i] = f_cosf(pf[i]); | pf3[i] = f_cosf(pf[i]); | ||||
#else | #else | ||||
@@ -159,7 +159,7 @@ void bench_trig(int mode) | |||||
/* Fast tan */ | /* Fast tan */ | ||||
timer.GetMs(); | timer.GetMs(); | ||||
for (size_t i = 0; i < TRIG_TABLE_SIZE; i++) | for (size_t i = 0; i < TRIG_TABLE_SIZE; i++) | ||||
#if defined HAVE_FASTMATH_H | |||||
#if defined HAVE_FASTMATH_H && !defined __native_client__ | |||||
pf2[i] = f_tanf(pf[i]); | pf2[i] = f_tanf(pf[i]); | ||||
#else | #else | ||||
pf2[i] = tanf(pf[i]); | pf2[i] = tanf(pf[i]); | ||||
@@ -34,6 +34,10 @@ using namespace lol; | |||||
static GLint const INTERNAL_FORMAT = GL_ARGB_SCE; | static GLint const INTERNAL_FORMAT = GL_ARGB_SCE; | ||||
static GLenum const TEXTURE_FORMAT = GL_BGRA; | static GLenum const TEXTURE_FORMAT = GL_BGRA; | ||||
static GLenum const TEXTURE_TYPE = GL_UNSIGNED_INT_8_8_8_8_REV; | static GLenum const TEXTURE_TYPE = GL_UNSIGNED_INT_8_8_8_8_REV; | ||||
#elif defined __native_client__ | |||||
static GLint const INTERNAL_FORMAT = GL_RGBA; | |||||
static GLenum const TEXTURE_FORMAT = GL_RGBA; | |||||
static GLenum const TEXTURE_TYPE = GL_UNSIGNED_BYTE; | |||||
#else | #else | ||||
/* Seems efficient for little endian textures */ | /* Seems efficient for little endian textures */ | ||||
static GLint const INTERNAL_FORMAT = GL_RGBA; | static GLint const INTERNAL_FORMAT = GL_RGBA; | ||||