master #4

Merged
BRNSystems merged 17 commits from Mirrorlandia_minetest/irrlicht:master into master 2024-01-28 00:16:35 +01:00
30 changed files with 353 additions and 967 deletions

@ -8,16 +8,13 @@ on:
jobs:
linux-gl:
runs-on: ubuntu-latest
container:
image: ubuntu:bionic
env: { LANG: "C.UTF-8" }
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Install deps
run: |
apt-get update
apt-get install g++ cmake libxi-dev libgl1-mesa-dev libpng-dev libjpeg-dev zlib1g-dev -qyy
sudo apt-get update
sudo apt-get install g++ cmake libxi-dev libgl1-mesa-dev libpng-dev libjpeg-dev zlib1g-dev -qyy
- name: Build
run: |
@ -39,16 +36,14 @@ jobs:
path: ./irrlicht-linux.tar.gz
linux-gles:
runs-on: ubuntu-latest
container:
image: ubuntu:bionic
env: { LANG: "C.UTF-8" }
# Xvfb test is broken on 20.04 for unknown reasons (not our bug)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install deps
run: |
apt-get update
apt-get install g++ cmake libxi-dev libgles2-mesa-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
sudo apt-get update
sudo apt-get install g++ cmake libxi-dev libgles2-mesa-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
- name: Build
run: |
@ -66,16 +61,13 @@ jobs:
LIBGL_ALWAYS_SOFTWARE=true xvfb-run ./AutomatedTest ogles2
linux-sdl:
runs-on: ubuntu-latest
container:
image: ubuntu:jammy
env: { LANG: "C.UTF-8" }
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Install deps
run: |
apt-get update
apt-get install g++ cmake libsdl2-dev libpng-dev libjpeg-dev zlib1g-dev -qyy
sudo apt-get update
sudo apt-get install g++ cmake libsdl2-dev libpng-dev libjpeg-dev zlib1g-dev -qyy
- name: Build
run: |
@ -88,16 +80,14 @@ jobs:
./AutomatedTest null
linux-sdl-gl3:
runs-on: ubuntu-latest
container:
image: ubuntu:jammy
env: { LANG: "C.UTF-8" }
# Xvfb test is broken on 20.04 for unknown reasons (not our bug)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install deps
run: |
apt-get update
apt-get install g++ cmake libsdl2-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
sudo apt-get update
sudo apt-get install g++ cmake libsdl2-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
- name: Build
run: |
@ -115,16 +105,13 @@ jobs:
LIBGL_ALWAYS_SOFTWARE=true xvfb-run ./AutomatedTest opengl3
linux-sdl-gles2:
runs-on: ubuntu-latest
container:
image: ubuntu:jammy
env: { LANG: "C.UTF-8" }
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Install deps
run: |
apt-get update
apt-get install g++ cmake libsdl2-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
sudo apt-get update
sudo apt-get install g++ cmake libsdl2-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
- name: Build
run: |
@ -190,6 +177,20 @@ jobs:
run: |
./bin/OSX/AutomatedTest null
macos-sdl:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Install deps
run: |
brew update
brew install cmake libpng jpeg sdl2
- name: Build
run: |
cmake . -DCMAKE_FIND_FRAMEWORK=LAST -DBUILD_EXAMPLES=1 -DUSE_SDL2=1
make -j3
msvc:
name: VS 2019 ${{ matrix.config.arch }} ${{ matrix.sdl.label }}
runs-on: windows-2019
@ -257,3 +258,46 @@ jobs:
with:
name: msvc-${{ matrix.config.arch }}
path: artifact/
android:
name: Android ${{ matrix.arch }}
runs-on: ubuntu-20.04
env:
ndk_version: "r25c"
ANDROID_NDK: ${{ github.workspace }}/android-ndk
strategy:
matrix:
arch: [armeabi-v7a, arm64-v8a, x86, x86_64]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install deps
run: |
sudo rm /var/lib/man-db/auto-update
sudo apt-get update
sudo apt-get install -qyy wget unzip zip gcc-multilib make cmake
- name: Cache NDK
id: cache-ndk
uses: actions/cache@v3
with:
key: android-ndk-${{ env.ndk_version }}-linux
path: ${{ env.ANDROID_NDK }}
- name: Install NDK
run: |
wget --progress=bar:force "http://dl.google.com/android/repository/android-ndk-${ndk_version}-linux.zip"
unzip -q "android-ndk-${ndk_version}-linux.zip"
rm "android-ndk-${ndk_version}-linux.zip"
mv "android-ndk-${ndk_version}" "${ANDROID_NDK}"
if: ${{ steps.cache-ndk.outputs.cache-hit != 'true' }}
- name: Build
run: ./scripts/ci-build-android.sh ${{ matrix.arch }}
#- name: Upload Artifact
# uses: actions/upload-artifact@v3
# with:
# name: irrlicht-android-${{ matrix.arch }}
# path: ${{ runner.temp }}/pkg/${{ matrix.arch }}

@ -1,13 +1,6 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.12)
# >=3.9 enables IPO; >=3.11 prefers GLVND
if(${CMAKE_VERSION} VERSION_LESS 3.11)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else()
cmake_policy(VERSION 3.11)
endif()
set(IRRLICHTMT_REVISION 13)
set(IRRLICHTMT_REVISION 14)
project(Irrlicht
VERSION 1.9.0.${IRRLICHTMT_REVISION}

@ -121,21 +121,6 @@ namespace video
//! Support for texture coord transformation via texture matrix
EVDF_TEXTURE_MATRIX,
//! Support for DXTn compressed textures.
EVDF_TEXTURE_COMPRESSED_DXT,
//! Support for PVRTC compressed textures.
EVDF_TEXTURE_COMPRESSED_PVRTC,
//! Support for PVRTC2 compressed textures.
EVDF_TEXTURE_COMPRESSED_PVRTC2,
//! Support for ETC1 compressed textures.
EVDF_TEXTURE_COMPRESSED_ETC1,
//! Support for ETC2 compressed textures.
EVDF_TEXTURE_COMPRESSED_ETC2,
//! Support for cube map textures.
EVDF_TEXTURE_CUBEMAP,

@ -362,28 +362,6 @@ public:
return 24;
case ECF_A8R8G8B8:
return 32;
case ECF_DXT1:
return 16;
case ECF_DXT2:
case ECF_DXT3:
case ECF_DXT4:
case ECF_DXT5:
return 32;
case ECF_PVRTC_RGB2:
return 12;
case ECF_PVRTC_ARGB2:
case ECF_PVRTC2_ARGB2:
return 16;
case ECF_PVRTC_RGB4:
return 24;
case ECF_PVRTC_ARGB4:
case ECF_PVRTC2_ARGB4:
return 32;
case ECF_ETC1:
case ECF_ETC2_RGB:
return 24;
case ECF_ETC2_ARGB:
return 32;
case ECF_D16:
return 16;
case ECF_D32:
@ -418,74 +396,17 @@ public:
//! calculate image data size in bytes for selected format, width and height.
static u32 getDataSizeFromFormat(ECOLOR_FORMAT format, u32 width, u32 height)
{
u32 imageSize = 0;
switch (format)
{
case ECF_DXT1:
imageSize = ((width + 3) / 4) * ((height + 3) / 4) * 8;
break;
case ECF_DXT2:
case ECF_DXT3:
case ECF_DXT4:
case ECF_DXT5:
imageSize = ((width + 3) / 4) * ((height + 3) / 4) * 16;
break;
case ECF_PVRTC_RGB2:
case ECF_PVRTC_ARGB2:
imageSize = (core::max_<u32>(width, 16) * core::max_<u32>(height, 8) * 2 + 7) / 8;
break;
case ECF_PVRTC_RGB4:
case ECF_PVRTC_ARGB4:
imageSize = (core::max_<u32>(width, 8) * core::max_<u32>(height, 8) * 4 + 7) / 8;
break;
case ECF_PVRTC2_ARGB2:
imageSize = core::ceil32(width / 8.0f) * core::ceil32(height / 4.0f) * 8;
break;
case ECF_PVRTC2_ARGB4:
case ECF_ETC1:
case ECF_ETC2_RGB:
imageSize = core::ceil32(width / 4.0f) * core::ceil32(height / 4.0f) * 8;
break;
case ECF_ETC2_ARGB:
imageSize = core::ceil32(width / 4.0f) * core::ceil32(height / 4.0f) * 16;
break;
default: // uncompressed formats
imageSize = getBitsPerPixelFromFormat(format) / 8 * width;
imageSize *= height;
break;
}
// non-compressed formats
u32 imageSize = getBitsPerPixelFromFormat(format) / 8 * width;
imageSize *= height;
return imageSize;
}
// Define to check for all compressed image formats cases in a switch
#define IRR_CASE_IIMAGE_COMPRESSED_FORMAT\
case ECF_DXT1:\
case ECF_DXT2:\
case ECF_DXT3:\
case ECF_DXT4:\
case ECF_DXT5:\
case ECF_PVRTC_RGB2:\
case ECF_PVRTC_ARGB2:\
case ECF_PVRTC2_ARGB2:\
case ECF_PVRTC_RGB4:\
case ECF_PVRTC_ARGB4:\
case ECF_PVRTC2_ARGB4:\
case ECF_ETC1:\
case ECF_ETC2_RGB:\
case ECF_ETC2_ARGB:
//! check if this is compressed color format
static bool isCompressedFormat(const ECOLOR_FORMAT format)
{
switch(format)
{
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
return true;
default:
return false;
}
return false;
}
//! check if the color format is only viable for depth/stencil textures
@ -523,22 +444,6 @@ public:
return false;
}
#if defined(PATCH_SUPERTUX_8_0_1_with_1_9_0)
static bool isRenderTargetOnlyFormat(const ECOLOR_FORMAT format)
{
switch (format)
{
case ECF_A1R5G5B5:
case ECF_R5G6B5:
case ECF_R8G8B8:
case ECF_A8R8G8B8:
return false;
default:
return true;
}
}
#endif
protected:
ECOLOR_FORMAT Format;
core::dimension2d<u32> Size;

@ -292,11 +292,6 @@ public:
{
case ECF_A8R8G8B8:
case ECF_A1R5G5B5:
case ECF_DXT1:
case ECF_DXT2:
case ECF_DXT3:
case ECF_DXT4:
case ECF_DXT5:
case ECF_A16B16G16R16F:
case ECF_A32B32G32R32F:
status = true;

@ -5,8 +5,8 @@
#pragma once
//! Identifies the IrrlichtMt fork customized for the Minetest engine
#define IRRLICHT_VERSION_MT_REVISION 13
#define IRRLICHT_VERSION_MT "mt13"
#define IRRLICHT_VERSION_MT_REVISION 14
#define IRRLICHT_VERSION_MT "mt14"
//! Irrlicht SDK Version
#define IRRLICHT_VERSION_MAJOR 1

@ -178,7 +178,10 @@ namespace irr
virtual bool isFullscreen() const = 0;
//! Checks if the window could possibly be visible.
//! Currently, this only returns false when the app is paused on Android.
//! Currently, this only returns false when the activity is stopped on
//! Android. Note that for Android activities, "stopped" means something
//! different than you might expect (and also something different than
//! "paused"). Read the Android lifecycle documentation.
virtual bool isWindowVisible() const { return true; };
//! Get the current color format of the window

@ -37,50 +37,6 @@ namespace video
//! Warning: This tends to be BGRA in memory (it's ARGB on file, but with usual big-endian memory it's flipped)
ECF_A8R8G8B8,
/** Compressed image formats. **/
//! DXT1 color format.
ECF_DXT1,
//! DXT2 color format.
ECF_DXT2,
//! DXT3 color format.
ECF_DXT3,
//! DXT4 color format.
ECF_DXT4,
//! DXT5 color format.
ECF_DXT5,
//! PVRTC RGB 2bpp.
ECF_PVRTC_RGB2,
//! PVRTC ARGB 2bpp.
ECF_PVRTC_ARGB2,
//! PVRTC RGB 4bpp.
ECF_PVRTC_RGB4,
//! PVRTC ARGB 4bpp.
ECF_PVRTC_ARGB4,
//! PVRTC2 ARGB 2bpp.
ECF_PVRTC2_ARGB2,
//! PVRTC2 ARGB 4bpp.
ECF_PVRTC2_ARGB4,
//! ETC1 RGB.
ECF_ETC1,
//! ETC2 RGB.
ECF_ETC2_RGB,
//! ETC2 ARGB.
ECF_ETC2_ARGB,
/** The following formats may only be used for render target textures. */
/** Floating point formats. */
@ -139,20 +95,6 @@ namespace video
"R5G6B5",
"R8G8B8",
"A8R8G8B8",
"DXT1",
"DXT2",
"DXT3",
"DXT4",
"DXT5",
"PVRTC_RGB2",
"PVRTC_ARGB2",
"PVRTC_RGB4",
"PVRTC_ARGB4",
"PVRTC2_ARGB2",
"PVRTC2_ARGB4",
"ETC1",
"ETC2_RGB",
"ETC2_ARGB",
"R16F",
"G16R16F",
"A16B16G16R16F",

@ -9,6 +9,7 @@
#include <float.h>
#include <stdlib.h> // for abs() etc.
#include <limits.h> // For INT_MAX / UINT_MAX
#include <type_traits>
namespace irr
{
@ -17,9 +18,6 @@ namespace core
//! Rounding error constant often used when comparing f32 values.
const s32 ROUNDING_ERROR_S32 = 0;
const s64 ROUNDING_ERROR_S64 = 0;
const f32 ROUNDING_ERROR_f32 = 0.000001f;
const f64 ROUNDING_ERROR_f64 = 0.00000001;
@ -170,30 +168,6 @@ namespace core
return ROUNDING_ERROR_f64;
}
template <>
inline s32 roundingError()
{
return ROUNDING_ERROR_S32;
}
template <>
inline u32 roundingError()
{
return ROUNDING_ERROR_S32;
}
template <>
inline s64 roundingError()
{
return ROUNDING_ERROR_S64;
}
template <>
inline u64 roundingError()
{
return ROUNDING_ERROR_S64;
}
template <class T>
inline T relativeErrorFactor()
{
@ -212,13 +186,19 @@ namespace core
return 8;
}
//! returns if a equals b, taking possible rounding errors into account
template <class T>
inline bool equals(const T a, const T b, const T tolerance = roundingError<T>())
//! returns if a equals b, for types without rounding errors
template <class T, std::enable_if_t<std::is_integral<T>::value, bool> = true>
inline bool equals(const T a, const T b)
{
return (a + tolerance >= b) && (a - tolerance <= b);
return a == b;
}
//! returns if a equals b, taking possible rounding errors into account
template <class T, std::enable_if_t<std::is_floating_point<T>::value, bool> = true>
inline bool equals(const T a, const T b, const T tolerance = roundingError<T>())
{
return abs(a - b) <= tolerance;
}
//! returns if a equals b, taking relative error in form of factor
//! this particular function does not involve any division.

@ -75,47 +75,47 @@ public:
return *(&X+index);
}
//! sort in order X, Y. Equality with rounding tolerance.
//! sort in order X, Y.
bool operator<=(const vector2d<T>&other) const
{
return (X<other.X || core::equals(X, other.X)) ||
(core::equals(X, other.X) && (Y<other.Y || core::equals(Y, other.Y)));
return !(*this > other);
}
//! sort in order X, Y. Equality with rounding tolerance.
//! sort in order X, Y.
bool operator>=(const vector2d<T>&other) const
{
return (X>other.X || core::equals(X, other.X)) ||
(core::equals(X, other.X) && (Y>other.Y || core::equals(Y, other.Y)));
return !(*this < other);
}
//! sort in order X, Y. Difference must be above rounding tolerance.
//! sort in order X, Y.
bool operator<(const vector2d<T>&other) const
{
return (X<other.X && !core::equals(X, other.X)) ||
(core::equals(X, other.X) && Y<other.Y && !core::equals(Y, other.Y));
return X < other.X || (X == other.X && Y < other.Y);
}
//! sort in order X, Y. Difference must be above rounding tolerance.
//! sort in order X, Y.
bool operator>(const vector2d<T>&other) const
{
return (X>other.X && !core::equals(X, other.X)) ||
(core::equals(X, other.X) && Y>other.Y && !core::equals(Y, other.Y));
return X > other.X || (X == other.X && Y > other.Y);
}
bool operator==(const vector2d<T>& other) const { return equals(other); }
bool operator!=(const vector2d<T>& other) const { return !equals(other); }
bool operator==(const vector2d<T>& other) const {
return X == other.X && Y == other.Y;
}
bool operator!=(const vector2d<T>& other) const {
return !(*this == other);
}
// functions
//! Checks if this vector equals the other one.
/** Takes floating point rounding errors into account.
\param other Vector to compare with.
\param tolerance Epsilon value for both - comparing X and Y.
\return True if the two vector are (almost) equal, else false. */
bool equals(const vector2d<T>& other, const T tolerance = (T)ROUNDING_ERROR_f32 ) const
bool equals(const vector2d<T>& other) const
{
return core::equals(X, other.X, tolerance) && core::equals(Y, other.Y, tolerance);
return core::equals(X, other.X) && core::equals(Y, other.Y);
}
vector2d<T>& set(T nx, T ny) {X=nx; Y=ny; return *this; }

@ -68,57 +68,51 @@ namespace core
return *(&X+index);
}
//! sort in order X, Y, Z. Equality with rounding tolerance.
//! sort in order X, Y, Z.
bool operator<=(const vector3d<T>&other) const
{
return (X<other.X || core::equals(X, other.X)) ||
(core::equals(X, other.X) && (Y<other.Y || core::equals(Y, other.Y))) ||
(core::equals(X, other.X) && core::equals(Y, other.Y) && (Z<other.Z || core::equals(Z, other.Z)));
return !(*this > other);
}
//! sort in order X, Y, Z. Equality with rounding tolerance.
//! sort in order X, Y, Z.
bool operator>=(const vector3d<T>&other) const
{
return (X>other.X || core::equals(X, other.X)) ||
(core::equals(X, other.X) && (Y>other.Y || core::equals(Y, other.Y))) ||
(core::equals(X, other.X) && core::equals(Y, other.Y) && (Z>other.Z || core::equals(Z, other.Z)));
return !(*this < other);
}
//! sort in order X, Y, Z. Difference must be above rounding tolerance.
//! sort in order X, Y, Z.
bool operator<(const vector3d<T>&other) const
{
return (X<other.X && !core::equals(X, other.X)) ||
(core::equals(X, other.X) && Y<other.Y && !core::equals(Y, other.Y)) ||
(core::equals(X, other.X) && core::equals(Y, other.Y) && Z<other.Z && !core::equals(Z, other.Z));
return X < other.X || (X == other.X && Y < other.Y) ||
(X == other.X && Y == other.Y && Z < other.Z);
}
//! sort in order X, Y, Z. Difference must be above rounding tolerance.
//! sort in order X, Y, Z.
bool operator>(const vector3d<T>&other) const
{
return (X>other.X && !core::equals(X, other.X)) ||
(core::equals(X, other.X) && Y>other.Y && !core::equals(Y, other.Y)) ||
(core::equals(X, other.X) && core::equals(Y, other.Y) && Z>other.Z && !core::equals(Z, other.Z));
return X > other.X || (X == other.X && Y > other.Y) ||
(X == other.X && Y == other.Y && Z > other.Z);
}
//! use weak float compare
bool operator==(const vector3d<T>& other) const
{
return this->equals(other);
return X == other.X && Y == other.Y && Z == other.Z;
}
bool operator!=(const vector3d<T>& other) const
{
return !this->equals(other);
return !(*this == other);
}
// functions
//! returns if this vector equals the other one, taking floating point rounding errors into account
bool equals(const vector3d<T>& other, const T tolerance = (T)ROUNDING_ERROR_f32 ) const
//! Checks if this vector equals the other one.
/** Takes floating point rounding errors into account.
\param other Vector to compare with.
\return True if the two vector are (almost) equal, else false. */
bool equals(const vector3d<T>& other) const
{
return core::equals(X, other.X, tolerance) &&
core::equals(Y, other.Y, tolerance) &&
core::equals(Z, other.Z, tolerance);
return core::equals(X, other.X) && core::equals(Y, other.Y) && core::equals(Z, other.Z);
}
vector3d<T>& set(const T nx, const T ny, const T nz) {X=nx; Y=ny; Z=nz; return *this;}

123
scripts/ci-build-android.sh Executable file

@ -0,0 +1,123 @@
#!/bin/bash -e
# NOTE: this code is mostly copied from minetest_android_deps
# <https://github.com/minetest/minetest_android_deps>
png_ver=1.6.40
jpeg_ver=3.0.1
download () {
get_tar_archive libpng "https://download.sourceforge.net/libpng/libpng-${png_ver}.tar.gz"
get_tar_archive libjpeg "https://download.sourceforge.net/libjpeg-turbo/libjpeg-turbo-${jpeg_ver}.tar.gz"
}
build () {
# Build libjpg and libpng first because Irrlicht needs them
mkdir -p libpng
pushd libpng
$srcdir/libpng/configure --host=$CROSS_PREFIX
make && make DESTDIR=$PWD install
popd
mkdir -p libjpeg
pushd libjpeg
cmake $srcdir/libjpeg "${CMAKE_FLAGS[@]}" -DENABLE_SHARED=OFF
make && make DESTDIR=$PWD install
popd
local libpng=$PWD/libpng/usr/local/lib/libpng.a
local libjpeg=$(echo $PWD/libjpeg/opt/libjpeg-turbo/lib*/libjpeg.a)
cmake $srcdir/irrlicht "${CMAKE_FLAGS[@]}" \
-DBUILD_SHARED_LIBS=OFF \
-DPNG_LIBRARY=$libpng \
-DPNG_PNG_INCLUDE_DIR=$(dirname "$libpng")/../include \
-DJPEG_LIBRARY=$libjpeg \
-DJPEG_INCLUDE_DIR=$(dirname "$libjpeg")/../include
make
cp -p lib/Android/libIrrlichtMt.a $libpng $libjpeg $pkgdir/
cp -a $srcdir/irrlicht/include $pkgdir/include
cp -a $srcdir/irrlicht/media/Shaders $pkgdir/Shaders
}
get_tar_archive () {
# $1: folder to extract to, $2: URL
local filename="${2##*/}"
[ -d "$1" ] && return 0
wget -c "$2" -O "$filename"
mkdir -p "$1"
tar -xaf "$filename" -C "$1" --strip-components=1
rm "$filename"
}
_setup_toolchain () {
local toolchain=$(echo "$ANDROID_NDK"/toolchains/llvm/prebuilt/*)
if [ ! -d "$toolchain" ]; then
echo "Android NDK path not specified or incorrect"; return 1
fi
export PATH="$toolchain/bin:$ANDROID_NDK:$PATH"
unset CFLAGS CPPFLAGS CXXFLAGS
TARGET_ABI="$1"
API=21
if [ "$TARGET_ABI" == armeabi-v7a ]; then
CROSS_PREFIX=armv7a-linux-androideabi
CFLAGS="-mthumb"
CXXFLAGS="-mthumb"
elif [ "$TARGET_ABI" == arm64-v8a ]; then
CROSS_PREFIX=aarch64-linux-android
elif [ "$TARGET_ABI" == x86 ]; then
CROSS_PREFIX=i686-linux-android
CFLAGS="-mssse3 -mfpmath=sse"
CXXFLAGS="-mssse3 -mfpmath=sse"
elif [ "$TARGET_ABI" == x86_64 ]; then
CROSS_PREFIX=x86_64-linux-android
else
echo "Invalid ABI given"; return 1
fi
export CC=$CROSS_PREFIX$API-clang
export CXX=$CROSS_PREFIX$API-clang++
export AR=llvm-ar
export RANLIB=llvm-ranlib
export CFLAGS="-fPIC ${CFLAGS}"
export CXXFLAGS="-fPIC ${CXXFLAGS}"
CMAKE_FLAGS=(
"-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake"
"-DANDROID_ABI=$TARGET_ABI" "-DANDROID_NATIVE_API_LEVEL=$API"
"-DCMAKE_BUILD_TYPE=Release"
)
# make sure pkg-config doesn't interfere
export PKG_CONFIG=/bin/false
export MAKEFLAGS="-j$(nproc)"
}
_run_build () {
local abi=$1
irrdir=$PWD
mkdir -p $RUNNER_TEMP/src
cd $RUNNER_TEMP/src
srcdir=$PWD
[ -d irrlicht ] || ln -s $irrdir irrlicht
download
builddir=$RUNNER_TEMP/build/irrlicht-$abi
pkgdir=$RUNNER_TEMP/pkg/$abi/Irrlicht
rm -rf "$pkgdir"
mkdir -p "$builddir" "$pkgdir"
cd "$builddir"
build
}
if [ $# -lt 1 ]; then
echo "Usage: ci-build-android.sh <ABI>"
exit 1
fi
_setup_toolchain $1
_run_build $1

@ -31,7 +31,8 @@ namespace irr
{
CIrrDeviceAndroid::CIrrDeviceAndroid(const SIrrlichtCreationParameters& param)
: CIrrDeviceStub(param), Accelerometer(0), Gyroscope(0), Focused(false), Initialized(false), Paused(true), JNIEnvAttachedToVM(0)
: CIrrDeviceStub(param), Accelerometer(0), Gyroscope(0), Initialized(false),
Stopped(true), Paused(true), Focused(false), JNIEnvAttachedToVM(0)
{
#ifdef _DEBUG
setDebugName("CIrrDeviceAndroid");
@ -64,7 +65,7 @@ CIrrDeviceAndroid::CIrrDeviceAndroid(const SIrrlichtCreationParameters& param)
s32 Events = 0;
android_poll_source* Source = 0;
while ((ALooper_pollAll(((Focused && !Paused) || !Initialized) ? 0 : -1, 0, &Events, (void**)&Source)) >= 0)
while ((ALooper_pollAll((!Initialized || isWindowActive()) ? 0 : -1, 0, &Events, (void**)&Source)) >= 0)
{
if(Source)
Source->process(Android, Source);
@ -180,7 +181,7 @@ void CIrrDeviceAndroid::setWindowCaption(const wchar_t* text)
bool CIrrDeviceAndroid::isWindowActive() const
{
return (Focused && !Paused);
return (Focused && !Paused && !Stopped);
}
bool CIrrDeviceAndroid::isWindowFocused() const
@ -195,7 +196,7 @@ bool CIrrDeviceAndroid::isWindowMinimized() const
bool CIrrDeviceAndroid::isWindowVisible() const
{
return !Paused;
return !Stopped;
}
void CIrrDeviceAndroid::closeDevice()
@ -265,6 +266,7 @@ void CIrrDeviceAndroid::handleAndroidCommand(android_app* app, int32_t cmd)
break;
case APP_CMD_START:
os::Printer::log("Android command APP_CMD_START", ELL_DEBUG);
device->Stopped = false;
break;
case APP_CMD_INIT_WINDOW:
os::Printer::log("Android command APP_CMD_INIT_WINDOW", ELL_DEBUG);
@ -322,6 +324,7 @@ void CIrrDeviceAndroid::handleAndroidCommand(android_app* app, int32_t cmd)
break;
case APP_CMD_STOP:
os::Printer::log("Android command APP_CMD_STOP", ELL_DEBUG);
device->Stopped = true;
break;
case APP_CMD_RESUME:
os::Printer::log("Android command APP_CMD_RESUME", ELL_DEBUG);

@ -86,9 +86,10 @@ namespace irr
const ASensor* Accelerometer;
const ASensor* Gyroscope;
bool Focused;
bool Initialized;
bool Stopped;
bool Paused;
bool Focused;
JNIEnv* JNIEnvAttachedToVM;

@ -51,6 +51,8 @@ CAnimatedMeshSceneNode::~CAnimatedMeshSceneNode()
{
if (LoopCallBack)
LoopCallBack->drop();
if (Mesh)
Mesh->drop();
}

@ -757,9 +757,6 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
case ECF_R8G8B8:
convert_A1R5G5B5toR8G8B8(sP, sN, dP);
break;
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break;
default:
break;
@ -780,9 +777,6 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
case ECF_R8G8B8:
convert_R5G6B5toR8G8B8(sP, sN, dP);
break;
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break;
default:
break;
@ -803,9 +797,6 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
case ECF_R8G8B8:
convert_A8R8G8B8toR8G8B8(sP, sN, dP);
break;
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break;
default:
break;
@ -826,17 +817,11 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
case ECF_R8G8B8:
convert_R8G8B8toR8G8B8(sP, sN, dP);
break;
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break;
default:
break;
}
break;
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break;
default:
break;

@ -75,10 +75,6 @@ void CImage::setPixel(u32 x, u32 y, const SColor &color, bool blend)
*dest = blend ? PixelBlend32 ( *dest, color.color ) : color.color;
} break;
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("IImage::setPixel method doesn't work with compressed images.", ELL_WARNING);
return;
case ECF_UNKNOWN:
os::Printer::log("IImage::setPixel unknown format.", ELL_WARNING);
return;
@ -109,10 +105,6 @@ SColor CImage::getPixel(u32 x, u32 y) const
return SColor(255,p[0],p[1],p[2]);
}
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("IImage::getPixel method doesn't work with compressed images.", ELL_WARNING);
break;
case ECF_UNKNOWN:
os::Printer::log("IImage::getPixel unknown format.", ELL_WARNING);
break;

@ -229,7 +229,7 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
Window((SDL_Window*)param.WindowId), SDL_Flags(0),
MouseX(0), MouseY(0), MouseXRel(0), MouseYRel(0), MouseButtonStates(0),
Width(param.WindowSize.Width), Height(param.WindowSize.Height),
Resizable(param.WindowResizable == 1 ? true : false)
Resizable(param.WindowResizable == 1 ? true : false), CurrentTouchCount(0)
{
#ifdef _DEBUG
setDebugName("CIrrDeviceSDL");
@ -254,14 +254,21 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
}
}
// Minetest has its own code to synthesize mouse events from touch events,
// so we prevent SDL from doing it.
SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
SDL_SetHint(SDL_HINT_MOUSE_TOUCH_EVENTS, "0");
// create keymap
createKeyMap();
// create window
if (CreationParams.DriverType != video::EDT_NULL)
{
// create the window, only if we do not use the null device
createWindow();
if (!createWindow()) {
Close = true;
return;
}
}
@ -745,6 +752,45 @@ bool CIrrDeviceSDL::run()
postEventFromUser(irrevent);
break;
case SDL_FINGERDOWN:
irrevent.EventType = EET_TOUCH_INPUT_EVENT;
irrevent.TouchInput.Event = ETIE_PRESSED_DOWN;
irrevent.TouchInput.ID = SDL_event.tfinger.fingerId;
irrevent.TouchInput.X = SDL_event.tfinger.x * Width;
irrevent.TouchInput.Y = SDL_event.tfinger.y * Height;
CurrentTouchCount++;
irrevent.TouchInput.touchedCount = CurrentTouchCount;
postEventFromUser(irrevent);
break;
case SDL_FINGERMOTION:
irrevent.EventType = EET_TOUCH_INPUT_EVENT;
irrevent.TouchInput.Event = ETIE_MOVED;
irrevent.TouchInput.ID = SDL_event.tfinger.fingerId;
irrevent.TouchInput.X = SDL_event.tfinger.x * Width;
irrevent.TouchInput.Y = SDL_event.tfinger.y * Height;
irrevent.TouchInput.touchedCount = CurrentTouchCount;
postEventFromUser(irrevent);
break;
case SDL_FINGERUP:
irrevent.EventType = EET_TOUCH_INPUT_EVENT;
irrevent.TouchInput.Event = ETIE_LEFT_UP;
irrevent.TouchInput.ID = SDL_event.tfinger.fingerId;
irrevent.TouchInput.X = SDL_event.tfinger.x * Width;
irrevent.TouchInput.Y = SDL_event.tfinger.y * Height;
// To match Android behavior, still count the pointer that was
// just released.
irrevent.TouchInput.touchedCount = CurrentTouchCount;
if (CurrentTouchCount > 0) {
CurrentTouchCount--;
}
postEventFromUser(irrevent);
break;
default:
break;
} // end switch

@ -17,6 +17,10 @@
#endif
#include <SDL.h>
// DirectFB is removed in SDL3, thou distribution as Alpine currently ships SDL2
// with enabled DirectFB, but requiring another fix at a top of SDL2.
// We don't need DirectFB in Irrlicht/Minetest, so simply disable it here to prevent issues.
#undef SDL_VIDEO_DRIVER_DIRECTFB
#include <SDL_syswm.h>
#include <memory>
@ -318,6 +322,8 @@ namespace irr
core::array<SKeyMap> KeyMap;
SDL_SysWMinfo Info;
s32 CurrentTouchCount;
};
} // end namespace irr

@ -184,6 +184,7 @@ endif()
if(ENABLE_OPENGL)
add_definitions(-D_IRR_COMPILE_WITH_OPENGL_)
set(OPENGL_DIRECT_LINK TRUE) # not yet possible to remove this
if(DEVICE STREQUAL "WINDOWS")
add_definitions(-D_IRR_COMPILE_WITH_WGL_MANAGER_ -D_IRR_OPENGL_USE_EXTPOINTER_)
elseif(DEVICE STREQUAL "X11")
@ -199,6 +200,7 @@ if(ENABLE_OPENGL3)
if (NOT USE_SDL2)
message(FATAL_ERROR "OpenGL 3 driver requires SDL2")
endif()
set(OPENGL_DIRECT_LINK TRUE) # TODO
set(USE_SDLGL ON)
set(USE_SDLGL3 ON)
endif()
@ -208,6 +210,7 @@ if(ENABLE_GLES1)
message(FATAL_ERROR "OpenGL ES 1 is not supported with SDL2")
endif()
add_definitions(-D_IRR_COMPILE_WITH_OGLES1_)
set(OPENGLES_DIRECT_LINK TRUE)
if(DEVICE MATCHES "^(WINDOWS|X11|ANDROID)$")
add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_ -D_IRR_OGLES1_USE_EXTPOINTER_)
endif()
@ -215,9 +218,11 @@ endif()
if(ENABLE_GLES2)
add_definitions(-D_IRR_COMPILE_WITH_OGLES2_)
set(OPENGLES2_DIRECT_LINK TRUE) # not yet possible to remove this
if(DEVICE MATCHES "^(WINDOWS|X11|ANDROID)$" OR EMSCRIPTEN)
add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_ -D_IRR_OGLES2_USE_EXTPOINTER_)
elseif(DEVICE STREQUAL "SDL")
add_definitions(-D_IRR_OGLES2_USE_EXTPOINTER_)
set(USE_SDLGL ON)
set(USE_SDLGLES2 ON)
endif()
@ -309,26 +314,6 @@ set(link_includes
"$<$<BOOL:${USE_X11}>:${X11_INCLUDE_DIR}>"
)
set(link_libs
"${ZLIB_LIBRARY}"
"${JPEG_LIBRARY}"
"${PNG_LIBRARY}"
"$<$<BOOL:${USE_SDL2}>:${SDL2_LIBRARIES}>"
${OPENGL_LIBRARIES}
${OPENGLES_LIBRARY}
${OPENGLES2_LIBRARIES}
${EGL_LIBRARY}
"$<$<PLATFORM_ID:Android>:-landroid -llog>"
${COCOA_LIB}
${IOKIT_LIB}
"$<$<PLATFORM_ID:Windows>:gdi32>"
"$<$<PLATFORM_ID:Windows>:winmm>"
"$<$<BOOL:${USE_X11}>:${X11_X11_LIB}>"
"$<$<BOOL:${USE_X11}>:${X11_Xi_LIB}>"
)
# Source files
set(IRRMESHLOADER
@ -528,7 +513,27 @@ target_include_directories(IrrlichtMt
${link_includes}
)
target_link_libraries(IrrlichtMt PRIVATE ${link_libs})
# this needs to be here and not in a variable (like link_includes) due to issues
# with the generator expressions on at least CMake 3.22, but not 3.28 or later
target_link_libraries(IrrlichtMt PRIVATE
${ZLIB_LIBRARY}
${JPEG_LIBRARY}
${PNG_LIBRARY}
"$<$<BOOL:${USE_SDL2}>:${SDL2_LIBRARIES}>"
"$<$<BOOL:${OPENGL_DIRECT_LINK}>:${OPENGL_LIBRARIES}>"
"$<$<BOOL:${OPENGLES_DIRECT_LINK}>:${OPENGLES_LIBRARY}>"
"$<$<BOOL:${OPENGLES2_DIRECT_LINK}>:${OPENGLES2_LIBRARIES}>"
${EGL_LIBRARY}
"$<$<PLATFORM_ID:Android>:-landroid -llog>"
${COCOA_LIB}
${IOKIT_LIB}
"$<$<PLATFORM_ID:Windows>:gdi32>"
"$<$<PLATFORM_ID:Windows>:winmm>"
"$<$<BOOL:${USE_X11}>:${X11_X11_LIB}>"
"$<$<BOOL:${USE_X11}>:${X11_Xi_LIB}>"
)
if(WIN32)
target_compile_definitions(IrrlichtMt INTERFACE _IRR_WINDOWS_API_) # used in _IRR_DEBUG_BREAK_IF definition in a public header

@ -1001,68 +1001,6 @@ bool CNullDriver::checkPrimitiveCount(u32 prmCount) const
bool CNullDriver::checkImage(IImage *image) const
{
ECOLOR_FORMAT format = image->getColorFormat();
core::dimension2d<u32> size = image->getDimension();
switch (format)
{
case ECF_DXT1:
case ECF_DXT2:
case ECF_DXT3:
case ECF_DXT4:
case ECF_DXT5:
if (!queryFeature(EVDF_TEXTURE_COMPRESSED_DXT))
{
os::Printer::log("DXT texture compression not available.", ELL_ERROR);
return false;
}
else if (size.getOptimalSize(true, false) != size)
{
os::Printer::log("Invalid size of image for DXT texture, size of image must be power of two.", ELL_ERROR);
return false;
}
break;
case ECF_PVRTC_RGB2:
case ECF_PVRTC_ARGB2:
case ECF_PVRTC_RGB4:
case ECF_PVRTC_ARGB4:
if (!queryFeature(EVDF_TEXTURE_COMPRESSED_PVRTC))
{
os::Printer::log("PVRTC texture compression not available.", ELL_ERROR);
return false;
}
else if (size.getOptimalSize(true, false) != size)
{
os::Printer::log("Invalid size of image for PVRTC compressed texture, size of image must be power of two and squared.", ELL_ERROR);
return false;
}
break;
case ECF_PVRTC2_ARGB2:
case ECF_PVRTC2_ARGB4:
if (!queryFeature(EVDF_TEXTURE_COMPRESSED_PVRTC2))
{
os::Printer::log("PVRTC2 texture compression not available.", ELL_ERROR);
return false;
}
break;
case ECF_ETC1:
if (!queryFeature(EVDF_TEXTURE_COMPRESSED_ETC1))
{
os::Printer::log("ETC1 texture compression not available.", ELL_ERROR);
return false;
}
break;
case ECF_ETC2_RGB:
case ECF_ETC2_ARGB:
if (!queryFeature(EVDF_TEXTURE_COMPRESSED_ETC2))
{
os::Printer::log("ETC2 texture compression not available.", ELL_ERROR);
return false;
}
break;
default:
break;
}
return true;
}

@ -2533,92 +2533,6 @@ COGLES2Driver::~COGLES2Driver()
}
pixelType = GL_UNSIGNED_BYTE;
break;
#ifdef GL_EXT_texture_compression_s3tc
case ECF_DXT1:
supported = true;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
break;
#endif
#ifdef GL_EXT_texture_compression_s3tc
case ECF_DXT2:
case ECF_DXT3:
supported = true;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
break;
#endif
#ifdef GL_EXT_texture_compression_s3tc
case ECF_DXT4:
case ECF_DXT5:
supported = true;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
break;
#endif
#ifdef GL_IMG_texture_compression_pvrtc
case ECF_PVRTC_RGB2:
supported = true;
pixelFormat = GL_RGB;
pixelType = GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
break;
#endif
#ifdef GL_IMG_texture_compression_pvrtc
case ECF_PVRTC_ARGB2:
supported = true;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
break;
#endif
#ifdef GL_IMG_texture_compression_pvrtc
case ECF_PVRTC_RGB4:
supported = true;
pixelFormat = GL_RGB;
pixelType = GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
break;
#endif
#ifdef GL_IMG_texture_compression_pvrtc
case ECF_PVRTC_ARGB4:
supported = true;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
break;
#endif
#ifdef GL_IMG_texture_compression_pvrtc2
case ECF_PVRTC2_ARGB2:
supported = true;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG;
break;
#endif
#ifdef GL_IMG_texture_compression_pvrtc2
case ECF_PVRTC2_ARGB4:
supported = true;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG;
break;
#endif
#ifdef GL_OES_compressed_ETC1_RGB8_texture
case ECF_ETC1:
supported = true;
pixelFormat = GL_RGB;
pixelType = GL_ETC1_RGB8_OES;
break;
#endif
#ifdef GL_ES_VERSION_3_0 // TO-DO - fix when extension name will be available
case ECF_ETC2_RGB:
supported = true;
pixelFormat = GL_RGB;
pixelType = GL_COMPRESSED_RGB8_ETC2;
break;
#endif
#ifdef GL_ES_VERSION_3_0 // TO-DO - fix when extension name will be available
case ECF_ETC2_ARGB:
supported = true;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA8_ETC2_EAC;
break;
#endif
case ECF_D16:
supported = true;
pixelFormat = GL_DEPTH_COMPONENT;

@ -64,16 +64,6 @@ namespace video
case EVDF_MRT_BLEND_FUNC:
case EVDF_OCCLUSION_QUERY:
return false;
case EVDF_TEXTURE_COMPRESSED_DXT:
return false; // NV Tegra need improvements here
case EVDF_TEXTURE_COMPRESSED_PVRTC:
return FeatureAvailable[IRR_GL_IMG_texture_compression_pvrtc];
case EVDF_TEXTURE_COMPRESSED_PVRTC2:
return FeatureAvailable[IRR_GL_IMG_texture_compression_pvrtc2];
case EVDF_TEXTURE_COMPRESSED_ETC1:
return FeatureAvailable[IRR_GL_OES_compressed_ETC1_RGB8_texture];
case EVDF_TEXTURE_COMPRESSED_ETC2:
return false;
case EVDF_STENCIL_BUFFER:
return StencilBuffer;
default:

@ -2888,104 +2888,6 @@ bool COGLES1Driver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
}
pixelType = GL_UNSIGNED_BYTE;
break;
#ifdef GL_EXT_texture_compression_s3tc
case ECF_DXT1:
supported = true;
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
break;
#endif
#ifdef GL_EXT_texture_compression_s3tc
case ECF_DXT2:
case ECF_DXT3:
supported = true;
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
break;
#endif
#ifdef GL_EXT_texture_compression_s3tc
case ECF_DXT4:
case ECF_DXT5:
supported = true;
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
break;
#endif
#ifdef GL_IMG_texture_compression_pvrtc
case ECF_PVRTC_RGB2:
supported = true;
internalFormat = GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
pixelFormat = GL_RGB;
pixelType = GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
break;
#endif
#ifdef GL_IMG_texture_compression_pvrtc
case ECF_PVRTC_ARGB2:
supported = true;
internalFormat = GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
break;
#endif
#ifdef GL_IMG_texture_compression_pvrtc
case ECF_PVRTC_RGB4:
supported = true;
internalFormat = GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
pixelFormat = GL_RGB;
pixelType = GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
break;
#endif
#ifdef GL_IMG_texture_compression_pvrtc
case ECF_PVRTC_ARGB4:
supported = true;
internalFormat = GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
break;
#endif
#ifdef GL_IMG_texture_compression_pvrtc2
case ECF_PVRTC2_ARGB2:
supported = true;
internalFormat = GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG;
break;
#endif
#ifdef GL_IMG_texture_compression_pvrtc2
case ECF_PVRTC2_ARGB4:
supported = true;
internalFormat = GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG;
break;
#endif
#ifdef GL_OES_compressed_ETC1_RGB8_texture
case ECF_ETC1:
supported = true;
internalFormat = GL_ETC1_RGB8_OES;
pixelFormat = GL_RGB;
pixelType = GL_ETC1_RGB8_OES;
break;
#endif
#ifdef GL_ES_VERSION_3_0 // TO-DO - fix when extension name will be available
case ECF_ETC2_RGB:
supported = true;
internalFormat = GL_COMPRESSED_RGB8_ETC2;
pixelFormat = GL_RGB;
pixelType = GL_COMPRESSED_RGB8_ETC2;
break;
#endif
#ifdef GL_ES_VERSION_3_0 // TO-DO - fix when extension name will be available
case ECF_ETC2_ARGB:
supported = true;
internalFormat = GL_COMPRESSED_RGBA8_ETC2_EAC;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA8_ETC2_EAC;
break;
#endif
case ECF_D16:
supported = true;
internalFormat = GL_DEPTH_COMPONENT16;

@ -55,14 +55,6 @@ namespace video
return FeatureAvailable[IRR_GL_OES_framebuffer_object];
case EVDF_VERTEX_BUFFER_OBJECT:
return Version>100;
case EVDF_TEXTURE_COMPRESSED_DXT:
return false; // NV Tegra need improvements here
case EVDF_TEXTURE_COMPRESSED_PVRTC:
return FeatureAvailable[IRR_GL_IMG_texture_compression_pvrtc];
case EVDF_TEXTURE_COMPRESSED_ETC1:
return FeatureAvailable[IRR_GL_OES_compressed_ETC1_RGB8_texture];
case EVDF_TEXTURE_CUBEMAP:
return FeatureAvailable[IRR_GL_OES_texture_cube_map];
default:
return true;
};

@ -23,7 +23,7 @@
#endif
#include <OpenGL/gl.h>
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
#include <GL/glext.h>
#error glext.h missing on OSX
#endif
#elif defined(_IRR_COMPILE_WITH_SDL_DEVICE_) && !defined(_IRR_COMPILE_WITH_X11_DEVICE_)
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
@ -34,8 +34,11 @@
#include <SDL_video.h>
#include <SDL_opengl.h>
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
// The SDL2 header doesn't cut it for extensions
#ifdef __APPLE__
#include <SDL_opengl_glext.h>
#else
#include <GL/glext.h>
#endif
#endif
#else
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)

@ -48,7 +48,7 @@ bool COpenGLDriver::initDriver()
genericDriverInit();
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_) || defined(_IRR_COMPILE_WITH_X11_DEVICE_)
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_) || defined(_IRR_COMPILE_WITH_X11_DEVICE_)
extGlSwapInterval(Params.Vsync ? 1 : 0);
#endif
@ -3962,29 +3962,6 @@ bool COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
if (Version > 101)
pixelType = GL_UNSIGNED_INT_8_8_8_8_REV;
break;
case ECF_DXT1:
if (queryOpenGLFeature(COpenGLExtensionHandler::IRR_EXT_texture_compression_s3tc))
{
supported = true;
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
pixelFormat = GL_BGRA_EXT;
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
}
break;
case ECF_DXT2:
case ECF_DXT3:
supported = true;
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
pixelFormat = GL_BGRA_EXT;
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
break;
case ECF_DXT4:
case ECF_DXT5:
supported = true;
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
pixelFormat = GL_BGRA_EXT;
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
break;
case ECF_D16:
supported = true;
internalFormat = GL_DEPTH_COMPONENT16;

@ -127,220 +127,6 @@ void COpenGLExtensionHandler::dump(ELOG_LEVEL logLevel) const
}
void COpenGLExtensionHandler::dumpFramebufferFormats() const
{
#ifdef _IRR_WINDOWS_API_
HDC hdc=wglGetCurrentDC();
core::stringc wglExtensions;
#ifdef WGL_ARB_extensions_string
PFNWGLGETEXTENSIONSSTRINGARBPROC irrGetExtensionsString = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
if (irrGetExtensionsString)
wglExtensions = irrGetExtensionsString(hdc);
#elif defined(WGL_EXT_extensions_string)
PFNWGLGETEXTENSIONSSTRINGEXTPROC irrGetExtensionsString = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)wglGetProcAddress("wglGetExtensionsStringEXT");
if (irrGetExtensionsString)
wglExtensions = irrGetExtensionsString(hdc);
#endif
const bool pixel_format_supported = (wglExtensions.find("WGL_ARB_pixel_format") != -1);
const bool multi_sample_supported = ((wglExtensions.find("WGL_ARB_multisample") != -1) ||
(wglExtensions.find("WGL_EXT_multisample") != -1) || (wglExtensions.find("WGL_3DFX_multisample") != -1) );
#ifdef _DEBUG
os::Printer::log("WGL_extensions", wglExtensions);
#endif
#ifdef WGL_ARB_pixel_format
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormat_ARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
if (pixel_format_supported && wglChoosePixelFormat_ARB)
{
// This value determines the number of samples used for antialiasing
// My experience is that 8 does not show a big
// improvement over 4, but 4 shows a big improvement
// over 2.
PFNWGLGETPIXELFORMATATTRIBIVARBPROC wglGetPixelFormatAttribiv_ARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)wglGetProcAddress("wglGetPixelFormatAttribivARB");
if (wglGetPixelFormatAttribiv_ARB)
{
int vals[128];
int atts[] = {
WGL_NUMBER_PIXEL_FORMATS_ARB,
WGL_DRAW_TO_BITMAP_ARB,
WGL_ACCELERATION_ARB,
WGL_NEED_PALETTE_ARB,
WGL_NEED_SYSTEM_PALETTE_ARB,
WGL_SWAP_LAYER_BUFFERS_ARB,
WGL_SWAP_METHOD_ARB,
WGL_NUMBER_OVERLAYS_ARB,
WGL_NUMBER_UNDERLAYS_ARB,
WGL_TRANSPARENT_ARB,
WGL_TRANSPARENT_RED_VALUE_ARB,
WGL_TRANSPARENT_GREEN_VALUE_ARB,
WGL_TRANSPARENT_BLUE_VALUE_ARB,
WGL_TRANSPARENT_ALPHA_VALUE_ARB,
WGL_TRANSPARENT_INDEX_VALUE_ARB,
WGL_SHARE_DEPTH_ARB,
WGL_SHARE_STENCIL_ARB,
WGL_SHARE_ACCUM_ARB,
WGL_SUPPORT_GDI_ARB,
WGL_SUPPORT_OPENGL_ARB,
WGL_DOUBLE_BUFFER_ARB,
WGL_STEREO_ARB,
WGL_PIXEL_TYPE_ARB,
WGL_COLOR_BITS_ARB,
WGL_RED_BITS_ARB,
WGL_RED_SHIFT_ARB,
WGL_GREEN_BITS_ARB,
WGL_GREEN_SHIFT_ARB,
WGL_BLUE_BITS_ARB,
WGL_BLUE_SHIFT_ARB,
WGL_ALPHA_BITS_ARB,
WGL_ALPHA_SHIFT_ARB,
WGL_ACCUM_BITS_ARB,
WGL_ACCUM_RED_BITS_ARB,
WGL_ACCUM_GREEN_BITS_ARB,
WGL_ACCUM_BLUE_BITS_ARB,
WGL_ACCUM_ALPHA_BITS_ARB,
WGL_DEPTH_BITS_ARB,
WGL_STENCIL_BITS_ARB,
WGL_AUX_BUFFERS_ARB
#ifdef WGL_ARB_render_texture
,WGL_BIND_TO_TEXTURE_RGB_ARB //40
,WGL_BIND_TO_TEXTURE_RGBA_ARB
#endif
#ifdef WGL_ARB_pbuffer
,WGL_DRAW_TO_PBUFFER_ARB //42
,WGL_MAX_PBUFFER_PIXELS_ARB
,WGL_MAX_PBUFFER_WIDTH_ARB
,WGL_MAX_PBUFFER_HEIGHT_ARB
#endif
#ifdef WGL_ARB_framebuffer_sRGB
,WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB //46
#endif
#ifdef WGL_ARB_multisample
,WGL_SAMPLES_ARB //47
,WGL_SAMPLE_BUFFERS_ARB
#endif
#ifdef WGL_EXT_depth_float
,WGL_DEPTH_FLOAT_EXT //49
#endif
,0,0,0,0
};
size_t nums = sizeof(atts)/sizeof(int);
const bool depth_float_supported= (wglExtensions.find("WGL_EXT_depth_float") != -1);
if (!depth_float_supported)
{
memmove(&atts[49], &atts[50], (nums-50)*sizeof(int));
nums -= 1;
}
if (!multi_sample_supported)
{
memmove(&atts[47], &atts[49], (nums-49)*sizeof(int));
nums -= 2;
}
const bool framebuffer_sRGB_supported= (wglExtensions.find("WGL_ARB_framebuffer_sRGB") != -1);
if (!framebuffer_sRGB_supported)
{
memmove(&atts[46], &atts[47], (nums-47)*sizeof(int));
nums -= 1;
}
const bool pbuffer_supported = (wglExtensions.find("WGL_ARB_pbuffer") != -1);
if (!pbuffer_supported)
{
memmove(&atts[42], &atts[46], (nums-46)*sizeof(int));
nums -= 4;
}
const bool render_texture_supported = (wglExtensions.find("WGL_ARB_render_texture") != -1);
if (!render_texture_supported)
{
memmove(&atts[40], &atts[42], (nums-42)*sizeof(int));
nums -= 2;
}
wglGetPixelFormatAttribiv_ARB(hdc,0,0,1,atts,vals);
const int count = vals[0];
atts[0]=WGL_DRAW_TO_WINDOW_ARB;
for (int i=1; i<count; ++i)
{
memset(vals,0,sizeof(vals));
#define tmplog(x,y) os::Printer::log(x, core::stringc(y).c_str())
const BOOL res = wglGetPixelFormatAttribiv_ARB(hdc,i,0,(UINT)nums,atts,vals);
if (FALSE==res)
continue;
tmplog("Pixel format ",i);
u32 j=0;
tmplog("Draw to window " , vals[j]);
tmplog("Draw to bitmap " , vals[++j]);
++j;
tmplog("Acceleration " , (vals[j]==WGL_NO_ACCELERATION_ARB?"No":
vals[j]==WGL_GENERIC_ACCELERATION_ARB?"Generic":vals[j]==WGL_FULL_ACCELERATION_ARB?"Full":"ERROR"));
tmplog("Need palette " , vals[++j]);
tmplog("Need system palette " , vals[++j]);
tmplog("Swap layer buffers " , vals[++j]);
++j;
tmplog("Swap method " , (vals[j]==WGL_SWAP_EXCHANGE_ARB?"Exchange":
vals[j]==WGL_SWAP_COPY_ARB?"Copy":vals[j]==WGL_SWAP_UNDEFINED_ARB?"Undefined":"ERROR"));
tmplog("Number of overlays " , vals[++j]);
tmplog("Number of underlays " , vals[++j]);
tmplog("Transparent " , vals[++j]);
tmplog("Transparent red value " , vals[++j]);
tmplog("Transparent green value " , vals[++j]);
tmplog("Transparent blue value " , vals[++j]);
tmplog("Transparent alpha value " , vals[++j]);
tmplog("Transparent index value " , vals[++j]);
tmplog("Share depth " , vals[++j]);
tmplog("Share stencil " , vals[++j]);
tmplog("Share accum " , vals[++j]);
tmplog("Support GDI " , vals[++j]);
tmplog("Support OpenGL " , vals[++j]);
tmplog("Double Buffer " , vals[++j]);
tmplog("Stereo Buffer " , vals[++j]);
tmplog("Pixel type " , vals[++j]);
tmplog("Color bits" , vals[++j]);
tmplog("Red bits " , vals[++j]);
tmplog("Red shift " , vals[++j]);
tmplog("Green bits " , vals[++j]);
tmplog("Green shift " , vals[++j]);
tmplog("Blue bits " , vals[++j]);
tmplog("Blue shift " , vals[++j]);
tmplog("Alpha bits " , vals[++j]);
tmplog("Alpha Shift " , vals[++j]);
tmplog("Accum bits " , vals[++j]);
tmplog("Accum red bits " , vals[++j]);
tmplog("Accum green bits " , vals[++j]);
tmplog("Accum blue bits " , vals[++j]);
tmplog("Accum alpha bits " , vals[++j]);
tmplog("Depth bits " , vals[++j]);
tmplog("Stencil bits " , vals[++j]);
tmplog("Aux buffers " , vals[++j]);
if (render_texture_supported)
{
tmplog("Bind to texture RGB" , vals[++j]);
tmplog("Bind to texture RGBA" , vals[++j]);
}
if (pbuffer_supported)
{
tmplog("Draw to pbuffer" , vals[++j]);
tmplog("Max pbuffer pixels " , vals[++j]);
tmplog("Max pbuffer width" , vals[++j]);
tmplog("Max pbuffer height" , vals[++j]);
}
if (framebuffer_sRGB_supported)
tmplog("Framebuffer sRBG capable" , vals[++j]);
if (multi_sample_supported)
{
tmplog("Samples " , vals[++j]);
tmplog("Sample buffers " , vals[++j]);
}
if (depth_float_supported)
tmplog("Depth float" , vals[++j]);
#undef tmplog
}
}
}
#endif
#elif defined(IRR_LINUX_DEVICE)
#endif
}
void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
{
const f32 ogl_ver = core::fast_atof(reinterpret_cast<const c8*>(glGetString(GL_VERSION)));
@ -882,8 +668,6 @@ bool COpenGLExtensionHandler::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const
return (Version>=104) || FeatureAvailable[IRR_EXT_blend_func_separate];
case EVDF_TEXTURE_MATRIX:
return true;
case EVDF_TEXTURE_COMPRESSED_DXT:
return FeatureAvailable[IRR_EXT_texture_compression_s3tc];
case EVDF_TEXTURE_CUBEMAP:
return (Version >= 103) || FeatureAvailable[IRR_ARB_texture_cube_map] || FeatureAvailable[IRR_EXT_texture_cube_map];
case EVDF_TEXTURE_CUBEMAP_SEAMLESS:

@ -1010,8 +1010,6 @@ class COpenGLExtensionHandler
//! show all features with availability
void dump(ELOG_LEVEL logLevel) const;
void dumpFramebufferFormats() const;
// Some variables for properties
bool StencilBuffer;
bool TextureCompressionExtension;

@ -782,122 +782,6 @@ bool CWebGL1Driver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
*converter = CColorConverter::convert_A8R8G8B8toA8B8G8R8;
pixelType = GL_UNSIGNED_BYTE;
break;
#ifdef GL_EXT_texture_compression_dxt1
case ECF_DXT1:
if ( WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_compressed_texture_s3tc) )
{
supported = true;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
}
break;
#endif
#ifdef GL_EXT_texture_compression_s3tc
case ECF_DXT2:
case ECF_DXT3:
if ( WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_compressed_texture_s3tc) )
{
supported = true;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
}
break;
#endif
#ifdef GL_EXT_texture_compression_s3tc
case ECF_DXT4:
case ECF_DXT5:
if ( WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_compressed_texture_s3tc) )
{
supported = true;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
}
break;
#endif
#ifdef GL_IMG_texture_compression_pvrtc
case ECF_PVRTC_RGB2:
if ( WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_compressed_texture_pvrtc) )
{
supported = true;
pixelFormat = GL_RGB;
pixelType = GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
}
break;
#endif
#ifdef GL_IMG_texture_compression_pvrtc
case ECF_PVRTC_ARGB2:
if ( WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_compressed_texture_pvrtc) )
{
supported = true;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
}
break;
#endif
#ifdef GL_IMG_texture_compression_pvrtc
case ECF_PVRTC_RGB4:
if ( WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_compressed_texture_pvrtc) )
{
supported = true;
pixelFormat = GL_RGB;
pixelType = GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
}
break;
#endif
#ifdef GL_IMG_texture_compression_pvrtc
case ECF_PVRTC_ARGB4:
if ( WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_compressed_texture_pvrtc) )
{
supported = true;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
}
break;
#endif
#ifdef GL_IMG_texture_compression_pvrtc2
case ECF_PVRTC2_ARGB2:
if ( WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_compressed_texture_pvrtc) )
{
supported = true;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG;
}
break;
#endif
#ifdef GL_IMG_texture_compression_pvrtc2
case ECF_PVRTC2_ARGB4:
if ( WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_compressed_texture_pvrtc) )
{
supported = true;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG;
}
break;
#endif
#ifdef GL_OES_compressed_ETC1_RGB8_texture
case ECF_ETC1:
if ( WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_compressed_texture_etc1) )
{
supported = true;
pixelFormat = GL_RGB;
pixelType = GL_ETC1_RGB8_OES;
}
break;
#endif
#ifdef GL_ES_VERSION_3_0 // TO-DO - fix when extension name will be available
case ECF_ETC2_RGB:
supported = true;
pixelFormat = GL_RGB;
pixelType = GL_COMPRESSED_RGB8_ETC2;
break;
#endif
#ifdef GL_ES_VERSION_3_0 // TO-DO - fix when extension name will be available
case ECF_ETC2_ARGB:
supported = true;
pixelFormat = GL_RGBA;
pixelType = GL_COMPRESSED_RGBA8_ETC2_EAC;
break;
#endif
case ECF_D16:
if (WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_depth_texture))
{