early-access version 1667
This commit is contained in:
15
externals/SDL/test/CMakeLists.txt
vendored
15
externals/SDL/test/CMakeLists.txt
vendored
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 2.8.11)
|
||||
cmake_minimum_required(VERSION 3.0.0)
|
||||
project(SDL2 C)
|
||||
|
||||
# Global settings for all of the test targets
|
||||
@@ -13,6 +13,12 @@ if(WINDOWS)
|
||||
add_definitions(-Dmain=SDL_main)
|
||||
endif()
|
||||
|
||||
find_package(OpenGL)
|
||||
|
||||
if (OPENGL_FOUND)
|
||||
add_definitions(-DHAVE_OPENGL)
|
||||
endif()
|
||||
|
||||
add_executable(checkkeys checkkeys.c)
|
||||
add_executable(loopwave loopwave.c)
|
||||
add_executable(loopwavequeue loopwavequeue.c)
|
||||
@@ -88,6 +94,13 @@ add_executable(controllermap controllermap.c)
|
||||
add_executable(testvulkan testvulkan.c)
|
||||
add_executable(testoffscreen testoffscreen.c)
|
||||
|
||||
if(OPENGL_FOUND)
|
||||
add_dependencies(testshader OpenGL::GL)
|
||||
add_dependencies(testgl2 OpenGL::GL)
|
||||
target_link_libraries(testshader OpenGL::GL)
|
||||
target_link_libraries(testgl2 OpenGL::GL)
|
||||
endif()
|
||||
|
||||
# HACK: Dummy target to cause the resource files to be copied to the build directory.
|
||||
# Need to make it an executable so we can use the TARGET_FILE_DIR generator expression.
|
||||
# This is needed so they get copied to the correct Debug/Release subdirectory in Xcode.
|
||||
|
3
externals/SDL/test/Makefile.in
vendored
3
externals/SDL/test/Makefile.in
vendored
@@ -170,6 +170,9 @@ testgles$(EXE): $(srcdir)/testgles.c
|
||||
testgles2$(EXE): $(srcdir)/testgles2.c
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@
|
||||
|
||||
testgles2_sdf$(EXE): $(srcdir)/testgles2_sdf.c
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@
|
||||
|
||||
testhaptic$(EXE): $(srcdir)/testhaptic.c
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
|
||||
|
||||
|
1
externals/SDL/test/Makefile.os2
vendored
1
externals/SDL/test/Makefile.os2
vendored
@@ -45,6 +45,7 @@ all: $(TARGETS)
|
||||
INCPATH = -I$(%WATCOM)/h/os2 -I$(%WATCOM)/h -I../include
|
||||
|
||||
CFLAGS = $(INCPATH) -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei
|
||||
CFLAGS+= -wx -wcd=303
|
||||
|
||||
LIBPATH = ..
|
||||
LIBS = SDL2.lib $(TESTLIB)
|
||||
|
46
externals/SDL/test/acinclude.m4
vendored
46
externals/SDL/test/acinclude.m4
vendored
@@ -5,13 +5,13 @@
|
||||
# stolen from Manish Singh
|
||||
# Shamelessly stolen from Owen Taylor
|
||||
|
||||
# serial 1
|
||||
# serial 2
|
||||
|
||||
dnl AM_PATH_SDL2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_SDL2],
|
||||
[dnl
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the sdl2-config script
|
||||
dnl
|
||||
AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
|
||||
@@ -80,41 +80,19 @@ dnl Now check if the installed SDL is sufficiently new. (Also sanity
|
||||
dnl checks the results of sdl2-config to some extent
|
||||
dnl
|
||||
rm -f conf.sdltest
|
||||
AC_TRY_RUN([
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "SDL.h"
|
||||
|
||||
char*
|
||||
my_strdup (char *str)
|
||||
{
|
||||
char *new_str;
|
||||
|
||||
if (str)
|
||||
{
|
||||
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
|
||||
strcpy (new_str, str);
|
||||
}
|
||||
else
|
||||
new_str = NULL;
|
||||
|
||||
return new_str;
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int major, minor, micro;
|
||||
char *tmp_version;
|
||||
FILE *fp = fopen("conf.sdltest", "w");
|
||||
|
||||
/* This hangs on some systems (?)
|
||||
system ("touch conf.sdltest");
|
||||
*/
|
||||
{ FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
|
||||
if (fp) fclose(fp);
|
||||
|
||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||
tmp_version = my_strdup("$min_sdl_version");
|
||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
if (sscanf("$min_sdl_version", "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_sdl_version");
|
||||
exit(1);
|
||||
}
|
||||
@@ -137,7 +115,7 @@ int main (int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
]])], [], [no_sdl=yes], [echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
@@ -165,7 +143,7 @@ int main (int argc, char *argv[])
|
||||
CFLAGS="$CFLAGS $SDL_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
|
||||
LIBS="$LIBS $SDL_LIBS"
|
||||
AC_TRY_LINK([
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <stdio.h>
|
||||
#include "SDL.h"
|
||||
|
||||
@@ -173,7 +151,7 @@ int main(int argc, char *argv[])
|
||||
{ return 0; }
|
||||
#undef main
|
||||
#define main K_and_R_C_main
|
||||
], [ return 0; ],
|
||||
]], [[ return 0; ]])],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding SDL or finding the wrong"
|
||||
echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
|
||||
@@ -228,7 +206,7 @@ int main(int argc, char *argv[])
|
||||
# ----------------------------------
|
||||
AC_DEFUN([PKG_PROG_PKG_CONFIG],
|
||||
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
|
||||
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
|
||||
m4_pattern_allow([^PKG_CONFIG(_PATH|_LIBDIR)?$])
|
||||
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
|
||||
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
|
||||
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
|
||||
@@ -337,7 +315,7 @@ $$1_PKG_ERRORS
|
||||
Consider adjusting the PKG_CONFIG_PATH environment variable if you
|
||||
installed software in a non-standard prefix.
|
||||
|
||||
_PKG_TEXT])dnl
|
||||
_PKG_TEXT])[]dnl
|
||||
])
|
||||
elif test $pkg_failed = untried; then
|
||||
AC_MSG_RESULT([no])
|
||||
@@ -348,7 +326,7 @@ path to pkg-config.
|
||||
|
||||
_PKG_TEXT
|
||||
|
||||
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl
|
||||
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
|
||||
])
|
||||
else
|
||||
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
|
||||
|
17
externals/SDL/test/autogen.sh
vendored
17
externals/SDL/test/autogen.sh
vendored
@@ -1,12 +1,11 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Regenerate configuration files
|
||||
|
||||
cp acinclude.m4 aclocal.m4
|
||||
found=false
|
||||
for autoconf in autoconf autoconf259 autoconf-2.59
|
||||
do if which $autoconf >/dev/null 2>&1; then $autoconf && found=true; break; fi
|
||||
done
|
||||
if test x$found = xfalse; then
|
||||
echo "Couldn't find autoconf, aborting"
|
||||
exit 1
|
||||
|
||||
if test "$AUTOCONF"x = x; then
|
||||
AUTOCONF=autoconf
|
||||
fi
|
||||
|
||||
$AUTOCONF || exit 1
|
||||
rm aclocal.m4
|
||||
rm -rf autom4te.cache
|
||||
|
2
externals/SDL/test/checkkeys.c
vendored
2
externals/SDL/test/checkkeys.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
174
externals/SDL/test/configure
vendored
174
externals/SDL/test/configure
vendored
@@ -581,7 +581,7 @@ PACKAGE_STRING=
|
||||
PACKAGE_BUGREPORT=
|
||||
PACKAGE_URL=
|
||||
|
||||
ac_unique_file="README"
|
||||
ac_unique_file="loopwave.c"
|
||||
ac_subst_vars='LTLIBOBJS
|
||||
LIBOBJS
|
||||
SDL_TTF_LIB
|
||||
@@ -1442,48 +1442,6 @@ fi
|
||||
|
||||
} # ac_fn_c_try_compile
|
||||
|
||||
# ac_fn_c_try_run LINENO
|
||||
# ----------------------
|
||||
# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
|
||||
# that executables *can* be run.
|
||||
ac_fn_c_try_run ()
|
||||
{
|
||||
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
|
||||
if { { ac_try="$ac_link"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo"; } >&5
|
||||
(eval "$ac_link") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
|
||||
{ { case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo"; } >&5
|
||||
(eval "$ac_try") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; }; then :
|
||||
ac_retval=0
|
||||
else
|
||||
$as_echo "$as_me: program exited with status $ac_status" >&5
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_retval=$ac_status
|
||||
fi
|
||||
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
|
||||
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
|
||||
as_fn_set_status $ac_retval
|
||||
|
||||
} # ac_fn_c_try_run
|
||||
|
||||
# ac_fn_c_try_link LINENO
|
||||
# -----------------------
|
||||
# Try to link conftest.$ac_ext, and return whether this succeeded.
|
||||
@@ -1530,6 +1488,48 @@ fi
|
||||
|
||||
} # ac_fn_c_try_link
|
||||
|
||||
# ac_fn_c_try_run LINENO
|
||||
# ----------------------
|
||||
# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
|
||||
# that executables *can* be run.
|
||||
ac_fn_c_try_run ()
|
||||
{
|
||||
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
|
||||
if { { ac_try="$ac_link"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo"; } >&5
|
||||
(eval "$ac_link") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
|
||||
{ { case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo"; } >&5
|
||||
(eval "$ac_try") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; }; then :
|
||||
ac_retval=0
|
||||
else
|
||||
$as_echo "$as_me: program exited with status $ac_status" >&5
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_retval=$ac_status
|
||||
fi
|
||||
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
|
||||
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
|
||||
as_fn_set_status $ac_retval
|
||||
|
||||
} # ac_fn_c_try_run
|
||||
|
||||
# ac_fn_c_try_cpp LINENO
|
||||
# ----------------------
|
||||
# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
|
||||
@@ -2899,7 +2899,7 @@ ISWINDOWS="false"
|
||||
ISMACOSX="false"
|
||||
|
||||
case "$host" in
|
||||
*-*-cygwin* | *-*-mingw32*)
|
||||
*-*-cygwin* | *-*-mingw*)
|
||||
ISWINDOWS="true"
|
||||
EXE=".exe"
|
||||
MATHLIB=""
|
||||
@@ -2996,7 +2996,48 @@ fi
|
||||
ISUNIX="true"
|
||||
EXE=""
|
||||
MATHLIB="-lm"
|
||||
SYS_GL_LIBS="-lGL"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for glBegin in -lOpenGL" >&5
|
||||
$as_echo_n "checking for glBegin in -lOpenGL... " >&6; }
|
||||
if ${ac_cv_lib_OpenGL_glBegin+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lOpenGL $LIBS"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char glBegin ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return glBegin ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
ac_cv_lib_OpenGL_glBegin=yes
|
||||
else
|
||||
ac_cv_lib_OpenGL_glBegin=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_OpenGL_glBegin" >&5
|
||||
$as_echo "$ac_cv_lib_OpenGL_glBegin" >&6; }
|
||||
if test "x$ac_cv_lib_OpenGL_glBegin" = xyes; then :
|
||||
SYS_GL_LIBS="-lOpenGL"
|
||||
else
|
||||
SYS_GL_LIBS="-lGL"
|
||||
fi
|
||||
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -3319,38 +3360,16 @@ else
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "SDL.h"
|
||||
|
||||
char*
|
||||
my_strdup (char *str)
|
||||
{
|
||||
char *new_str;
|
||||
|
||||
if (str)
|
||||
{
|
||||
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
|
||||
strcpy (new_str, str);
|
||||
}
|
||||
else
|
||||
new_str = NULL;
|
||||
|
||||
return new_str;
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int major, minor, micro;
|
||||
char *tmp_version;
|
||||
FILE *fp = fopen("conf.sdltest", "w");
|
||||
|
||||
/* This hangs on some systems (?)
|
||||
system ("touch conf.sdltest");
|
||||
*/
|
||||
{ FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
|
||||
if (fp) fclose(fp);
|
||||
|
||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||
tmp_version = my_strdup("$min_sdl_version");
|
||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
if (sscanf("$min_sdl_version", "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_sdl_version");
|
||||
exit(1);
|
||||
}
|
||||
@@ -3862,15 +3881,12 @@ int
|
||||
main ()
|
||||
{
|
||||
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
|
||||
have_opengl=yes
|
||||
|
||||
have_opengl=yes
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_opengl" >&5
|
||||
@@ -3891,15 +3907,12 @@ int
|
||||
main ()
|
||||
{
|
||||
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
|
||||
have_opengles=yes
|
||||
|
||||
have_opengles=yes
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_opengles" >&5
|
||||
@@ -3920,15 +3933,12 @@ int
|
||||
main ()
|
||||
{
|
||||
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
|
||||
have_opengles2=yes
|
||||
|
||||
have_opengles2=yes
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_opengles2" >&5
|
||||
|
29
externals/SDL/test/configure.ac
vendored
29
externals/SDL/test/configure.ac
vendored
@@ -1,6 +1,6 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT
|
||||
AC_CONFIG_SRCDIR([README])
|
||||
AC_CONFIG_SRCDIR([loopwave.c])
|
||||
|
||||
dnl Detect the canonical build and host environments
|
||||
AC_CONFIG_AUX_DIRS($srcdir/../build-scripts)
|
||||
@@ -21,7 +21,7 @@ ISMACOSX="false"
|
||||
|
||||
dnl Figure out which math library to use
|
||||
case "$host" in
|
||||
*-*-cygwin* | *-*-mingw32*)
|
||||
*-*-cygwin* | *-*-mingw*)
|
||||
ISWINDOWS="true"
|
||||
EXE=".exe"
|
||||
MATHLIB=""
|
||||
@@ -80,7 +80,9 @@ case "$host" in
|
||||
ISUNIX="true"
|
||||
EXE=""
|
||||
MATHLIB="-lm"
|
||||
SYS_GL_LIBS="-lGL"
|
||||
dnl Use the new libOpenGL if present.
|
||||
AC_CHECK_LIB(OpenGL, glBegin,
|
||||
[SYS_GL_LIBS="-lOpenGL"],[SYS_GL_LIBS="-lGL"])
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(EXE)
|
||||
@@ -122,43 +124,34 @@ fi
|
||||
dnl Check for OpenGL
|
||||
AC_MSG_CHECKING(for OpenGL support)
|
||||
have_opengl=no
|
||||
AC_TRY_COMPILE([
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include "SDL_opengl.h"
|
||||
#ifndef SDL_VIDEO_OPENGL
|
||||
#error SDL_VIDEO_OPENGL
|
||||
#endif
|
||||
],[
|
||||
],[
|
||||
have_opengl=yes
|
||||
])
|
||||
]],[])], [have_opengl=yes],[])
|
||||
AC_MSG_RESULT($have_opengl)
|
||||
|
||||
dnl Check for OpenGL ES
|
||||
AC_MSG_CHECKING(for OpenGL ES support)
|
||||
have_opengles=no
|
||||
AC_TRY_COMPILE([
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include "SDL_opengles.h"
|
||||
#ifndef SDL_VIDEO_OPENGL_ES
|
||||
#error SDL_VIDEO_OPENGL_ES
|
||||
#endif
|
||||
],[
|
||||
],[
|
||||
have_opengles=yes
|
||||
])
|
||||
]],[])] ,[have_opengles=yes],[])
|
||||
AC_MSG_RESULT($have_opengles)
|
||||
|
||||
dnl Check for OpenGL ES2
|
||||
AC_MSG_CHECKING(for OpenGL ES2 support)
|
||||
have_opengles2=no
|
||||
AC_TRY_COMPILE([
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include "SDL_opengles2.h"
|
||||
#ifndef SDL_VIDEO_OPENGL_ES2
|
||||
#error SDL_VIDEO_OPENGL_ES2
|
||||
#endif
|
||||
],[
|
||||
],[
|
||||
have_opengles2=yes
|
||||
])
|
||||
]],[])], [have_opengles2=yes],[])
|
||||
AC_MSG_RESULT($have_opengles2)
|
||||
|
||||
GLLIB=""
|
||||
|
23
externals/SDL/test/controllermap.c
vendored
23
externals/SDL/test/controllermap.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -53,7 +53,7 @@ static struct
|
||||
double angle;
|
||||
int marker;
|
||||
|
||||
} s_arrBindingDisplay[BINDING_COUNT] = {
|
||||
} s_arrBindingDisplay[] = {
|
||||
{ 387, 167, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_A */
|
||||
{ 431, 132, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_B */
|
||||
{ 342, 132, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_X */
|
||||
@@ -86,8 +86,9 @@ static struct
|
||||
{ 91, -20, 180.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_TRIGGERLEFT */
|
||||
{ 375, -20, 180.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_TRIGGERRIGHT */
|
||||
};
|
||||
SDL_COMPILE_TIME_ASSERT(s_arrBindingDisplay, SDL_arraysize(s_arrBindingDisplay) == BINDING_COUNT);
|
||||
|
||||
static int s_arrBindingOrder[BINDING_COUNT] = {
|
||||
static int s_arrBindingOrder[] = {
|
||||
SDL_CONTROLLER_BUTTON_A,
|
||||
SDL_CONTROLLER_BUTTON_B,
|
||||
SDL_CONTROLLER_BUTTON_Y,
|
||||
@@ -118,7 +119,9 @@ static int s_arrBindingOrder[BINDING_COUNT] = {
|
||||
SDL_CONTROLLER_BUTTON_PADDLE2,
|
||||
SDL_CONTROLLER_BUTTON_PADDLE3,
|
||||
SDL_CONTROLLER_BUTTON_PADDLE4,
|
||||
-1,
|
||||
};
|
||||
SDL_COMPILE_TIME_ASSERT(s_arrBindingOrder, SDL_arraysize(s_arrBindingOrder) == BINDING_COUNT);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -224,6 +227,12 @@ SetCurrentBinding(int iBinding)
|
||||
return;
|
||||
}
|
||||
|
||||
if (s_arrBindingOrder[iBinding] == -1)
|
||||
{
|
||||
SetCurrentBinding(iBinding + 1);
|
||||
return;
|
||||
}
|
||||
|
||||
s_iCurrentBinding = iBinding;
|
||||
|
||||
pBinding = &s_arrBindings[s_arrBindingOrder[s_iCurrentBinding]];
|
||||
@@ -412,10 +421,10 @@ WatchJoystick(SDL_Joystick * joystick)
|
||||
s_nNumAxes = SDL_JoystickNumAxes(joystick);
|
||||
s_arrAxisState = (AxisState *)SDL_calloc(s_nNumAxes, sizeof(*s_arrAxisState));
|
||||
|
||||
/* Skip any spurious events at start */
|
||||
while (SDL_PollEvent(&event) > 0) {
|
||||
continue;
|
||||
}
|
||||
/* Skip any spurious events at start */
|
||||
while (SDL_PollEvent(&event) > 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Loop, getting joystick events! */
|
||||
while (!done && !s_bBindingComplete) {
|
||||
|
2
externals/SDL/test/loopwave.c
vendored
2
externals/SDL/test/loopwave.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/loopwavequeue.c
vendored
2
externals/SDL/test/loopwavequeue.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
18
externals/SDL/test/testatomic.c
vendored
18
externals/SDL/test/testatomic.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -353,7 +353,7 @@ static SDL_bool EnqueueEvent_LockFree(SDL_EventQueue *queue, const SDL_Event *ev
|
||||
}
|
||||
|
||||
#ifdef TEST_SPINLOCK_FIFO
|
||||
SDL_AtomicDecRef(&queue->rwcount);
|
||||
(void) SDL_AtomicDecRef(&queue->rwcount);
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
@@ -400,7 +400,7 @@ static SDL_bool DequeueEvent_LockFree(SDL_EventQueue *queue, SDL_Event *event)
|
||||
}
|
||||
|
||||
#ifdef TEST_SPINLOCK_FIFO
|
||||
SDL_AtomicDecRef(&queue->rwcount);
|
||||
(void) SDL_AtomicDecRef(&queue->rwcount);
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
@@ -473,8 +473,6 @@ static SDL_bool DequeueEvent_Mutex(SDL_EventQueue *queue, SDL_Event *event)
|
||||
|
||||
static SDL_sem *writersDone;
|
||||
static SDL_sem *readersDone;
|
||||
static SDL_atomic_t writersRunning;
|
||||
static SDL_atomic_t readersRunning;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -525,7 +523,6 @@ static int SDLCALL FIFO_Writer(void* _data)
|
||||
}
|
||||
}
|
||||
}
|
||||
SDL_AtomicAdd(&writersRunning, -1);
|
||||
SDL_SemPost(writersDone);
|
||||
return 0;
|
||||
}
|
||||
@@ -563,7 +560,6 @@ static int SDLCALL FIFO_Reader(void* _data)
|
||||
}
|
||||
}
|
||||
}
|
||||
SDL_AtomicAdd(&readersRunning, -1);
|
||||
SDL_SemPost(readersDone);
|
||||
return 0;
|
||||
}
|
||||
@@ -581,7 +577,7 @@ static int SDLCALL FIFO_Watcher(void* _data)
|
||||
SDL_Delay(0);
|
||||
}
|
||||
/* Do queue manipulation here... */
|
||||
SDL_AtomicDecRef(&queue->watcher);
|
||||
(void) SDL_AtomicDecRef(&queue->watcher);
|
||||
SDL_AtomicUnlock(&queue->lock);
|
||||
|
||||
/* Wait a bit... */
|
||||
@@ -627,7 +623,6 @@ static void RunFIFOTest(SDL_bool lock_free)
|
||||
/* Start the readers first */
|
||||
SDL_Log("Starting %d readers\n", NUM_READERS);
|
||||
SDL_zeroa(readerData);
|
||||
SDL_AtomicSet(&readersRunning, NUM_READERS);
|
||||
for (i = 0; i < NUM_READERS; ++i) {
|
||||
char name[64];
|
||||
SDL_snprintf(name, sizeof (name), "FIFOReader%d", i);
|
||||
@@ -639,7 +634,6 @@ static void RunFIFOTest(SDL_bool lock_free)
|
||||
/* Start up the writers */
|
||||
SDL_Log("Starting %d writers\n", NUM_WRITERS);
|
||||
SDL_zeroa(writerData);
|
||||
SDL_AtomicSet(&writersRunning, NUM_WRITERS);
|
||||
for (i = 0; i < NUM_WRITERS; ++i) {
|
||||
char name[64];
|
||||
SDL_snprintf(name, sizeof (name), "FIFOWriter%d", i);
|
||||
@@ -650,7 +644,7 @@ static void RunFIFOTest(SDL_bool lock_free)
|
||||
}
|
||||
|
||||
/* Wait for the writers */
|
||||
while (SDL_AtomicGet(&writersRunning) > 0) {
|
||||
for (i = 0; i < NUM_WRITERS; ++i) {
|
||||
SDL_SemWait(writersDone);
|
||||
}
|
||||
|
||||
@@ -658,7 +652,7 @@ static void RunFIFOTest(SDL_bool lock_free)
|
||||
SDL_AtomicSet(&queue.active, 0);
|
||||
|
||||
/* Wait for the readers */
|
||||
while (SDL_AtomicGet(&readersRunning) > 0) {
|
||||
for (i = 0; i < NUM_READERS; ++i) {
|
||||
SDL_SemWait(readersDone);
|
||||
}
|
||||
|
||||
|
2
externals/SDL/test/testaudiocapture.c
vendored
2
externals/SDL/test/testaudiocapture.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testaudiohotplug.c
vendored
2
externals/SDL/test/testaudiohotplug.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testaudioinfo.c
vendored
2
externals/SDL/test/testaudioinfo.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testautomation.c
vendored
2
externals/SDL/test/testautomation.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
15
externals/SDL/test/testautomation_clipboard.c
vendored
15
externals/SDL/test/testautomation_clipboard.c
vendored
@@ -16,13 +16,12 @@
|
||||
* \brief Check call to SDL_HasClipboardText
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_HasClipboardText
|
||||
* http://wiki.libsdl.org/SDL_HasClipboardText
|
||||
*/
|
||||
int
|
||||
clipboard_testHasClipboardText(void *arg)
|
||||
{
|
||||
SDL_bool result;
|
||||
result = SDL_HasClipboardText();
|
||||
SDL_HasClipboardText();
|
||||
SDLTest_AssertPass("Call to SDL_HasClipboardText succeeded");
|
||||
|
||||
return TEST_COMPLETED;
|
||||
@@ -32,7 +31,7 @@ clipboard_testHasClipboardText(void *arg)
|
||||
* \brief Check call to SDL_GetClipboardText
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_GetClipboardText
|
||||
* http://wiki.libsdl.org/SDL_GetClipboardText
|
||||
*/
|
||||
int
|
||||
clipboard_testGetClipboardText(void *arg)
|
||||
@@ -49,7 +48,7 @@ clipboard_testGetClipboardText(void *arg)
|
||||
/**
|
||||
* \brief Check call to SDL_SetClipboardText
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_SetClipboardText
|
||||
* http://wiki.libsdl.org/SDL_SetClipboardText
|
||||
*/
|
||||
int
|
||||
clipboard_testSetClipboardText(void *arg)
|
||||
@@ -78,9 +77,9 @@ clipboard_testSetClipboardText(void *arg)
|
||||
/**
|
||||
* \brief End-to-end test of SDL_xyzClipboardText functions
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_HasClipboardText
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_GetClipboardText
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_SetClipboardText
|
||||
* http://wiki.libsdl.org/SDL_HasClipboardText
|
||||
* http://wiki.libsdl.org/SDL_GetClipboardText
|
||||
* http://wiki.libsdl.org/SDL_SetClipboardText
|
||||
*/
|
||||
int
|
||||
clipboard_testClipboardTextFunctions(void *arg)
|
||||
|
12
externals/SDL/test/testautomation_events.c
vendored
12
externals/SDL/test/testautomation_events.c
vendored
@@ -42,8 +42,8 @@ int SDLCALL _events_sampleNullEventFilter(void *userdata, SDL_Event *event)
|
||||
/**
|
||||
* @brief Test pumping and peeking events.
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_PumpEvents
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_PollEvent
|
||||
* @sa http://wiki.libsdl.org/SDL_PumpEvents
|
||||
* @sa http://wiki.libsdl.org/SDL_PollEvent
|
||||
*/
|
||||
int
|
||||
events_pushPumpAndPollUserevent(void *arg)
|
||||
@@ -76,8 +76,8 @@ events_pushPumpAndPollUserevent(void *arg)
|
||||
/**
|
||||
* @brief Adds and deletes an event watch function with NULL userdata
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_AddEventWatch
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_DelEventWatch
|
||||
* @sa http://wiki.libsdl.org/SDL_AddEventWatch
|
||||
* @sa http://wiki.libsdl.org/SDL_DelEventWatch
|
||||
*
|
||||
*/
|
||||
int
|
||||
@@ -126,8 +126,8 @@ events_addDelEventWatch(void *arg)
|
||||
/**
|
||||
* @brief Adds and deletes an event watch function with userdata
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_AddEventWatch
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_DelEventWatch
|
||||
* @sa http://wiki.libsdl.org/SDL_AddEventWatch
|
||||
* @sa http://wiki.libsdl.org/SDL_DelEventWatch
|
||||
*
|
||||
*/
|
||||
int
|
||||
|
42
externals/SDL/test/testautomation_keyboard.c
vendored
42
externals/SDL/test/testautomation_keyboard.c
vendored
@@ -16,7 +16,7 @@
|
||||
/**
|
||||
* @brief Check call to SDL_GetKeyboardState with and without numkeys reference.
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_GetKeyboardState
|
||||
* @sa http://wiki.libsdl.org/SDL_GetKeyboardState
|
||||
*/
|
||||
int
|
||||
keyboard_getKeyboardState(void *arg)
|
||||
@@ -42,15 +42,13 @@ keyboard_getKeyboardState(void *arg)
|
||||
/**
|
||||
* @brief Check call to SDL_GetKeyboardFocus
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_GetKeyboardFocus
|
||||
* @sa http://wiki.libsdl.org/SDL_GetKeyboardFocus
|
||||
*/
|
||||
int
|
||||
keyboard_getKeyboardFocus(void *arg)
|
||||
{
|
||||
SDL_Window* window;
|
||||
|
||||
/* Call, but ignore return value */
|
||||
window = SDL_GetKeyboardFocus();
|
||||
SDL_GetKeyboardFocus();
|
||||
SDLTest_AssertPass("Call to SDL_GetKeyboardFocus()");
|
||||
|
||||
return TEST_COMPLETED;
|
||||
@@ -59,7 +57,7 @@ keyboard_getKeyboardFocus(void *arg)
|
||||
/**
|
||||
* @brief Check call to SDL_GetKeyFromName for known, unknown and invalid name.
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_GetKeyFromName
|
||||
* @sa http://wiki.libsdl.org/SDL_GetKeyFromName
|
||||
*/
|
||||
int
|
||||
keyboard_getKeyFromName(void *arg)
|
||||
@@ -126,7 +124,7 @@ _checkInvalidScancodeError()
|
||||
/**
|
||||
* @brief Check call to SDL_GetKeyFromScancode
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_GetKeyFromScancode
|
||||
* @sa http://wiki.libsdl.org/SDL_GetKeyFromScancode
|
||||
*/
|
||||
int
|
||||
keyboard_getKeyFromScancode(void *arg)
|
||||
@@ -165,7 +163,7 @@ keyboard_getKeyFromScancode(void *arg)
|
||||
/**
|
||||
* @brief Check call to SDL_GetKeyName
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_GetKeyName
|
||||
* @sa http://wiki.libsdl.org/SDL_GetKeyName
|
||||
*/
|
||||
int
|
||||
keyboard_getKeyName(void *arg)
|
||||
@@ -221,7 +219,7 @@ keyboard_getKeyName(void *arg)
|
||||
/**
|
||||
* @brief SDL_GetScancodeName negative cases
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_GetScancodeName
|
||||
* @sa http://wiki.libsdl.org/SDL_GetScancodeName
|
||||
*/
|
||||
int
|
||||
keyboard_getScancodeNameNegative(void *arg)
|
||||
@@ -248,7 +246,7 @@ keyboard_getScancodeNameNegative(void *arg)
|
||||
/**
|
||||
* @brief SDL_GetKeyName negative cases
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_GetKeyName
|
||||
* @sa http://wiki.libsdl.org/SDL_GetKeyName
|
||||
*/
|
||||
int
|
||||
keyboard_getKeyNameNegative(void *arg)
|
||||
@@ -285,8 +283,8 @@ keyboard_getKeyNameNegative(void *arg)
|
||||
/**
|
||||
* @brief Check call to SDL_GetModState and SDL_SetModState
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_GetModState
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_SetModState
|
||||
* @sa http://wiki.libsdl.org/SDL_GetModState
|
||||
* @sa http://wiki.libsdl.org/SDL_SetModState
|
||||
*/
|
||||
int
|
||||
keyboard_getSetModState(void *arg)
|
||||
@@ -346,8 +344,8 @@ keyboard_getSetModState(void *arg)
|
||||
/**
|
||||
* @brief Check call to SDL_StartTextInput and SDL_StopTextInput
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_StartTextInput
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_StopTextInput
|
||||
* @sa http://wiki.libsdl.org/SDL_StartTextInput
|
||||
* @sa http://wiki.libsdl.org/SDL_StopTextInput
|
||||
*/
|
||||
int
|
||||
keyboard_startStopTextInput(void *arg)
|
||||
@@ -393,7 +391,7 @@ void _testSetTextInputRect(SDL_Rect refRect)
|
||||
/**
|
||||
* @brief Check call to SDL_SetTextInputRect
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_SetTextInputRect
|
||||
* @sa http://wiki.libsdl.org/SDL_SetTextInputRect
|
||||
*/
|
||||
int
|
||||
keyboard_setTextInputRect(void *arg)
|
||||
@@ -473,7 +471,7 @@ keyboard_setTextInputRect(void *arg)
|
||||
/**
|
||||
* @brief Check call to SDL_SetTextInputRect with invalid data
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_SetTextInputRect
|
||||
* @sa http://wiki.libsdl.org/SDL_SetTextInputRect
|
||||
*/
|
||||
int
|
||||
keyboard_setTextInputRectNegative(void *arg)
|
||||
@@ -511,8 +509,8 @@ keyboard_setTextInputRectNegative(void *arg)
|
||||
/**
|
||||
* @brief Check call to SDL_GetScancodeFromKey
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_GetScancodeFromKey
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_Keycode
|
||||
* @sa http://wiki.libsdl.org/SDL_GetScancodeFromKey
|
||||
* @sa http://wiki.libsdl.org/SDL_Keycode
|
||||
*/
|
||||
int
|
||||
keyboard_getScancodeFromKey(void *arg)
|
||||
@@ -535,8 +533,8 @@ keyboard_getScancodeFromKey(void *arg)
|
||||
/**
|
||||
* @brief Check call to SDL_GetScancodeFromName
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_GetScancodeFromName
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_Keycode
|
||||
* @sa http://wiki.libsdl.org/SDL_GetScancodeFromName
|
||||
* @sa http://wiki.libsdl.org/SDL_Keycode
|
||||
*/
|
||||
int
|
||||
keyboard_getScancodeFromName(void *arg)
|
||||
@@ -608,8 +606,8 @@ _checkInvalidNameError()
|
||||
/**
|
||||
* @brief Check call to SDL_GetScancodeFromName with invalid data
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_GetScancodeFromName
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_Keycode
|
||||
* @sa http://wiki.libsdl.org/SDL_GetScancodeFromName
|
||||
* @sa http://wiki.libsdl.org/SDL_Keycode
|
||||
*/
|
||||
int
|
||||
keyboard_getScancodeFromNameNegative(void *arg)
|
||||
|
8
externals/SDL/test/testautomation_main.c
vendored
8
externals/SDL/test/testautomation_main.c
vendored
@@ -13,8 +13,8 @@
|
||||
/* !
|
||||
* \brief Tests SDL_Init() and SDL_Quit() of Joystick and Haptic subsystems
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_Init
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_Quit
|
||||
* http://wiki.libsdl.org/SDL_Init
|
||||
* http://wiki.libsdl.org/SDL_Quit
|
||||
*/
|
||||
static int main_testInitQuitJoystickHaptic (void *arg)
|
||||
{
|
||||
@@ -41,8 +41,8 @@ static int main_testInitQuitJoystickHaptic (void *arg)
|
||||
/* !
|
||||
* \brief Tests SDL_InitSubSystem() and SDL_QuitSubSystem()
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_Init
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_Quit
|
||||
* http://wiki.libsdl.org/SDL_Init
|
||||
* http://wiki.libsdl.org/SDL_Quit
|
||||
*/
|
||||
static int main_testInitQuitSubSystem (void *arg)
|
||||
{
|
||||
|
22
externals/SDL/test/testautomation_mouse.c
vendored
22
externals/SDL/test/testautomation_mouse.c
vendored
@@ -192,8 +192,8 @@ static SDL_Cursor *_initArrowCursor(const char *image[])
|
||||
/**
|
||||
* @brief Check call to SDL_CreateCursor and SDL_FreeCursor
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_CreateCursor
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_FreeCursor
|
||||
* @sa http://wiki.libsdl.org/SDL_CreateCursor
|
||||
* @sa http://wiki.libsdl.org/SDL_FreeCursor
|
||||
*/
|
||||
int
|
||||
mouse_createFreeCursor(void *arg)
|
||||
@@ -218,8 +218,8 @@ mouse_createFreeCursor(void *arg)
|
||||
/**
|
||||
* @brief Check call to SDL_CreateColorCursor and SDL_FreeCursor
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_CreateColorCursor
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_FreeCursor
|
||||
* @sa http://wiki.libsdl.org/SDL_CreateColorCursor
|
||||
* @sa http://wiki.libsdl.org/SDL_FreeCursor
|
||||
*/
|
||||
int
|
||||
mouse_createFreeColorCursor(void *arg)
|
||||
@@ -275,7 +275,7 @@ void _changeCursorVisibility(int state)
|
||||
/**
|
||||
* @brief Check call to SDL_ShowCursor
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_ShowCursor
|
||||
* @sa http://wiki.libsdl.org/SDL_ShowCursor
|
||||
*/
|
||||
int
|
||||
mouse_showCursor(void *arg)
|
||||
@@ -305,7 +305,7 @@ mouse_showCursor(void *arg)
|
||||
/**
|
||||
* @brief Check call to SDL_SetCursor
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_SetCursor
|
||||
* @sa http://wiki.libsdl.org/SDL_SetCursor
|
||||
*/
|
||||
int
|
||||
mouse_setCursor(void *arg)
|
||||
@@ -338,7 +338,7 @@ mouse_setCursor(void *arg)
|
||||
/**
|
||||
* @brief Check call to SDL_GetCursor
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_GetCursor
|
||||
* @sa http://wiki.libsdl.org/SDL_GetCursor
|
||||
*/
|
||||
int
|
||||
mouse_getCursor(void *arg)
|
||||
@@ -356,8 +356,8 @@ mouse_getCursor(void *arg)
|
||||
/**
|
||||
* @brief Check call to SDL_GetRelativeMouseMode and SDL_SetRelativeMouseMode
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_GetRelativeMouseMode
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_SetRelativeMouseMode
|
||||
* @sa http://wiki.libsdl.org/SDL_GetRelativeMouseMode
|
||||
* @sa http://wiki.libsdl.org/SDL_SetRelativeMouseMode
|
||||
*/
|
||||
int
|
||||
mouse_getSetRelativeMouseMode(void *arg)
|
||||
@@ -440,7 +440,7 @@ void _destroyMouseSuiteTestWindow(SDL_Window *window)
|
||||
/**
|
||||
* @brief Check call to SDL_WarpMouseInWindow
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_WarpMouseInWindow
|
||||
* @sa http://wiki.libsdl.org/SDL_WarpMouseInWindow
|
||||
*/
|
||||
int
|
||||
mouse_warpMouseInWindow(void *arg)
|
||||
@@ -502,7 +502,7 @@ mouse_warpMouseInWindow(void *arg)
|
||||
/**
|
||||
* @brief Check call to SDL_GetMouseFocus
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.cgi/SDL_GetMouseFocus
|
||||
* @sa http://wiki.libsdl.org/SDL_GetMouseFocus
|
||||
*/
|
||||
int
|
||||
mouse_getMouseFocus(void *arg)
|
||||
|
12
externals/SDL/test/testautomation_pixels.c
vendored
12
externals/SDL/test/testautomation_pixels.c
vendored
@@ -121,8 +121,8 @@ char* _invalidPixelFormatsVerbose[] =
|
||||
/**
|
||||
* @brief Call to SDL_AllocFormat and SDL_FreeFormat
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_AllocFormat
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_FreeFormat
|
||||
* @sa http://wiki.libsdl.org/SDL_AllocFormat
|
||||
* @sa http://wiki.libsdl.org/SDL_FreeFormat
|
||||
*/
|
||||
int
|
||||
pixels_allocFreeFormat(void *arg)
|
||||
@@ -228,7 +228,7 @@ pixels_allocFreeFormat(void *arg)
|
||||
/**
|
||||
* @brief Call to SDL_GetPixelFormatName
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_GetPixelFormatName
|
||||
* @sa http://wiki.libsdl.org/SDL_GetPixelFormatName
|
||||
*/
|
||||
int
|
||||
pixels_getPixelFormatName(void *arg)
|
||||
@@ -312,8 +312,8 @@ pixels_getPixelFormatName(void *arg)
|
||||
/**
|
||||
* @brief Call to SDL_AllocPalette and SDL_FreePalette
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_AllocPalette
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_FreePalette
|
||||
* @sa http://wiki.libsdl.org/SDL_AllocPalette
|
||||
* @sa http://wiki.libsdl.org/SDL_FreePalette
|
||||
*/
|
||||
int
|
||||
pixels_allocFreePalette(void *arg)
|
||||
@@ -402,7 +402,7 @@ pixels_allocFreePalette(void *arg)
|
||||
/**
|
||||
* @brief Call to SDL_CalculateGammaRamp
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_CalculateGammaRamp
|
||||
* @sa http://wiki.libsdl.org/SDL_CalculateGammaRamp
|
||||
*/
|
||||
int
|
||||
pixels_calcGammaRamp(void *arg)
|
||||
|
69
externals/SDL/test/testautomation_platform.c
vendored
69
externals/SDL/test/testautomation_platform.c
vendored
@@ -101,11 +101,11 @@ int platform_testEndianessAndSwap(void *arg)
|
||||
/* !
|
||||
* \brief Tests SDL_GetXYZ() functions
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_GetPlatform
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_GetCPUCount
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_GetCPUCacheLineSize
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_GetRevision
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_GetRevisionNumber
|
||||
* http://wiki.libsdl.org/SDL_GetPlatform
|
||||
* http://wiki.libsdl.org/SDL_GetCPUCount
|
||||
* http://wiki.libsdl.org/SDL_GetCPUCacheLineSize
|
||||
* http://wiki.libsdl.org/SDL_GetRevision
|
||||
* http://wiki.libsdl.org/SDL_GetRevisionNumber
|
||||
*/
|
||||
int platform_testGetFunctions (void *arg)
|
||||
{
|
||||
@@ -141,60 +141,55 @@ int platform_testGetFunctions (void *arg)
|
||||
SDLTest_AssertPass("SDL_GetRevision()");
|
||||
SDLTest_AssertCheck(revision != NULL, "SDL_GetRevision() != NULL");
|
||||
|
||||
ret = SDL_GetRevisionNumber();
|
||||
SDLTest_AssertPass("SDL_GetRevisionNumber()");
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
||||
/* !
|
||||
* \brief Tests SDL_HasXYZ() functions
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_Has3DNow
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_HasAltiVec
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_HasMMX
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_HasRDTSC
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_HasSSE
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_HasSSE2
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_HasSSE3
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_HasSSE41
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_HasSSE42
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_HasAVX
|
||||
* http://wiki.libsdl.org/SDL_Has3DNow
|
||||
* http://wiki.libsdl.org/SDL_HasAltiVec
|
||||
* http://wiki.libsdl.org/SDL_HasMMX
|
||||
* http://wiki.libsdl.org/SDL_HasRDTSC
|
||||
* http://wiki.libsdl.org/SDL_HasSSE
|
||||
* http://wiki.libsdl.org/SDL_HasSSE2
|
||||
* http://wiki.libsdl.org/SDL_HasSSE3
|
||||
* http://wiki.libsdl.org/SDL_HasSSE41
|
||||
* http://wiki.libsdl.org/SDL_HasSSE42
|
||||
* http://wiki.libsdl.org/SDL_HasAVX
|
||||
*/
|
||||
int platform_testHasFunctions (void *arg)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* TODO: independently determine and compare values as well */
|
||||
|
||||
ret = SDL_HasRDTSC();
|
||||
SDL_HasRDTSC();
|
||||
SDLTest_AssertPass("SDL_HasRDTSC()");
|
||||
|
||||
ret = SDL_HasAltiVec();
|
||||
SDL_HasAltiVec();
|
||||
SDLTest_AssertPass("SDL_HasAltiVec()");
|
||||
|
||||
ret = SDL_HasMMX();
|
||||
SDL_HasMMX();
|
||||
SDLTest_AssertPass("SDL_HasMMX()");
|
||||
|
||||
ret = SDL_Has3DNow();
|
||||
SDL_Has3DNow();
|
||||
SDLTest_AssertPass("SDL_Has3DNow()");
|
||||
|
||||
ret = SDL_HasSSE();
|
||||
SDL_HasSSE();
|
||||
SDLTest_AssertPass("SDL_HasSSE()");
|
||||
|
||||
ret = SDL_HasSSE2();
|
||||
SDL_HasSSE2();
|
||||
SDLTest_AssertPass("SDL_HasSSE2()");
|
||||
|
||||
ret = SDL_HasSSE3();
|
||||
SDL_HasSSE3();
|
||||
SDLTest_AssertPass("SDL_HasSSE3()");
|
||||
|
||||
ret = SDL_HasSSE41();
|
||||
SDL_HasSSE41();
|
||||
SDLTest_AssertPass("SDL_HasSSE41()");
|
||||
|
||||
ret = SDL_HasSSE42();
|
||||
SDL_HasSSE42();
|
||||
SDLTest_AssertPass("SDL_HasSSE42()");
|
||||
|
||||
ret = SDL_HasAVX();
|
||||
SDL_HasAVX();
|
||||
SDLTest_AssertPass("SDL_HasAVX()");
|
||||
|
||||
return TEST_COMPLETED;
|
||||
@@ -203,7 +198,7 @@ int platform_testHasFunctions (void *arg)
|
||||
/* !
|
||||
* \brief Tests SDL_GetVersion
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_GetVersion
|
||||
* http://wiki.libsdl.org/SDL_GetVersion
|
||||
*/
|
||||
int platform_testGetVersion(void *arg)
|
||||
{
|
||||
@@ -273,9 +268,9 @@ int platform_testDefaultInit(void *arg)
|
||||
/* !
|
||||
* \brief Tests SDL_Get/Set/ClearError
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_GetError
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_SetError
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_ClearError
|
||||
* http://wiki.libsdl.org/SDL_GetError
|
||||
* http://wiki.libsdl.org/SDL_SetError
|
||||
* http://wiki.libsdl.org/SDL_ClearError
|
||||
*/
|
||||
int platform_testGetSetClearError(void *arg)
|
||||
{
|
||||
@@ -327,7 +322,7 @@ int platform_testGetSetClearError(void *arg)
|
||||
/* !
|
||||
* \brief Tests SDL_SetError with empty input
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_SetError
|
||||
* http://wiki.libsdl.org/SDL_SetError
|
||||
*/
|
||||
int platform_testSetErrorEmptyInput(void *arg)
|
||||
{
|
||||
@@ -365,7 +360,7 @@ int platform_testSetErrorEmptyInput(void *arg)
|
||||
/* !
|
||||
* \brief Tests SDL_SetError with invalid input
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_SetError
|
||||
* http://wiki.libsdl.org/SDL_SetError
|
||||
*/
|
||||
int platform_testSetErrorInvalidInput(void *arg)
|
||||
{
|
||||
@@ -448,7 +443,7 @@ int platform_testSetErrorInvalidInput(void *arg)
|
||||
/* !
|
||||
* \brief Tests SDL_GetPowerInfo
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_GetPowerInfo
|
||||
* http://wiki.libsdl.org/SDL_GetPowerInfo
|
||||
*/
|
||||
int platform_testGetPowerInfo(void *arg)
|
||||
{
|
||||
|
60
externals/SDL/test/testautomation_rect.c
vendored
60
externals/SDL/test/testautomation_rect.c
vendored
@@ -43,7 +43,7 @@ void _validateIntersectRectAndLineResults(
|
||||
* \brief Tests SDL_IntersectRectAndLine() clipping cases
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
|
||||
* http://wiki.libsdl.org/SDL_IntersectRectAndLine
|
||||
*/
|
||||
int
|
||||
rect_testIntersectRectAndLine (void *arg)
|
||||
@@ -114,7 +114,7 @@ rect_testIntersectRectAndLine (void *arg)
|
||||
* \brief Tests SDL_IntersectRectAndLine() non-clipping case line inside
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
|
||||
* http://wiki.libsdl.org/SDL_IntersectRectAndLine
|
||||
*/
|
||||
int
|
||||
rect_testIntersectRectAndLineInside (void *arg)
|
||||
@@ -181,7 +181,7 @@ rect_testIntersectRectAndLineInside (void *arg)
|
||||
* \brief Tests SDL_IntersectRectAndLine() non-clipping cases outside
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
|
||||
* http://wiki.libsdl.org/SDL_IntersectRectAndLine
|
||||
*/
|
||||
int
|
||||
rect_testIntersectRectAndLineOutside (void *arg)
|
||||
@@ -236,7 +236,7 @@ rect_testIntersectRectAndLineOutside (void *arg)
|
||||
* \brief Tests SDL_IntersectRectAndLine() with empty rectangle
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
|
||||
* http://wiki.libsdl.org/SDL_IntersectRectAndLine
|
||||
*/
|
||||
int
|
||||
rect_testIntersectRectAndLineEmpty (void *arg)
|
||||
@@ -271,7 +271,7 @@ rect_testIntersectRectAndLineEmpty (void *arg)
|
||||
* \brief Negative tests against SDL_IntersectRectAndLine() with invalid parameters
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
|
||||
* http://wiki.libsdl.org/SDL_IntersectRectAndLine
|
||||
*/
|
||||
int
|
||||
rect_testIntersectRectAndLineParam (void *arg)
|
||||
@@ -412,7 +412,7 @@ void _validateRectEqualsResults(
|
||||
* \brief Tests SDL_IntersectRect() with B fully inside A
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
|
||||
* http://wiki.libsdl.org/SDL_IntersectRect
|
||||
*/
|
||||
int rect_testIntersectRectInside (void *arg)
|
||||
{
|
||||
@@ -440,7 +440,7 @@ int rect_testIntersectRectInside (void *arg)
|
||||
* \brief Tests SDL_IntersectRect() with B fully outside A
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
|
||||
* http://wiki.libsdl.org/SDL_IntersectRect
|
||||
*/
|
||||
int rect_testIntersectRectOutside (void *arg)
|
||||
{
|
||||
@@ -468,7 +468,7 @@ int rect_testIntersectRectOutside (void *arg)
|
||||
* \brief Tests SDL_IntersectRect() with B partially intersecting A
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
|
||||
* http://wiki.libsdl.org/SDL_IntersectRect
|
||||
*/
|
||||
int rect_testIntersectRectPartial (void *arg)
|
||||
{
|
||||
@@ -557,7 +557,7 @@ int rect_testIntersectRectPartial (void *arg)
|
||||
* \brief Tests SDL_IntersectRect() with 1x1 pixel sized rectangles
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
|
||||
* http://wiki.libsdl.org/SDL_IntersectRect
|
||||
*/
|
||||
int rect_testIntersectRectPoint (void *arg)
|
||||
{
|
||||
@@ -604,7 +604,7 @@ int rect_testIntersectRectPoint (void *arg)
|
||||
* \brief Tests SDL_IntersectRect() with empty rectangles
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
|
||||
* http://wiki.libsdl.org/SDL_IntersectRect
|
||||
*/
|
||||
int rect_testIntersectRectEmpty (void *arg)
|
||||
{
|
||||
@@ -676,7 +676,7 @@ int rect_testIntersectRectEmpty (void *arg)
|
||||
* \brief Negative tests against SDL_IntersectRect() with invalid parameters
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
|
||||
* http://wiki.libsdl.org/SDL_IntersectRect
|
||||
*/
|
||||
int rect_testIntersectRectParam(void *arg)
|
||||
{
|
||||
@@ -706,7 +706,7 @@ int rect_testIntersectRectParam(void *arg)
|
||||
* \brief Tests SDL_HasIntersection() with B fully inside A
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
|
||||
* http://wiki.libsdl.org/SDL_HasIntersection
|
||||
*/
|
||||
int rect_testHasIntersectionInside (void *arg)
|
||||
{
|
||||
@@ -733,7 +733,7 @@ int rect_testHasIntersectionInside (void *arg)
|
||||
* \brief Tests SDL_HasIntersection() with B fully outside A
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
|
||||
* http://wiki.libsdl.org/SDL_HasIntersection
|
||||
*/
|
||||
int rect_testHasIntersectionOutside (void *arg)
|
||||
{
|
||||
@@ -760,7 +760,7 @@ int rect_testHasIntersectionOutside (void *arg)
|
||||
* \brief Tests SDL_HasIntersection() with B partially intersecting A
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
|
||||
* http://wiki.libsdl.org/SDL_HasIntersection
|
||||
*/
|
||||
int rect_testHasIntersectionPartial (void *arg)
|
||||
{
|
||||
@@ -827,7 +827,7 @@ int rect_testHasIntersectionPartial (void *arg)
|
||||
* \brief Tests SDL_HasIntersection() with 1x1 pixel sized rectangles
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
|
||||
* http://wiki.libsdl.org/SDL_HasIntersection
|
||||
*/
|
||||
int rect_testHasIntersectionPoint (void *arg)
|
||||
{
|
||||
@@ -873,7 +873,7 @@ int rect_testHasIntersectionPoint (void *arg)
|
||||
* \brief Tests SDL_HasIntersection() with empty rectangles
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
|
||||
* http://wiki.libsdl.org/SDL_HasIntersection
|
||||
*/
|
||||
int rect_testHasIntersectionEmpty (void *arg)
|
||||
{
|
||||
@@ -931,7 +931,7 @@ int rect_testHasIntersectionEmpty (void *arg)
|
||||
* \brief Negative tests against SDL_HasIntersection() with invalid parameters
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
|
||||
* http://wiki.libsdl.org/SDL_HasIntersection
|
||||
*/
|
||||
int rect_testHasIntersectionParam(void *arg)
|
||||
{
|
||||
@@ -954,7 +954,7 @@ int rect_testHasIntersectionParam(void *arg)
|
||||
* \brief Test SDL_EnclosePoints() without clipping
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_EnclosePoints
|
||||
* http://wiki.libsdl.org/SDL_EnclosePoints
|
||||
*/
|
||||
int rect_testEnclosePoints(void *arg)
|
||||
{
|
||||
@@ -1024,7 +1024,7 @@ int rect_testEnclosePoints(void *arg)
|
||||
* \brief Test SDL_EnclosePoints() with repeated input points
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_EnclosePoints
|
||||
* http://wiki.libsdl.org/SDL_EnclosePoints
|
||||
*/
|
||||
int rect_testEnclosePointsRepeatedInput(void *arg)
|
||||
{
|
||||
@@ -1100,7 +1100,7 @@ int rect_testEnclosePointsRepeatedInput(void *arg)
|
||||
* \brief Test SDL_EnclosePoints() with clipping
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_EnclosePoints
|
||||
* http://wiki.libsdl.org/SDL_EnclosePoints
|
||||
*/
|
||||
int rect_testEnclosePointsWithClipping(void *arg)
|
||||
{
|
||||
@@ -1199,7 +1199,7 @@ int rect_testEnclosePointsWithClipping(void *arg)
|
||||
* \brief Negative tests against SDL_EnclosePoints() with invalid parameters
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_EnclosePoints
|
||||
* http://wiki.libsdl.org/SDL_EnclosePoints
|
||||
*/
|
||||
int rect_testEnclosePointsParam(void *arg)
|
||||
{
|
||||
@@ -1227,7 +1227,7 @@ int rect_testEnclosePointsParam(void *arg)
|
||||
* \brief Tests SDL_UnionRect() where rect B is outside rect A
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_UnionRect
|
||||
* http://wiki.libsdl.org/SDL_UnionRect
|
||||
*/
|
||||
int rect_testUnionRectOutside(void *arg)
|
||||
{
|
||||
@@ -1298,7 +1298,7 @@ int rect_testUnionRectOutside(void *arg)
|
||||
* \brief Tests SDL_UnionRect() where rect A or rect B are empty
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_UnionRect
|
||||
* http://wiki.libsdl.org/SDL_UnionRect
|
||||
*/
|
||||
int rect_testUnionRectEmpty(void *arg)
|
||||
{
|
||||
@@ -1363,7 +1363,7 @@ int rect_testUnionRectEmpty(void *arg)
|
||||
* \brief Tests SDL_UnionRect() where rect B is inside rect A
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_UnionRect
|
||||
* http://wiki.libsdl.org/SDL_UnionRect
|
||||
*/
|
||||
int rect_testUnionRectInside(void *arg)
|
||||
{
|
||||
@@ -1427,7 +1427,7 @@ int rect_testUnionRectInside(void *arg)
|
||||
* \brief Negative tests against SDL_UnionRect() with invalid parameters
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_UnionRect
|
||||
* http://wiki.libsdl.org/SDL_UnionRect
|
||||
*/
|
||||
int rect_testUnionRectParam(void *arg)
|
||||
{
|
||||
@@ -1455,7 +1455,7 @@ int rect_testUnionRectParam(void *arg)
|
||||
* \brief Tests SDL_RectEmpty() with various inputs
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RectEmpty
|
||||
* http://wiki.libsdl.org/SDL_RectEmpty
|
||||
*/
|
||||
int rect_testRectEmpty(void *arg)
|
||||
{
|
||||
@@ -1498,7 +1498,7 @@ int rect_testRectEmpty(void *arg)
|
||||
* \brief Negative tests against SDL_RectEmpty() with invalid parameters
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RectEmpty
|
||||
* http://wiki.libsdl.org/SDL_RectEmpty
|
||||
*/
|
||||
int rect_testRectEmptyParam(void *arg)
|
||||
{
|
||||
@@ -1515,7 +1515,7 @@ int rect_testRectEmptyParam(void *arg)
|
||||
* \brief Tests SDL_RectEquals() with various inputs
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RectEquals
|
||||
* http://wiki.libsdl.org/SDL_RectEquals
|
||||
*/
|
||||
int rect_testRectEquals(void *arg)
|
||||
{
|
||||
@@ -1545,7 +1545,7 @@ int rect_testRectEquals(void *arg)
|
||||
* \brief Negative tests against SDL_RectEquals() with invalid parameters
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RectEquals
|
||||
* http://wiki.libsdl.org/SDL_RectEquals
|
||||
*/
|
||||
int rect_testRectEqualsParam(void *arg)
|
||||
{
|
||||
@@ -1678,7 +1678,7 @@ static const SDLTest_TestCaseReference rectTest29 =
|
||||
* \brief Sequence of Rect test cases; functions that handle simple rectangles including overlaps and merges.
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/CategoryRect
|
||||
* http://wiki.libsdl.org/CategoryRect
|
||||
*/
|
||||
static const SDLTest_TestCaseReference *rectTests[] = {
|
||||
&rectTest1, &rectTest2, &rectTest3, &rectTest4, &rectTest5, &rectTest6, &rectTest7, &rectTest8, &rectTest9, &rectTest10, &rectTest11, &rectTest12, &rectTest13, &rectTest14,
|
||||
|
78
externals/SDL/test/testautomation_render.c
vendored
78
externals/SDL/test/testautomation_render.c
vendored
@@ -83,7 +83,7 @@ void CleanupDestroyRenderer(void *arg)
|
||||
* @brief Tests call to SDL_GetNumRenderDrivers
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_GetNumRenderDrivers
|
||||
* http://wiki.libsdl.org/SDL_GetNumRenderDrivers
|
||||
*/
|
||||
int
|
||||
render_testGetNumRenderDrivers(void *arg)
|
||||
@@ -99,9 +99,9 @@ render_testGetNumRenderDrivers(void *arg)
|
||||
* @brief Tests the SDL primitives for rendering.
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RenderDrawLine
|
||||
* http://wiki.libsdl.org/SDL_SetRenderDrawColor
|
||||
* http://wiki.libsdl.org/SDL_RenderFillRect
|
||||
* http://wiki.libsdl.org/SDL_RenderDrawLine
|
||||
*
|
||||
*/
|
||||
int render_testPrimitives (void *arg)
|
||||
@@ -206,9 +206,9 @@ int render_testPrimitives (void *arg)
|
||||
* @brief Tests the SDL primitives with alpha for rendering.
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
|
||||
* http://wiki.libsdl.org/SDL_SetRenderDrawColor
|
||||
* http://wiki.libsdl.org/SDL_SetRenderDrawBlendMode
|
||||
* http://wiki.libsdl.org/SDL_RenderFillRect
|
||||
*/
|
||||
int render_testPrimitivesBlend (void *arg)
|
||||
{
|
||||
@@ -355,8 +355,8 @@ int render_testPrimitivesBlend (void *arg)
|
||||
* @brief Tests some blitting routines.
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
|
||||
* http://wiki.libsdl.org/SDL_RenderCopy
|
||||
* http://wiki.libsdl.org/SDL_DestroyTexture
|
||||
*/
|
||||
int
|
||||
render_testBlit(void *arg)
|
||||
@@ -424,9 +424,9 @@ render_testBlit(void *arg)
|
||||
* @brief Blits doing color tests.
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
|
||||
* http://wiki.libsdl.org/SDL_SetTextureColorMod
|
||||
* http://wiki.libsdl.org/SDL_RenderCopy
|
||||
* http://wiki.libsdl.org/SDL_DestroyTexture
|
||||
*/
|
||||
int
|
||||
render_testBlitColor (void *arg)
|
||||
@@ -498,9 +498,9 @@ render_testBlitColor (void *arg)
|
||||
* @brief Tests blitting with alpha.
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
|
||||
* http://wiki.libsdl.org/SDL_SetTextureAlphaMod
|
||||
* http://wiki.libsdl.org/SDL_RenderCopy
|
||||
* http://wiki.libsdl.org/SDL_DestroyTexture
|
||||
*/
|
||||
int
|
||||
render_testBlitAlpha (void *arg)
|
||||
@@ -576,8 +576,8 @@ render_testBlitAlpha (void *arg)
|
||||
* @brief Tests a blend mode.
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_SetTextureBlendMode
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
|
||||
* http://wiki.libsdl.org/SDL_SetTextureBlendMode
|
||||
* http://wiki.libsdl.org/SDL_RenderCopy
|
||||
*/
|
||||
static void
|
||||
_testBlitBlendMode( SDL_Texture * tface, int mode )
|
||||
@@ -626,10 +626,10 @@ _testBlitBlendMode( SDL_Texture * tface, int mode )
|
||||
* @brief Tests some more blitting routines.
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_SetTextureBlendMode
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
|
||||
* http://wiki.libsdl.org/SDL_SetTextureColorMod
|
||||
* http://wiki.libsdl.org/SDL_SetTextureAlphaMod
|
||||
* http://wiki.libsdl.org/SDL_SetTextureBlendMode
|
||||
* http://wiki.libsdl.org/SDL_DestroyTexture
|
||||
*/
|
||||
int
|
||||
render_testBlitBlend (void *arg)
|
||||
@@ -779,8 +779,8 @@ _isSupported( int code )
|
||||
* @brief Test to see if we can vary the draw color. Helper function.
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawColor
|
||||
* http://wiki.libsdl.org/SDL_SetRenderDrawColor
|
||||
* http://wiki.libsdl.org/SDL_GetRenderDrawColor
|
||||
*/
|
||||
static int
|
||||
_hasDrawColor (void)
|
||||
@@ -817,8 +817,8 @@ _hasDrawColor (void)
|
||||
* @brief Test to see if we can vary the blend mode. Helper function.
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawBlendMode
|
||||
* http://wiki.libsdl.org/SDL_SetRenderDrawBlendMode
|
||||
* http://wiki.libsdl.org/SDL_GetRenderDrawBlendMode
|
||||
*/
|
||||
static int
|
||||
_hasBlendModes (void)
|
||||
@@ -874,7 +874,7 @@ _hasBlendModes (void)
|
||||
* @brief Loads the test image 'Face' as texture. Helper function.
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_CreateTextureFromSurface
|
||||
* http://wiki.libsdl.org/SDL_CreateTextureFromSurface
|
||||
*/
|
||||
static SDL_Texture *
|
||||
_loadTestFace(void)
|
||||
@@ -902,9 +902,9 @@ _loadTestFace(void)
|
||||
* @brief Test to see if can set texture color mode. Helper function.
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_GetTextureColorMod
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
|
||||
* http://wiki.libsdl.org/SDL_SetTextureColorMod
|
||||
* http://wiki.libsdl.org/SDL_GetTextureColorMod
|
||||
* http://wiki.libsdl.org/SDL_DestroyTexture
|
||||
*/
|
||||
static int
|
||||
_hasTexColor (void)
|
||||
@@ -942,9 +942,9 @@ _hasTexColor (void)
|
||||
* @brief Test to see if we can vary the alpha of the texture. Helper function.
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_GetTextureAlphaMod
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
|
||||
* http://wiki.libsdl.org/SDL_SetTextureAlphaMod
|
||||
* http://wiki.libsdl.org/SDL_GetTextureAlphaMod
|
||||
* http://wiki.libsdl.org/SDL_DestroyTexture
|
||||
*/
|
||||
static int
|
||||
_hasTexAlpha(void)
|
||||
@@ -984,9 +984,9 @@ _hasTexAlpha(void)
|
||||
* @param s Image to compare against.
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RenderReadPixels
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_CreateRGBSurfaceFrom
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_FreeSurface
|
||||
* http://wiki.libsdl.org/SDL_RenderReadPixels
|
||||
* http://wiki.libsdl.org/SDL_CreateRGBSurfaceFrom
|
||||
* http://wiki.libsdl.org/SDL_FreeSurface
|
||||
*/
|
||||
static void
|
||||
_compare(SDL_Surface *referenceSurface, int allowable_error)
|
||||
@@ -1027,10 +1027,10 @@ _compare(SDL_Surface *referenceSurface, int allowable_error)
|
||||
* @brief Clears the screen. Helper function.
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RenderClear
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RenderPresent
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
|
||||
* http://wiki.libsdl.org/SDL_SetRenderDrawColor
|
||||
* http://wiki.libsdl.org/SDL_RenderClear
|
||||
* http://wiki.libsdl.org/SDL_RenderPresent
|
||||
* http://wiki.libsdl.org/SDL_SetRenderDrawBlendMode
|
||||
*/
|
||||
static int
|
||||
_clearScreen(void)
|
||||
|
46
externals/SDL/test/testautomation_rwops.c
vendored
46
externals/SDL/test/testautomation_rwops.c
vendored
@@ -88,8 +88,8 @@ RWopsTearDown(void *arg)
|
||||
* @brief Makes sure parameters work properly. Local helper function.
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RWseek
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RWread
|
||||
* http://wiki.libsdl.org/SDL_RWseek
|
||||
* http://wiki.libsdl.org/SDL_RWread
|
||||
*/
|
||||
void
|
||||
_testGenericRWopsValidations(SDL_RWops *rw, int write)
|
||||
@@ -168,7 +168,7 @@ _testGenericRWopsValidations(SDL_RWops *rw, int write)
|
||||
/* !
|
||||
* Negative test for SDL_RWFromFile parameters
|
||||
*
|
||||
* \sa http://wiki.libsdl.org/moin.cgi/SDL_RWFromFile
|
||||
* \sa http://wiki.libsdl.org/SDL_RWFromFile
|
||||
*
|
||||
*/
|
||||
int
|
||||
@@ -215,8 +215,8 @@ rwops_testParamNegative (void)
|
||||
/**
|
||||
* @brief Tests opening from memory.
|
||||
*
|
||||
* \sa http://wiki.libsdl.org/moin.cgi/SDL_RWFromMem
|
||||
* \sa http://wiki.libsdl.org/moin.cgi/SDL_RWClose
|
||||
* \sa http://wiki.libsdl.org/SDL_RWFromMem
|
||||
* \sa http://wiki.libsdl.org/SDL_RWClose
|
||||
*/
|
||||
int
|
||||
rwops_testMem (void)
|
||||
@@ -255,8 +255,8 @@ rwops_testMem (void)
|
||||
* @brief Tests opening from memory.
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RWFromConstMem
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RWClose
|
||||
* http://wiki.libsdl.org/SDL_RWFromConstMem
|
||||
* http://wiki.libsdl.org/SDL_RWClose
|
||||
*/
|
||||
int
|
||||
rwops_testConstMem (void)
|
||||
@@ -291,8 +291,8 @@ rwops_testConstMem (void)
|
||||
* @brief Tests reading from file.
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RWFromFile
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RWClose
|
||||
* http://wiki.libsdl.org/SDL_RWFromFile
|
||||
* http://wiki.libsdl.org/SDL_RWClose
|
||||
*/
|
||||
int
|
||||
rwops_testFileRead(void)
|
||||
@@ -338,8 +338,8 @@ rwops_testFileRead(void)
|
||||
* @brief Tests writing from file.
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RWFromFile
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RWClose
|
||||
* http://wiki.libsdl.org/SDL_RWFromFile
|
||||
* http://wiki.libsdl.org/SDL_RWClose
|
||||
*/
|
||||
int
|
||||
rwops_testFileWrite(void)
|
||||
@@ -386,8 +386,8 @@ rwops_testFileWrite(void)
|
||||
* @brief Tests reading from file handle
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RWFromFP
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RWClose
|
||||
* http://wiki.libsdl.org/SDL_RWFromFP
|
||||
* http://wiki.libsdl.org/SDL_RWClose
|
||||
*
|
||||
*/
|
||||
int
|
||||
@@ -436,8 +436,8 @@ rwops_testFPRead(void)
|
||||
* @brief Tests writing to file handle
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RWFromFP
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RWClose
|
||||
* http://wiki.libsdl.org/SDL_RWFromFP
|
||||
* http://wiki.libsdl.org/SDL_RWClose
|
||||
*
|
||||
*/
|
||||
int
|
||||
@@ -484,8 +484,8 @@ rwops_testFPWrite(void)
|
||||
/**
|
||||
* @brief Tests alloc and free RW context.
|
||||
*
|
||||
* \sa http://wiki.libsdl.org/moin.cgi/SDL_AllocRW
|
||||
* \sa http://wiki.libsdl.org/moin.cgi/SDL_FreeRW
|
||||
* \sa http://wiki.libsdl.org/SDL_AllocRW
|
||||
* \sa http://wiki.libsdl.org/SDL_FreeRW
|
||||
*/
|
||||
int
|
||||
rwops_testAllocFree (void)
|
||||
@@ -511,8 +511,8 @@ rwops_testAllocFree (void)
|
||||
/**
|
||||
* @brief Compare memory and file reads
|
||||
*
|
||||
* \sa http://wiki.libsdl.org/moin.cgi/SDL_RWFromMem
|
||||
* \sa http://wiki.libsdl.org/moin.cgi/SDL_RWFromFile
|
||||
* \sa http://wiki.libsdl.org/SDL_RWFromMem
|
||||
* \sa http://wiki.libsdl.org/SDL_RWFromFile
|
||||
*/
|
||||
int
|
||||
rwops_testCompareRWFromMemWithRWFromFile(void)
|
||||
@@ -578,10 +578,10 @@ rwops_testCompareRWFromMemWithRWFromFile(void)
|
||||
* @brief Tests writing and reading from file using endian aware functions.
|
||||
*
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RWFromFile
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_RWClose
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_ReadBE16
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_WriteBE16
|
||||
* http://wiki.libsdl.org/SDL_RWFromFile
|
||||
* http://wiki.libsdl.org/SDL_RWClose
|
||||
* http://wiki.libsdl.org/SDL_ReadBE16
|
||||
* http://wiki.libsdl.org/SDL_WriteBE16
|
||||
*/
|
||||
int
|
||||
rwops_testFileWriteReadEndian(void)
|
||||
|
3
externals/SDL/test/testautomation_sdltest.c
vendored
3
externals/SDL/test/testautomation_sdltest.c
vendored
@@ -89,7 +89,6 @@ int
|
||||
sdltest_randomNumber(void *arg)
|
||||
{
|
||||
Sint64 result;
|
||||
Uint64 uresult;
|
||||
double dresult;
|
||||
Uint64 umax;
|
||||
Sint64 min, max;
|
||||
@@ -127,7 +126,7 @@ sdltest_randomNumber(void *arg)
|
||||
SDLTest_AssertPass("Call to SDLTest_RandomSint32");
|
||||
SDLTest_AssertCheck(result >= min && result <= max, "Verify result value, expected: [%"SDL_PRIs64",%"SDL_PRIs64"], got: %"SDL_PRIs64, min, max, result);
|
||||
|
||||
uresult = SDLTest_RandomUint64();
|
||||
SDLTest_RandomUint64();
|
||||
SDLTest_AssertPass("Call to SDLTest_RandomUint64");
|
||||
|
||||
result = SDLTest_RandomSint64();
|
||||
|
228
externals/SDL/test/testautomation_video.c
vendored
228
externals/SDL/test/testautomation_video.c
vendored
@@ -265,7 +265,7 @@ video_createWindowVariousFlags(void *arg)
|
||||
w = SDLTest_RandomIntegerInRange(320, 1024);
|
||||
h = SDLTest_RandomIntegerInRange(320, 768);
|
||||
|
||||
for (fVariation = 0; fVariation < 13; fVariation++) {
|
||||
for (fVariation = 0; fVariation < 14; fVariation++) {
|
||||
switch(fVariation) {
|
||||
case 0:
|
||||
flags = SDL_WINDOW_FULLSCREEN;
|
||||
@@ -299,7 +299,7 @@ video_createWindowVariousFlags(void *arg)
|
||||
flags = SDL_WINDOW_MAXIMIZED;
|
||||
break;
|
||||
case 9:
|
||||
flags = SDL_WINDOW_INPUT_GRABBED;
|
||||
flags = SDL_WINDOW_MOUSE_GRABBED;
|
||||
break;
|
||||
case 10:
|
||||
flags = SDL_WINDOW_INPUT_FOCUS;
|
||||
@@ -310,6 +310,9 @@ video_createWindowVariousFlags(void *arg)
|
||||
case 12:
|
||||
flags = SDL_WINDOW_FOREIGN;
|
||||
break;
|
||||
case 13:
|
||||
flags = SDL_WINDOW_KEYBOARD_GRABBED;
|
||||
break;
|
||||
}
|
||||
|
||||
window = SDL_CreateWindow(title, x, y, w, h, flags);
|
||||
@@ -474,7 +477,6 @@ video_getClosestDisplayModeRandomResolution(void *arg)
|
||||
{
|
||||
SDL_DisplayMode target;
|
||||
SDL_DisplayMode closest;
|
||||
SDL_DisplayMode* dResult;
|
||||
int displayNum;
|
||||
int i;
|
||||
int variation;
|
||||
@@ -497,7 +499,7 @@ video_getClosestDisplayModeRandomResolution(void *arg)
|
||||
target.driverdata = 0;
|
||||
|
||||
/* Make call; may or may not find anything, so don't validate any further */
|
||||
dResult = SDL_GetClosestDisplayMode(i, &target, &closest);
|
||||
SDL_GetClosestDisplayMode(i, &target, &closest);
|
||||
SDLTest_AssertPass("Call to SDL_GetClosestDisplayMode(target=random/variation%d)", variation);
|
||||
}
|
||||
}
|
||||
@@ -508,7 +510,7 @@ video_getClosestDisplayModeRandomResolution(void *arg)
|
||||
/**
|
||||
* @brief Tests call to SDL_GetWindowBrightness
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowBrightness
|
||||
* @sa http://wiki.libsdl.org/SDL_GetWindowBrightness
|
||||
*/
|
||||
int
|
||||
video_getWindowBrightness(void *arg)
|
||||
@@ -534,7 +536,7 @@ video_getWindowBrightness(void *arg)
|
||||
/**
|
||||
* @brief Tests call to SDL_GetWindowBrightness with invalid input
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowBrightness
|
||||
* @sa http://wiki.libsdl.org/SDL_GetWindowBrightness
|
||||
*/
|
||||
int
|
||||
video_getWindowBrightnessNegative(void *arg)
|
||||
@@ -563,7 +565,7 @@ video_getWindowBrightnessNegative(void *arg)
|
||||
/**
|
||||
* @brief Tests call to SDL_GetWindowDisplayMode
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowDisplayMode
|
||||
* @sa http://wiki.libsdl.org/SDL_GetWindowDisplayMode
|
||||
*/
|
||||
int
|
||||
video_getWindowDisplayMode(void *arg)
|
||||
@@ -617,7 +619,7 @@ void _checkInvalidWindowError()
|
||||
/**
|
||||
* @brief Tests call to SDL_GetWindowDisplayMode with invalid input
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowDisplayMode
|
||||
* @sa http://wiki.libsdl.org/SDL_GetWindowDisplayMode
|
||||
*/
|
||||
int
|
||||
video_getWindowDisplayModeNegative(void *arg)
|
||||
@@ -661,7 +663,7 @@ video_getWindowDisplayModeNegative(void *arg)
|
||||
/**
|
||||
* @brief Tests call to SDL_GetWindowGammaRamp
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowGammaRamp
|
||||
* @sa http://wiki.libsdl.org/SDL_GetWindowGammaRamp
|
||||
*/
|
||||
int
|
||||
video_getWindowGammaRamp(void *arg)
|
||||
@@ -722,7 +724,7 @@ video_getWindowGammaRamp(void *arg)
|
||||
/**
|
||||
* @brief Tests call to SDL_GetWindowGammaRamp with invalid input
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowGammaRamp
|
||||
* @sa http://wiki.libsdl.org/SDL_GetWindowGammaRamp
|
||||
*/
|
||||
int
|
||||
video_getWindowGammaRampNegative(void *arg)
|
||||
@@ -744,87 +746,213 @@ video_getWindowGammaRampNegative(void *arg)
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
||||
/* Helper for setting and checking the window grab state */
|
||||
/* Helper for setting and checking the window mouse grab state */
|
||||
void
|
||||
_setAndCheckWindowGrabState(SDL_Window* window, SDL_bool desiredState)
|
||||
_setAndCheckWindowMouseGrabState(SDL_Window* window, SDL_bool desiredState)
|
||||
{
|
||||
SDL_bool currentState;
|
||||
|
||||
/* Set state */
|
||||
SDL_SetWindowGrab(window, desiredState);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowGrab(%s)", (desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
|
||||
SDL_SetWindowMouseGrab(window, desiredState);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowMouseGrab(%s)", (desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
|
||||
|
||||
/* Get and check state */
|
||||
currentState = SDL_GetWindowGrab(window);
|
||||
SDLTest_AssertPass("Call to SDL_GetWindowGrab()");
|
||||
currentState = SDL_GetWindowMouseGrab(window);
|
||||
SDLTest_AssertPass("Call to SDL_GetWindowMouseGrab()");
|
||||
SDLTest_AssertCheck(
|
||||
currentState == desiredState,
|
||||
"Validate returned state; expected: %s, got: %s",
|
||||
(desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE",
|
||||
(currentState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
|
||||
|
||||
if (desiredState) {
|
||||
SDLTest_AssertCheck(
|
||||
SDL_GetGrabbedWindow() == window,
|
||||
"Grabbed window should be to our window");
|
||||
SDLTest_AssertCheck(
|
||||
SDL_GetWindowGrab(window),
|
||||
"SDL_GetWindowGrab() should return SDL_TRUE");
|
||||
SDLTest_AssertCheck(
|
||||
SDL_GetWindowFlags(window) & SDL_WINDOW_MOUSE_GRABBED,
|
||||
"SDL_WINDOW_MOUSE_GRABBED should be set");
|
||||
} else {
|
||||
SDLTest_AssertCheck(
|
||||
!(SDL_GetWindowFlags(window) & SDL_WINDOW_MOUSE_GRABBED),
|
||||
"SDL_WINDOW_MOUSE_GRABBED should be unset");
|
||||
}
|
||||
}
|
||||
|
||||
/* Helper for setting and checking the window keyboard grab state */
|
||||
void
|
||||
_setAndCheckWindowKeyboardGrabState(SDL_Window* window, SDL_bool desiredState)
|
||||
{
|
||||
SDL_bool currentState;
|
||||
|
||||
/* Set state */
|
||||
SDL_SetWindowKeyboardGrab(window, desiredState);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowKeyboardGrab(%s)", (desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
|
||||
|
||||
/* Get and check state */
|
||||
currentState = SDL_GetWindowKeyboardGrab(window);
|
||||
SDLTest_AssertPass("Call to SDL_GetWindowKeyboardGrab()");
|
||||
SDLTest_AssertCheck(
|
||||
currentState == desiredState,
|
||||
"Validate returned state; expected: %s, got: %s",
|
||||
(desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE",
|
||||
(currentState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
|
||||
|
||||
if (desiredState) {
|
||||
SDLTest_AssertCheck(
|
||||
SDL_GetGrabbedWindow() == window,
|
||||
"Grabbed window should be set to our window");
|
||||
SDLTest_AssertCheck(
|
||||
SDL_GetWindowGrab(window),
|
||||
"SDL_GetWindowGrab() should return SDL_TRUE");
|
||||
SDLTest_AssertCheck(
|
||||
SDL_GetWindowFlags(window) & SDL_WINDOW_KEYBOARD_GRABBED,
|
||||
"SDL_WINDOW_KEYBOARD_GRABBED should be set");
|
||||
} else {
|
||||
SDLTest_AssertCheck(
|
||||
!(SDL_GetWindowFlags(window) & SDL_WINDOW_KEYBOARD_GRABBED),
|
||||
"SDL_WINDOW_KEYBOARD_GRABBED should be unset");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Tests call to SDL_GetWindowGrab and SDL_SetWindowGrab
|
||||
* @brief Tests keyboard and mouse grab support
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowGrab
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_SetWindowGrab
|
||||
* @sa http://wiki.libsdl.org/SDL_GetWindowGrab
|
||||
* @sa http://wiki.libsdl.org/SDL_SetWindowGrab
|
||||
*/
|
||||
int
|
||||
video_getSetWindowGrab(void *arg)
|
||||
{
|
||||
const char* title = "video_getSetWindowGrab Test Window";
|
||||
SDL_Window* window;
|
||||
SDL_bool originalState, dummyState, currentState, desiredState;
|
||||
SDL_bool originalMouseState, originalKeyboardState;
|
||||
|
||||
/* Call against new test window */
|
||||
window = _createVideoSuiteTestWindow(title);
|
||||
if (window == NULL) return TEST_ABORTED;
|
||||
|
||||
/* Get state */
|
||||
originalState = SDL_GetWindowGrab(window);
|
||||
SDLTest_AssertPass("Call to SDL_GetWindowGrab()");
|
||||
originalMouseState = SDL_GetWindowMouseGrab(window);
|
||||
SDLTest_AssertPass("Call to SDL_GetWindowMouseGrab()");
|
||||
originalKeyboardState = SDL_GetWindowKeyboardGrab(window);
|
||||
SDLTest_AssertPass("Call to SDL_GetWindowKeyboardGrab()");
|
||||
|
||||
/* F */
|
||||
_setAndCheckWindowGrabState(window, SDL_FALSE);
|
||||
_setAndCheckWindowKeyboardGrabState(window, SDL_FALSE);
|
||||
_setAndCheckWindowMouseGrabState(window, SDL_FALSE);
|
||||
SDLTest_AssertCheck(!SDL_GetWindowGrab(window),
|
||||
"SDL_GetWindowGrab should return SDL_FALSE");
|
||||
SDLTest_AssertCheck(SDL_GetGrabbedWindow() == NULL,
|
||||
"Expected NULL grabbed window");
|
||||
|
||||
/* F --> F */
|
||||
_setAndCheckWindowGrabState(window, SDL_FALSE);
|
||||
_setAndCheckWindowMouseGrabState(window, SDL_FALSE);
|
||||
_setAndCheckWindowKeyboardGrabState(window, SDL_FALSE);
|
||||
SDLTest_AssertCheck(SDL_GetGrabbedWindow() == NULL,
|
||||
"Expected NULL grabbed window");
|
||||
|
||||
/* F --> T */
|
||||
_setAndCheckWindowGrabState(window, SDL_TRUE);
|
||||
_setAndCheckWindowMouseGrabState(window, SDL_TRUE);
|
||||
_setAndCheckWindowKeyboardGrabState(window, SDL_TRUE);
|
||||
SDLTest_AssertCheck(SDL_GetWindowGrab(window),
|
||||
"SDL_GetWindowGrab() should return SDL_TRUE");
|
||||
|
||||
/* T --> T */
|
||||
_setAndCheckWindowGrabState(window, SDL_TRUE);
|
||||
_setAndCheckWindowKeyboardGrabState(window, SDL_TRUE);
|
||||
_setAndCheckWindowMouseGrabState(window, SDL_TRUE);
|
||||
SDLTest_AssertCheck(SDL_GetWindowGrab(window),
|
||||
"SDL_GetWindowGrab() should return SDL_TRUE");
|
||||
|
||||
/* T --> F */
|
||||
_setAndCheckWindowGrabState(window, SDL_FALSE);
|
||||
/* M: T --> F */
|
||||
/* K: T --> T */
|
||||
_setAndCheckWindowKeyboardGrabState(window, SDL_TRUE);
|
||||
_setAndCheckWindowMouseGrabState(window, SDL_FALSE);
|
||||
SDLTest_AssertCheck(SDL_GetWindowGrab(window),
|
||||
"SDL_GetWindowGrab() should return SDL_TRUE");
|
||||
|
||||
/* M: F --> T */
|
||||
/* K: T --> F */
|
||||
_setAndCheckWindowMouseGrabState(window, SDL_TRUE);
|
||||
_setAndCheckWindowKeyboardGrabState(window, SDL_FALSE);
|
||||
SDLTest_AssertCheck(SDL_GetWindowGrab(window),
|
||||
"SDL_GetWindowGrab() should return SDL_TRUE");
|
||||
|
||||
/* M: T --> F */
|
||||
/* K: F --> F */
|
||||
_setAndCheckWindowMouseGrabState(window, SDL_FALSE);
|
||||
_setAndCheckWindowKeyboardGrabState(window, SDL_FALSE);
|
||||
SDLTest_AssertCheck(!SDL_GetWindowGrab(window),
|
||||
"SDL_GetWindowGrab() should return SDL_FALSE");
|
||||
SDLTest_AssertCheck(SDL_GetGrabbedWindow() == NULL,
|
||||
"Expected NULL grabbed window");
|
||||
|
||||
/* Using the older SDL_SetWindowGrab API should only grab mouse by default */
|
||||
SDL_SetWindowGrab(window, SDL_TRUE);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowGrab(SDL_TRUE)");
|
||||
SDLTest_AssertCheck(SDL_GetWindowGrab(window),
|
||||
"SDL_GetWindowGrab() should return SDL_TRUE");
|
||||
SDLTest_AssertCheck(SDL_GetWindowMouseGrab(window),
|
||||
"SDL_GetWindowMouseGrab() should return SDL_TRUE");
|
||||
SDLTest_AssertCheck(!SDL_GetWindowKeyboardGrab(window),
|
||||
"SDL_GetWindowKeyboardGrab() should return SDL_FALSE");
|
||||
SDL_SetWindowGrab(window, SDL_FALSE);
|
||||
SDLTest_AssertCheck(!SDL_GetWindowGrab(window),
|
||||
"SDL_GetWindowGrab() should return SDL_FALSE");
|
||||
SDLTest_AssertCheck(!SDL_GetWindowMouseGrab(window),
|
||||
"SDL_GetWindowMouseGrab() should return SDL_FALSE");
|
||||
SDLTest_AssertCheck(!SDL_GetWindowKeyboardGrab(window),
|
||||
"SDL_GetWindowKeyboardGrab() should return SDL_FALSE");
|
||||
|
||||
/* Now test with SDL_HINT_GRAB_KEYBOARD set. We should get keyboard grab now. */
|
||||
SDL_SetHint(SDL_HINT_GRAB_KEYBOARD, "1");
|
||||
SDL_SetWindowGrab(window, SDL_TRUE);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowGrab(SDL_TRUE)");
|
||||
SDLTest_AssertCheck(SDL_GetWindowGrab(window),
|
||||
"SDL_GetWindowGrab() should return SDL_TRUE");
|
||||
SDLTest_AssertCheck(SDL_GetWindowMouseGrab(window),
|
||||
"SDL_GetWindowMouseGrab() should return SDL_TRUE");
|
||||
SDLTest_AssertCheck(SDL_GetWindowKeyboardGrab(window),
|
||||
"SDL_GetWindowKeyboardGrab() should return SDL_TRUE");
|
||||
SDL_SetWindowGrab(window, SDL_FALSE);
|
||||
SDLTest_AssertCheck(!SDL_GetWindowGrab(window),
|
||||
"SDL_GetWindowGrab() should return SDL_FALSE");
|
||||
SDLTest_AssertCheck(!SDL_GetWindowMouseGrab(window),
|
||||
"SDL_GetWindowMouseGrab() should return SDL_FALSE");
|
||||
SDLTest_AssertCheck(!SDL_GetWindowKeyboardGrab(window),
|
||||
"SDL_GetWindowKeyboardGrab() should return SDL_FALSE");
|
||||
|
||||
/* Negative tests */
|
||||
dummyState = SDL_GetWindowGrab(NULL);
|
||||
SDL_GetWindowGrab(NULL);
|
||||
SDLTest_AssertPass("Call to SDL_GetWindowGrab(window=NULL)");
|
||||
_checkInvalidWindowError();
|
||||
|
||||
SDL_GetWindowKeyboardGrab(NULL);
|
||||
SDLTest_AssertPass("Call to SDL_GetWindowKeyboardGrab(window=NULL)");
|
||||
_checkInvalidWindowError();
|
||||
|
||||
SDL_SetWindowGrab(NULL, SDL_FALSE);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowGrab(window=NULL,SDL_FALSE)");
|
||||
_checkInvalidWindowError();
|
||||
|
||||
SDL_SetWindowGrab(NULL, SDL_TRUE);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowGrab(window=NULL,SDL_FALSE)");
|
||||
SDL_SetWindowKeyboardGrab(NULL, SDL_FALSE);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowKeyboardGrab(window=NULL,SDL_FALSE)");
|
||||
_checkInvalidWindowError();
|
||||
|
||||
/* State should still be F */
|
||||
desiredState = SDL_FALSE;
|
||||
currentState = SDL_GetWindowGrab(window);
|
||||
SDLTest_AssertPass("Call to SDL_GetWindowGrab()");
|
||||
SDLTest_AssertCheck(
|
||||
currentState == desiredState,
|
||||
"Validate returned state; expected: %s, got: %s",
|
||||
(desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE",
|
||||
(currentState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
|
||||
SDL_SetWindowGrab(NULL, SDL_TRUE);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowGrab(window=NULL,SDL_TRUE)");
|
||||
_checkInvalidWindowError();
|
||||
|
||||
SDL_SetWindowKeyboardGrab(NULL, SDL_TRUE);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowKeyboardGrab(window=NULL,SDL_TRUE)");
|
||||
_checkInvalidWindowError();
|
||||
|
||||
/* Restore state */
|
||||
_setAndCheckWindowGrabState(window, originalState);
|
||||
_setAndCheckWindowMouseGrabState(window, originalMouseState);
|
||||
_setAndCheckWindowKeyboardGrabState(window, originalKeyboardState);
|
||||
|
||||
/* Clean up */
|
||||
_destroyVideoSuiteTestWindow(window);
|
||||
@@ -836,8 +964,8 @@ video_getSetWindowGrab(void *arg)
|
||||
/**
|
||||
* @brief Tests call to SDL_GetWindowID and SDL_GetWindowFromID
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowID
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_SetWindowFromID
|
||||
* @sa http://wiki.libsdl.org/SDL_GetWindowID
|
||||
* @sa http://wiki.libsdl.org/SDL_SetWindowFromID
|
||||
*/
|
||||
int
|
||||
video_getWindowId(void *arg)
|
||||
@@ -892,7 +1020,7 @@ video_getWindowId(void *arg)
|
||||
/**
|
||||
* @brief Tests call to SDL_GetWindowPixelFormat
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowPixelFormat
|
||||
* @sa http://wiki.libsdl.org/SDL_GetWindowPixelFormat
|
||||
*/
|
||||
int
|
||||
video_getWindowPixelFormat(void *arg)
|
||||
@@ -926,8 +1054,8 @@ video_getWindowPixelFormat(void *arg)
|
||||
/**
|
||||
* @brief Tests call to SDL_GetWindowPosition and SDL_SetWindowPosition
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowPosition
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_SetWindowPosition
|
||||
* @sa http://wiki.libsdl.org/SDL_GetWindowPosition
|
||||
* @sa http://wiki.libsdl.org/SDL_SetWindowPosition
|
||||
*/
|
||||
int
|
||||
video_getSetWindowPosition(void *arg)
|
||||
@@ -1069,8 +1197,8 @@ void _checkInvalidParameterError()
|
||||
/**
|
||||
* @brief Tests call to SDL_GetWindowSize and SDL_SetWindowSize
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowSize
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_SetWindowSize
|
||||
* @sa http://wiki.libsdl.org/SDL_GetWindowSize
|
||||
* @sa http://wiki.libsdl.org/SDL_SetWindowSize
|
||||
*/
|
||||
int
|
||||
video_getSetWindowSize(void *arg)
|
||||
@@ -1508,8 +1636,8 @@ video_getSetWindowMaximumSize(void *arg)
|
||||
/**
|
||||
* @brief Tests call to SDL_SetWindowData and SDL_GetWindowData
|
||||
*
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_SetWindowData
|
||||
* @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowData
|
||||
* @sa http://wiki.libsdl.org/SDL_SetWindowData
|
||||
* @sa http://wiki.libsdl.org/SDL_GetWindowData
|
||||
*/
|
||||
int
|
||||
video_getSetWindowData(void *arg)
|
||||
|
2
externals/SDL/test/testbounds.c
vendored
2
externals/SDL/test/testbounds.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testcustomcursor.c
vendored
2
externals/SDL/test/testcustomcursor.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testdisplayinfo.c
vendored
2
externals/SDL/test/testdisplayinfo.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testdraw2.c
vendored
2
externals/SDL/test/testdraw2.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
6
externals/SDL/test/testdrawchessboard.c
vendored
6
externals/SDL/test/testdrawchessboard.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -29,7 +29,7 @@ SDL_Surface *surface;
|
||||
int done;
|
||||
|
||||
void
|
||||
DrawChessBoard(SDL_Renderer * renderer)
|
||||
DrawChessBoard()
|
||||
{
|
||||
int row = 0,column = 0,x = 0;
|
||||
SDL_Rect rect, darea;
|
||||
@@ -90,7 +90,7 @@ loop()
|
||||
}
|
||||
}
|
||||
|
||||
DrawChessBoard(renderer);
|
||||
DrawChessBoard();
|
||||
|
||||
/* Got everything on rendering surface,
|
||||
now Update the drawing image on window screen */
|
||||
|
2
externals/SDL/test/testdropfile.c
vendored
2
externals/SDL/test/testdropfile.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testerror.c
vendored
2
externals/SDL/test/testerror.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testevdev.c
vendored
2
externals/SDL/test/testevdev.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 2020 Collabora Ltd.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
|
2
externals/SDL/test/testfile.c
vendored
2
externals/SDL/test/testfile.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testfilesystem.c
vendored
2
externals/SDL/test/testfilesystem.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
21
externals/SDL/test/testgamecontroller.c
vendored
21
externals/SDL/test/testgamecontroller.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -267,7 +267,8 @@ loop(void *arg)
|
||||
case SDL_CONTROLLERTOUCHPADDOWN:
|
||||
case SDL_CONTROLLERTOUCHPADMOTION:
|
||||
case SDL_CONTROLLERTOUCHPADUP:
|
||||
SDL_Log("Controller touchpad %d finger %d %s %.2f, %.2f, %.2f\n",
|
||||
SDL_Log("Controller %d touchpad %d finger %d %s %.2f, %.2f, %.2f\n",
|
||||
event.ctouchpad.which,
|
||||
event.ctouchpad.touchpad,
|
||||
event.ctouchpad.finger,
|
||||
(event.type == SDL_CONTROLLERTOUCHPADDOWN ? "pressed at" :
|
||||
@@ -279,7 +280,8 @@ loop(void *arg)
|
||||
break;
|
||||
|
||||
case SDL_CONTROLLERSENSORUPDATE:
|
||||
SDL_Log("Controller sensor %s: %.2f, %.2f, %.2f\n",
|
||||
SDL_Log("Controller %d sensor %s: %.2f, %.2f, %.2f\n",
|
||||
event.csensor.which,
|
||||
event.csensor.sensor == SDL_SENSOR_ACCEL ? "accelerometer" :
|
||||
event.csensor.sensor == SDL_SENSOR_GYRO ? "gyro" : "unknown",
|
||||
event.csensor.data[0],
|
||||
@@ -291,7 +293,7 @@ loop(void *arg)
|
||||
if (event.caxis.value <= (-SDL_JOYSTICK_AXIS_MAX / 2) || event.caxis.value >= (SDL_JOYSTICK_AXIS_MAX / 2)) {
|
||||
SetController(event.caxis.which);
|
||||
}
|
||||
SDL_Log("Controller axis %s changed to %d\n", SDL_GameControllerGetStringForAxis((SDL_GameControllerAxis)event.caxis.axis), event.caxis.value);
|
||||
SDL_Log("Controller %d axis %s changed to %d\n", event.caxis.which, SDL_GameControllerGetStringForAxis((SDL_GameControllerAxis)event.caxis.axis), event.caxis.value);
|
||||
break;
|
||||
|
||||
case SDL_CONTROLLERBUTTONDOWN:
|
||||
@@ -299,10 +301,18 @@ loop(void *arg)
|
||||
if (event.type == SDL_CONTROLLERBUTTONDOWN) {
|
||||
SetController(event.cbutton.which);
|
||||
}
|
||||
SDL_Log("Controller button %s %s\n", SDL_GameControllerGetStringForButton((SDL_GameControllerButton)event.cbutton.button), event.cbutton.state ? "pressed" : "released");
|
||||
SDL_Log("Controller %d button %s %s\n", event.cbutton.which, SDL_GameControllerGetStringForButton((SDL_GameControllerButton)event.cbutton.button), event.cbutton.state ? "pressed" : "released");
|
||||
break;
|
||||
|
||||
case SDL_KEYDOWN:
|
||||
if (event.key.keysym.sym >= SDLK_0 && event.key.keysym.sym <= SDLK_9) {
|
||||
if (gamecontroller) {
|
||||
int player_index = (event.key.keysym.sym - SDLK_0);
|
||||
|
||||
SDL_GameControllerSetPlayerIndex(gamecontroller, player_index);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (event.key.keysym.sym != SDLK_ESCAPE) {
|
||||
break;
|
||||
}
|
||||
@@ -425,6 +435,7 @@ main(int argc, char *argv[])
|
||||
|
||||
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
|
||||
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, "1");
|
||||
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "1");
|
||||
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
|
||||
|
||||
/* Enable standard application logging */
|
||||
|
4
externals/SDL/test/testgesture.c
vendored
4
externals/SDL/test/testgesture.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -90,6 +90,7 @@ setpix(SDL_Surface *screen, float _x, float _y, unsigned int col)
|
||||
*pixmem32 = colour;
|
||||
}
|
||||
|
||||
#if 0 /* unused */
|
||||
static void
|
||||
drawLine(SDL_Surface *screen, float x0, float y0, float x1, float y1, unsigned int col)
|
||||
{
|
||||
@@ -98,6 +99,7 @@ drawLine(SDL_Surface *screen, float x0, float y0, float x1, float y1, unsigned i
|
||||
setpix(screen, x1 + t * (x0 - x1), y1 + t * (y0 - y1), col);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
drawCircle(SDL_Surface *screen, float x, float y, float r, unsigned int c)
|
||||
|
2
externals/SDL/test/testgl2.c
vendored
2
externals/SDL/test/testgl2.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testgles.c
vendored
2
externals/SDL/test/testgles.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testgles2.c
vendored
2
externals/SDL/test/testgles2.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
806
externals/SDL/test/testgles2_sdf.c
vendored
Executable file
806
externals/SDL/test/testgles2_sdf.c
vendored
Executable file
@@ -0,0 +1,806 @@
|
||||
/*
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include "SDL_test_common.h"
|
||||
|
||||
#if defined(__IPHONEOS__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__NACL__) \
|
||||
|| defined(__WINDOWS__) || defined(__LINUX__)
|
||||
#define HAVE_OPENGLES2
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENGLES2
|
||||
|
||||
#include "SDL_opengles2.h"
|
||||
|
||||
typedef struct GLES2_Context
|
||||
{
|
||||
#define SDL_PROC(ret,func,params) ret (APIENTRY *func) params;
|
||||
#include "../src/render/opengles2/SDL_gles2funcs.h"
|
||||
#undef SDL_PROC
|
||||
} GLES2_Context;
|
||||
|
||||
|
||||
static SDL_Surface *g_surf_sdf = NULL;
|
||||
GLenum g_texture;
|
||||
GLenum g_texture_type = GL_TEXTURE_2D;
|
||||
GLfloat g_verts[24];
|
||||
typedef enum
|
||||
{
|
||||
GLES2_ATTRIBUTE_POSITION = 0,
|
||||
GLES2_ATTRIBUTE_TEXCOORD = 1,
|
||||
GLES2_ATTRIBUTE_ANGLE = 2,
|
||||
GLES2_ATTRIBUTE_CENTER = 3,
|
||||
} GLES2_Attribute;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GLES2_UNIFORM_PROJECTION,
|
||||
GLES2_UNIFORM_TEXTURE,
|
||||
GLES2_UNIFORM_COLOR,
|
||||
} GLES2_Uniform;
|
||||
|
||||
|
||||
GLuint g_uniform_locations[16];
|
||||
|
||||
|
||||
|
||||
static SDLTest_CommonState *state;
|
||||
static SDL_GLContext *context = NULL;
|
||||
static int depth = 16;
|
||||
static GLES2_Context ctx;
|
||||
|
||||
static int LoadContext(GLES2_Context * data)
|
||||
{
|
||||
#if SDL_VIDEO_DRIVER_UIKIT
|
||||
#define __SDL_NOGETPROCADDR__
|
||||
#elif SDL_VIDEO_DRIVER_ANDROID
|
||||
#define __SDL_NOGETPROCADDR__
|
||||
#elif SDL_VIDEO_DRIVER_PANDORA
|
||||
#define __SDL_NOGETPROCADDR__
|
||||
#endif
|
||||
|
||||
#if defined __SDL_NOGETPROCADDR__
|
||||
#define SDL_PROC(ret,func,params) data->func=func;
|
||||
#else
|
||||
#define SDL_PROC(ret,func,params) \
|
||||
do { \
|
||||
data->func = SDL_GL_GetProcAddress(#func); \
|
||||
if ( ! data->func ) { \
|
||||
return SDL_SetError("Couldn't load GLES2 function %s: %s", #func, SDL_GetError()); \
|
||||
} \
|
||||
} while ( 0 );
|
||||
#endif /* __SDL_NOGETPROCADDR__ */
|
||||
|
||||
#include "../src/render/opengles2/SDL_gles2funcs.h"
|
||||
#undef SDL_PROC
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
|
||||
static void
|
||||
quit(int rc)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (context != NULL) {
|
||||
for (i = 0; i < state->num_windows; i++) {
|
||||
if (context[i]) {
|
||||
SDL_GL_DeleteContext(context[i]);
|
||||
}
|
||||
}
|
||||
|
||||
SDL_free(context);
|
||||
}
|
||||
|
||||
SDLTest_CommonQuit(state);
|
||||
exit(rc);
|
||||
}
|
||||
|
||||
#define GL_CHECK(x) \
|
||||
x; \
|
||||
{ \
|
||||
GLenum glError = ctx.glGetError(); \
|
||||
if(glError != GL_NO_ERROR) { \
|
||||
SDL_Log("glGetError() = %i (0x%.8x) at line %i\n", glError, glError, __LINE__); \
|
||||
quit(1); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create shader, load in source, compile, dump debug as necessary.
|
||||
*
|
||||
* shader: Pointer to return created shader ID.
|
||||
* source: Passed-in shader source code.
|
||||
* shader_type: Passed to GL, e.g. GL_VERTEX_SHADER.
|
||||
*/
|
||||
void
|
||||
process_shader(GLuint *shader, const char * source, GLint shader_type)
|
||||
{
|
||||
GLint status = GL_FALSE;
|
||||
const char *shaders[1] = { NULL };
|
||||
char buffer[1024];
|
||||
GLsizei length;
|
||||
|
||||
/* Create shader and load into GL. */
|
||||
*shader = GL_CHECK(ctx.glCreateShader(shader_type));
|
||||
|
||||
shaders[0] = source;
|
||||
|
||||
GL_CHECK(ctx.glShaderSource(*shader, 1, shaders, NULL));
|
||||
|
||||
/* Clean up shader source. */
|
||||
shaders[0] = NULL;
|
||||
|
||||
/* Try compiling the shader. */
|
||||
GL_CHECK(ctx.glCompileShader(*shader));
|
||||
GL_CHECK(ctx.glGetShaderiv(*shader, GL_COMPILE_STATUS, &status));
|
||||
|
||||
/* Dump debug info (source and log) if compilation failed. */
|
||||
if(status != GL_TRUE) {
|
||||
ctx.glGetProgramInfoLog(*shader, sizeof(buffer), &length, &buffer[0]);
|
||||
buffer[length] = '\0';
|
||||
SDL_Log("Shader compilation failed: %s", buffer);fflush(stderr);
|
||||
quit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Notes on a_angle:
|
||||
* It is a vector containing sin and cos for rotation matrix
|
||||
* To get correct rotation for most cases when a_angle is disabled cos
|
||||
value is decremented by 1.0 to get proper output with 0.0 which is
|
||||
default value
|
||||
*/
|
||||
static const Uint8 GLES2_VertexSrc_Default_[] = " \
|
||||
uniform mat4 u_projection; \
|
||||
attribute vec2 a_position; \
|
||||
attribute vec2 a_texCoord; \
|
||||
attribute vec2 a_angle; \
|
||||
attribute vec2 a_center; \
|
||||
varying vec2 v_texCoord; \
|
||||
\
|
||||
void main() \
|
||||
{ \
|
||||
float s = a_angle[0]; \
|
||||
float c = a_angle[1] + 1.0; \
|
||||
mat2 rotationMatrix = mat2(c, -s, s, c); \
|
||||
vec2 position = rotationMatrix * (a_position - a_center) + a_center; \
|
||||
v_texCoord = a_texCoord; \
|
||||
gl_Position = u_projection * vec4(position, 0.0, 1.0);\
|
||||
gl_PointSize = 1.0; \
|
||||
} \
|
||||
";
|
||||
|
||||
static const Uint8 GLES2_FragmentSrc_TextureABGRSrc_[] = " \
|
||||
precision mediump float; \
|
||||
uniform sampler2D u_texture; \
|
||||
uniform vec4 u_color; \
|
||||
varying vec2 v_texCoord; \
|
||||
\
|
||||
void main() \
|
||||
{ \
|
||||
gl_FragColor = texture2D(u_texture, v_texCoord); \
|
||||
gl_FragColor *= u_color; \
|
||||
} \
|
||||
";
|
||||
|
||||
/* RGB to ABGR conversion */
|
||||
static const Uint8 GLES2_FragmentSrc_TextureABGRSrc_SDF[] = " \
|
||||
#extension GL_OES_standard_derivatives : enable\n\
|
||||
\
|
||||
precision mediump float; \
|
||||
uniform sampler2D u_texture; \
|
||||
uniform vec4 u_color; \
|
||||
varying vec2 v_texCoord; \
|
||||
\
|
||||
void main() \
|
||||
{ \
|
||||
vec4 abgr = texture2D(u_texture, v_texCoord); \
|
||||
\
|
||||
float sigDist = abgr.a; \
|
||||
\
|
||||
float w = fwidth( sigDist );\
|
||||
float alpha = clamp(smoothstep(0.5 - w, 0.5 + w, sigDist), 0.0, 1.0); \
|
||||
\
|
||||
gl_FragColor = vec4(abgr.rgb, abgr.a * alpha); \
|
||||
gl_FragColor.rgb *= gl_FragColor.a; \
|
||||
gl_FragColor *= u_color; \
|
||||
} \
|
||||
";
|
||||
|
||||
/* RGB to ABGR conversion DEBUG */
|
||||
static const char *GLES2_FragmentSrc_TextureABGRSrc_SDF_dbg = " \
|
||||
#extension GL_OES_standard_derivatives : enable\n\
|
||||
\
|
||||
precision mediump float; \
|
||||
uniform sampler2D u_texture; \
|
||||
uniform vec4 u_color; \
|
||||
varying vec2 v_texCoord; \
|
||||
\
|
||||
void main() \
|
||||
{ \
|
||||
vec4 abgr = texture2D(u_texture, v_texCoord); \
|
||||
\
|
||||
float a = abgr.a; \
|
||||
gl_FragColor = vec4(a, a, a, 1.0); \
|
||||
} \
|
||||
";
|
||||
|
||||
|
||||
static float g_val = 1.0f;
|
||||
static int g_use_SDF = 1;
|
||||
static int g_use_SDF_debug = 0;
|
||||
static float g_angle = 0.0f;
|
||||
static float matrix_mvp[4][4];
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct shader_data
|
||||
{
|
||||
GLuint shader_program, shader_frag, shader_vert;
|
||||
|
||||
GLint attr_position;
|
||||
GLint attr_color, attr_mvp;
|
||||
|
||||
} shader_data;
|
||||
|
||||
static void
|
||||
Render(unsigned int width, unsigned int height, shader_data* data)
|
||||
{
|
||||
float *verts = g_verts;
|
||||
ctx.glViewport(0, 0, 640, 480);
|
||||
|
||||
GL_CHECK(ctx.glClear(GL_COLOR_BUFFER_BIT));
|
||||
|
||||
GL_CHECK(ctx.glUniformMatrix4fv(g_uniform_locations[GLES2_UNIFORM_PROJECTION], 1, GL_FALSE, (const float *)matrix_mvp));
|
||||
GL_CHECK(ctx.glUniform4f(g_uniform_locations[GLES2_UNIFORM_COLOR], 1.0f, 1.0f, 1.0f, 1.0f));
|
||||
|
||||
GL_CHECK(ctx.glVertexAttribPointer(GLES2_ATTRIBUTE_ANGLE, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *) (verts + 16)));
|
||||
GL_CHECK(ctx.glVertexAttribPointer(GLES2_ATTRIBUTE_TEXCOORD, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *) (verts + 8)));
|
||||
GL_CHECK(ctx.glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *) verts));
|
||||
|
||||
GL_CHECK(ctx.glDrawArrays(GL_TRIANGLE_STRIP, 0, 4));
|
||||
}
|
||||
|
||||
|
||||
void renderCopy_angle(float degree_angle)
|
||||
{
|
||||
const float radian_angle = (float)(3.141592 * degree_angle) / 180.0;
|
||||
const GLfloat s = (GLfloat) SDL_sin(radian_angle);
|
||||
const GLfloat c = (GLfloat) SDL_cos(radian_angle) - 1.0f;
|
||||
GLfloat *verts = g_verts + 16;
|
||||
*(verts++) = s;
|
||||
*(verts++) = c;
|
||||
*(verts++) = s;
|
||||
*(verts++) = c;
|
||||
*(verts++) = s;
|
||||
*(verts++) = c;
|
||||
*(verts++) = s;
|
||||
*(verts++) = c;
|
||||
}
|
||||
|
||||
|
||||
void renderCopy_position(SDL_Rect *srcrect, SDL_Rect *dstrect)
|
||||
{
|
||||
GLfloat minx, miny, maxx, maxy;
|
||||
GLfloat minu, maxu, minv, maxv;
|
||||
GLfloat *verts = g_verts;
|
||||
|
||||
minx = dstrect->x;
|
||||
miny = dstrect->y;
|
||||
maxx = dstrect->x + dstrect->w;
|
||||
maxy = dstrect->y + dstrect->h;
|
||||
|
||||
minu = (GLfloat) srcrect->x / g_surf_sdf->w;
|
||||
maxu = (GLfloat) (srcrect->x + srcrect->w) / g_surf_sdf->w;
|
||||
minv = (GLfloat) srcrect->y / g_surf_sdf->h;
|
||||
maxv = (GLfloat) (srcrect->y + srcrect->h) / g_surf_sdf->h;
|
||||
|
||||
*(verts++) = minx;
|
||||
*(verts++) = miny;
|
||||
*(verts++) = maxx;
|
||||
*(verts++) = miny;
|
||||
*(verts++) = minx;
|
||||
*(verts++) = maxy;
|
||||
*(verts++) = maxx;
|
||||
*(verts++) = maxy;
|
||||
|
||||
*(verts++) = minu;
|
||||
*(verts++) = minv;
|
||||
*(verts++) = maxu;
|
||||
*(verts++) = minv;
|
||||
*(verts++) = minu;
|
||||
*(verts++) = maxv;
|
||||
*(verts++) = maxu;
|
||||
*(verts++) = maxv;
|
||||
}
|
||||
|
||||
int done;
|
||||
Uint32 frames;
|
||||
shader_data *datas;
|
||||
|
||||
void loop()
|
||||
{
|
||||
SDL_Event event;
|
||||
int i;
|
||||
int status;
|
||||
|
||||
/* Check for events */
|
||||
++frames;
|
||||
while (SDL_PollEvent(&event) && !done) {
|
||||
switch (event.type) {
|
||||
case SDL_KEYDOWN:
|
||||
{
|
||||
const int sym = event.key.keysym.sym;
|
||||
|
||||
if (sym == SDLK_TAB) {
|
||||
SDL_Log("Tab");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (sym == SDLK_LEFT) g_val -= 0.05;
|
||||
if (sym == SDLK_RIGHT) g_val += 0.05;
|
||||
if (sym == SDLK_UP) g_angle -= 1;
|
||||
if (sym == SDLK_DOWN) g_angle += 1;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL_WINDOWEVENT:
|
||||
switch (event.window.event) {
|
||||
case SDL_WINDOWEVENT_RESIZED:
|
||||
for (i = 0; i < state->num_windows; ++i) {
|
||||
if (event.window.windowID == SDL_GetWindowID(state->windows[i])) {
|
||||
int w, h;
|
||||
status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
|
||||
if (status) {
|
||||
SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
|
||||
break;
|
||||
}
|
||||
/* Change view port to the new window dimensions */
|
||||
SDL_GL_GetDrawableSize(state->windows[i], &w, &h);
|
||||
ctx.glViewport(0, 0, w, h);
|
||||
state->window_w = event.window.data1;
|
||||
state->window_h = event.window.data2;
|
||||
/* Update window content */
|
||||
Render(event.window.data1, event.window.data2, &datas[i]);
|
||||
SDL_GL_SwapWindow(state->windows[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
SDLTest_CommonEvent(state, &event, &done);
|
||||
}
|
||||
|
||||
|
||||
matrix_mvp[3][0] = -1.0f;
|
||||
matrix_mvp[3][3] = 1.0f;
|
||||
|
||||
matrix_mvp[0][0] = 2.0f / 640.0;
|
||||
matrix_mvp[1][1] = -2.0f / 480.0;
|
||||
matrix_mvp[3][1] = 1.0f;
|
||||
|
||||
if (0)
|
||||
{
|
||||
float *f = (float *) matrix_mvp;
|
||||
SDL_Log("-----------------------------------");
|
||||
SDL_Log("[ %f, %f, %f, %f ]", *f++, *f++, *f++, *f++);
|
||||
SDL_Log("[ %f, %f, %f, %f ]", *f++, *f++, *f++, *f++);
|
||||
SDL_Log("[ %f, %f, %f, %f ]", *f++, *f++, *f++, *f++);
|
||||
SDL_Log("[ %f, %f, %f, %f ]", *f++, *f++, *f++, *f++);
|
||||
SDL_Log("-----------------------------------");
|
||||
}
|
||||
|
||||
renderCopy_angle(g_angle);
|
||||
|
||||
{
|
||||
int w, h;
|
||||
SDL_Rect rs, rd;
|
||||
|
||||
SDL_GL_GetDrawableSize(state->windows[0], &w, &h);
|
||||
|
||||
rs.x = 0; rs.y = 0; rs.w = g_surf_sdf->w; rs.h = g_surf_sdf->h;
|
||||
rd.w = g_surf_sdf->w * g_val; rd.h = g_surf_sdf->h * g_val;
|
||||
rd.x = (w - rd.w) / 2; rd.y = (h - rd.h) / 2;
|
||||
renderCopy_position(&rs, &rd);
|
||||
}
|
||||
|
||||
|
||||
if (!done) {
|
||||
for (i = 0; i < state->num_windows; ++i) {
|
||||
status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
|
||||
if (status) {
|
||||
SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
|
||||
|
||||
/* Continue for next window */
|
||||
continue;
|
||||
}
|
||||
Render(state->window_w, state->window_h, &datas[i]);
|
||||
SDL_GL_SwapWindow(state->windows[i]);
|
||||
}
|
||||
}
|
||||
#ifdef __EMSCRIPTEN__
|
||||
else {
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int fsaa, accel;
|
||||
int value;
|
||||
int i;
|
||||
SDL_DisplayMode mode;
|
||||
Uint32 then, now;
|
||||
int status;
|
||||
shader_data *data;
|
||||
|
||||
/* Initialize parameters */
|
||||
fsaa = 0;
|
||||
accel = 0;
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
for (i = 1; i < argc;) {
|
||||
int consumed;
|
||||
|
||||
consumed = SDLTest_CommonArg(state, i);
|
||||
if (consumed == 0) {
|
||||
if (SDL_strcasecmp(argv[i], "--fsaa") == 0) {
|
||||
++fsaa;
|
||||
consumed = 1;
|
||||
} else if (SDL_strcasecmp(argv[i], "--accel") == 0) {
|
||||
++accel;
|
||||
consumed = 1;
|
||||
} else if (SDL_strcasecmp(argv[i], "--zdepth") == 0) {
|
||||
i++;
|
||||
if (!argv[i]) {
|
||||
consumed = -1;
|
||||
} else {
|
||||
depth = SDL_atoi(argv[i]);
|
||||
consumed = 1;
|
||||
}
|
||||
} else {
|
||||
consumed = -1;
|
||||
}
|
||||
}
|
||||
if (consumed < 0) {
|
||||
static const char *options[] = { "[--fsaa]", "[--accel]", "[--zdepth %d]", NULL };
|
||||
SDLTest_CommonLogUsage(state, argv[0], options);
|
||||
quit(1);
|
||||
}
|
||||
i += consumed;
|
||||
}
|
||||
|
||||
/* Set OpenGL parameters */
|
||||
state->window_flags |= SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE;
|
||||
state->gl_red_size = 5;
|
||||
state->gl_green_size = 5;
|
||||
state->gl_blue_size = 5;
|
||||
state->gl_depth_size = depth;
|
||||
state->gl_major_version = 2;
|
||||
state->gl_minor_version = 0;
|
||||
state->gl_profile_mask = SDL_GL_CONTEXT_PROFILE_ES;
|
||||
|
||||
if (fsaa) {
|
||||
state->gl_multisamplebuffers=1;
|
||||
state->gl_multisamplesamples=fsaa;
|
||||
}
|
||||
if (accel) {
|
||||
state->gl_accelerated=1;
|
||||
}
|
||||
if (!SDLTest_CommonInit(state)) {
|
||||
quit(2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(context));
|
||||
if (context == NULL) {
|
||||
SDL_Log("Out of memory!\n");
|
||||
quit(2);
|
||||
}
|
||||
|
||||
/* Create OpenGL ES contexts */
|
||||
for (i = 0; i < state->num_windows; i++) {
|
||||
context[i] = SDL_GL_CreateContext(state->windows[i]);
|
||||
if (!context[i]) {
|
||||
SDL_Log("SDL_GL_CreateContext(): %s\n", SDL_GetError());
|
||||
quit(2);
|
||||
}
|
||||
}
|
||||
|
||||
/* Important: call this *after* creating the context */
|
||||
if (LoadContext(&ctx) < 0) {
|
||||
SDL_Log("Could not load GLES2 functions\n");
|
||||
quit(2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDL_memset(matrix_mvp, 0, sizeof (matrix_mvp));
|
||||
|
||||
{
|
||||
SDL_Surface *tmp;
|
||||
char *f;
|
||||
g_use_SDF = 1;
|
||||
g_use_SDF_debug = 0;
|
||||
|
||||
if (g_use_SDF) {
|
||||
f = "testgles2_sdf_img_sdf.bmp";
|
||||
} else {
|
||||
f = "testgles2_sdf_img_normal.bmp";
|
||||
}
|
||||
|
||||
SDL_Log("SDF is %s", g_use_SDF ? "enabled" : "disabled");
|
||||
|
||||
/* Load SDF BMP image */
|
||||
#if 1
|
||||
tmp = SDL_LoadBMP(f);
|
||||
if (tmp == NULL) {
|
||||
SDL_Log("missing image file: %s", f);
|
||||
exit(-1);
|
||||
} else {
|
||||
SDL_Log("Load image file: %s", f);
|
||||
}
|
||||
|
||||
#else
|
||||
/* Generate SDF image using SDL_ttf */
|
||||
|
||||
#include "SDL_ttf.h"
|
||||
char *font_file = "./font/DroidSansFallback.ttf";
|
||||
char *str = "Abcde";
|
||||
SDL_Color color = { 0, 0,0, 255};
|
||||
|
||||
TTF_Init();
|
||||
TTF_Font *font = TTF_OpenFont(font_file, 72);
|
||||
|
||||
if (font == NULL) {
|
||||
SDL_Log("Cannot open font %s", font_file);
|
||||
}
|
||||
|
||||
TTF_SetFontSDF(font, g_use_SDF);
|
||||
SDL_Surface *tmp = TTF_RenderUTF8_Blended(font, str, color);
|
||||
|
||||
SDL_Log("err: %s", SDL_GetError());
|
||||
if (tmp == NULL) {
|
||||
SDL_Log("can't render text");
|
||||
return -1;
|
||||
}
|
||||
|
||||
SDL_SaveBMP(tmp, f);
|
||||
|
||||
TTF_CloseFont(font);
|
||||
TTF_Quit();
|
||||
#endif
|
||||
g_surf_sdf = SDL_ConvertSurfaceFormat(tmp, SDL_PIXELFORMAT_ABGR8888, 0);
|
||||
|
||||
SDL_SetSurfaceBlendMode(g_surf_sdf, SDL_BLENDMODE_BLEND);
|
||||
}
|
||||
|
||||
|
||||
if (state->render_flags & SDL_RENDERER_PRESENTVSYNC) {
|
||||
SDL_GL_SetSwapInterval(1);
|
||||
} else {
|
||||
SDL_GL_SetSwapInterval(0);
|
||||
}
|
||||
|
||||
SDL_GetCurrentDisplayMode(0, &mode);
|
||||
SDL_Log("Screen bpp: %d\n", SDL_BITSPERPIXEL(mode.format));
|
||||
SDL_Log("\n");
|
||||
SDL_Log("Vendor : %s\n", ctx.glGetString(GL_VENDOR));
|
||||
SDL_Log("Renderer : %s\n", ctx.glGetString(GL_RENDERER));
|
||||
SDL_Log("Version : %s\n", ctx.glGetString(GL_VERSION));
|
||||
SDL_Log("Extensions : %s\n", ctx.glGetString(GL_EXTENSIONS));
|
||||
SDL_Log("\n");
|
||||
|
||||
status = SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &value);
|
||||
if (!status) {
|
||||
SDL_Log("SDL_GL_RED_SIZE: requested %d, got %d\n", 5, value);
|
||||
} else {
|
||||
SDL_Log( "Failed to get SDL_GL_RED_SIZE: %s\n",
|
||||
SDL_GetError());
|
||||
}
|
||||
status = SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &value);
|
||||
if (!status) {
|
||||
SDL_Log("SDL_GL_GREEN_SIZE: requested %d, got %d\n", 5, value);
|
||||
} else {
|
||||
SDL_Log( "Failed to get SDL_GL_GREEN_SIZE: %s\n",
|
||||
SDL_GetError());
|
||||
}
|
||||
status = SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &value);
|
||||
if (!status) {
|
||||
SDL_Log("SDL_GL_BLUE_SIZE: requested %d, got %d\n", 5, value);
|
||||
} else {
|
||||
SDL_Log( "Failed to get SDL_GL_BLUE_SIZE: %s\n",
|
||||
SDL_GetError());
|
||||
}
|
||||
status = SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &value);
|
||||
if (!status) {
|
||||
SDL_Log("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", depth, value);
|
||||
} else {
|
||||
SDL_Log( "Failed to get SDL_GL_DEPTH_SIZE: %s\n",
|
||||
SDL_GetError());
|
||||
}
|
||||
if (fsaa) {
|
||||
status = SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &value);
|
||||
if (!status) {
|
||||
SDL_Log("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value);
|
||||
} else {
|
||||
SDL_Log( "Failed to get SDL_GL_MULTISAMPLEBUFFERS: %s\n",
|
||||
SDL_GetError());
|
||||
}
|
||||
status = SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &value);
|
||||
if (!status) {
|
||||
SDL_Log("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa,
|
||||
value);
|
||||
} else {
|
||||
SDL_Log( "Failed to get SDL_GL_MULTISAMPLESAMPLES: %s\n",
|
||||
SDL_GetError());
|
||||
}
|
||||
}
|
||||
if (accel) {
|
||||
status = SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value);
|
||||
if (!status) {
|
||||
SDL_Log("SDL_GL_ACCELERATED_VISUAL: requested 1, got %d\n", value);
|
||||
} else {
|
||||
SDL_Log( "Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n",
|
||||
SDL_GetError());
|
||||
}
|
||||
}
|
||||
|
||||
datas = (shader_data *)SDL_calloc(state->num_windows, sizeof(shader_data));
|
||||
|
||||
/* Set rendering settings for each context */
|
||||
for (i = 0; i < state->num_windows; ++i) {
|
||||
|
||||
int w, h;
|
||||
status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
|
||||
if (status) {
|
||||
SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
|
||||
|
||||
/* Continue for next window */
|
||||
continue;
|
||||
}
|
||||
|
||||
{
|
||||
int format = GL_RGBA;
|
||||
int type = GL_UNSIGNED_BYTE;
|
||||
|
||||
GL_CHECK(ctx.glGenTextures(1, &g_texture));
|
||||
|
||||
ctx.glActiveTexture(GL_TEXTURE0);
|
||||
ctx.glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
ctx.glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
ctx.glBindTexture(g_texture_type, g_texture);
|
||||
|
||||
ctx.glTexParameteri(g_texture_type, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
ctx.glTexParameteri(g_texture_type, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
ctx.glTexParameteri(g_texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
ctx.glTexParameteri(g_texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
GL_CHECK(ctx.glTexImage2D(g_texture_type, 0, format, g_surf_sdf->w, g_surf_sdf->h, 0, format, type, NULL));
|
||||
GL_CHECK(ctx.glTexSubImage2D(g_texture_type, 0, 0 /* xoffset */, 0 /* yoffset */, g_surf_sdf->w, g_surf_sdf->h, format, type, g_surf_sdf->pixels));
|
||||
}
|
||||
|
||||
|
||||
SDL_GL_GetDrawableSize(state->windows[i], &w, &h);
|
||||
ctx.glViewport(0, 0, w, h);
|
||||
|
||||
data = &datas[i];
|
||||
|
||||
/* Shader Initialization */
|
||||
process_shader(&data->shader_vert, GLES2_VertexSrc_Default_, GL_VERTEX_SHADER);
|
||||
|
||||
if (g_use_SDF) {
|
||||
if (g_use_SDF_debug == 0) {
|
||||
process_shader(&data->shader_frag, GLES2_FragmentSrc_TextureABGRSrc_SDF, GL_FRAGMENT_SHADER);
|
||||
} else {
|
||||
process_shader(&data->shader_frag, GLES2_FragmentSrc_TextureABGRSrc_SDF_dbg, GL_FRAGMENT_SHADER);
|
||||
}
|
||||
} else {
|
||||
process_shader(&data->shader_frag, GLES2_FragmentSrc_TextureABGRSrc_, GL_FRAGMENT_SHADER);
|
||||
}
|
||||
|
||||
/* Create shader_program (ready to attach shaders) */
|
||||
data->shader_program = GL_CHECK(ctx.glCreateProgram());
|
||||
|
||||
/* Attach shaders and link shader_program */
|
||||
GL_CHECK(ctx.glAttachShader(data->shader_program, data->shader_vert));
|
||||
GL_CHECK(ctx.glAttachShader(data->shader_program, data->shader_frag));
|
||||
GL_CHECK(ctx.glLinkProgram(data->shader_program));
|
||||
|
||||
ctx.glBindAttribLocation(data->shader_program, GLES2_ATTRIBUTE_POSITION, "a_position");
|
||||
ctx.glBindAttribLocation(data->shader_program, GLES2_ATTRIBUTE_TEXCOORD, "a_texCoord");
|
||||
ctx.glBindAttribLocation(data->shader_program, GLES2_ATTRIBUTE_ANGLE, "a_angle");
|
||||
ctx.glBindAttribLocation(data->shader_program, GLES2_ATTRIBUTE_CENTER, "a_center");
|
||||
|
||||
/* Predetermine locations of uniform variables */
|
||||
g_uniform_locations[GLES2_UNIFORM_PROJECTION] = ctx.glGetUniformLocation(data->shader_program, "u_projection");
|
||||
g_uniform_locations[GLES2_UNIFORM_TEXTURE] = ctx.glGetUniformLocation(data->shader_program, "u_texture");
|
||||
g_uniform_locations[GLES2_UNIFORM_COLOR] = ctx.glGetUniformLocation(data->shader_program, "u_color");
|
||||
|
||||
GL_CHECK(ctx.glUseProgram(data->shader_program));
|
||||
|
||||
ctx.glEnableVertexAttribArray((GLenum) GLES2_ATTRIBUTE_ANGLE);
|
||||
ctx.glDisableVertexAttribArray((GLenum) GLES2_ATTRIBUTE_CENTER);
|
||||
ctx.glEnableVertexAttribArray(GLES2_ATTRIBUTE_POSITION);
|
||||
ctx.glEnableVertexAttribArray((GLenum) GLES2_ATTRIBUTE_TEXCOORD);
|
||||
|
||||
|
||||
ctx.glUniform1i(g_uniform_locations[GLES2_UNIFORM_TEXTURE], 0); /* always texture unit 0. */
|
||||
ctx.glActiveTexture(GL_TEXTURE0);
|
||||
ctx.glBindTexture(g_texture_type, g_texture);
|
||||
GL_CHECK(ctx.glClearColor(1, 1, 1, 1));
|
||||
|
||||
// SDL_BLENDMODE_BLEND
|
||||
GL_CHECK(ctx.glEnable(GL_BLEND));
|
||||
ctx.glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
ctx.glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* Main render loop */
|
||||
frames = 0;
|
||||
then = SDL_GetTicks();
|
||||
done = 0;
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
emscripten_set_main_loop(loop, 0, 1);
|
||||
#else
|
||||
while (!done) {
|
||||
loop();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Print out some timing information */
|
||||
now = SDL_GetTicks();
|
||||
if (now > then) {
|
||||
SDL_Log("%2.2f frames per second\n",
|
||||
((double) frames * 1000) / (now - then));
|
||||
}
|
||||
#if !defined(__ANDROID__) && !defined(__NACL__)
|
||||
quit(0);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* HAVE_OPENGLES2 */
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
SDL_Log("No OpenGL ES support on this system\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* HAVE_OPENGLES2 */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
BIN
externals/SDL/test/testgles2_sdf_img_normal.bmp
vendored
Executable file
BIN
externals/SDL/test/testgles2_sdf_img_normal.bmp
vendored
Executable file
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
BIN
externals/SDL/test/testgles2_sdf_img_sdf.bmp
vendored
Executable file
BIN
externals/SDL/test/testgles2_sdf_img_sdf.bmp
vendored
Executable file
Binary file not shown.
After Width: | Height: | Size: 70 KiB |
2
externals/SDL/test/testhotplug.c
vendored
2
externals/SDL/test/testhotplug.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testiconv.c
vendored
2
externals/SDL/test/testiconv.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testime.c
vendored
2
externals/SDL/test/testime.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testintersections.c
vendored
2
externals/SDL/test/testintersections.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testjoystick.c
vendored
2
externals/SDL/test/testjoystick.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testkeys.c
vendored
2
externals/SDL/test/testkeys.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testloadso.c
vendored
2
externals/SDL/test/testloadso.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testlocale.c
vendored
2
externals/SDL/test/testlocale.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testlock.c
vendored
2
externals/SDL/test/testlock.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
8
externals/SDL/test/testmessage.c
vendored
8
externals/SDL/test/testmessage.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -189,6 +189,12 @@ main(int argc, char *argv[])
|
||||
SDL_Event event;
|
||||
SDL_Window *window = SDL_CreateWindow("Test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, 0);
|
||||
|
||||
/* On wayland, no window will actually show until something has
|
||||
actually been displayed.
|
||||
*/
|
||||
SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, 0);
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
success = SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
||||
"Simple MessageBox",
|
||||
"This is a simple error MessageBox with a parent window",
|
||||
|
12
externals/SDL/test/testmultiaudio.c
vendored
12
externals/SDL/test/testmultiaudio.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -33,20 +33,20 @@ callback_data cbd[64];
|
||||
void SDLCALL
|
||||
play_through_once(void *arg, Uint8 * stream, int len)
|
||||
{
|
||||
callback_data *cbd = (callback_data *) arg;
|
||||
Uint8 *waveptr = sound + cbd->soundpos;
|
||||
int waveleft = soundlen - cbd->soundpos;
|
||||
callback_data *cbdata = (callback_data *) arg;
|
||||
Uint8 *waveptr = sound + cbdata->soundpos;
|
||||
int waveleft = soundlen - cbdata->soundpos;
|
||||
int cpy = len;
|
||||
if (cpy > waveleft)
|
||||
cpy = waveleft;
|
||||
|
||||
SDL_memcpy(stream, waveptr, cpy);
|
||||
len -= cpy;
|
||||
cbd->soundpos += cpy;
|
||||
cbdata->soundpos += cpy;
|
||||
if (len > 0) {
|
||||
stream += cpy;
|
||||
SDL_memset(stream, spec.silence, len);
|
||||
SDL_AtomicSet(&cbd->done, 1);
|
||||
SDL_AtomicSet(&cbdata->done, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
2
externals/SDL/test/testnative.c
vendored
2
externals/SDL/test/testnative.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testnative.h
vendored
2
externals/SDL/test/testnative.h
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testnativeos2.c
vendored
2
externals/SDL/test/testnativeos2.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testnativew32.c
vendored
2
externals/SDL/test/testnativew32.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testnativex11.c
vendored
2
externals/SDL/test/testnativex11.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testoffscreen.c
vendored
2
externals/SDL/test/testoffscreen.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
3
externals/SDL/test/testoverlay2.c
vendored
3
externals/SDL/test/testoverlay2.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -144,7 +144,6 @@ SDL_Texture *MooseTexture;
|
||||
SDL_Rect displayrect;
|
||||
int window_w;
|
||||
int window_h;
|
||||
SDL_Window *window;
|
||||
SDL_Renderer *renderer;
|
||||
int paused = 0;
|
||||
int i;
|
||||
|
3
externals/SDL/test/testplatform.c
vendored
3
externals/SDL/test/testplatform.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -381,6 +381,7 @@ TestCPUInfo(SDL_bool verbose)
|
||||
SDL_Log("AVX %s\n", SDL_HasAVX()? "detected" : "not detected");
|
||||
SDL_Log("AVX2 %s\n", SDL_HasAVX2()? "detected" : "not detected");
|
||||
SDL_Log("AVX-512F %s\n", SDL_HasAVX512F()? "detected" : "not detected");
|
||||
SDL_Log("ARM SIMD %s\n", SDL_HasARMSIMD()? "detected" : "not detected");
|
||||
SDL_Log("NEON %s\n", SDL_HasNEON()? "detected" : "not detected");
|
||||
SDL_Log("System RAM %d MB\n", SDL_GetSystemRAM());
|
||||
}
|
||||
|
2
externals/SDL/test/testpower.c
vendored
2
externals/SDL/test/testpower.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
6
externals/SDL/test/testqsort.c
vendored
6
externals/SDL/test/testqsort.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -54,9 +54,9 @@ main(int argc, char *argv[])
|
||||
int success;
|
||||
Uint64 seed = 0;
|
||||
if (argv[1][0] == '0' && argv[1][1] == 'x')
|
||||
success = SDL_sscanf(argv[1] + 2, "%llx", &seed);
|
||||
success = SDL_sscanf(argv[1] + 2, "%"SDL_PRIx64, &seed);
|
||||
else
|
||||
success = SDL_sscanf(argv[1], "%llu", &seed);
|
||||
success = SDL_sscanf(argv[1], "%"SDL_PRIu64, &seed);
|
||||
if (!success) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Invalid seed. Use a decimal or hexadecimal number.\n");
|
||||
return 1;
|
||||
|
8
externals/SDL/test/testrelative.c
vendored
8
externals/SDL/test/testrelative.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -28,10 +28,10 @@ SDL_Rect rect;
|
||||
SDL_Event event;
|
||||
|
||||
static void
|
||||
DrawRects(SDL_Renderer * renderer, SDL_Rect * rect)
|
||||
DrawRects(SDL_Renderer * renderer)
|
||||
{
|
||||
SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
|
||||
SDL_RenderFillRect(renderer, rect);
|
||||
SDL_RenderFillRect(renderer, &rect);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -63,7 +63,7 @@ loop(){
|
||||
if (rect.x > viewport.x + viewport.w) rect.x -= viewport.w;
|
||||
if (rect.y > viewport.y + viewport.h) rect.y -= viewport.h;
|
||||
|
||||
DrawRects(renderer, &rect);
|
||||
DrawRects(renderer);
|
||||
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
|
2
externals/SDL/test/testrendercopyex.c
vendored
2
externals/SDL/test/testrendercopyex.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testrendertarget.c
vendored
2
externals/SDL/test/testrendertarget.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testresample.c
vendored
2
externals/SDL/test/testresample.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testrumble.c
vendored
2
externals/SDL/test/testrumble.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testscale.c
vendored
2
externals/SDL/test/testscale.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
246
externals/SDL/test/testsem.c
vendored
246
externals/SDL/test/testsem.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -19,27 +19,21 @@
|
||||
#include "SDL.h"
|
||||
|
||||
#define NUM_THREADS 10
|
||||
/* This value should be smaller than the maximum count of the */
|
||||
/* semaphore implementation: */
|
||||
#define NUM_OVERHEAD_OPS 10000
|
||||
#define NUM_OVERHEAD_OPS_MULT 10
|
||||
|
||||
static SDL_sem *sem;
|
||||
int alive = 1;
|
||||
int alive;
|
||||
|
||||
int SDLCALL
|
||||
ThreadFunc(void *data)
|
||||
{
|
||||
int threadnum = (int) (uintptr_t) data;
|
||||
while (alive) {
|
||||
SDL_SemWait(sem);
|
||||
SDL_Log("Thread number %d has got the semaphore (value = %d)!\n",
|
||||
threadnum, SDL_SemValue(sem));
|
||||
SDL_Delay(200);
|
||||
SDL_SemPost(sem);
|
||||
SDL_Log("Thread number %d has released the semaphore (value = %d)!\n",
|
||||
threadnum, SDL_SemValue(sem));
|
||||
SDL_Delay(1); /* For the scheduler */
|
||||
}
|
||||
SDL_Log("Thread number %d exiting.\n", threadnum);
|
||||
return 0;
|
||||
}
|
||||
typedef struct Thread_State {
|
||||
SDL_Thread * thread;
|
||||
int number;
|
||||
SDL_bool flag;
|
||||
int loop_count;
|
||||
int content_count;
|
||||
} Thread_State;
|
||||
|
||||
static void
|
||||
killed(int sig)
|
||||
@@ -47,6 +41,60 @@ killed(int sig)
|
||||
alive = 0;
|
||||
}
|
||||
|
||||
static int SDLCALL
|
||||
ThreadFuncRealWorld(void *data)
|
||||
{
|
||||
Thread_State *state = (Thread_State *) data;
|
||||
while (alive) {
|
||||
SDL_SemWait(sem);
|
||||
SDL_Log("Thread number %d has got the semaphore (value = %d)!\n",
|
||||
state->number, SDL_SemValue(sem));
|
||||
SDL_Delay(200);
|
||||
SDL_SemPost(sem);
|
||||
SDL_Log("Thread number %d has released the semaphore (value = %d)!\n",
|
||||
state->number, SDL_SemValue(sem));
|
||||
++state->loop_count;
|
||||
SDL_Delay(1); /* For the scheduler */
|
||||
}
|
||||
SDL_Log("Thread number %d exiting.\n", state->number);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
TestRealWorld(int init_sem) {
|
||||
Thread_State thread_states[NUM_THREADS] = { {0} };
|
||||
int i;
|
||||
int loop_count;
|
||||
|
||||
sem = SDL_CreateSemaphore(init_sem);
|
||||
|
||||
SDL_Log("Running %d threads, semaphore value = %d\n", NUM_THREADS,
|
||||
init_sem);
|
||||
alive = 1;
|
||||
/* Create all the threads */
|
||||
for (i = 0; i < NUM_THREADS; ++i) {
|
||||
char name[64];
|
||||
SDL_snprintf(name, sizeof (name), "Thread%u", (unsigned int) i);
|
||||
thread_states[i].number = i;
|
||||
thread_states[i].thread = SDL_CreateThread(ThreadFuncRealWorld, name, (void *) &thread_states[i]);
|
||||
}
|
||||
|
||||
/* Wait 10 seconds */
|
||||
SDL_Delay(10 * 1000);
|
||||
|
||||
/* Wait for all threads to finish */
|
||||
SDL_Log("Waiting for threads to finish\n");
|
||||
alive = 0;
|
||||
loop_count = 0;
|
||||
for (i = 0; i < NUM_THREADS; ++i) {
|
||||
SDL_WaitThread(thread_states[i].thread, NULL);
|
||||
loop_count += thread_states[i].loop_count;
|
||||
}
|
||||
SDL_Log("Finished waiting for threads, ran %d loops in total\n\n", loop_count);
|
||||
|
||||
SDL_DestroySemaphore(sem);
|
||||
}
|
||||
|
||||
static void
|
||||
TestWaitTimeout(void)
|
||||
{
|
||||
@@ -65,21 +113,137 @@ TestWaitTimeout(void)
|
||||
duration = end_ticks - start_ticks;
|
||||
|
||||
/* Accept a little offset in the effective wait */
|
||||
if (duration > 1900 && duration < 2050)
|
||||
SDL_Log("Wait done.\n");
|
||||
else
|
||||
SDL_Log("Wait took %d milliseconds\n", duration);
|
||||
SDL_assert(duration > 1900 && duration < 2050);
|
||||
SDL_Log("Wait took %d milliseconds\n\n", duration);
|
||||
|
||||
/* Check to make sure the return value indicates timed out */
|
||||
if (retval != SDL_MUTEX_TIMEDOUT)
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_SemWaitTimeout returned: %d; expected: %d\n", retval, SDL_MUTEX_TIMEDOUT);
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_SemWaitTimeout returned: %d; expected: %d\n\n", retval, SDL_MUTEX_TIMEDOUT);
|
||||
|
||||
SDL_DestroySemaphore(sem);
|
||||
}
|
||||
|
||||
static void
|
||||
TestOverheadUncontended(void)
|
||||
{
|
||||
Uint32 start_ticks;
|
||||
Uint32 end_ticks;
|
||||
Uint32 duration;
|
||||
int i, j;
|
||||
|
||||
sem = SDL_CreateSemaphore(0);
|
||||
SDL_Log("Doing %d uncontended Post/Wait operations on semaphore\n", NUM_OVERHEAD_OPS * NUM_OVERHEAD_OPS_MULT);
|
||||
|
||||
start_ticks = SDL_GetTicks();
|
||||
for (i = 0; i < NUM_OVERHEAD_OPS_MULT; i++){
|
||||
for (j = 0; j < NUM_OVERHEAD_OPS; j++) {
|
||||
SDL_SemPost(sem);
|
||||
}
|
||||
for (j = 0; j < NUM_OVERHEAD_OPS; j++) {
|
||||
SDL_SemWait(sem);
|
||||
}
|
||||
}
|
||||
end_ticks = SDL_GetTicks();
|
||||
|
||||
duration = end_ticks - start_ticks;
|
||||
SDL_Log("Took %d milliseconds\n\n", duration);
|
||||
|
||||
SDL_DestroySemaphore(sem);
|
||||
}
|
||||
|
||||
static int SDLCALL
|
||||
ThreadFuncOverheadContended(void *data)
|
||||
{
|
||||
Thread_State *state = (Thread_State *) data;
|
||||
|
||||
if (state->flag) {
|
||||
while(alive) {
|
||||
if (SDL_SemTryWait(sem) == SDL_MUTEX_TIMEDOUT) {
|
||||
++state->content_count;
|
||||
}
|
||||
++state->loop_count;
|
||||
}
|
||||
} else {
|
||||
while(alive) {
|
||||
/* Timeout needed to allow check on alive flag */
|
||||
if (SDL_SemWaitTimeout(sem, 50) == SDL_MUTEX_TIMEDOUT) {
|
||||
++state->content_count;
|
||||
}
|
||||
++state->loop_count;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
TestOverheadContended(SDL_bool try_wait)
|
||||
{
|
||||
Uint32 start_ticks;
|
||||
Uint32 end_ticks;
|
||||
Uint32 duration;
|
||||
Thread_State thread_states[NUM_THREADS] = { {0} };
|
||||
char textBuffer[1024];
|
||||
int loop_count;
|
||||
int content_count;
|
||||
int i, j;
|
||||
size_t len;
|
||||
|
||||
sem = SDL_CreateSemaphore(0);
|
||||
SDL_Log("Doing %d contended %s operations on semaphore using %d threads\n",
|
||||
NUM_OVERHEAD_OPS * NUM_OVERHEAD_OPS_MULT, try_wait ? "Post/TryWait" : "Post/WaitTimeout", NUM_THREADS);
|
||||
alive = 1;
|
||||
/* Create multiple threads to starve the semaphore and cause contention */
|
||||
for (i = 0; i < NUM_THREADS; ++i) {
|
||||
char name[64];
|
||||
SDL_snprintf(name, sizeof (name), "Thread%u", (unsigned int) i);
|
||||
thread_states[i].flag = try_wait;
|
||||
thread_states[i].thread = SDL_CreateThread(ThreadFuncOverheadContended, name, (void *) &thread_states[i]);
|
||||
}
|
||||
|
||||
start_ticks = SDL_GetTicks();
|
||||
for (i = 0; i < NUM_OVERHEAD_OPS_MULT; i++) {
|
||||
for (j = 0; j < NUM_OVERHEAD_OPS; j++) {
|
||||
SDL_SemPost(sem);
|
||||
}
|
||||
/* Make sure threads consumed everything */
|
||||
while (SDL_SemValue(sem)) { }
|
||||
}
|
||||
end_ticks = SDL_GetTicks();
|
||||
|
||||
alive = 0;
|
||||
loop_count = 0;
|
||||
content_count = 0;
|
||||
for (i = 0; i < NUM_THREADS; ++i) {
|
||||
SDL_WaitThread(thread_states[i].thread, NULL);
|
||||
loop_count += thread_states[i].loop_count;
|
||||
content_count += thread_states[i].content_count;
|
||||
}
|
||||
SDL_assert_release((loop_count - content_count) == NUM_OVERHEAD_OPS * NUM_OVERHEAD_OPS_MULT);
|
||||
|
||||
duration = end_ticks - start_ticks;
|
||||
SDL_Log("Took %d milliseconds, threads %s %d out of %d times in total (%.2f%%)\n",
|
||||
duration, try_wait ? "where contended" : "timed out", content_count,
|
||||
loop_count, ((float)content_count * 100) / loop_count);
|
||||
/* Print how many semaphores where consumed per thread */
|
||||
SDL_snprintf(textBuffer, sizeof(textBuffer), "{ ");
|
||||
for (i = 0; i < NUM_THREADS; ++i) {
|
||||
if (i > 0) {
|
||||
len = SDL_strlen(textBuffer);
|
||||
SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, ", ");
|
||||
}
|
||||
len = SDL_strlen(textBuffer);
|
||||
SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, "%d", thread_states[i].loop_count - thread_states[i].content_count);
|
||||
}
|
||||
len = SDL_strlen(textBuffer);
|
||||
SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, " }\n");
|
||||
SDL_Log("%s\n", textBuffer);
|
||||
|
||||
SDL_DestroySemaphore(sem);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
SDL_Thread *threads[NUM_THREADS];
|
||||
uintptr_t i;
|
||||
int init_sem;
|
||||
|
||||
/* Enable standard application logging */
|
||||
@@ -99,32 +263,18 @@ main(int argc, char **argv)
|
||||
signal(SIGINT, killed);
|
||||
|
||||
init_sem = atoi(argv[1]);
|
||||
sem = SDL_CreateSemaphore(init_sem);
|
||||
|
||||
SDL_Log("Running %d threads, semaphore value = %d\n", NUM_THREADS,
|
||||
init_sem);
|
||||
/* Create all the threads */
|
||||
for (i = 0; i < NUM_THREADS; ++i) {
|
||||
char name[64];
|
||||
SDL_snprintf(name, sizeof (name), "Thread%u", (unsigned int) i);
|
||||
threads[i] = SDL_CreateThread(ThreadFunc, name, (void *) i);
|
||||
if (init_sem > 0) {
|
||||
TestRealWorld(init_sem);
|
||||
}
|
||||
|
||||
/* Wait 10 seconds */
|
||||
SDL_Delay(10 * 1000);
|
||||
|
||||
/* Wait for all threads to finish */
|
||||
SDL_Log("Waiting for threads to finish\n");
|
||||
alive = 0;
|
||||
for (i = 0; i < NUM_THREADS; ++i) {
|
||||
SDL_WaitThread(threads[i], NULL);
|
||||
}
|
||||
SDL_Log("Finished waiting for threads\n");
|
||||
|
||||
SDL_DestroySemaphore(sem);
|
||||
|
||||
TestWaitTimeout();
|
||||
|
||||
TestOverheadUncontended();
|
||||
|
||||
TestOverheadContended(SDL_FALSE);
|
||||
|
||||
TestOverheadContended(SDL_TRUE);
|
||||
|
||||
SDL_Quit();
|
||||
return (0);
|
||||
}
|
||||
|
2
externals/SDL/test/testsensor.c
vendored
2
externals/SDL/test/testsensor.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testshader.c
vendored
2
externals/SDL/test/testshader.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testshape.c
vendored
2
externals/SDL/test/testshape.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testsprite2.c
vendored
2
externals/SDL/test/testsprite2.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
10
externals/SDL/test/testspriteminimal.c
vendored
10
externals/SDL/test/testspriteminimal.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -43,7 +43,7 @@ quit(int rc)
|
||||
}
|
||||
|
||||
int
|
||||
LoadSprite(char *file, SDL_Renderer *renderer)
|
||||
LoadSprite(char *file)
|
||||
{
|
||||
SDL_Surface *temp;
|
||||
|
||||
@@ -92,7 +92,7 @@ LoadSprite(char *file, SDL_Renderer *renderer)
|
||||
}
|
||||
|
||||
void
|
||||
MoveSprites(SDL_Renderer * renderer, SDL_Texture * sprite)
|
||||
MoveSprites()
|
||||
{
|
||||
int i;
|
||||
int window_w = WINDOW_WIDTH;
|
||||
@@ -136,7 +136,7 @@ void loop()
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
MoveSprites(renderer, sprite);
|
||||
MoveSprites();
|
||||
#ifdef __EMSCRIPTEN__
|
||||
if (done) {
|
||||
emscripten_cancel_main_loop();
|
||||
@@ -158,7 +158,7 @@ main(int argc, char *argv[])
|
||||
quit(2);
|
||||
}
|
||||
|
||||
if (LoadSprite("icon.bmp", renderer) < 0) {
|
||||
if (LoadSprite("icon.bmp") < 0) {
|
||||
quit(2);
|
||||
}
|
||||
|
||||
|
6
externals/SDL/test/teststreaming.c
vendored
6
externals/SDL/test/teststreaming.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -67,7 +67,7 @@ void quit(int rc)
|
||||
exit(rc);
|
||||
}
|
||||
|
||||
void UpdateTexture(SDL_Texture *texture, int frame)
|
||||
void UpdateTexture(SDL_Texture *texture)
|
||||
{
|
||||
SDL_Color *color;
|
||||
Uint8 *src;
|
||||
@@ -110,7 +110,7 @@ loop()
|
||||
}
|
||||
|
||||
frame = (frame + 1) % MOOSEFRAMES_COUNT;
|
||||
UpdateTexture(MooseTexture, frame);
|
||||
UpdateTexture(MooseTexture);
|
||||
|
||||
SDL_RenderClear(renderer);
|
||||
SDL_RenderCopy(renderer, MooseTexture, NULL, NULL);
|
||||
|
2
externals/SDL/test/testthread.c
vendored
2
externals/SDL/test/testthread.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testtimer.c
vendored
2
externals/SDL/test/testtimer.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testurl.c
vendored
2
externals/SDL/test/testurl.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
10
externals/SDL/test/testver.c
vendored
10
externals/SDL/test/testver.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -35,13 +35,13 @@ main(int argc, char *argv[])
|
||||
SDL_Log("Compiled with SDL older than 2.0\n");
|
||||
#endif
|
||||
SDL_VERSION(&compiled);
|
||||
SDL_Log("Compiled version: %d.%d.%d.%d (%s)\n",
|
||||
SDL_Log("Compiled version: %d.%d.%d (%s)\n",
|
||||
compiled.major, compiled.minor, compiled.patch,
|
||||
SDL_REVISION_NUMBER, SDL_REVISION);
|
||||
SDL_REVISION);
|
||||
SDL_GetVersion(&linked);
|
||||
SDL_Log("Linked version: %d.%d.%d.%d (%s)\n",
|
||||
SDL_Log("Linked version: %d.%d.%d (%s)\n",
|
||||
linked.major, linked.minor, linked.patch,
|
||||
SDL_GetRevisionNumber(), SDL_GetRevision());
|
||||
SDL_GetRevision());
|
||||
SDL_Quit();
|
||||
return (0);
|
||||
}
|
||||
|
6
externals/SDL/test/testviewport.c
vendored
6
externals/SDL/test/testviewport.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -92,7 +92,7 @@ LoadSprite(char *file, SDL_Renderer *renderer)
|
||||
}
|
||||
|
||||
void
|
||||
DrawOnViewport(SDL_Renderer * renderer, SDL_Rect viewport)
|
||||
DrawOnViewport(SDL_Renderer * renderer)
|
||||
{
|
||||
SDL_Rect rect;
|
||||
|
||||
@@ -174,7 +174,7 @@ loop()
|
||||
continue;
|
||||
|
||||
/* Draw using viewport */
|
||||
DrawOnViewport(state->renderers[i], viewport);
|
||||
DrawOnViewport(state->renderers[i]);
|
||||
|
||||
/* Update the screen! */
|
||||
if (use_target) {
|
||||
|
59
externals/SDL/test/testvulkan.c
vendored
59
externals/SDL/test/testvulkan.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -247,10 +247,10 @@ static void createInstance(void)
|
||||
VkInstanceCreateInfo instanceCreateInfo = {0};
|
||||
const char **extensions = NULL;
|
||||
unsigned extensionCount = 0;
|
||||
VkResult result;
|
||||
VkResult result;
|
||||
|
||||
|
||||
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
|
||||
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
|
||||
appInfo.apiVersion = VK_API_VERSION_1_0;
|
||||
instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||
instanceCreateInfo.pApplicationInfo = &appInfo;
|
||||
@@ -323,12 +323,12 @@ static void createSurface(void)
|
||||
static void findPhysicalDevice(void)
|
||||
{
|
||||
uint32_t physicalDeviceCount = 0;
|
||||
VkPhysicalDevice *physicalDevices;
|
||||
VkQueueFamilyProperties *queueFamiliesProperties = NULL;
|
||||
VkPhysicalDevice *physicalDevices;
|
||||
VkQueueFamilyProperties *queueFamiliesProperties = NULL;
|
||||
uint32_t queueFamiliesPropertiesAllocatedSize = 0;
|
||||
VkExtensionProperties *deviceExtensions = NULL;
|
||||
uint32_t deviceExtensionsAllocatedSize = 0;
|
||||
uint32_t physicalDeviceIndex;
|
||||
uint32_t physicalDeviceIndex;
|
||||
|
||||
VkResult result =
|
||||
vkEnumeratePhysicalDevices(vulkanContext.instance, &physicalDeviceCount, NULL);
|
||||
@@ -366,13 +366,13 @@ static void findPhysicalDevice(void)
|
||||
physicalDeviceIndex++)
|
||||
{
|
||||
uint32_t queueFamiliesCount = 0;
|
||||
uint32_t queueFamilyIndex;
|
||||
uint32_t queueFamilyIndex;
|
||||
uint32_t deviceExtensionCount = 0;
|
||||
SDL_bool hasSwapchainExtension = SDL_FALSE;
|
||||
uint32_t i;
|
||||
SDL_bool hasSwapchainExtension = SDL_FALSE;
|
||||
uint32_t i;
|
||||
|
||||
|
||||
VkPhysicalDevice physicalDevice = physicalDevices[physicalDeviceIndex];
|
||||
VkPhysicalDevice physicalDevice = physicalDevices[physicalDeviceIndex];
|
||||
vkGetPhysicalDeviceProperties(physicalDevice, &vulkanContext.physicalDeviceProperties);
|
||||
if(VK_VERSION_MAJOR(vulkanContext.physicalDeviceProperties.apiVersion) < 1)
|
||||
continue;
|
||||
@@ -403,7 +403,7 @@ static void findPhysicalDevice(void)
|
||||
{
|
||||
VkBool32 supported = 0;
|
||||
|
||||
if(queueFamiliesProperties[queueFamilyIndex].queueCount == 0)
|
||||
if(queueFamiliesProperties[queueFamilyIndex].queueCount == 0)
|
||||
continue;
|
||||
if(queueFamiliesProperties[queueFamilyIndex].queueFlags & VK_QUEUE_GRAPHICS_BIT)
|
||||
vulkanContext.graphicsQueueFamilyIndex = queueFamilyIndex;
|
||||
@@ -495,15 +495,15 @@ static void findPhysicalDevice(void)
|
||||
|
||||
static void createDevice(void)
|
||||
{
|
||||
VkDeviceQueueCreateInfo deviceQueueCreateInfo[1] = {0};
|
||||
VkDeviceQueueCreateInfo deviceQueueCreateInfo[1] = { {0} };
|
||||
static const float queuePriority[] = {1.0f};
|
||||
VkDeviceCreateInfo deviceCreateInfo = {0};
|
||||
static const char *const deviceExtensionNames[] = {
|
||||
VK_KHR_SWAPCHAIN_EXTENSION_NAME,
|
||||
};
|
||||
VkResult result;
|
||||
VkResult result;
|
||||
|
||||
deviceQueueCreateInfo->sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
||||
deviceQueueCreateInfo->sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
||||
deviceQueueCreateInfo->queueFamilyIndex = vulkanContext.graphicsQueueFamilyIndex;
|
||||
deviceQueueCreateInfo->queueCount = 1;
|
||||
deviceQueueCreateInfo->pQueuePriorities = &queuePriority[0];
|
||||
@@ -562,7 +562,7 @@ static void getQueues(void)
|
||||
|
||||
static void createSemaphore(VkSemaphore *semaphore)
|
||||
{
|
||||
VkResult result;
|
||||
VkResult result;
|
||||
|
||||
VkSemaphoreCreateInfo createInfo = {0};
|
||||
createInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
|
||||
@@ -647,7 +647,7 @@ static void getSurfaceFormats(void)
|
||||
|
||||
static void getSwapchainImages(void)
|
||||
{
|
||||
VkResult result;
|
||||
VkResult result;
|
||||
|
||||
SDL_free(vulkanContext.swapchainImages);
|
||||
vulkanContext.swapchainImages = NULL;
|
||||
@@ -685,10 +685,10 @@ static void getSwapchainImages(void)
|
||||
|
||||
static SDL_bool createSwapchain(void)
|
||||
{
|
||||
uint32_t i;
|
||||
int w, h;
|
||||
VkSwapchainCreateInfoKHR createInfo = {0};
|
||||
VkResult result;
|
||||
uint32_t i;
|
||||
int w, h;
|
||||
VkSwapchainCreateInfoKHR createInfo = {0};
|
||||
VkResult result;
|
||||
|
||||
// pick an image count
|
||||
vulkanContext.swapchainDesiredImageCount = vulkanContext.surfaceCapabilities.minImageCount + 1;
|
||||
@@ -783,7 +783,7 @@ static void destroyCommandPool(void)
|
||||
|
||||
static void createCommandPool(void)
|
||||
{
|
||||
VkResult result;
|
||||
VkResult result;
|
||||
|
||||
VkCommandPoolCreateInfo createInfo = {0};
|
||||
createInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
|
||||
@@ -804,7 +804,7 @@ static void createCommandPool(void)
|
||||
|
||||
static void createCommandBuffers(void)
|
||||
{
|
||||
VkResult result;
|
||||
VkResult result;
|
||||
|
||||
VkCommandBufferAllocateInfo allocateInfo = {0};
|
||||
allocateInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
|
||||
@@ -828,7 +828,7 @@ static void createCommandBuffers(void)
|
||||
|
||||
static void createFences(void)
|
||||
{
|
||||
uint32_t i;
|
||||
uint32_t i;
|
||||
|
||||
vulkanContext.fences = SDL_malloc(sizeof(VkFence) * vulkanContext.swapchainImageCount);
|
||||
if(!vulkanContext.fences)
|
||||
@@ -838,7 +838,7 @@ static void createFences(void)
|
||||
}
|
||||
for(i = 0; i < vulkanContext.swapchainImageCount; i++)
|
||||
{
|
||||
VkResult result;
|
||||
VkResult result;
|
||||
|
||||
VkFenceCreateInfo createInfo = {0};
|
||||
createInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
|
||||
@@ -863,7 +863,7 @@ static void createFences(void)
|
||||
|
||||
static void destroyFences(void)
|
||||
{
|
||||
uint32_t i;
|
||||
uint32_t i;
|
||||
|
||||
if(!vulkanContext.fences)
|
||||
return;
|
||||
@@ -912,7 +912,7 @@ static void rerecordCommandBuffer(uint32_t frameIndex, const VkClearColorValue *
|
||||
{
|
||||
VkCommandBuffer commandBuffer = vulkanContext.commandBuffers[frameIndex];
|
||||
VkImage image = vulkanContext.swapchainImages[frameIndex];
|
||||
VkCommandBufferBeginInfo beginInfo = {0};
|
||||
VkCommandBufferBeginInfo beginInfo = {0};
|
||||
VkImageSubresourceRange clearRange = {0};
|
||||
|
||||
VkResult result = vkResetCommandBuffer(commandBuffer, 0);
|
||||
@@ -1024,7 +1024,7 @@ static SDL_bool render(void)
|
||||
uint32_t frameIndex;
|
||||
VkResult result;
|
||||
double currentTime;
|
||||
VkClearColorValue clearColor = {0};
|
||||
VkClearColorValue clearColor = { {0} };
|
||||
VkPipelineStageFlags waitDestStageMask = VK_PIPELINE_STAGE_TRANSFER_BIT;
|
||||
VkSubmitInfo submitInfo = {0};
|
||||
VkPresentInfoKHR presentInfo = {0};
|
||||
@@ -1117,7 +1117,6 @@ static SDL_bool render(void)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int fsaa, accel;
|
||||
int done;
|
||||
SDL_DisplayMode mode;
|
||||
SDL_Event event;
|
||||
@@ -1127,10 +1126,6 @@ int main(int argc, char *argv[])
|
||||
/* Enable standard application logging */
|
||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||
|
||||
/* Initialize parameters */
|
||||
fsaa = 0;
|
||||
accel = -1;
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if(!state)
|
||||
|
8
externals/SDL/test/testwm2.c
vendored
8
externals/SDL/test/testwm2.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -104,8 +104,10 @@ loop()
|
||||
|
||||
for (i = 0; i < state->num_windows; ++i) {
|
||||
SDL_Renderer *renderer = state->renderers[i];
|
||||
SDL_RenderClear(renderer);
|
||||
SDL_RenderPresent(renderer);
|
||||
if (renderer != NULL) {
|
||||
SDL_RenderClear(renderer);
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
}
|
||||
#ifdef __EMSCRIPTEN__
|
||||
if (done) {
|
||||
|
2
externals/SDL/test/testyuv.c
vendored
2
externals/SDL/test/testyuv.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testyuv_cvt.c
vendored
2
externals/SDL/test/testyuv_cvt.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/testyuv_cvt.h
vendored
2
externals/SDL/test/testyuv_cvt.h
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
2
externals/SDL/test/torturethread.c
vendored
2
externals/SDL/test/torturethread.c
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
Reference in New Issue
Block a user