mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-04 11:43:47 +01:00
19 files changed
+208
-252
No files matched your search
@@ -806,7 +806,6 @@ add_library(Common STATIC
|
||||
Common/Input/KeyCodes.h
|
||||
Common/Input/InputState.cpp
|
||||
Common/Input/InputState.h
|
||||
Common/Math/fast/fast_matrix.c
|
||||
Common/Math/SIMDHeaders.h
|
||||
Common/Math/SIMDHeaders.h
|
||||
Common/Math/curves.cpp
|
||||
|
||||
@@ -90,3 +90,12 @@
|
||||
|
||||
// Easy way to printf string_views (note: The formatting specifier is "%.*s", not "%s")
|
||||
#define STR_VIEW(sv) (int)(sv).size(), (sv).data()
|
||||
|
||||
// Restrict qualifier
|
||||
#if defined(_MSC_VER)
|
||||
#define RESTRICT __restrict
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
#define RESTRICT __restrict__
|
||||
#else
|
||||
#define RESTRICT
|
||||
#endif
|
||||
@@ -918,7 +918,6 @@
|
||||
<ClCompile Include="LoongArch64Emitter.cpp" />
|
||||
<ClCompile Include="Math\curves.cpp" />
|
||||
<ClCompile Include="Math\expression_parser.cpp" />
|
||||
<ClCompile Include="Math\fast\fast_matrix.c" />
|
||||
<ClCompile Include="Math\lin\matrix4x4.cpp" />
|
||||
<ClCompile Include="Math\lin\vec3.cpp" />
|
||||
<ClCompile Include="Math\math_util.cpp" />
|
||||
|
||||
@@ -861,9 +861,6 @@
|
||||
<ClCompile Include="Math\lin\vec3.cpp">
|
||||
<Filter>Math\lin</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Math\fast\fast_matrix.c">
|
||||
<Filter>Math\fast</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Data\Format\RIFF.cpp">
|
||||
<Filter>Data\Format</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -198,7 +198,7 @@ struct Vec4F32 {
|
||||
return Vec4F32 { _mm_mul_ps(_mm_cvtepi32_ps(value32), _mm_set1_ps(1.0f / 128.0f)) };
|
||||
}
|
||||
static Vec4F32 LoadS16Norm(const int16_t *src) { // Divides by 32768.0f
|
||||
__m128i bits = _mm_castpd_si128(_mm_load_sd((const double *)src));
|
||||
__m128i bits = _mm_loadl_epi64((const __m128i*)src);
|
||||
// Sign extension. A bit ugly without SSE4.
|
||||
bits = _mm_srai_epi32(_mm_unpacklo_epi16(bits, bits), 16);
|
||||
return Vec4F32 { _mm_mul_ps(_mm_cvtepi32_ps(bits), _mm_set1_ps(1.0f / 32768.0f)) };
|
||||
|
||||
@@ -1,159 +0,0 @@
|
||||
#include "ppsspp_config.h"
|
||||
|
||||
#include "Common/Math/SIMDHeaders.h"
|
||||
|
||||
#include "fast_matrix.h"
|
||||
|
||||
#if PPSSPP_ARCH(SSE2)
|
||||
|
||||
void fast_matrix_mul_4x4_sse(float *dest, const float *a, const float *b) {
|
||||
int i;
|
||||
__m128 a_col_1 = _mm_loadu_ps(a);
|
||||
__m128 a_col_2 = _mm_loadu_ps(&a[4]);
|
||||
__m128 a_col_3 = _mm_loadu_ps(&a[8]);
|
||||
__m128 a_col_4 = _mm_loadu_ps(&a[12]);
|
||||
|
||||
for (i = 0; i < 16; i += 4) {
|
||||
__m128 r_col = _mm_mul_ps(a_col_1, _mm_set1_ps(b[i]));
|
||||
r_col = _mm_add_ps(r_col, _mm_mul_ps(a_col_2, _mm_set1_ps(b[i + 1])));
|
||||
r_col = _mm_add_ps(r_col, _mm_mul_ps(a_col_3, _mm_set1_ps(b[i + 2])));
|
||||
r_col = _mm_add_ps(r_col, _mm_mul_ps(a_col_4, _mm_set1_ps(b[i + 3])));
|
||||
_mm_storeu_ps(&dest[i], r_col);
|
||||
}
|
||||
}
|
||||
|
||||
#elif PPSSPP_ARCH(LOONGARCH64_LSX)
|
||||
|
||||
typedef union
|
||||
{
|
||||
int32_t i;
|
||||
float f;
|
||||
} FloatInt;
|
||||
|
||||
static __m128 __lsx_vreplfr2vr_s(float val)
|
||||
{
|
||||
FloatInt tmpval = {.f = val};
|
||||
return (__m128)__lsx_vreplgr2vr_w(tmpval.i);
|
||||
}
|
||||
|
||||
void fast_matrix_mul_4x4_lsx(float *dest, const float *a, const float *b) {
|
||||
__m128 a_col_1 = (__m128)__lsx_vld(a, 0);
|
||||
__m128 a_col_2 = (__m128)__lsx_vld(a + 4, 0);
|
||||
__m128 a_col_3 = (__m128)__lsx_vld(a + 8, 0);
|
||||
__m128 a_col_4 = (__m128)__lsx_vld(a + 12, 0);
|
||||
|
||||
for (int i = 0; i < 16; i += 4) {
|
||||
|
||||
__m128 b1 = __lsx_vreplfr2vr_s(b[i]);
|
||||
__m128 b2 = __lsx_vreplfr2vr_s(b[i + 1]);
|
||||
__m128 b3 = __lsx_vreplfr2vr_s(b[i + 2]);
|
||||
__m128 b4 = __lsx_vreplfr2vr_s(b[i + 3]);
|
||||
|
||||
__m128 result = __lsx_vfmul_s(a_col_1, b1);
|
||||
result = __lsx_vfmadd_s(a_col_2, b2, result);
|
||||
result = __lsx_vfmadd_s(a_col_3, b3, result);
|
||||
result = __lsx_vfmadd_s(a_col_4, b4, result);
|
||||
|
||||
__lsx_vst(result, &dest[i], 0);
|
||||
}
|
||||
}
|
||||
|
||||
#elif PPSSPP_ARCH(ARM_NEON)
|
||||
|
||||
// From https://developer.arm.com/documentation/102467/0100/Matrix-multiplication-example
|
||||
void fast_matrix_mul_4x4_neon(float *C, const float *A, const float *B) {
|
||||
// these are the columns A
|
||||
float32x4_t A0;
|
||||
float32x4_t A1;
|
||||
float32x4_t A2;
|
||||
float32x4_t A3;
|
||||
|
||||
// these are the columns B
|
||||
float32x4_t B0;
|
||||
float32x4_t B1;
|
||||
float32x4_t B2;
|
||||
float32x4_t B3;
|
||||
|
||||
// these are the columns C
|
||||
float32x4_t C0;
|
||||
float32x4_t C1;
|
||||
float32x4_t C2;
|
||||
float32x4_t C3;
|
||||
|
||||
A0 = vld1q_f32(A);
|
||||
A1 = vld1q_f32(A + 4);
|
||||
A2 = vld1q_f32(A + 8);
|
||||
A3 = vld1q_f32(A + 12);
|
||||
|
||||
// Multiply accumulate in 4x1 blocks, i.e. each column in C
|
||||
B0 = vld1q_f32(B);
|
||||
C0 = vmulq_laneq_f32(A0, B0, 0);
|
||||
C0 = vfmaq_laneq_f32(C0, A1, B0, 1);
|
||||
C0 = vfmaq_laneq_f32(C0, A2, B0, 2);
|
||||
C0 = vfmaq_laneq_f32(C0, A3, B0, 3);
|
||||
vst1q_f32(C, C0);
|
||||
|
||||
B1 = vld1q_f32(B + 4);
|
||||
C1 = vmulq_laneq_f32(A0, B1, 0);
|
||||
C1 = vfmaq_laneq_f32(C1, A1, B1, 1);
|
||||
C1 = vfmaq_laneq_f32(C1, A2, B1, 2);
|
||||
C1 = vfmaq_laneq_f32(C1, A3, B1, 3);
|
||||
vst1q_f32(C + 4, C1);
|
||||
|
||||
B2 = vld1q_f32(B + 8);
|
||||
C2 = vmulq_laneq_f32(A0, B2, 0);
|
||||
C2 = vfmaq_laneq_f32(C2, A1, B2, 1);
|
||||
C2 = vfmaq_laneq_f32(C2, A2, B2, 2);
|
||||
C2 = vfmaq_laneq_f32(C2, A3, B2, 3);
|
||||
vst1q_f32(C + 8, C2);
|
||||
|
||||
B3 = vld1q_f32(B + 12);
|
||||
C3 = vmulq_laneq_f32(A0, B3, 0);
|
||||
C3 = vfmaq_laneq_f32(C3, A1, B3, 1);
|
||||
C3 = vfmaq_laneq_f32(C3, A2, B3, 2);
|
||||
C3 = vfmaq_laneq_f32(C3, A3, B3, 3);
|
||||
vst1q_f32(C + 12, C3);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define xx 0
|
||||
#define xy 1
|
||||
#define xz 2
|
||||
#define xw 3
|
||||
#define yx 4
|
||||
#define yy 5
|
||||
#define yz 6
|
||||
#define yw 7
|
||||
#define zx 8
|
||||
#define zy 9
|
||||
#define zz 10
|
||||
#define zw 11
|
||||
#define wx 12
|
||||
#define wy 13
|
||||
#define wz 14
|
||||
#define ww 15
|
||||
|
||||
void fast_matrix_mul_4x4_c(float *dest, const float *a, const float *b) {
|
||||
dest[xx] = b[xx] * a[xx] + b[xy] * a[yx] + b[xz] * a[zx] + b[xw] * a[wx];
|
||||
dest[xy] = b[xx] * a[xy] + b[xy] * a[yy] + b[xz] * a[zy] + b[xw] * a[wy];
|
||||
dest[xz] = b[xx] * a[xz] + b[xy] * a[yz] + b[xz] * a[zz] + b[xw] * a[wz];
|
||||
dest[xw] = b[xx] * a[xw] + b[xy] * a[yw] + b[xz] * a[zw] + b[xw] * a[ww];
|
||||
|
||||
dest[yx] = b[yx] * a[xx] + b[yy] * a[yx] + b[yz] * a[zx] + b[yw] * a[wx];
|
||||
dest[yy] = b[yx] * a[xy] + b[yy] * a[yy] + b[yz] * a[zy] + b[yw] * a[wy];
|
||||
dest[yz] = b[yx] * a[xz] + b[yy] * a[yz] + b[yz] * a[zz] + b[yw] * a[wz];
|
||||
dest[yw] = b[yx] * a[xw] + b[yy] * a[yw] + b[yz] * a[zw] + b[yw] * a[ww];
|
||||
|
||||
dest[zx] = b[zx] * a[xx] + b[zy] * a[yx] + b[zz] * a[zx] + b[zw] * a[wx];
|
||||
dest[zy] = b[zx] * a[xy] + b[zy] * a[yy] + b[zz] * a[zy] + b[zw] * a[wy];
|
||||
dest[zz] = b[zx] * a[xz] + b[zy] * a[yz] + b[zz] * a[zz] + b[zw] * a[wz];
|
||||
dest[zw] = b[zx] * a[xw] + b[zy] * a[yw] + b[zz] * a[zw] + b[zw] * a[ww];
|
||||
|
||||
dest[wx] = b[wx] * a[xx] + b[wy] * a[yx] + b[wz] * a[zx] + b[ww] * a[wx];
|
||||
dest[wy] = b[wx] * a[xy] + b[wy] * a[yy] + b[wz] * a[zy] + b[ww] * a[wy];
|
||||
dest[wz] = b[wx] * a[xz] + b[wy] * a[yz] + b[wz] * a[zz] + b[ww] * a[wz];
|
||||
dest[ww] = b[wx] * a[xw] + b[wy] * a[yw] + b[wz] * a[zw] + b[ww] * a[ww];
|
||||
}
|
||||
|
||||
#endif
|
||||
+135
-18
@@ -2,28 +2,145 @@
|
||||
|
||||
#include "ppsspp_config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// A mini library of 4x4 matrix muls.
|
||||
#include "Common/Math/SIMDHeaders.h"
|
||||
#include "Common/Common.h"
|
||||
|
||||
extern void fast_matrix_mul_4x4_c(float *dest, const float *a, const float *b);
|
||||
extern void fast_matrix_mul_4x4_neon(float *dest, const float *a, const float *b);
|
||||
extern void fast_matrix_mul_4x4_sse(float *dest, const float *a, const float *b);
|
||||
extern void fast_matrix_mul_4x4_lsx(float *dest, const float *a, const float *b);
|
||||
#if PPSSPP_ARCH(SSE2)
|
||||
|
||||
inline void fast_matrix_mul_4x4(float *dest, const float *a, const float *b) {
|
||||
int i;
|
||||
__m128 a_col_1 = _mm_loadu_ps(a);
|
||||
__m128 a_col_2 = _mm_loadu_ps(&a[4]);
|
||||
__m128 a_col_3 = _mm_loadu_ps(&a[8]);
|
||||
__m128 a_col_4 = _mm_loadu_ps(&a[12]);
|
||||
|
||||
for (i = 0; i < 16; i += 4) {
|
||||
__m128 r_col = _mm_mul_ps(a_col_1, _mm_set1_ps(b[i]));
|
||||
r_col = _mm_add_ps(r_col, _mm_mul_ps(a_col_2, _mm_set1_ps(b[i + 1])));
|
||||
r_col = _mm_add_ps(r_col, _mm_mul_ps(a_col_3, _mm_set1_ps(b[i + 2])));
|
||||
r_col = _mm_add_ps(r_col, _mm_mul_ps(a_col_4, _mm_set1_ps(b[i + 3])));
|
||||
_mm_storeu_ps(&dest[i], r_col);
|
||||
}
|
||||
}
|
||||
|
||||
#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
|
||||
// Hard link to SSE implementations on x86/amd64
|
||||
#define fast_matrix_mul_4x4 fast_matrix_mul_4x4_sse
|
||||
#elif PPSSPP_ARCH(ARM_NEON)
|
||||
#define fast_matrix_mul_4x4 fast_matrix_mul_4x4_neon
|
||||
#elif PPSSPP_ARCH(LOONGARCH64_LSX)
|
||||
#define fast_matrix_mul_4x4 fast_matrix_mul_4x4_lsx
|
||||
#else
|
||||
#define fast_matrix_mul_4x4 fast_matrix_mul_4x4_c
|
||||
|
||||
inline __m128 __lsx_vreplfr2vr_s(float val) {
|
||||
typedef union {
|
||||
int32_t i;
|
||||
float f;
|
||||
} FloatInt;
|
||||
FloatInt tmpval = {.f = val};
|
||||
return (__m128)__lsx_vreplgr2vr_w(tmpval.i);
|
||||
}
|
||||
|
||||
inline void fast_matrix_mul_4x4(float *dest, const float *a, const float *b) {
|
||||
__m128 a_col_1 = (__m128)__lsx_vld(a, 0);
|
||||
__m128 a_col_2 = (__m128)__lsx_vld(a + 4, 0);
|
||||
__m128 a_col_3 = (__m128)__lsx_vld(a + 8, 0);
|
||||
__m128 a_col_4 = (__m128)__lsx_vld(a + 12, 0);
|
||||
|
||||
for (int i = 0; i < 16; i += 4) {
|
||||
|
||||
__m128 b1 = __lsx_vreplfr2vr_s(b[i]);
|
||||
__m128 b2 = __lsx_vreplfr2vr_s(b[i + 1]);
|
||||
__m128 b3 = __lsx_vreplfr2vr_s(b[i + 2]);
|
||||
__m128 b4 = __lsx_vreplfr2vr_s(b[i + 3]);
|
||||
|
||||
__m128 result = __lsx_vfmul_s(a_col_1, b1);
|
||||
result = __lsx_vfmadd_s(a_col_2, b2, result);
|
||||
result = __lsx_vfmadd_s(a_col_3, b3, result);
|
||||
result = __lsx_vfmadd_s(a_col_4, b4, result);
|
||||
|
||||
__lsx_vst(result, &dest[i], 0);
|
||||
}
|
||||
}
|
||||
|
||||
#elif PPSSPP_ARCH(ARM_NEON)
|
||||
|
||||
#ifdef B0
|
||||
#undef B0
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
// From https://developer.arm.com/documentation/102467/0100/Matrix-multiplication-example
|
||||
inline void fast_matrix_mul_4x4(float *C, const float *A, const float *B) {
|
||||
// these are the columns A
|
||||
float32x4_t A0;
|
||||
float32x4_t A1;
|
||||
float32x4_t A2;
|
||||
float32x4_t A3;
|
||||
|
||||
// these are the columns B
|
||||
float32x4_t B0;
|
||||
float32x4_t B1;
|
||||
float32x4_t B2;
|
||||
float32x4_t B3;
|
||||
|
||||
// these are the columns C
|
||||
float32x4_t C0;
|
||||
float32x4_t C1;
|
||||
float32x4_t C2;
|
||||
float32x4_t C3;
|
||||
|
||||
A0 = vld1q_f32(A);
|
||||
A1 = vld1q_f32(A + 4);
|
||||
A2 = vld1q_f32(A + 8);
|
||||
A3 = vld1q_f32(A + 12);
|
||||
|
||||
// Multiply accumulate in 4x1 blocks, i.e. each column in C
|
||||
B0 = vld1q_f32(B);
|
||||
B1 = vld1q_f32(B + 4);
|
||||
B2 = vld1q_f32(B + 8);
|
||||
B3 = vld1q_f32(B + 12);
|
||||
|
||||
C0 = vmulq_laneq_f32(A0, B0, 0);
|
||||
C0 = vfmaq_laneq_f32(C0, A1, B0, 1);
|
||||
C0 = vfmaq_laneq_f32(C0, A2, B0, 2);
|
||||
C0 = vfmaq_laneq_f32(C0, A3, B0, 3);
|
||||
vst1q_f32(C, C0);
|
||||
|
||||
C1 = vmulq_laneq_f32(A0, B1, 0);
|
||||
C1 = vfmaq_laneq_f32(C1, A1, B1, 1);
|
||||
C1 = vfmaq_laneq_f32(C1, A2, B1, 2);
|
||||
C1 = vfmaq_laneq_f32(C1, A3, B1, 3);
|
||||
vst1q_f32(C + 4, C1);
|
||||
|
||||
C2 = vmulq_laneq_f32(A0, B2, 0);
|
||||
C2 = vfmaq_laneq_f32(C2, A1, B2, 1);
|
||||
C2 = vfmaq_laneq_f32(C2, A2, B2, 2);
|
||||
C2 = vfmaq_laneq_f32(C2, A3, B2, 3);
|
||||
vst1q_f32(C + 8, C2);
|
||||
|
||||
C3 = vmulq_laneq_f32(A0, B3, 0);
|
||||
C3 = vfmaq_laneq_f32(C3, A1, B3, 1);
|
||||
C3 = vfmaq_laneq_f32(C3, A2, B3, 2);
|
||||
C3 = vfmaq_laneq_f32(C3, A3, B3, 3);
|
||||
vst1q_f32(C + 12, C3);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
inline void fast_matrix_mul_4x4(float * RESTRICT dest, const float * RESTRICT a, const float * RESTRICT b) {
|
||||
dest[0] = b[0] * a[0] + b[1] * a[4] + b[2] * a[8] + b[3] * a[12];
|
||||
dest[1] = b[0] * a[1] + b[1] * a[5] + b[2] * a[9] + b[3] * a[13];
|
||||
dest[2] = b[0] * a[2] + b[1] * a[6] + b[2] * a[10] + b[3] * a[14];
|
||||
dest[3] = b[0] * a[3] + b[1] * a[7] + b[2] * a[11] + b[3] * a[15];
|
||||
|
||||
dest[4] = b[4] * a[0] + b[5] * a[4] + b[6] * a[8] + b[7] * a[12];
|
||||
dest[5] = b[4] * a[1] + b[5] * a[5] + b[6] * a[9] + b[7] * a[13];
|
||||
dest[6] = b[4] * a[2] + b[5] * a[6] + b[6] * a[10] + b[7] * a[14];
|
||||
dest[7] = b[4] * a[3] + b[5] * a[7] + b[6] * a[11] + b[7] * a[15];
|
||||
|
||||
dest[8] = b[8] * a[0] + b[9] * a[4] + b[10] * a[8] + b[11] * a[12];
|
||||
dest[9] = b[8] * a[1] + b[9] * a[5] + b[10] * a[9] + b[11] * a[13];
|
||||
dest[10] = b[8] * a[2] + b[9] * a[6] + b[10] * a[10] + b[11] * a[14];
|
||||
dest[11] = b[8] * a[3] + b[9] * a[7] + b[10] * a[11] + b[11] * a[15];
|
||||
|
||||
dest[12] = b[12] * a[0] + b[13] * a[4] + b[14] * a[8] + b[15] * a[12];
|
||||
dest[13] = b[12] * a[1] + b[13] * a[5] + b[14] * a[9] + b[15] * a[13];
|
||||
dest[14] = b[12] * a[2] + b[13] * a[6] + b[14] * a[10] + b[15] * a[14];
|
||||
dest[15] = b[12] * a[3] + b[13] * a[7] + b[14] * a[11] + b[15] * a[15];
|
||||
}
|
||||
|
||||
#endif
|
||||
+11
-12
@@ -762,9 +762,10 @@ void PopupTextInputChoice::HandleClick(EventParams &e) {
|
||||
|
||||
// Choose method depending on platform capabilities.
|
||||
if (System_GetPropertyBool(SYSPROP_HAS_TEXT_INPUT_DIALOG)) {
|
||||
System_InputBoxGetString(token_, text_, *value_, passwordMasking_, [=](const std::string &enteredValue, int) {
|
||||
System_InputBoxGetString(token_, text_, *value_, passwordMasking_, [this](const std::string &enteredValue, int) {
|
||||
*value_ = SanitizeString(StripSpaces(enteredValue), restriction_, minLen_, maxLen_);
|
||||
EventParams params{};
|
||||
params.v = this;
|
||||
OnChange.Trigger(params);
|
||||
});
|
||||
return;
|
||||
@@ -775,7 +776,15 @@ void PopupTextInputChoice::HandleClick(EventParams &e) {
|
||||
if (System_GetPropertyBool(SYSPROP_KEYBOARD_IS_SOFT)) {
|
||||
popupScreen->SetAlignTop(true);
|
||||
}
|
||||
popupScreen->OnChange.Handle(this, &PopupTextInputChoice::HandleChange);
|
||||
popupScreen->OnChange.Add([this](EventParams &e) {
|
||||
*value_ = StripSpaces(SanitizeString(*value_, restriction_, minLen_, maxLen_));
|
||||
EventParams params{};
|
||||
params.v = this;
|
||||
OnChange.Trigger(params);
|
||||
if (restoreFocus_) {
|
||||
SetFocusedView(this);
|
||||
}
|
||||
});
|
||||
if (e.v)
|
||||
popupScreen->SetPopupOrigin(e.v);
|
||||
screenManager_->push(popupScreen);
|
||||
@@ -785,16 +794,6 @@ std::string PopupTextInputChoice::ValueText() const {
|
||||
return *value_;
|
||||
}
|
||||
|
||||
void PopupTextInputChoice::HandleChange(EventParams &e) {
|
||||
*value_ = StripSpaces(SanitizeString(*value_, restriction_, minLen_, maxLen_));
|
||||
e.v = this;
|
||||
OnChange.Trigger(e);
|
||||
|
||||
if (restoreFocus_) {
|
||||
SetFocusedView(this);
|
||||
}
|
||||
}
|
||||
|
||||
void TextEditPopupScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
using namespace UI;
|
||||
UIContext &dc = *screenManager()->getUIContext();
|
||||
|
||||
@@ -506,7 +506,6 @@ protected:
|
||||
|
||||
private:
|
||||
void HandleClick(EventParams &e);
|
||||
void HandleChange(EventParams &e);
|
||||
RequesterToken token_;
|
||||
ScreenManager *screenManager_;
|
||||
std::string *value_;
|
||||
|
||||
+2
-1
@@ -848,7 +848,8 @@ void NotifyPadConnected(InputDeviceID deviceId, std::string_view name) {
|
||||
g_padNames[deviceId] = name;
|
||||
|
||||
// Don't notify within the first 5 seconds, to avoid notification spam on startup.
|
||||
if (time_now_d() >= 5.0) {
|
||||
// Also for some reason we get some strange things on Android... "Virtual"?
|
||||
if (time_now_d() >= 5.0 && name != "Virtual") {
|
||||
auto co = GetI18NCategory(I18NCat::CONTROLS);
|
||||
g_OSD.Show(OSDType::MESSAGE_SUCCESS, ApplySafeSubstitutions("%1: %2", co->T("Game controller connected"), name), "", "I_CONTROLLER", 2.0f, "controller_connected");
|
||||
}
|
||||
|
||||
@@ -81,7 +81,10 @@ std::vector<std::string> DrawEngineCommon::DebugGetVertexLoaderIDs() {
|
||||
return ids;
|
||||
}
|
||||
|
||||
std::string DrawEngineCommon::DebugGetVertexLoaderString(std::string id, DebugShaderStringType stringType) {
|
||||
std::string DrawEngineCommon::DebugGetVertexLoaderString(std::string_view id, DebugShaderStringType stringType) {
|
||||
if (id.size() < sizeof(u32)) {
|
||||
return "N/A";
|
||||
}
|
||||
u32 mapId;
|
||||
memcpy(&mapId, &id[0], sizeof(mapId));
|
||||
VertexDecoder *dec;
|
||||
@@ -196,7 +199,8 @@ void DrawEngineCommon::UpdatePlanes() {
|
||||
|
||||
float mtx[16];
|
||||
Matrix4ByMatrix4(mtx, viewproj, applyViewport.m);
|
||||
// I'm sure there's some fairly optimized way to set these.
|
||||
// I'm sure there's some fairly optimized way to set these. If we make a version of Matrix4ByMatrix4
|
||||
// that returns a transpose, it looks like these will be more straightforward.
|
||||
planes_.Set(0, mtx[3] - mtx[0], mtx[7] - mtx[4], mtx[11] - mtx[8], mtx[15] - mtx[12]); // Right
|
||||
planes_.Set(1, mtx[3] + mtx[0], mtx[7] + mtx[4], mtx[11] + mtx[8], mtx[15] + mtx[12]); // Left
|
||||
planes_.Set(2, mtx[3] + mtx[1], mtx[7] + mtx[5], mtx[11] + mtx[9], mtx[15] + mtx[13]); // Bottom
|
||||
@@ -398,7 +402,7 @@ bool DrawEngineCommon::TestBoundingBoxFast(const void *vdata, int vertexCount, c
|
||||
__m128 scaleFactor = _mm_set1_ps(1.0f / 32768.0f);
|
||||
for (int i = 0; i < vertexCount; i++) {
|
||||
const s16 *data = ((const s16 *)((const s8 *)vdata + i * stride + offset));
|
||||
__m128i bits = _mm_castpd_si128(_mm_load_sd((const double *)data));
|
||||
__m128i bits = _mm_loadl_epi64((const __m128i*)data);
|
||||
// Sign extension. Hacky without SSE4.
|
||||
bits = _mm_srai_epi32(_mm_unpacklo_epi16(bits, bits), 16);
|
||||
__m128 pos = _mm_mul_ps(_mm_cvtepi32_ps(bits), scaleFactor);
|
||||
@@ -619,6 +623,7 @@ int DrawEngineCommon::ExtendNonIndexedPrim(const uint32_t *cmd, const uint32_t *
|
||||
anyCCWOrIndexed_ = true;
|
||||
}
|
||||
int seenPrims = 0;
|
||||
int numDrawInds = numDrawInds_;
|
||||
while (cmd != stall) {
|
||||
uint32_t data = *cmd;
|
||||
if ((data & 0xFFF80000) != 0x04000000) {
|
||||
@@ -628,10 +633,10 @@ int DrawEngineCommon::ExtendNonIndexedPrim(const uint32_t *cmd, const uint32_t *
|
||||
if (IsTrianglePrim(newPrim) != isTriangle)
|
||||
break;
|
||||
int vertexCount = data & 0xFFFF;
|
||||
if (numDrawInds_ >= MAX_DEFERRED_DRAW_INDS || vertexCountInDrawCalls_ + offset + vertexCount > VERTEX_BUFFER_MAX) {
|
||||
if (numDrawInds >= MAX_DEFERRED_DRAW_INDS || vertexCountInDrawCalls_ + offset + vertexCount > VERTEX_BUFFER_MAX) {
|
||||
break;
|
||||
}
|
||||
DeferredInds &di = drawInds_[numDrawInds_++];
|
||||
DeferredInds &di = drawInds_[numDrawInds++];
|
||||
di.indexType = 0;
|
||||
di.prim = newPrim;
|
||||
seenPrims |= (1 << newPrim);
|
||||
@@ -642,7 +647,7 @@ int DrawEngineCommon::ExtendNonIndexedPrim(const uint32_t *cmd, const uint32_t *
|
||||
offset += vertexCount;
|
||||
cmd++;
|
||||
}
|
||||
|
||||
numDrawInds_ = numDrawInds;
|
||||
seenPrims_ |= seenPrims;
|
||||
|
||||
int totalCount = offset - dv.vertexCount;
|
||||
@@ -722,6 +727,8 @@ bool DrawEngineCommon::SubmitPrim(const void *verts, const void *inds, GEPrimiti
|
||||
bool applySkin = dec_->skinInDecode;
|
||||
|
||||
DeferredInds &di = drawInds_[numDrawInds_++];
|
||||
_dbg_assert_(numDrawInds_ <= MAX_DEFERRED_DRAW_INDS);
|
||||
|
||||
di.inds = inds;
|
||||
int indexType = (vertTypeID & GE_VTYPE_IDX_MASK) >> GE_VTYPE_IDX_SHIFT;
|
||||
if (indexType) {
|
||||
@@ -734,26 +741,27 @@ bool DrawEngineCommon::SubmitPrim(const void *verts, const void *inds, GEPrimiti
|
||||
anyCCWOrIndexed_ = true;
|
||||
}
|
||||
di.vertexCount = vertexCount;
|
||||
di.vertDecodeIndex = numDrawVerts_;
|
||||
const int numDrawVerts = numDrawVerts_;
|
||||
di.vertDecodeIndex = numDrawVerts;
|
||||
di.offset = 0;
|
||||
|
||||
_dbg_assert_(numDrawVerts_ <= MAX_DEFERRED_DRAW_VERTS);
|
||||
_dbg_assert_(numDrawInds_ <= MAX_DEFERRED_DRAW_INDS);
|
||||
_dbg_assert_(numDrawVerts <= MAX_DEFERRED_DRAW_VERTS);
|
||||
|
||||
if (inds && numDrawVerts_ > decodeVertsCounter_ && drawVerts_[numDrawVerts_ - 1].verts == verts && !applySkin) {
|
||||
if (inds && numDrawVerts > decodeVertsCounter_ && drawVerts_[numDrawVerts - 1].verts == verts && !applySkin) {
|
||||
// Same vertex pointer as a previous un-decoded draw call - let's just extend the decode!
|
||||
di.vertDecodeIndex = numDrawVerts_ - 1;
|
||||
di.vertDecodeIndex = numDrawVerts - 1;
|
||||
u16 lb;
|
||||
u16 ub;
|
||||
GetIndexBounds(inds, vertexCount, vertTypeID, &lb, &ub);
|
||||
DeferredVerts &dv = drawVerts_[numDrawVerts_ - 1];
|
||||
DeferredVerts &dv = drawVerts_[numDrawVerts - 1];
|
||||
if (lb < dv.indexLowerBound)
|
||||
dv.indexLowerBound = lb;
|
||||
if (ub > dv.indexUpperBound)
|
||||
dv.indexUpperBound = ub;
|
||||
} else {
|
||||
// Record a new draw, and a new index gen.
|
||||
DeferredVerts &dv = drawVerts_[numDrawVerts_++];
|
||||
DeferredVerts &dv = drawVerts_[numDrawVerts];
|
||||
numDrawVerts_ = numDrawVerts + 1; // Increment the uncached variable
|
||||
dv.verts = verts;
|
||||
dv.vertexCount = vertexCount;
|
||||
dv.uvScale = gstate_c.uv;
|
||||
@@ -777,29 +785,30 @@ void DrawEngineCommon::BeginFrame() {
|
||||
}
|
||||
|
||||
void DrawEngineCommon::DecodeVerts(const VertexDecoder *dec, u8 *dest) {
|
||||
if (!numDrawVerts_) {
|
||||
const int numDrawVerts = numDrawVerts_;
|
||||
if (!numDrawVerts) {
|
||||
return;
|
||||
}
|
||||
// Note that this should be able to continue a partial decode - we don't necessarily start from zero here (although we do most of the time).
|
||||
int i = decodeVertsCounter_;
|
||||
int stride = (int)dec->GetDecVtxFmt().stride;
|
||||
for (; i < numDrawVerts_; i++) {
|
||||
const int stride = (int)dec->GetDecVtxFmt().stride;
|
||||
int numDecodedVerts = numDecodedVerts_; // Move to a local for better codegen.
|
||||
for (; i < numDrawVerts; i++) {
|
||||
const DeferredVerts &dv = drawVerts_[i];
|
||||
|
||||
int indexLowerBound = dv.indexLowerBound;
|
||||
drawVertexOffsets_[i] = numDecodedVerts_ - indexLowerBound;
|
||||
|
||||
int indexUpperBound = dv.indexUpperBound;
|
||||
|
||||
if (indexUpperBound + 1 - indexLowerBound + numDecodedVerts_ >= VERTEX_BUFFER_MAX) {
|
||||
const int indexLowerBound = dv.indexLowerBound;
|
||||
drawVertexOffsets_[i] = numDecodedVerts - indexLowerBound;
|
||||
const int indexUpperBound = dv.indexUpperBound;
|
||||
if (indexUpperBound + 1 - indexLowerBound + numDecodedVerts >= VERTEX_BUFFER_MAX) {
|
||||
// Hit our limit! Stop decoding in this draw.
|
||||
break;
|
||||
}
|
||||
|
||||
// Decode the verts (and at the same time apply morphing/skinning). Simple.
|
||||
dec->DecodeVerts(dest + numDecodedVerts_ * stride, dv.verts, &dv.uvScale, indexLowerBound, indexUpperBound);
|
||||
numDecodedVerts_ += indexUpperBound - indexLowerBound + 1;
|
||||
dec->DecodeVerts(dest + numDecodedVerts * stride, dv.verts, &dv.uvScale, indexLowerBound, indexUpperBound);
|
||||
numDecodedVerts += indexUpperBound - indexLowerBound + 1;
|
||||
}
|
||||
numDecodedVerts_ = numDecodedVerts;
|
||||
decodeVertsCounter_ = i;
|
||||
}
|
||||
|
||||
@@ -810,8 +819,8 @@ int DrawEngineCommon::DecodeInds() {
|
||||
for (; i < numDrawInds_; i++) {
|
||||
const DeferredInds &di = drawInds_[i];
|
||||
|
||||
int indexOffset = drawVertexOffsets_[di.vertDecodeIndex] + di.offset;
|
||||
bool clockwise = di.clockwise;
|
||||
const int indexOffset = drawVertexOffsets_[di.vertDecodeIndex] + di.offset;
|
||||
const bool clockwise = di.clockwise;
|
||||
// We've already collapsed subsequent draws with the same vertex pointer, so no tricky logic here anymore.
|
||||
// 2. Loop through the drawcalls, translating indices as we go.
|
||||
switch (di.indexType) {
|
||||
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
bool CanUseHardwareTessellation(GEPatchPrimType prim) const;
|
||||
|
||||
std::vector<std::string> DebugGetVertexLoaderIDs();
|
||||
std::string DebugGetVertexLoaderString(std::string id, DebugShaderStringType stringType);
|
||||
std::string DebugGetVertexLoaderString(std::string_view id, DebugShaderStringType stringType);
|
||||
|
||||
virtual void NotifyConfigChanged();
|
||||
|
||||
|
||||
@@ -802,7 +802,7 @@ bool TextureCacheCommon::GetBestFramebufferCandidate(const TextureDefinition &en
|
||||
|
||||
if (bestIndex != -1) {
|
||||
if (logging) {
|
||||
WARN_LOG(Log::G3D, "Chose candidate %d:\n%s (%dx%d)\n", (int)bestIndex, candidates[bestIndex].ToString().c_str());
|
||||
WARN_LOG(Log::G3D, "Chose candidate %d:\n%s", (int)bestIndex, candidates[bestIndex].ToString().c_str());
|
||||
}
|
||||
*bestCandidate = candidates[bestIndex];
|
||||
return true;
|
||||
|
||||
@@ -114,12 +114,12 @@ void UITabbedBaseDialogScreen::CreateViews() {
|
||||
auto se = GetI18NCategory(I18NCat::SEARCH);
|
||||
|
||||
searchSettings->Add(new ItemHeader(se->T("Find settings")));
|
||||
searchSettings->Add(new PopupTextInputChoice(GetRequesterToken(), &searchFilter_, se->T("Filter"), "", 64, screenManager()))->OnChange.Add([=](UI::EventParams &e) {
|
||||
searchSettings->Add(new PopupTextInputChoice(GetRequesterToken(), &searchFilter_, se->T("Filter"), "", 64, screenManager()))->OnChange.Add([this](UI::EventParams &e) {
|
||||
System_PostUIMessage(UIMessage::GAMESETTINGS_SEARCH, StripSpaces(searchFilter_));
|
||||
});
|
||||
|
||||
clearSearchChoice_ = searchSettings->Add(new Choice(se->T("Clear filter")));
|
||||
clearSearchChoice_->OnClick.Add([=](UI::EventParams &e) {
|
||||
clearSearchChoice_->OnClick.Add([](UI::EventParams &e) {
|
||||
System_PostUIMessage(UIMessage::GAMESETTINGS_SEARCH, "");
|
||||
});
|
||||
clearSearchChoice_->SetVisibility(searchFilter_.empty() ? UI::V_GONE : UI::V_VISIBLE);
|
||||
@@ -128,6 +128,11 @@ void UITabbedBaseDialogScreen::CreateViews() {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Need to handle recreates, both important and accidental ones.
|
||||
if (!searchFilter_.empty()) {
|
||||
ApplySearchFilter();
|
||||
}
|
||||
}
|
||||
|
||||
void UITabbedBaseDialogScreen::sendMessage(UIMessage message, const char *value) {
|
||||
@@ -205,7 +210,7 @@ void UITabbedBaseDialogScreen::ApplySearchFilter() {
|
||||
|
||||
if (match && lastHeading)
|
||||
lastHeading->SetVisibility(UI::V_VISIBLE);
|
||||
v->SetVisibility(searchFilter_.empty() || match ? UI::V_VISIBLE : UI::V_GONE);
|
||||
v->SetVisibility((searchFilter_.empty() || match) ? UI::V_VISIBLE : UI::V_GONE);
|
||||
}
|
||||
tabHolder_->EnableTab(t, tabMatches);
|
||||
matches = matches || tabMatches;
|
||||
|
||||
@@ -330,7 +330,6 @@
|
||||
<ClCompile Include="..\..\Common\Input\InputState.cpp" />
|
||||
<ClCompile Include="..\..\Common\Math\curves.cpp" />
|
||||
<ClCompile Include="..\..\Common\Math\expression_parser.cpp" />
|
||||
<ClCompile Include="..\..\Common\Math\fast\fast_matrix.c" />
|
||||
<ClCompile Include="..\..\Common\Math\lin\matrix4x4.cpp" />
|
||||
<ClCompile Include="..\..\Common\Math\lin\vec3.cpp" />
|
||||
<ClCompile Include="..\..\Common\Math\math_util.cpp" />
|
||||
@@ -461,10 +460,6 @@
|
||||
<None Include="..\..\ext\basis_universal\basisu_transcoder_tables_pvrtc2_alpha_33.inc" />
|
||||
<None Include="..\..\ext\libpng17\CMakeLists.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\Common\Math\fast\fast_matrix_neon.S" />
|
||||
<None Include="..\..\Common\Math\lin\matrix_neon.s" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\cpu_features_UWP\cpu_features_UWP.vcxproj">
|
||||
<Project>{c249f016-7f82-45cf-bb6e-0642a988c4d3}</Project>
|
||||
@@ -477,4 +472,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -250,9 +250,6 @@
|
||||
<ClCompile Include="..\..\Common\Math\math_util.cpp">
|
||||
<Filter>Math</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\Common\Math\fast\fast_matrix.c">
|
||||
<Filter>Math\fast</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\Common\Math\lin\matrix4x4.cpp">
|
||||
<Filter>Math\lin</Filter>
|
||||
</ClCompile>
|
||||
@@ -702,9 +699,6 @@
|
||||
<ClInclude Include="..\..\Common\Math\math_util.h">
|
||||
<Filter>Math</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\Common\Math\fast\fast_matrix.h">
|
||||
<Filter>Math\fast</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\Common\Math\lin\matrix4x4.h">
|
||||
<Filter>Math\lin</Filter>
|
||||
</ClInclude>
|
||||
@@ -1049,12 +1043,6 @@
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\Common\Math\fast\fast_matrix_neon.S">
|
||||
<Filter>Math\fast</Filter>
|
||||
</None>
|
||||
<None Include="..\..\Common\Math\lin\matrix_neon.s">
|
||||
<Filter>Math\lin</Filter>
|
||||
</None>
|
||||
<None Include="..\..\ext\libpng17\CMakeLists.txt" />
|
||||
<None Include="..\..\ext\basis_universal\basisu_transcoder_tables_astc.inc">
|
||||
<Filter>ext\basis_universal</Filter>
|
||||
@@ -1095,4 +1083,4 @@
|
||||
<Filter>ext\at3_standalone</Filter>
|
||||
</Text>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -330,7 +330,6 @@ EXEC_AND_LIB_FILES := \
|
||||
$(SRC)/Common/Render/Text/draw_text_android.cpp \
|
||||
$(SRC)/Common/Input/GestureDetector.cpp \
|
||||
$(SRC)/Common/Input/InputState.cpp \
|
||||
$(SRC)/Common/Math/fast/fast_matrix.c \
|
||||
$(SRC)/Common/Math/math_util.cpp \
|
||||
$(SRC)/Common/Math/Statistics.cpp \
|
||||
$(SRC)/Common/Math/curves.cpp \
|
||||
|
||||
+1
-1
Submodule ffmpeg updated: ee9265e96a...1e3b496563.
@@ -561,9 +561,8 @@ SOURCES_CXX += \
|
||||
$(COMMONDIR)/VR/VRInput.cpp \
|
||||
$(COMMONDIR)/VR/VRRenderer.cpp
|
||||
|
||||
SOURCES_C +=\
|
||||
$(COMMONDIR)/GPU/OpenGL/gl3stub.c \
|
||||
$(COMMONDIR)/Math/fast/fast_matrix.c
|
||||
SOURCES_C += \
|
||||
$(COMMONDIR)/GPU/OpenGL/gl3stub.c
|
||||
|
||||
SOURCES_CXX += \
|
||||
$(GPUCOMMONDIR)/Draw2D.cpp \
|
||||
|
||||
Reference in new issue
Block a user