summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortalha <sarcxd@gmail.com>2025-02-01 17:37:26 +0500
committertalha <sarcxd@gmail.com>2025-02-01 17:37:26 +0500
commit79773a58ef3fd3caf6067422df430aa4a60ad127 (patch)
tree8bbf84a0217b1859612169f4c511e2f5d68370ea
parentce28ed66a5cb155285a5971013f54919757cd65a (diff)
Setup benchmarh branch to have max performancebranch/simd-math
-rwxr-xr-xbuild.sh2
-rwxr-xr-xsource/main.cpp19
-rwxr-xr-xsource/math.h8
3 files changed, 14 insertions, 15 deletions
diff --git a/build.sh b/build.sh
index f7cc7fa..a4f0fda 100755
--- a/build.sh
+++ b/build.sh
@@ -14,7 +14,7 @@ build_opts="$build_dir/main"
lib_path="libs/SDL2 libs/freetype/libfreetype.so"
link_opts="-L $lib_path -lSDL2"
-build_command="clang++ -std=c++11 -g -O0 $include_opts $files $link_opts -o $build_opts"
+build_command="clang++ -std=c++11 -g -O2 $include_opts $files $link_opts -o $build_opts"
printf "Building Project...\n"
printf "$build_command\n\n"
diff --git a/source/main.cpp b/source/main.cpp
index a4d7b2c..8a88231 100755
--- a/source/main.cpp
+++ b/source/main.cpp
@@ -690,8 +690,8 @@ Vec3 get_screen_position_from_percent(GameState state, Vec3 v) {
int main(int argc, char* argv[])
{
- u32 scr_width = 1024;
- u32 scr_height = 768;
+ u32 scr_width = 1920;
+ u32 scr_height = 1080;
if (SDL_Init(SDL_INIT_VIDEO) != 0)
{
@@ -896,7 +896,7 @@ int main(int argc, char* argv[])
{
update_frame_timer(&timer);
//enforce_frame_rate(&timer, 60);
- hp_ticks = SDL_GetPerformanceCounter();
+ //hp_ticks = SDL_GetPerformanceCounter();
cum_math_ticks = 0;
controller.jump = 0;
@@ -1277,8 +1277,7 @@ int main(int argc, char* argv[])
u32 max_col_ele = max_cq_count/max_row_ele;
Vec2 screen_render_size = (state.render_scale * state.screen_size)/2.0f;
Vec2 based_size = Vec2{
- screen_render_size.x / max_row_ele,
- screen_render_size.y / max_col_ele
+ 16.0f, 16.0f
};
#if 1
for (int i=0;i<max_cq_count;i++) {
@@ -1315,12 +1314,12 @@ int main(int argc, char* argv[])
renderer->cq_batch_count = 0;
// render ui text
- u64 new_ticks = SDL_GetPerformanceCounter();
- r64 hp_time = (r64)(new_ticks - hp_ticks) / (r64) hp_tick_freq;
- SDL_Log("ticks time: %fs", hp_time);
+ //u64 new_ticks = SDL_GetPerformanceCounter();
+ //r64 hp_time = (r64)(new_ticks - hp_ticks) / (r64) hp_tick_freq;
+ //SDL_Log("ticks time: %fs", hp_time);
- cum_math_time = (r64)cum_math_ticks/(r64)tick_freq;
- SDL_Log("multiply4mv time: %fs", cum_math_time);
+ //cum_math_time = (r64)cum_math_ticks/(r64)tick_freq;
+ //SDL_Log("multiply4mv time: %fs", cum_math_time);
if (is_collide_x || is_collide_y)
{
diff --git a/source/math.h b/source/math.h
index 1ac3605..1d7924c 100755
--- a/source/math.h
+++ b/source/math.h
@@ -10,7 +10,7 @@
// @todo:
// - make everything simd
-#define USE_SSE 1
+#define USE_SSE 0
r32 clampf(r32 x, r32 bottom, r32 top)
{
@@ -393,7 +393,7 @@ Mat4 subtract4m(Mat4 a, Mat4 b)
Vec4 multiply4mv(Mat4 m, Vec4 v)
{
- r64 prev_tick = SDL_GetPerformanceCounter();
+ //r64 prev_tick = SDL_GetPerformanceCounter();
Vec4 res = vec4(0);
#if USE_SSE
@@ -434,8 +434,8 @@ Vec4 multiply4mv(Mat4 m, Vec4 v)
res.w += v.w*m.data[3][3];
#endif
- r64 curr_tick = SDL_GetPerformanceCounter();
- cum_math_ticks += curr_tick - prev_tick;
+ //r64 curr_tick = SDL_GetPerformanceCounter();
+ //cum_math_ticks += curr_tick - prev_tick;
return res;
}