Skip to content

Commit

Permalink
Merge branch 'stenzek:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
yeager authored Jan 4, 2025
2 parents dce2d07 + a5d90c0 commit 61e179e
Show file tree
Hide file tree
Showing 49 changed files with 2,296 additions and 1,789 deletions.
4 changes: 2 additions & 2 deletions scripts/deps/build-dependencies-linux-cross.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ LIBJPEGTURBO=3.0.4
LIBPNG=1.6.44
LIBWEBP=1.4.0
LIBZIP=1.11.2
SDL2=2.30.9
SDL2=2.30.11
QT=6.8.1
ZSTD=1.5.6

Expand Down Expand Up @@ -118,7 +118,7 @@ fi

cat > SHASUMS <<EOF
baf8aebd22002b762d803ba0e1e389b6b4415159334e9d34bba1a938f6de8ce6 $LIBBACKTRACE.tar.gz
24b574f71c87a763f50704bbb630cbe38298d544a1f890f099a4696b1d6beba4 SDL2-$SDL2.tar.gz
8b8d4aef2038533da814965220f88f77d60dfa0f32685f80ead65e501337da7f SDL2-$SDL2.tar.gz
e1351218d270db49c3dddcba04fb2153b09731ea3fa6830e423f5952f44585be cpuinfo-$CPUINFO.tar.gz
3eea5ccce6670c126282f1ba4d32c19d486db49a1a5cbfb8d6f48774784d310c discord-rpc-$DISCORD_RPC.tar.gz
3998b024b0d442614a9ee270e76e018bb37a17b8c6941212171731123cbbcac7 lunasvg-$LUNASVG.tar.gz
Expand Down
4 changes: 2 additions & 2 deletions scripts/deps/build-dependencies-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ LIBJPEGTURBO=3.0.4
LIBPNG=1.6.44
LIBWEBP=1.4.0
LIBZIP=1.11.2
SDL2=2.30.9
SDL2=2.30.11
QT=6.8.1
ZSTD=1.5.6

Expand All @@ -99,7 +99,7 @@ fi

cat > SHASUMS <<EOF
baf8aebd22002b762d803ba0e1e389b6b4415159334e9d34bba1a938f6de8ce6 $LIBBACKTRACE.tar.gz
24b574f71c87a763f50704bbb630cbe38298d544a1f890f099a4696b1d6beba4 SDL2-$SDL2.tar.gz
8b8d4aef2038533da814965220f88f77d60dfa0f32685f80ead65e501337da7f SDL2-$SDL2.tar.gz
e1351218d270db49c3dddcba04fb2153b09731ea3fa6830e423f5952f44585be cpuinfo-$CPUINFO.tar.gz
3eea5ccce6670c126282f1ba4d32c19d486db49a1a5cbfb8d6f48774784d310c discord-rpc-$DISCORD_RPC.tar.gz
3998b024b0d442614a9ee270e76e018bb37a17b8c6941212171731123cbbcac7 lunasvg-$LUNASVG.tar.gz
Expand Down
4 changes: 2 additions & 2 deletions scripts/deps/build-dependencies-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fi

FREETYPE=2.13.3
HARFBUZZ=10.1.0
SDL2=2.30.9
SDL2=2.30.11
ZSTD=1.5.6
LIBPNG=1.6.44
LIBJPEGTURBO=3.0.4
Expand Down Expand Up @@ -86,7 +86,7 @@ c758fdce8587641b00403ee0df2cd5d30cbea7803d43c65fddd76224f7b49b88 harfbuzz-$HARF
99130559e7d62e8d695f2c0eaeef912c5828d5b84a0537dcb24c9678c9d5b76b libjpeg-turbo-$LIBJPEGTURBO.tar.gz
61f873ec69e3be1b99535634340d5bde750b2e4447caa1db9f61be3fd49ab1e5 libwebp-$LIBWEBP.tar.gz
5d471308cef4c4752bbcf973d9cd37ba4cb53739116c30349d4764ba1410dfc1 libzip-$LIBZIP.tar.xz
24b574f71c87a763f50704bbb630cbe38298d544a1f890f099a4696b1d6beba4 SDL2-$SDL2.tar.gz
8b8d4aef2038533da814965220f88f77d60dfa0f32685f80ead65e501337da7f SDL2-$SDL2.tar.gz
8c29e06cf42aacc1eafc4077ae2ec6c6fcb96a626157e0593d5e82a34fd403c1 zstd-$ZSTD.tar.gz
40973d44970dbc83ef302b0609f2e74982be2d85916dd2ee7472d30678a7abe6 ffmpeg-$FFMPEG.tar.xz
f415a09385030c6510a936155ce211f617c31506db5fbc563e804345f1ecf56e v$MOLTENVK.tar.gz
Expand Down
4 changes: 2 additions & 2 deletions scripts/deps/build-dependencies-windows-arm64.bat
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ set LIBJPEGTURBO=3.0.4
set LIBPNG=1644
set QT=6.8.1
set QTMINOR=6.8
set SDL2=2.30.9
set SDL2=2.30.11
set WEBP=1.4.0
set LIBZIP=1.11.2
set ZLIB=1.3.1
Expand All @@ -71,7 +71,7 @@ call :downloadfile "freetype-%FREETYPE%.tar.gz" "https://download.savannah.gnu.o
call :downloadfile "harfbuzz-%HARFBUZZ%.zip" "https://github.com/harfbuzz/harfbuzz/archive/refs/tags/%HARFBUZZ%.zip" f93ff7ec6f2fcb9242256976a7e6d1da2588b5e57a559fb71a025b74bd1f5539 || goto error
call :downloadfile "lpng%LIBPNG%.zip" "https://download.sourceforge.net/libpng/lpng%LIBPNG%.zip" 7d7571a1faa1898b69888716dfdea0e4d466f1a5cf518e6aa626df2242bbadbe || goto error
call :downloadfile "libjpeg-turbo-%LIBJPEGTURBO%.tar.gz" "https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/%LIBJPEGTURBO%/libjpeg-turbo-%LIBJPEGTURBO%.tar.gz" 99130559e7d62e8d695f2c0eaeef912c5828d5b84a0537dcb24c9678c9d5b76b || goto error
call :downloadfile "SDL2-%SDL2%.zip" "https://github.com/libsdl-org/SDL/releases/download/release-%SDL2%/SDL2-%SDL2%.zip" ec855bcd815b4b63d0c958c42c2923311c656227d6e0c1ae1e721406d346444b || goto error
call :downloadfile "SDL2-%SDL2%.zip" "https://github.com/libsdl-org/SDL/releases/download/release-%SDL2%/SDL2-%SDL2%.zip" a0b3e7ac5f708042683ff0f22e069bdf75563540c615f9854ecc9bc8913e2488 || goto error
call :downloadfile "qtbase-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtbase-everywhere-src-%QT%.zip" e22d997bd15b795a176c8da62c8c1da0a674eb534e02f7c01ca507bf11bce0c3 || goto error
call :downloadfile "qtimageformats-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtimageformats-everywhere-src-%QT%.zip" 247a0a58039275a5a4fb499a600a90f66dc6e00321bb6f86a9b8d8020344d853 || goto error
call :downloadfile "qtsvg-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtsvg-everywhere-src-%QT%.zip" 57bd332e5550ff70a852560c591b786b6ba587c5e41cb5ef91038d82db137ab9 || goto error
Expand Down
4 changes: 2 additions & 2 deletions scripts/deps/build-dependencies-windows-x64.bat
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ set LIBJPEGTURBO=3.0.4
set LIBPNG=1644
set QT=6.8.1
set QTMINOR=6.8
set SDL2=2.30.9
set SDL2=2.30.11
set WEBP=1.4.0
set LIBZIP=1.11.2
set ZLIB=1.3.1
Expand All @@ -69,7 +69,7 @@ call :downloadfile "freetype-%FREETYPE%.tar.gz" "https://download.savannah.gnu.o
call :downloadfile "harfbuzz-%HARFBUZZ%.zip" "https://github.com/harfbuzz/harfbuzz/archive/refs/tags/%HARFBUZZ%.zip" f93ff7ec6f2fcb9242256976a7e6d1da2588b5e57a559fb71a025b74bd1f5539 || goto error
call :downloadfile "lpng%LIBPNG%.zip" "https://download.sourceforge.net/libpng/lpng%LIBPNG%.zip" 7d7571a1faa1898b69888716dfdea0e4d466f1a5cf518e6aa626df2242bbadbe || goto error
call :downloadfile "libjpeg-turbo-%LIBJPEGTURBO%.tar.gz" "https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/%LIBJPEGTURBO%/libjpeg-turbo-%LIBJPEGTURBO%.tar.gz" 99130559e7d62e8d695f2c0eaeef912c5828d5b84a0537dcb24c9678c9d5b76b || goto error
call :downloadfile "SDL2-%SDL2%.zip" "https://github.com/libsdl-org/SDL/releases/download/release-%SDL2%/SDL2-%SDL2%.zip" ec855bcd815b4b63d0c958c42c2923311c656227d6e0c1ae1e721406d346444b || goto error
call :downloadfile "SDL2-%SDL2%.zip" "https://github.com/libsdl-org/SDL/releases/download/release-%SDL2%/SDL2-%SDL2%.zip" a0b3e7ac5f708042683ff0f22e069bdf75563540c615f9854ecc9bc8913e2488 || goto error
call :downloadfile "qtbase-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtbase-everywhere-src-%QT%.zip" e22d997bd15b795a176c8da62c8c1da0a674eb534e02f7c01ca507bf11bce0c3 || goto error
call :downloadfile "qtimageformats-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtimageformats-everywhere-src-%QT%.zip" 247a0a58039275a5a4fb499a600a90f66dc6e00321bb6f86a9b8d8020344d853 || goto error
call :downloadfile "qtsvg-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtsvg-everywhere-src-%QT%.zip" 57bd332e5550ff70a852560c591b786b6ba587c5e41cb5ef91038d82db137ab9 || goto error
Expand Down
2 changes: 2 additions & 0 deletions src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ add_library(common
thirdparty/SmallVector.h
thirdparty/aes.cpp
thirdparty/aes.h
task_queue.cpp
task_queue.h
threading.cpp
threading.h
timer.cpp
Expand Down
2 changes: 2 additions & 0 deletions src/common/common.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<ClInclude Include="thirdparty\SmallVector.h" />
<ClInclude Include="thirdparty\StackWalker.h" />
<ClInclude Include="threading.h" />
<ClInclude Include="task_queue.h" />
<ClInclude Include="timer.h" />
<ClInclude Include="types.h" />
<ClInclude Include="minizip_helpers.h" />
Expand Down Expand Up @@ -74,6 +75,7 @@
<ClCompile Include="thirdparty\SmallVector.cpp" />
<ClCompile Include="thirdparty\StackWalker.cpp" />
<ClCompile Include="threading.cpp" />
<ClCompile Include="task_queue.cpp" />
<ClCompile Include="timer.cpp" />
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/common/common.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<ClInclude Include="log_channels.h" />
<ClInclude Include="sha256_digest.h" />
<ClInclude Include="thirdparty\aes.h" />
<ClInclude Include="task_queue.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="small_string.cpp" />
Expand Down Expand Up @@ -82,6 +83,7 @@
<ClCompile Include="gsvector.cpp" />
<ClCompile Include="sha256_digest.cpp" />
<ClCompile Include="thirdparty\aes.cpp" />
<ClCompile Include="task_queue.cpp" />
</ItemGroup>
<ItemGroup>
<Natvis Include="bitfield.natvis" />
Expand Down
125 changes: 10 additions & 115 deletions src/common/gsvector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,53 +66,11 @@ void GSMatrix2x2::store(void* m)
std::memcpy(m, E, sizeof(E));
}

GSMatrix4x4::GSMatrix4x4(float e00, float e01, float e02, float e03, float e10, float e11, float e12, float e13,
float e20, float e21, float e22, float e23, float e30, float e31, float e32, float e33)
{
E[0][0] = e00;
E[0][1] = e01;
E[0][2] = e02;
E[0][3] = e03;
E[1][0] = e10;
E[1][1] = e11;
E[1][2] = e12;
E[1][3] = e13;
E[2][0] = e20;
E[2][1] = e21;
E[2][2] = e22;
E[2][3] = e23;
E[3][0] = e30;
E[3][1] = e31;
E[3][2] = e32;
E[3][3] = e33;
}

GSMatrix4x4::GSMatrix4x4(const GSMatrix2x2& m)
{
E[0][0] = m.E[0][0];
E[0][1] = m.E[0][1];
E[0][2] = 0.0f;
E[0][3] = 0.0f;
E[1][0] = m.E[1][0];
E[1][1] = m.E[1][1];
E[1][2] = 0.0f;
E[1][3] = 0.0f;
E[2][0] = 0.0f;
E[2][1] = 0.0f;
E[2][2] = 1.0f;
E[2][3] = 0.0f;
E[3][0] = 0.0f;
E[3][1] = 0.0f;
E[3][2] = 0.0f;
E[3][3] = 1.0f;
}

GSMatrix4x4 GSMatrix4x4::operator*(const GSMatrix4x4& m) const
ALWAYS_INLINE static void MatrixMult4x4(GSMatrix4x4& res, const GSMatrix4x4& lhs, const GSMatrix4x4& rhs)
{
// This isn't speedy by any means, but it's not hot code either.
GSMatrix4x4 res;

#define MultRC(rw, cl) E[rw][0] * m.E[0][cl] + E[rw][1] * m.E[1][cl] + E[rw][2] * m.E[2][cl] + E[rw][3] * m.E[3][cl]
#define MultRC(rw, cl) \
lhs.E[rw][0] * rhs.E[0][cl] + lhs.E[rw][1] * rhs.E[1][cl] + lhs.E[rw][2] * rhs.E[2][cl] + lhs.E[rw][3] * rhs.E[3][cl]

res.E[0][0] = MultRC(0, 0);
res.E[0][1] = MultRC(0, 1);
Expand All @@ -132,75 +90,22 @@ GSMatrix4x4 GSMatrix4x4::operator*(const GSMatrix4x4& m) const
res.E[3][3] = MultRC(3, 3);

#undef MultRC
}

GSMatrix4x4 GSMatrix4x4::operator*(const GSMatrix4x4& m) const
{
GSMatrix4x4 res;
MatrixMult4x4(res, *this, m);
return res;
}

GSMatrix4x4& GSMatrix4x4::operator*=(const GSMatrix4x4& m)
{
const GSMatrix4x4 copy(*this);

#define MultRC(rw, cl) \
copy.E[rw][0] * m.E[0][cl] + copy.E[rw][1] * m.E[1][cl] + copy.E[rw][2] * m.E[2][cl] + copy.E[rw][3] * m.E[3][cl]

E[0][0] = MultRC(0, 0);
E[0][1] = MultRC(0, 1);
E[0][2] = MultRC(0, 2);
E[0][3] = MultRC(0, 3);
E[1][0] = MultRC(1, 0);
E[1][1] = MultRC(1, 1);
E[1][2] = MultRC(1, 2);
E[1][3] = MultRC(1, 3);
E[2][0] = MultRC(2, 0);
E[2][1] = MultRC(2, 1);
E[2][2] = MultRC(2, 2);
E[2][3] = MultRC(2, 3);
E[3][0] = MultRC(3, 0);
E[3][1] = MultRC(3, 1);
E[3][2] = MultRC(3, 2);
E[3][3] = MultRC(3, 3);

#undef MultRC

MatrixMult4x4(*this, copy, m);
return *this;
}

GSVector4 GSMatrix4x4::operator*(const GSVector4& v) const
{
const GSVector4 r0 = row(0);
const GSVector4 r1 = row(1);
const GSVector4 r2 = row(2);
const GSVector4 r3 = row(3);

return GSVector4(r0.dot(v), r1.dot(v), r2.dot(v), r3.dot(v));
}

GSMatrix4x4 GSMatrix4x4::Identity()
{
GSMatrix4x4 res;

#define MultRC(rw, cl) E[rw][0] * m.E[0][cl] + E[rw][1] * m.E[1][cl] + E[rw][2] * m.E[2][cl] + E[rw][3] * m.E[3][cl]

res.E[0][0] = 1.0f;
res.E[0][1] = 0.0f;
res.E[0][2] = 0.0f;
res.E[0][3] = 0.0f;
res.E[1][0] = 0.0f;
res.E[1][1] = 1.0f;
res.E[1][2] = 0.0f;
res.E[1][3] = 0.0f;
res.E[2][0] = 0.0f;
res.E[2][1] = 0.0f;
res.E[2][2] = 1.0f;
res.E[2][3] = 0.0f;
res.E[3][0] = 0.0f;
res.E[3][1] = 0.0f;
res.E[3][2] = 0.0f;
res.E[3][3] = 1.0f;

return res;
}

GSMatrix4x4 GSMatrix4x4::RotationX(float angle_in_radians)
{
const float sin_angle = std::sin(angle_in_radians);
Expand Down Expand Up @@ -246,17 +151,7 @@ GSMatrix4x4 GSMatrix4x4::OffCenterOrthographicProjection(float width, float heig
return OffCenterOrthographicProjection(0.0f, 0.0f, width, height, zNear, zFar);
}

GSVector4 GSMatrix4x4::row(size_t i) const
{
return GSVector4::load<true>(&E[i][0]);
}

GSVector4 GSMatrix4x4::col(size_t i) const
{
return GSVector4(E[0][i], E[1][i], E[2][i], E[3][i]);
}

GSMatrix4x4 GSMatrix4x4::Invert() const
GSMatrix4x4 GSMatrix4x4::invert() const
{
GSMatrix4x4 ret;

Expand Down
70 changes: 61 additions & 9 deletions src/common/gsvector.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,60 @@ class GSMatrix2x2
class alignas(VECTOR_ALIGNMENT) GSMatrix4x4
{
public:
GSMatrix4x4() = default;
GSMatrix4x4(float e00, float e01, float e02, float e03, float e10, float e11, float e12, float e13, float e20,
float e21, float e22, float e23, float e30, float e31, float e32, float e33);
GSMatrix4x4(const GSMatrix2x2& m);
constexpr GSMatrix4x4() = default;
constexpr GSMatrix4x4(float e00, float e01, float e02, float e03, float e10, float e11, float e12, float e13,
float e20, float e21, float e22, float e23, float e30, float e31, float e32, float e33)
{
E[0][0] = e00;
E[0][1] = e01;
E[0][2] = e02;
E[0][3] = e03;
E[1][0] = e10;
E[1][1] = e11;
E[1][2] = e12;
E[1][3] = e13;
E[2][0] = e20;
E[2][1] = e21;
E[2][2] = e22;
E[2][3] = e23;
E[3][0] = e30;
E[3][1] = e31;
E[3][2] = e32;
E[3][3] = e33;
}

constexpr GSMatrix4x4(const GSMatrix2x2& m)
{
E[0][0] = m.E[0][0];
E[0][1] = m.E[0][1];
E[0][2] = 0.0f;
E[0][3] = 0.0f;
E[1][0] = m.E[1][0];
E[1][1] = m.E[1][1];
E[1][2] = 0.0f;
E[1][3] = 0.0f;
E[2][0] = 0.0f;
E[2][1] = 0.0f;
E[2][2] = 1.0f;
E[2][3] = 0.0f;
E[3][0] = 0.0f;
E[3][1] = 0.0f;
E[3][2] = 0.0f;
E[3][3] = 1.0f;
}

GSMatrix4x4 operator*(const GSMatrix4x4& m) const;
GSMatrix4x4& operator*=(const GSMatrix4x4& m);

GSVector4 operator*(const GSVector4& v) const;
GSVector4 operator*(const GSVector4& v) const
{
return GSVector4(row(0).dot(v), row(1).dot(v), row(2).dot(v), row(3).dot(v));
}

static GSMatrix4x4 Identity();
static constexpr GSMatrix4x4 Identity()
{
return GSMatrix4x4(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f);
}

static GSMatrix4x4 RotationX(float angle_in_radians);
static GSMatrix4x4 RotationY(float angle_in_radians);
Expand All @@ -62,10 +105,19 @@ class alignas(VECTOR_ALIGNMENT) GSMatrix4x4
float zFar);
static GSMatrix4x4 OffCenterOrthographicProjection(float width, float height, float zNear, float zFar);

GSVector4 row(size_t i) const;
GSVector4 col(size_t i) const;
GSVector4 row(size_t i) const { return GSVector4::load<true>(&E[i][0]); }
GSVector4 col(size_t i) const { return GSVector4(E[0][i], E[1][i], E[2][i], E[3][i]); }

GSMatrix4x4 Invert() const;
void set_row(size_t i, GSVector4 row) { GSVector4::store<true>(&E[i][0], row); }
void set_col(size_t i, GSVector4 col)
{
E[0][i] = col.x;
E[1][i] = col.y;
E[2][i] = col.z;
E[3][i] = col.w;
}

GSMatrix4x4 invert() const;

void store(void* m);

Expand Down
Loading

0 comments on commit 61e179e

Please sign in to comment.