partial emscripten working

main
Brett 2024-04-26 01:11:46 -04:00
parent 42fbae4ba1
commit 7c7e97872d
8 changed files with 22 additions and 19 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.25) cmake_minimum_required(VERSION 3.25)
set(BLT_GRAPHICS_VERSION 0.10.1) set(BLT_GRAPHICS_VERSION 0.10.2)
set(BLT_GRAPHICS_TEST_VERSION 0.0.1) set(BLT_GRAPHICS_TEST_VERSION 0.0.1)
project(BLT_WITH_GRAPHICS VERSION ${BLT_GRAPHICS_VERSION}) project(BLT_WITH_GRAPHICS VERSION ${BLT_GRAPHICS_VERSION})
@ -81,8 +81,7 @@ if (${BUILD_GRAPHICS_TESTS})
target_link_libraries(BLT_GRAPHICS_TESTS BLT_WITH_GRAPHICS) target_link_libraries(BLT_GRAPHICS_TESTS BLT_WITH_GRAPHICS)
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wpedantic -Wno-comment -Wno-strict-aliasing) include(libraries/BLT/cmake/warnings.cmake)
target_link_options(${PROJECT_NAME} PRIVATE -Wall -Wpedantic -Wno-comment -Wno-strict-aliasing -Wno-unused-function)
if (${ENABLE_ADDRSAN} MATCHES ON) if (${ENABLE_ADDRSAN} MATCHES ON)
target_compile_options(${PROJECT_NAME} PRIVATE -fsanitize=address) target_compile_options(${PROJECT_NAME} PRIVATE -fsanitize=address)
@ -109,8 +108,7 @@ if (${BUILD_EXAMPLE_BASIC})
target_link_libraries(${PROJECT_NAME} BLT_WITH_GRAPHICS) target_link_libraries(${PROJECT_NAME} BLT_WITH_GRAPHICS)
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wpedantic -Wno-comment -Wno-strict-aliasing) include(libraries/BLT/cmake/warnings.cmake)
target_link_options(${PROJECT_NAME} PRIVATE -Wall -Wpedantic -Wno-comment -Wno-strict-aliasing -Wno-unused-function)
if (${ENABLE_ADDRSAN} MATCHES ON) if (${ENABLE_ADDRSAN} MATCHES ON)
target_compile_options(${PROJECT_NAME} PRIVATE -fsanitize=address) target_compile_options(${PROJECT_NAME} PRIVATE -fsanitize=address)
@ -138,15 +136,11 @@ if (EMSCRIPTEN)
endif () endif ()
#set_target_properties(FinalProject PROPERTIES LINK_FLAGS "-sMAX_WEBGL_VERSION=2 -sASSERTIONS=1 -pthread -sPTHREAD_POOL_SIZE=8 -s INITIAL_MEMORY=134217728 -sUSE_GLFW=3 --preload-file 'assets'") #set_target_properties(FinalProject PROPERTIES LINK_FLAGS "-sMAX_WEBGL_VERSION=2 -sASSERTIONS=1 -pthread -sPTHREAD_POOL_SIZE=8 -s INITIAL_MEMORY=134217728 -sUSE_GLFW=3 --preload-file 'assets'")
set_target_properties(${TARGETS} PROPERTIES LINK_FLAGS "-sMAX_WEBGL_VERSION=2 -sASSERTIONS=1 -sUSE_GLFW=3") set_target_properties(${TARGETS} PROPERTIES LINK_FLAGS "-sMAX_WEBGL_VERSION=2 -sFULL_ES2=1 -sFULL_ES3 -sASSERTIONS=1 -sUSE_GLFW=3")
#set_target_properties(BLT_WITH_GRAPHICS PROPERTIES COMPILE_FLAGS "-pthread") #set_target_properties(BLT_WITH_GRAPHICS PROPERTIES COMPILE_FLAGS "-pthread")
target_compile_options(BLT_WITH_GRAPHICS PRIVATE -Wall -Wpedantic -Wno-comment -Wno-strict-aliasing)
target_link_options(BLT_WITH_GRAPHICS PRIVATE -Wall -Wpedantic -Wno-comment -Wno-strict-aliasing)
else () else ()
target_link_libraries(BLT_WITH_GRAPHICS PUBLIC glfw) target_link_libraries(BLT_WITH_GRAPHICS PUBLIC glfw)
target_link_libraries(BLT_WITH_GRAPHICS PUBLIC OpenAL) target_link_libraries(BLT_WITH_GRAPHICS PUBLIC OpenAL)
target_compile_options(BLT_WITH_GRAPHICS PRIVATE -Wall -Wpedantic -Wno-comment -Wno-strict-aliasing -Wno-unused-function)
target_link_options(BLT_WITH_GRAPHICS PRIVATE -Wall -Wpedantic -Wno-comment -Wno-strict-aliasing -Wno-unused-function)
endif () endif ()
include(libraries/BLT/cmake/warnings.cmake)

View File

@ -13,6 +13,9 @@
#include <glad/gl.h> #include <glad/gl.h>
#else #else
#include <GLES2/gl2.h> #include <GLES2/gl2.h>
#include <GLES3/gl3.h>
#include <GLES3/gl31.h>
#include <GLES3/gl32.h>
#include <emscripten.h> #include <emscripten.h>
#define GL_GLEXT_PROTOTYPES #define GL_GLEXT_PROTOTYPES
#define EGL_EGLEXT_PROTOTYPES #define EGL_EGLEXT_PROTOTYPES

@ -1 +1 @@
Subproject commit 325508e807f376fb7d287dbb9d80899eddb4e8ff Subproject commit 1772e9a6d7fe3bd866c4daac5546347634178cb4

@ -1 +1 @@
Subproject commit a1b06823fe2d964a62fda99385499b218cf5cea5 Subproject commit 231cbee0fc4f59dbe5b8b853a11b08dc84e57c65

@ -1 +1 @@
Subproject commit 6675317107257c2cc16c947b359d557821d85bf2 Subproject commit 111397c71a5f1c2c88e05da9c84edfdba2e472a4

View File

@ -170,7 +170,9 @@ namespace blt::gfx
glBindFramebuffer(GL_READ_FRAMEBUFFER, fboID); glBindFramebuffer(GL_READ_FRAMEBUFFER, fboID);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, draw.fboID); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, draw.fboID);
glReadBuffer(static_cast<GLuint>(attachment_read)); glReadBuffer(static_cast<GLuint>(attachment_read));
#ifdef glDrawBuffer
glDrawBuffer(static_cast<GLuint>(attachment_write)); glDrawBuffer(static_cast<GLuint>(attachment_write));
#endif
glBlitFramebuffer(srcX, srcY, width_, height_, destX, destY, draw.width_, draw.height_, GL_COLOR_BUFFER_BIT, filter); glBlitFramebuffer(srcX, srcY, width_, height_, destX, destY, draw.width_, draw.height_, GL_COLOR_BUFFER_BIT, filter);
} }

View File

@ -173,13 +173,15 @@ blt::gfx::texture_gl2D_multisample::texture_gl2D_multisample(int width, int heig
{ {
bind(); bind();
setDefaults(); setDefaults();
glTexImage2DMultisample(textureBindType, samples, colorMode, width, height, GL_TRUE); //glTexImage2DMultisample(textureBindType, samples, colorMode, width, height, GL_TRUE);
glTexStorage2DMultisample(textureBindType, samples, colorMode, width, height, GL_TRUE);
} }
void blt::gfx::texture_gl2D_multisample::resize(int width, int height) void blt::gfx::texture_gl2D_multisample::resize(int width, int height)
{ {
bind(); bind();
glTexImage2DMultisample(textureBindType, samples, textureColorMode, width, height, GL_TRUE); //glTexImage2DMultisample(textureBindType, samples, textureColorMode, width, height, GL_TRUE);
glTexStorage2DMultisample(textureBindType, samples, textureColorMode, width, height, GL_TRUE);
} }
blt::gfx::gl_texture2D_array::gl_texture2D_array(int width, int height, int layers, GLint colorMode): texture_gl(width, height, layers, colorMode) blt::gfx::gl_texture2D_array::gl_texture2D_array(int width, int height, int layers, GLint colorMode): texture_gl(width, height, layers, colorMode)

View File

@ -194,8 +194,8 @@ namespace blt::gfx
/* -- Set Window Specifics + OpenGL -- */ /* -- Set Window Specifics + OpenGL -- */
glfwMakeContextCurrent(window_state.window); glfwMakeContextCurrent(window_state.window);
glfwSwapInterval(data.sync_interval);
#ifndef __EMSCRIPTEN__ #ifndef __EMSCRIPTEN__
glfwSwapInterval(data.sync_interval);
gladLoadGL(glfwGetProcAddress); gladLoadGL(glfwGetProcAddress);
#endif #endif
@ -205,8 +205,10 @@ namespace blt::gfx
/* -- Set up ImGUI -- */ /* -- Set up ImGUI -- */
setup_ImGUI(); setup_ImGUI();
#ifdef GL_MULTISAMPLE
if (data.context.SAMPLES > 0) if (data.context.SAMPLES > 0)
glEnable(GL_MULTISAMPLE); glEnable(GL_MULTISAMPLE);
#endif
/* -- Call User Provided post-window-init function -- */ /* -- Call User Provided post-window-init function -- */
data.init(data.context); data.init(data.context);