From fdb130651de99cbe67116351808c91e09c08c014 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 15 Oct 2022 12:56:19 +0200 Subject: Detect if hardware supports S3TC. --- profiler/src/main.cpp | 1 + server/TracyTexture.cpp | 28 +++++++++++++++++++++++++++- server/TracyTexture.hpp | 1 + 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp index 6035b590..a579564b 100644 --- a/profiler/src/main.cpp +++ b/profiler/src/main.cpp @@ -221,6 +221,7 @@ int main( int argc, char** argv ) ImGuiTracyContext imguiContext; Backend backend( title, DrawContents, &mainThreadTasks ); + tracy::InitTexture(); iconTex = tracy::MakeTexture(); iconThread.join(); backend.SetIcon( iconPx, iconX, iconY ); diff --git a/server/TracyTexture.cpp b/server/TracyTexture.cpp index 1fa748c2..dd07751f 100644 --- a/server/TracyTexture.cpp +++ b/server/TracyTexture.cpp @@ -1,6 +1,7 @@ #include #ifdef __EMSCRIPTEN__ +# include # include #else # include "../profiler/src/imgui/imgui_impl_opengl3_loader.h" @@ -14,6 +15,28 @@ namespace tracy { +static bool s_hardwareS3tc; + +void InitTexture() +{ +#ifdef __EMSCRIPTEN__ + s_hardwareS3tc = emscripten_webgl_enable_extension( emscripten_webgl_get_current_context(), "WEBGL_compressed_texture_s3tc" ); +#else + s_hardwareS3tc = false; + GLint num; + glGetIntegerv( GL_NUM_EXTENSIONS, &num ); + for( GLint i=0; i, bool) ); void UpdateTexture( void* tex, const char* data, int w, int h ); -- cgit v1.2.3