Fixed issues with emscripten build
This commit is contained in:
parent
6b3ac4dc04
commit
af32fd46c1
7 changed files with 14 additions and 6 deletions
|
|
@ -233,7 +233,7 @@ if(EMSCRIPTEN)
|
|||
endif()
|
||||
|
||||
target_compile_options(infinipaint PRIVATE -Wall -sUSE_HARFBUZZ=1 -fdiagnostics-color -sUSE_SDL=0 -include functional -fexceptions -pthread)
|
||||
target_link_options(infinipaint PRIVATE --emrun -sUSE_HARFBUZZ=1 -sUSE_SDL=0 -sFULL_ES2 -sUSE_WEBGL2=1 -sFETCH --embed-file data -sALLOW_MEMORY_GROWTH=1 -sEXPORTED_RUNTIME_METHODS=ccall -sEXPORTED_FUNCTIONS=[_main,_malloc,_free] -sMAXIMUM_MEMORY=4GB -sSINGLE_FILE -lidbfs.js -fexceptions -pthread) # -sINITIAL_MEMORY=67108864
|
||||
target_link_options(infinipaint PRIVATE --emrun -sUSE_HARFBUZZ=1 -sUSE_SDL=0 -sFULL_ES2 -sUSE_WEBGL2=1 -sFETCH --embed-file data -sALLOW_MEMORY_GROWTH=1 -sEXPORTED_RUNTIME_METHODS=ccall,HEAPU8 -sEXPORTED_FUNCTIONS=[_main,_malloc,_free] -sMAXIMUM_MEMORY=4GB -sSINGLE_FILE -lidbfs.js -fexceptions -pthread) # -sINITIAL_MEMORY=67108864
|
||||
set(CMAKE_EXECUTABLE_SUFFIX ".js")
|
||||
message("In Emscripten Mode")
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -86,11 +86,15 @@ inline void upload(std::string const &accept_types, upload_handler callback, voi
|
|||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmissing-variable-declarations"
|
||||
EM_JS_INLINE(void, download, (char const *filename, char const *mime_type, void const *buffer, size_t buffer_size), {
|
||||
EM_JS_INLINE(void, download, (char const *filename, char const *mime_type, void const *b, size_t buffer_size), {
|
||||
// Fix copied from: https://github.com/Armchair-Software/emscripten-browser-file/issues/1
|
||||
/// Offer a buffer in memory as a file to download, specifying download filename and mime type
|
||||
var a = document.createElement('a');
|
||||
a.download = UTF8ToString(filename);
|
||||
a.href = URL.createObjectURL(new Blob([new Uint8Array(Module["HEAPU8"].buffer, buffer, buffer_size)], {type: UTF8ToString(mime_type)}));
|
||||
var bufferCopy = new ArrayBuffer(buffer_size);
|
||||
var uint8Array = new Uint8Array(bufferCopy);
|
||||
uint8Array.set(new Uint8Array(Module["HEAPU8"].buffer, b, buffer_size));
|
||||
a.href = URL.createObjectURL(new Blob([uint8Array], {type: UTF8ToString(mime_type)}));
|
||||
a.click();
|
||||
});
|
||||
#pragma GCC diagnostic pop
|
||||
|
|
|
|||
|
|
@ -19,6 +19,5 @@ class LineDrawTool : public DrawingProgramToolBase {
|
|||
private:
|
||||
void commit();
|
||||
|
||||
Vector2f startAt;
|
||||
CanvasComponentContainer::ObjInfo* objInfoBeingEdited = nullptr;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,6 +21,5 @@ class TextBoxTool : public DrawingProgramToolBase {
|
|||
|
||||
Vector2f startAt;
|
||||
Vector2f endAt;
|
||||
int drawStage = 0;
|
||||
CanvasComponentContainer::ObjInfo* objInfoBeingEdited = nullptr;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ class MainProgram {
|
|||
bool applyDisplayScale = true;
|
||||
#endif
|
||||
|
||||
bool disableGraphicsDriverWorkarounds = false;
|
||||
|
||||
int defaultMSAASampleCount = 0;
|
||||
SkSurfaceProps defaultMSAASurfaceProps;
|
||||
|
||||
|
|
|
|||
|
|
@ -252,6 +252,7 @@ nlohmann::json Toolbar::get_config_json() {
|
|||
toRet["keybinds"] = jKeybinds;
|
||||
toRet["guiScale"] = guiScale;
|
||||
toRet["jumpTransitionTime"] = jumpTransitionTime;
|
||||
toRet["disableGraphicsDriverWorkarounds"] = main.window.disableGraphicsDriverWorkarounds;
|
||||
toRet["dragZoomSpeed"] = dragZoomSpeed;
|
||||
toRet["scrollZoomSpeed"] = scrollZoomSpeed;
|
||||
toRet["vsync"] = main.window.vsyncValue;
|
||||
|
|
@ -330,6 +331,8 @@ void Toolbar::set_config_json(const nlohmann::json& j, VersionNumber version) {
|
|||
try{j.at("applyDisplayScale").get_to(main.window.applyDisplayScale);} catch(...) {}
|
||||
#endif
|
||||
try{j.at("guiScale").get_to(guiScale);} catch(...) {}
|
||||
try{j.at("jumpTransitionTime").get_to(jumpTransitionTime);} catch(...) {}
|
||||
try{j.at("disableGraphicsDriverWorkarounds").get_to(main.window.disableGraphicsDriverWorkarounds);} catch(...) {}
|
||||
try{j.at("useNativeFilePicker").get_to(useNativeFilePicker);} catch(...) {}
|
||||
try{j.at("themeInUse").get_to(themeData.themeCurrentlyLoaded);} catch(...) {}
|
||||
if(version >= VersionNumber(0, 3, 0))
|
||||
|
|
@ -1701,6 +1704,7 @@ void Toolbar::options_menu() {
|
|||
gui.slider_scalar_field("scroll zoom slider", "Scroll zoom speed", &scrollZoomSpeed, 0.0, 1.0, 3);
|
||||
gui.checkbox_field("flip zoom tool direction", "Flip zoom tool direction", &flipZoomToolDirection);
|
||||
gui.checkbox_field("make all tools share same size", "Make all tools share size", &main.toolConfig.globalConf.useGlobalRelativeWidth);
|
||||
gui.checkbox_field("disable graphics driver workarounds", "Disable graphics driver workarounds (enabling or disabling this might fix some graphical glitches, requires restart)", &main.window.disableGraphicsDriverWorkarounds);
|
||||
gui.input_scalar_field("jump transition time", "Jump transition time", &jumpTransitionTime, 0.01f, 1000.0f, 2);
|
||||
gui.input_scalar_field("Max GUI Scale", "Max GUI Scale", &guiScale, 0.5f, 5.0f, 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -490,7 +490,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) {
|
|||
|
||||
GrContextOptions opts;
|
||||
opts.fSuppressPrints = true;
|
||||
opts.fDisableDriverCorrectnessWorkarounds = true; // Driver workarounds causing glitches in windows drivers
|
||||
opts.fDisableDriverCorrectnessWorkarounds = mS.m->window.disableGraphicsDriverWorkarounds; // Driver workarounds causing glitches on intel drivers on windows, but are required in the Emscripten version. Good idea to have a toggle for it
|
||||
|
||||
mS.ctx = GrDirectContexts::MakeGL(iface, opts);
|
||||
if(!mS.ctx)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue