defold
defold copied to clipboard
The game does not run on the html5 platform
Describe the bug (REQUIRED) My game is on the Yandex Games web platform and sometimes when I start the game for reasons I don't understand it won't start and I only see a black screen. The following errors are displayed in the console:
v2:1 Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment
v2:1 exception thrown: RuntimeError: abort(Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment). Build with -s ASSERTIONS=1 for more info.,RuntimeError: abort(Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment). Build with -s ASSERTIONS=1 for more info.
at abort (<anonymous>:1:12355)
at ___assert_fail (<anonymous>:1:37497)
at wasm://wasm/0081e562:wasm-function[855]:0x1a275
at wasm://wasm/0081e562:wasm-function[2181]:0xa1f53
at wasm://wasm/0081e562:wasm-function[4090]:0x145af2
at wasm://wasm/0081e562:wasm-function[1599]:0x63c28
at wasm://wasm/0081e562:wasm-function[3595]:0x11e71d
at wasm://wasm/0081e562:wasm-function[1243]:0x3cc1a
at wasm://wasm/0081e562:wasm-function[1839]:0x7d68b
at wasm://wasm/0081e562:wasm-function[710]:0xe995
dmloader.js:646 INFO:CRASH: Successfully wrote Crashdump to file: /data/.Defold/_crash
v2:1 ERROR:CRASH: CALL STACK:
v2:1 ["RuntimeError: abort(Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment). Build with -s ASSERTIONS=1 for more info.","abort@<anonymous>:1:12355","___assert_fail@<anonymous>:1:37497","@wasm://wasm/0081e562:wasm-function[855]:0x1a275","@wasm://wasm/0081e562:wasm-function[2181]:0xa1f53","@wasm://wasm/0081e562:wasm-function[4090]:0x145af2","@wasm://wasm/0081e562:wasm-function[1599]:0x63c28","@wasm://wasm/0081e562:wasm-function[3595]:0x11e71d","@wasm://wasm/0081e562:wasm-function[1243]:0x3cc1a","@wasm://wasm/0081e562:wasm-function[1839]:0x7d68b","@wasm://wasm/0081e562:wasm-function[710]:0xe995"]Lua Callstack:
v2:1 render/postprocess.render_script:26: in function create_render_target
v2:1 render/postprocess.render_script:30: in function create_render_targets
v2:1 render/postprocess.render_script:55: in function <render/postprocess.render_script:34>
v2:1
v2:1 CALL STACK END
dmloader.js:649 Exception thrown, see JavaScript console
v2:1 Uncaught RuntimeError: abort(Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment). Build with -s ASSERTIONS=1 for more info.
Object
VM565:1 Uncaught RuntimeError: abort(Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment). Build with -s ASSERTIONS=1 for more info.
at abort (<anonymous>:1:12355)
at ___assert_fail (<anonymous>:1:37497)
at 0081e562:0x1a275
at 0081e562:0xa1f53
at 0081e562:0x145af2
at 0081e562:0x63c28
at 0081e562:0x11e71d
at 0081e562:0x3cc1a
at 0081e562:0x7d68b
at 0081e562:0xe995
The following is written to the file /data/.Defold/_crash:
I have an extension in my dependency that is causing this error: https://github.com/TheKing0x9/horri-fold/archive/refs/tags/v1.0.0-beta.3.zip
Full list of dependencies: dependencies#0 = https://github.com/indiesoftby/defold-yagames/archive/refs/tags/0.10.0.zip dependencies#1 = https://github.com/britzl/ludobits/archive/refs/tags/7.4.0.zip dependencies#2 = https://github.com/defold/lua-language-server/releases/download/v0.0.5/release.zip dependencies#3 = https://github.com/selimanac/defold-astar/archive/master.zip dependencies#4 = https://github.com/britzl/defold-orthographic/archive/master.zip dependencies#5 = https://github.com/defold/extension-lua-preprocessor/archive/refs/tags/1.1.3.zip dependencies#6 = https://github.com/AGulev/drawpixels/archive/refs/tags/2.0.1.zip dependencies#7 = https://github.com/TheKing0x9/horri-fold/archive/refs/tags/v1.0.0-beta.3.zip dependencies#8 = https://github.com/Insality/druid/archive/refs/tags/0.11.0.zip dependencies#9 = https://github.com/britzl/defold-input/archive/refs/tags/4.6.1.zip dependencies#10 = https://github.com/subsoap/defglot/archive/master.zip dependencies#11 = https://github.com/britzl/defold-metrics/archive/master.zip
To Reproduce (REQUIRED) I don't know if this error will work for you, but you can do the following
- Put the dependency: https://github.com/TheKing0x9/horri-fold/archive/refs/tags/v1.0.0-beta.3.zip
- Use render script from horri-fold library
- Bundle the release version for the html5 platform
- Try to run the game several times and catch the error
Expected behavior (REQUIRED) The game starts without errors
Defold version (REQUIRED):
| Build time | 2024-04-05T07:34:48.512723 |
| Defold channel | alpha |
| Defold editor sha | 3e1b2edbded3eaef762f8d416a74714613ece137 |
| Defold engine sha | 3e1b2edbded3eaef762f8d416a74714613ece137 |
| Defold version | 1.7.1 |
| GPU | NVIDIA GeForce GTX 660/PCIe/SSE2 |
| GPU Driver | 4.6.0 NVIDIA 474.14 |
| Java version | 17.0.5+8 |
| OS arch | amd64 |
| OS name | Windows 11 |
| OS version | 10.0 |
Could you please attach the full log from the browser console? And the same build is working on Windows?
Could you please share a minimal repro case?
@britzl, I think I've figured out what the problem is. The problem lies in the render.render_target() function, namely when render.BUFFER_COLOR_BIT parameter is passed with width or height equal to zero:
local color_params = {
format = render.FORMAT_RGBA,
width = render.get_window_width(), -- Getting zero
height = render.get_window_height(), -- Getting zero
min_filter = render.FILTER_LINEAR,
mag_filter = render.FILTER_LINEAR,
u_wrap = render.WRAP_CLAMP_TO_EDGE,
v_wrap = render.WRAP_CLAMP_TO_EDGE
}
return render.render_target(name, {[render.BUFFER_COLOR_BIT] = color_params })
For some reason render.get_window_width() and render.get_window_height() sometimes return zero when the game starts. Apparently it is related to the Yandex Games platform. And when the render.render_target() function receives the render.BUFFER_COLOR_BIT parameter with a width or height equal to zero, this error occurs:
v2:1 Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment
v2:1 exception thrown: RuntimeError: abort(Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment). Build with -s ASSERTIONS=1 for more info.,RuntimeError: abort(Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment). Build with -s ASSERTIONS=1 for more info.
at abort (<anonymous>:1:12355)
at ___assert_fail (<anonymous>:1:37497)
at wasm://wasm/0081e562:wasm-function[855]:0x1a275
at wasm://wasm/0081e562:wasm-function[2181]:0xa1f53
at wasm://wasm/0081e562:wasm-function[4090]:0x145af2
at wasm://wasm/0081e562:wasm-function[1599]:0x63c28
at wasm://wasm/0081e562:wasm-function[3595]:0x11e71d
at wasm://wasm/0081e562:wasm-function[1243]:0x3cc1a
at wasm://wasm/0081e562:wasm-function[1839]:0x7d68b
at wasm://wasm/0081e562:wasm-function[710]:0xe995
dmloader.js:646 INFO:CRASH: Successfully wrote Crashdump to file: /data/.Defold/_crash
v2:1 ERROR:CRASH: CALL STACK:
v2:1 ["RuntimeError: abort(Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment). Build with -s ASSERTIONS=1 for more info.","abort@<anonymous>:1:12355","___assert_fail@<anonymous>:1:37497","@wasm://wasm/0081e562:wasm-function[855]:0x1a275","@wasm://wasm/0081e562:wasm-function[2181]:0xa1f53","@wasm://wasm/0081e562:wasm-function[4090]:0x145af2","@wasm://wasm/0081e562:wasm-function[1599]:0x63c28","@wasm://wasm/0081e562:wasm-function[3595]:0x11e71d","@wasm://wasm/0081e562:wasm-function[1243]:0x3cc1a","@wasm://wasm/0081e562:wasm-function[1839]:0x7d68b","@wasm://wasm/0081e562:wasm-function[710]:0xe995"]Lua Callstack:
v2:1 render/postprocess.render_script:26: in function create_render_target
v2:1 render/postprocess.render_script:30: in function create_render_targets
v2:1 render/postprocess.render_script:55: in function <render/postprocess.render_script:34>
v2:1
v2:1 CALL STACK END
dmloader.js:649 Exception thrown, see JavaScript console
v2:1 Uncaught RuntimeError: abort(Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment). Build with -s ASSERTIONS=1 for more info.
Object
VM565:1 Uncaught RuntimeError: abort(Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment). Build with -s ASSERTIONS=1 for more info.
at abort (<anonymous>:1:12355)
at ___assert_fail (<anonymous>:1:37497)
at 0081e562:0x1a275
at 0081e562:0xa1f53
at 0081e562:0x145af2
at 0081e562:0x63c28
at 0081e562:0x11e71d
at 0081e562:0x3cc1a
at 0081e562:0x7d68b
at 0081e562:0xe995
For some reason render.get_window_width() and render.get_window_height() sometimes return zero when the game starts. Apparently it is related to the Yandex Games platform.
I've seen similar things elsewhere when going back to a previously minified window or when a tab has been in the background. It is of course possible to check if width and height is empty and do nothing that frame, but still, the engine should not crash. We will look into it.