Skip to content

Commit

Permalink
Merge pull request #17808 from hrydgard/frustum-cull-small-draws
Browse files Browse the repository at this point in the history
Frustum-cull small draws (experiment)
  • Loading branch information
hrydgard committed Dec 9, 2023
2 parents 7f65db9 + 7e85d3d commit 27e47d9
Show file tree
Hide file tree
Showing 13 changed files with 371 additions and 37 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -737,6 +737,7 @@ add_library(Common STATIC
Common/Input/InputState.cpp
Common/Input/InputState.h
Common/Math/fast/fast_matrix.c
Common/Math/CrossSIMD.h
Common/Math/curves.cpp
Common/Math/curves.h
Common/Math/expression_parser.cpp
Expand Down
1 change: 1 addition & 0 deletions Common/Common.vcxproj
Expand Up @@ -484,6 +484,7 @@
<ClInclude Include="Input\GestureDetector.h" />
<ClInclude Include="Input\InputState.h" />
<ClInclude Include="Input\KeyCodes.h" />
<ClInclude Include="Math\CrossSIMD.h" />
<ClInclude Include="Math\curves.h" />
<ClInclude Include="Math\expression_parser.h" />
<ClInclude Include="Math\fast\fast_matrix.h" />
Expand Down
3 changes: 3 additions & 0 deletions Common/Common.vcxproj.filters
Expand Up @@ -518,6 +518,9 @@
<ClInclude Include="GPU\Vulkan\VulkanDescSet.h">
<Filter>GPU\Vulkan</Filter>
</ClInclude>
<ClInclude Include="Math\CrossSIMD.h">
<Filter>Math</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="ABI.cpp" />
Expand Down
58 changes: 58 additions & 0 deletions Common/Math/CrossSIMD.h
@@ -0,0 +1,58 @@
// CrossSIMD
//
// Compatibility wrappers for SIMD dialects.
//
// In the long run, might do a more general single-source-SIMD wrapper here consisting
// of defines that translate to either NEON or SSE. It would be possible to write quite a lot of
// our various color conversion functions and so on in a pretty generic manner.

#include "ppsspp_config.h"

#include <cstdint>

#if PPSSPP_ARCH(SSE2)
#include <emmintrin.h>
#endif

#if PPSSPP_ARCH(ARM_NEON)
#if defined(_MSC_VER) && PPSSPP_ARCH(ARM64)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
#endif

// Basic types

#if PPSSPP_ARCH(ARM64_NEON)

// No special ones here.

#elif PPSSPP_ARCH(ARM_NEON)

// Compatibility wrappers making ARM64 NEON code run on ARM32
// With optimization on, these should compile down to the optimal code.

inline float32x4_t vmulq_laneq_f32(float32x4_t a, float32x4_t b, int lane) {
switch (lane & 3) {
case 0: return vmulq_lane_f32(a, vget_low_f32(b), 0);
case 1: return vmulq_lane_f32(a, vget_low_f32(b), 1);
case 2: return vmulq_lane_f32(a, vget_high_f32(b), 0);
default: return vmulq_lane_f32(a, vget_high_f32(b), 1);
}
}

inline float32x4_t vmlaq_laneq_f32(float32x4_t a, float32x4_t b, float32x4_t c, int lane) {
switch (lane & 3) {
case 0: return vmlaq_lane_f32(a, b, vget_low_f32(c), 0);
case 1: return vmlaq_lane_f32(a, b, vget_low_f32(c), 1);
case 2: return vmlaq_lane_f32(a, b, vget_high_f32(c), 0);
default: return vmlaq_lane_f32(a, b, vget_high_f32(c), 1);
}
}

inline uint32x4_t vcgezq_f32(float32x4_t v) {
return vcgeq_f32(v, vdupq_n_f32(0.0f));
}

#endif
1 change: 0 additions & 1 deletion Common/UI/View.cpp
Expand Up @@ -620,7 +620,6 @@ CollapsibleHeader::CollapsibleHeader(bool *toggle, const std::string &text, Layo

void CollapsibleHeader::Draw(UIContext &dc) {
Style style = dc.theme->itemStyle;
style.background.color = 0;
if (HasFocus()) style = dc.theme->itemFocusedStyle;
if (down_) style = dc.theme->itemDownStyle;
if (!IsEnabled()) style = dc.theme->itemDisabledStyle;
Expand Down
2 changes: 1 addition & 1 deletion Core/Config.cpp
Expand Up @@ -1893,7 +1893,7 @@ void PlayTimeTracker::Load(const Section *section) {

// Parse the string.
PlayTime gameTime{};
if (2 == sscanf(value.c_str(), "%d,%llu", &gameTime.totalTimePlayed, &gameTime.lastTimePlayed)) {
if (2 == sscanf(value.c_str(), "%d,%llu", &gameTime.totalTimePlayed, (long long *)&gameTime.lastTimePlayed)) {
tracker_[key] = gameTime;
}
}
Expand Down

0 comments on commit 27e47d9

Please sign in to comment.