diff --git a/bind/v4k.lua b/bind/v4k.lua index ce12785..8d02f0b 100644 --- a/bind/v4k.lua +++ b/bind/v4k.lua @@ -2111,6 +2111,7 @@ enum WINDOW_FLAGS { void window_loop_exit(); void window_title(const char *title); void window_color(unsigned color); + char window_msaa(); vec2 window_canvas(); void* window_handle(); char* window_stats(); diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index 31d8d0b..c0831f9 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -18787,6 +18787,7 @@ API void window_loop_exit(); // exit from main loop function (emscripten onl API void window_title(const char *title); API void window_color(unsigned color); +API char window_msaa(); API vec2 window_canvas(); API void* window_handle(); API char* window_stats(); @@ -383224,6 +383225,14 @@ void shadowmatrix_ortho(mat44 shm_proj, float left, float right, float bottom, f static renderstate_t query_test_rs; +static inline +unsigned query_adjust_samples_msaa(unsigned samples) { + if (window_msaa() > 1) { + return samples / window_msaa(); + } + return samples; +} + static inline void query_test_rs_init() { do_once { @@ -383271,7 +383280,7 @@ unsigned query_test_point(mat44 proj, mat44 view, vec3 pos, float size) { glBindVertexArray( 0 ); glUseProgram( oldprog ); - return samples_passed; + return query_adjust_samples_msaa(samples_passed); } // ----------------------------------------------------------------------------- @@ -392045,6 +392054,7 @@ static int w, h, xpos, ypos, paused; static int fullscreen, xprev, yprev, wprev, hprev; static uint64_t frame_count; static double t, dt, fps, hz = 0.00; +static char msaa = 0; static char title[128] = {0}; static char screenshot_file[DIR_MAX]; static int locked_aspect_ratio = 0; @@ -392154,9 +392164,9 @@ void window_hints(unsigned flags) { glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); // glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); // glfwWindowHint(GLFW_DECORATED, GLFW_FALSE); // makes it non-resizable - if(flags & WINDOW_MSAA2) glfwWindowHint(GLFW_SAMPLES, 2); // x2 AA - if(flags & WINDOW_MSAA4) glfwWindowHint(GLFW_SAMPLES, 4); // x4 AA - if(flags & WINDOW_MSAA8) glfwWindowHint(GLFW_SAMPLES, 8); // x8 AA + if(flags & WINDOW_MSAA2) glfwWindowHint(GLFW_SAMPLES, 2), msaa = 2; // x2 AA + if(flags & WINDOW_MSAA4) glfwWindowHint(GLFW_SAMPLES, 4), msaa = 4; // x4 AA + if(flags & WINDOW_MSAA8) glfwWindowHint(GLFW_SAMPLES, 8), msaa = 8; // x8 AA g->flags = flags; } @@ -392772,6 +392782,9 @@ void window_color(unsigned color) { unsigned a = (color >> 24) & 255; winbgcolor = vec4(r / 255.0, g / 255.0, b / 255.0, a / 255.0); } +char window_msaa() { + return msaa; +} static int has_icon; int window_has_icon() { return has_icon; diff --git a/engine/split/v4k_render.c b/engine/split/v4k_render.c index e90f83f..c2d30e5 100644 --- a/engine/split/v4k_render.c +++ b/engine/split/v4k_render.c @@ -1552,6 +1552,14 @@ void shadowmatrix_ortho(mat44 shm_proj, float left, float right, float bottom, f static renderstate_t query_test_rs; +static inline +unsigned query_adjust_samples_msaa(unsigned samples) { + if (window_msaa() > 1) { + return samples / window_msaa(); + } + return samples; +} + static inline void query_test_rs_init() { do_once { @@ -1599,7 +1607,7 @@ unsigned query_test_point(mat44 proj, mat44 view, vec3 pos, float size) { glBindVertexArray( 0 ); glUseProgram( oldprog ); - return samples_passed; + return query_adjust_samples_msaa(samples_passed); } // ----------------------------------------------------------------------------- diff --git a/engine/split/v4k_window.c b/engine/split/v4k_window.c index cbc679c..7b63914 100644 --- a/engine/split/v4k_window.c +++ b/engine/split/v4k_window.c @@ -112,6 +112,7 @@ static int w, h, xpos, ypos, paused; static int fullscreen, xprev, yprev, wprev, hprev; static uint64_t frame_count; static double t, dt, fps, hz = 0.00; +static char msaa = 0; static char title[128] = {0}; static char screenshot_file[DIR_MAX]; static int locked_aspect_ratio = 0; @@ -221,9 +222,9 @@ void window_hints(unsigned flags) { glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); // glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); // glfwWindowHint(GLFW_DECORATED, GLFW_FALSE); // makes it non-resizable - if(flags & WINDOW_MSAA2) glfwWindowHint(GLFW_SAMPLES, 2); // x2 AA - if(flags & WINDOW_MSAA4) glfwWindowHint(GLFW_SAMPLES, 4); // x4 AA - if(flags & WINDOW_MSAA8) glfwWindowHint(GLFW_SAMPLES, 8); // x8 AA + if(flags & WINDOW_MSAA2) glfwWindowHint(GLFW_SAMPLES, 2), msaa = 2; // x2 AA + if(flags & WINDOW_MSAA4) glfwWindowHint(GLFW_SAMPLES, 4), msaa = 4; // x4 AA + if(flags & WINDOW_MSAA8) glfwWindowHint(GLFW_SAMPLES, 8), msaa = 8; // x8 AA g->flags = flags; } @@ -839,6 +840,9 @@ void window_color(unsigned color) { unsigned a = (color >> 24) & 255; winbgcolor = vec4(r / 255.0, g / 255.0, b / 255.0, a / 255.0); } +char window_msaa() { + return msaa; +} static int has_icon; int window_has_icon() { return has_icon; diff --git a/engine/split/v4k_window.h b/engine/split/v4k_window.h index ef99096..beda90a 100644 --- a/engine/split/v4k_window.h +++ b/engine/split/v4k_window.h @@ -40,6 +40,7 @@ API void window_loop_exit(); // exit from main loop function (emscripten onl API void window_title(const char *title); API void window_color(unsigned color); +API char window_msaa(); API vec2 window_canvas(); API void* window_handle(); API char* window_stats(); diff --git a/engine/v4k.c b/engine/v4k.c index e5d8628..c7260a5 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -18351,6 +18351,14 @@ void shadowmatrix_ortho(mat44 shm_proj, float left, float right, float bottom, f static renderstate_t query_test_rs; +static inline +unsigned query_adjust_samples_msaa(unsigned samples) { + if (window_msaa() > 1) { + return samples / window_msaa(); + } + return samples; +} + static inline void query_test_rs_init() { do_once { @@ -18398,7 +18406,7 @@ unsigned query_test_point(mat44 proj, mat44 view, vec3 pos, float size) { glBindVertexArray( 0 ); glUseProgram( oldprog ); - return samples_passed; + return query_adjust_samples_msaa(samples_passed); } // ----------------------------------------------------------------------------- @@ -27172,6 +27180,7 @@ static int w, h, xpos, ypos, paused; static int fullscreen, xprev, yprev, wprev, hprev; static uint64_t frame_count; static double t, dt, fps, hz = 0.00; +static char msaa = 0; static char title[128] = {0}; static char screenshot_file[DIR_MAX]; static int locked_aspect_ratio = 0; @@ -27281,9 +27290,9 @@ void window_hints(unsigned flags) { glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); // glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); // glfwWindowHint(GLFW_DECORATED, GLFW_FALSE); // makes it non-resizable - if(flags & WINDOW_MSAA2) glfwWindowHint(GLFW_SAMPLES, 2); // x2 AA - if(flags & WINDOW_MSAA4) glfwWindowHint(GLFW_SAMPLES, 4); // x4 AA - if(flags & WINDOW_MSAA8) glfwWindowHint(GLFW_SAMPLES, 8); // x8 AA + if(flags & WINDOW_MSAA2) glfwWindowHint(GLFW_SAMPLES, 2), msaa = 2; // x2 AA + if(flags & WINDOW_MSAA4) glfwWindowHint(GLFW_SAMPLES, 4), msaa = 4; // x4 AA + if(flags & WINDOW_MSAA8) glfwWindowHint(GLFW_SAMPLES, 8), msaa = 8; // x8 AA g->flags = flags; } @@ -27899,6 +27908,9 @@ void window_color(unsigned color) { unsigned a = (color >> 24) & 255; winbgcolor = vec4(r / 255.0, g / 255.0, b / 255.0, a / 255.0); } +char window_msaa() { + return msaa; +} static int has_icon; int window_has_icon() { return has_icon; diff --git a/engine/v4k.h b/engine/v4k.h index 11533c9..88eddd9 100644 --- a/engine/v4k.h +++ b/engine/v4k.h @@ -4854,6 +4854,7 @@ API void window_loop_exit(); // exit from main loop function (emscripten onl API void window_title(const char *title); API void window_color(unsigned color); +API char window_msaa(); API vec2 window_canvas(); API void* window_handle(); API char* window_stats(); diff --git a/tools/MAKE_assimp.bat b/tools/MAKE_assimp.bat index 0965c24..0c194f1 100644 --- a/tools/MAKE_assimp.bat +++ b/tools/MAKE_assimp.bat @@ -4,7 +4,7 @@ cd `dirname $0` git clone https://github.com/assimp/assimp && cd assimp && git checkout 05115b07 -cmake -DCMAKE_BUILD_TYPE=Release -DASSIMP_BUILD_TESTS=OFF . +cmake -DCMAKE_BUILD_TYPE=Release -DASSIMP_BUILD_TESTS=OFF -D_FORTIFY_SOURCE=0 . make -j 8 cp bin/libassimp.so ../libassimp.so cp bin/libassimp.so ../libassimp.so.5