Web assembly #6

Merged
Mergul merged 38 commits from WebAssembly into master 2020-04-14 17:44:27 +02:00
6 changed files with 17 additions and 9 deletions
Showing only changes of commit 46de0f6adb - Show all commits

3
demos/.gitignore vendored
View file

@ -11,4 +11,5 @@
!external/**/*.d
!.gitignore
!compile_wasm.py
!cimgui.bc
!cimgui.bc
.dub

View file

@ -25,9 +25,9 @@ precision lowp samplerCube;
#endif
#else
#if __VERSION__ > 320
layout(location = 0) uniform vec4 matrix_1;
layout(location = 1) uniform vec4 matrix_2;
layout(location = 2) uniform vec4 uv_transform;
uniform vec4 matrix_1;
uniform vec4 matrix_2;
uniform vec4 uv_transform;
layout(location = 0) in vec2 positions;
layout(location = 1) in vec2 tex_coords;

View file

@ -24,11 +24,11 @@ def compile(sources, output):
for f in files:
ldc_cmd += f + ' '
print ldc_cmd
print(ldc_cmd)
if os.system(ldc_cmd):
exit(0)
print
print()
shared_flags = ''
@ -74,7 +74,7 @@ for arg in sys.argv[1:]:
elif(arg == '-pthread'):
shared_flags += '-O3 '
ldc_flags += '-release -enable-inlining '
emc_flags += '-s PTHREAD_POOL_SIZE=16 -Wl,--no-check-features -s USE_PTHREADS=1 '
emc_flags += '-s PTHREAD_POOL_SIZE=16 -s USE_PTHREADS=1 '
elif(arg == '--demo=simple'):
demo = 0
else:
@ -101,6 +101,6 @@ emcc_cmd += 'cimgui.bc '
emcc_cmd += 'mmutils.bc '
emcc_cmd += 'demo.bc '
print emcc_cmd
print(emcc_cmd)
os.system(emcc_cmd)

View file

@ -16,6 +16,8 @@
"source"
],
"libs-windows-x86_64": ["libs/windows/x64/SDL2","libs/windows/x64/SDL2_Image","libs/windows/x64/cimgui"],
"libs-linux-x86_64": ["cimgui","SDL2","SDL2_image"],
"lflags-linux-x86_64": ["-rpath=libs/linux/x64/","-Llibs/linux/x64/"],
"configurations" : [
{
"name" : "default",

BIN
demos/libs/linux/x64/libcimgui.so Executable file

Binary file not shown.

View file

@ -67,7 +67,7 @@ struct Shader
}
version(WebAssembly)const char* glsl = "#version 100\n";
else const char* glsl = "#version 450\n";
else const char* glsl = "#version 330\n";
const char* buffer = data.code.ptr;
char* ver;
version(WebAssembly)ver = cast(char*)"#define ver1 1\n#define GLES\n".ptr;
@ -136,6 +136,11 @@ struct Shader
if(compile == GL_FALSE)
{
SDL_Log("Shader compile error! %u %s",data.type,glsl);
char[256] log;
int log_len;
glGetShaderInfoLog(data.gl_handle, 256, &log_len, log.ptr);
import ecs_utils.utils;
if(log_len)printf("%s",log.ptr);
return false;
}