Defold 1.9.2 BETA

Defold 1.9.2 BETA

The latest beta is now released, and we invite those interested in beta testing the new features in the editor and engine to join now.
The beta period will be 2 weeks and the next planned stable release is two weeks from now.

We hope this new workflow will highlight any issues earlier, and also get valuable feedback from our users. And please comment if you come up with ideas on improving on this new workflow.

Please report any engine issues in this thread or in issues using Help → Report Issue

Thx for helping out!

Disclaimer

This is a BETA release, and it might have issues that could potentially be disruptive for you and your teams workflow. Use with caution. Use of source control for your projects is strongly recommended.

Access to the beta

Download the editor or bob.jar from http://d.defold.com/beta/

Summary

  • NEW: (#9218) Migrate dynamic GUI textures to use resource system
  • NEW: (#9236) Added function collectionproxy.set_collection() to replace collections for excluded collection proxies (Live Update functionality)
  • NEW: (#9244) Updated LuaJIT
  • NEW: (#9249) Add graphics module
  • NEW: (#9200) Make ‘image’ module excludable.
  • NEW: (#9205) Make ‘rig’ and ‘model’ modules excludable via appmanifest.
  • NEW: (#9185) Refactor shader pipeline to use SPIR-v as base
  • NEW: (#9256) The ability to launch up to four instances from the Editor on Build.
  • FIX: (#9262) Don’t attempt to preload deprecated tile_set field
  • FIX: (#9228) Upgrade GLFW to 3.4 for Win32 platforms
  • FIX: (#9224) Fix the issue where fonts with different characters generate the same glyph bank
  • FIX: (#9207) Recreate material when material resource is hot-reloaded
  • FIX: (#9216) Trigger window resize flow on GLFW3 when the window content scale changes
  • FIX: (#9223) Remove timer callback if timer freed prematurely
  • FIX: (#9231) Make non-standard OpenGL functions optional on windows
  • FIX: (#9258) Fixed issue where the scene graph can’t produce valid information for excessively long values
  • FIX: (#9220) Delete render contants from CompRenderConstants
  • FIX: (#9070) Add preference to disable build-time linting
  • FIX: (#9199) Allow copying folder’s project and absolute paths
  • FIX: (#9243) Notify language servers about file changes
  • FIX: (#9264) Fix editor crash when switching to Manual Size Mode without a texture assigned
  • FIX: (#9204) Frame the camera to the very first visible object added to the scene view

Engine

NEW: (#9185) Refactor shader pipeline to use SPIR-v as base
The shader support in Defold has gotten a major update. Defold outputs engine shaders in a pipelined manner, and currently utilises two slightly different setups: the new and the legacy pipelines. The legacy pipeline produces engine shaders the same way as before:

  • Take ES2 compatible GLSL code as input
  • Transform the shader source into ES3 / OpenGL 3 variants via mostly regexp
  • Optionally take the GL3 code and cross-compile into SPIR-v for vulkan

This setup has multiple issues:

  • The engine is using ancient GLSL code. Most modern sources of information has moved on, and so we should too
  • Each uniform is packed into their own uniform buffer, which is very inefficient
  • The ES2 → ES3 transformation is very brittle due to the nature of regular expressions
  • The GLSL code is unoptimized - there are basically no available tools that operate on old GLSL code

The new pipeline uses the same tools, but in a different order:

  • Take shaders written in at least GLSL version 140 as input
  • Generate SPIR-v via glslang
  • Run optimisation pass on the SPIR-v binary
  • Generate reflection data from the optimised shader, which will now be used by the engine for all adapters
  • At this point, we can generate shaders in whatever language and version we want via spirv-cross - including GLSL for webgl 1 / ES2, HLSL, metal and whatever else we need.

The produced shaders from this new pipeline has multiple benefits:

  • Produces optimised shaders, even for old GLSL variants
  • The engine can now use constant buffers. This means that you can pack all your uniforms into a single buffer, which can be updated in one go instead of updating each uniform individually.
  • More stable transformation of shader source into the target platform
  • The engine code for the graphics adapters is more uniform than before, which helps us to write new functionality

To utilise this new setup, shaders must be written in at least version 140 (GL3/ES3+ compatible) since that is what the spirv toolchain requires. Note that it is not required to rewrite your shaders in order to get the game to still work, but in order to use the new functionality you need to convert your shaders into the newer GLSL. In the future, all builtin shaders will be upgraded into #version 140 shaders, but for now this must be done manually.

NEW: (#9218) Migrate dynamic GUI textures to use resource system
Dynamic textures (created via gui.new_texture) are now managed by the resource system. There is no change in behaviour or function signature for how dynamic textures are managed, the biggest gain of this task is to remove GUI specific code in the engine and move some parts of the GUI system closer to the regular gameobject world, code wise.

NEW: (#9236) Added function collectionproxy.set_collection() to replace collections for excluded collection proxies (Live Update functionality)
Added a new function, collectionproxy.set_collection(), which is designed to simplify the management of resources loaded using the Live Update feature.

NEW: (#9249) Add graphics module
A new graphics script module has been added that currently only has the same graphics constants that we already use in the render and resource modules. In the future, new functionality will be added to this module for things like querying GPU extensions, max texture size and so on.

NOTE!
render and resource constants, such as render.STATE_DEPTH_TEST still exist which means that existing projects will not need to be ported to using graphics constants. However, the constants are deprecated and removed from the autocomplete as well as the documentation in favor of using the graphics module!

FIX: (#9262) Don’t attempt to preload deprecated tile_set field
Fixed an issue where loading a sprite resource with no texture samplers assigned incorrectly tries to load the tileset instead.

FIX: (#9228) Upgrade GLFW to 3.4 for Win32 platforms
Windows is now using GLFW version 3.4 for window management. The window will always be centered now and no flickering will occur when the window is opened.

FIX: (#9224) Fix the issue where fonts with different characters generate the same glyph bank
Fixed the issue where the character set wasn’t taken into account when deciding if a new glyph bank should be generated.

FIX: (#9207) Recreate material when material resource is hot-reloaded
Fixed an issue where hot-reloading shaders have no effect. The fix also applies to swapping out shaders in the material resource as well.

FIX: (#9216) Trigger window resize flow on GLFW3 when the window content scale changes
Moving the window between displays with different content scales will now trigger a window resize event on MacOS.

FIX: (#9223) Remove timer callback if timer freed prematurely
Fixed an issue where a timer was created with a callback and the timer was removed before it could complete. In this case, the lua reference to the timer callback was never released, causing a reference leak.

FIX: (#9258) Fixed issue where the scene graph can’t produce valid information for excessively long values
Fixed an issue where the scene graph produces invalid JSON when some of the values are longer than 128 characters.

FIX: (#9220) Delete render contants from CompRenderConstants
Fixed a memory leak in the engine that happens when setting component constants via constant buffers.

Editor

NEW: (#9256) The ability to launch up to four instances from the Editor on Build.
Now, in the Project menu, it is possible to pick how many instances the Editor should launch when building. This functionality is useful for developing a multiplayer project. The following features are supported:

  • Launch multiple instances of the engine.
  • Relaunch or hot-reload all instances simultaneously.
  • Relaunch, hot-reload, and debug each instance separately if a particular target is selected in the Project -> Target menu.
  • If more than one instance is launched, the instance index will be added to the window title.
  • The index is available at runtime using
local instance_index = sys.get_config_int("project.instance_index", 0)
  • If logs are enabled, each instance will use its own log file, instance_N_log.txt, where N is the instance index.
  • If more than one instance is launched, each instance will have its own debugger port: the default port + instance index.
  • A new menu option (and shortcut Ctrl+J or ‘Cmd+J’ on Mac) has been added to close the engine (all instances) from the editor. See the Project menu.

FIX: (#9264) Fix editor crash when switching to Manual Size Mode without a texture assigned
Fixed an editor crash resulting from invalid vertex buffers when using Manual Size Mode with zero-area geometry.

FIX: (#9204) Frame the camera to the very first visible object added to the scene view
It may be confusing when a visible object is added to an empty scene, but nothing is visible because the camera is too zoomed in. After this fix, the very first visible object added to a scene will be framed to ensure it is visible.

16 Likes

Thanks to all of you, again a great release. :100:
Do we have to define a version for new pipeline?

2 Likes

Yes, the short version is that you will need to specify at least #version 140 in your shader(s). I am writing a manual entry on this, but haven’t had the time to finish it yet.

7 Likes

Ah, okay, sorry. I’m just working on a shader and I would like to test it right away. I’ll wait then. :slightly_smiling_face:

1 Like

You don’t need to wait, here’s an example of a fragment shader written in version 140:

#version 140

// inputs & outputs
in vec2 var_texcoord0;
out vec4 color;

// resource bindings
uniform sampler2D texture_sampler;
uniform uniforms_fs
{
    vec4 tint;
    vec4 tint_2;
};

void main()
{
    // Pre-multiply alpha since all runtime textures already are
    vec4 tint_pm = vec4(tint.xyz * tint.w, tint.w);
    color = texture(texture_sampler, var_texcoord0.xy) * tint_pm * tint_2;
}
10 Likes

Wow! This is gold.

2 Likes

Work fine with our current project :heart:

3 Likes

I found a bug with arrays in shaders while poking around with the new shader pipeline:

2 Likes

Thank you! I’ll take a look

3 Likes

Pushed a fix for this to beta. Should be available within the hour, thanks for reporting!

4 Likes

Hello, I just created an account to say thanks you a lot for this !
I desperalty needed this :heart:

Cheers !

1 Like

Bug in beta 8201073966fb31fa605f443c28a886e5dde0c04d
Platform: Mac arm64
Attaching the debugger to a running build kills the build and relaunches it.

Steps:

  1. Project → Build
  2. Debug → Start/Attach

In previous versions this would attach the debugger to the running instance

1 Like

Thank you, I’ll take a look.

2 Likes

The fix merged into beta.
Thank you one more time for the report.

2 Likes

Thanks for the update!

Will the new graphics module be added to the API reference in time for stable release? I checked the beta version of the docs, but haven’t been able to find it.

Ah yes, I forgot a step in the build process I think. Thanks for letting us know!

Punch Legend Simulator. Worked in pc, crashed at start in web.
Was this on first start.

VM18:30 Uncaught 
RuntimeError: Aborted(Assertion failed: 0 && "Unsupported primitive_type", at: ../src/gamesys/resources/res_mesh.cpp,79,ToGraphicsPrimitiveType). Build with -sASSERTIONS for more info.
    at abort (<anonymous>:286:11)
    at ___assert_fail (<anonymous>:602:3)
    at 00ac7a4e:0x105199
    at 00ac7a4e:0x17775d
    at 00ac7a4e:0xf7ea9
    at 00ac7a4e:0x17651c
    at 00ac7a4e:0x5f4f4
    at 00ac7a4e:0x2a375
    at 00ac7a4e:0x144907
    at invoke_vii (<anonymous>:10168:29)

This on second

dmloader.js:712 ERROR:CRASH: CALL STACK:
["RuntimeError: memory access out of bounds","@wasm://wasm/00ac7a4e:wasm-function[3622]:0x177755","@wasm://wasm/00ac7a4e:wasm-function[2221]:0xf7ea9","@wasm://wasm/00ac7a4e:wasm-function[3604]:0x17651c","@wasm://wasm/00ac7a4e:wasm-function[1251]:0x5f4f4","@wasm://wasm/00ac7a4e:wasm-function[846]:0x2a375","@wasm://wasm/00ac7a4e:wasm-function[2942]:0x144907","invoke_vii@<anonymous>:10168:29","@wasm://wasm/00ac7a4e:wasm-function[1250]:0x5ec92","@wasm://wasm/00ac7a4e:wasm-function[1870]:0xbce0d","@wasm://wasm/00ac7a4e:wasm-function[911]:0x2f67f"]
CALL STACK END

printErr @ dmloader.js:712
_ @ VM149:423
runEmAsmFunction @ VM149:4875
_emscripten_asm_const_int @ VM149:4878
$func510 @ 00ac7a4e:0x4192
$Li @ 00ac7a4e:0x1fb2af
Module._JSWriteDump @ VM149:10145
ccall @ VM149:9567
window.onerror @ dmloader.js:1019
error (async)
(anonymous) @ dmloader.js:1016
dmloader.js:714 Exception thrown, see JavaScript console
VM149:30 Uncaught RuntimeError: memory access out of bounds
    at 00ac7a4e:0x177755
    at 00ac7a4e:0xf7ea9
    at 00ac7a4e:0x17651c
    at 00ac7a4e:0x5f4f4
    at 00ac7a4e:0x2a375
    at 00ac7a4e:0x144907
    at invoke_vii (<anonymous>:10168:29)
    at 00ac7a4e:0x5ec92
    at 00ac7a4e:0xbce0d
    at 00ac7a4e:0x2f67f

@jhonny.goransson you have access to repository.
https://github.com/d954mas/game-blocky-fighting

I have no ideas what is wrong(

4 Likes

Thanks, it was my mistake. This was live update issue. When update liveupdate.zip this issue was fixed

5 Likes

It would be really cool if you write a manual on the new shader pipeline before the end of beta testing, so that we have time to port our shader assets to the new pipeline and fix possible bugs :pray: