Currently if you provide a mesh with invalid vertex layout e.g. aPosition attribute missing the pex-context will crash via failed assert . e.g.
assert.fail(`Can't set uniform "${name}" with a null value`)
assert.fail(`Command is missing attribute "${name}" at location ${location} with ${attrib}`)
It's annoying because it's breaking e.g. pex-renderer render loop and the whole app stops so the options are as follows
a) crash and ask you to fix code immediately
b) don’t render invalid meshes
c) don’t render invalid meshes and print warning (forever and ever every frame..)
Currently option a) is implemented. After discussion with @nicknikolov I tried to implement option c) but it's not without issues:
currently logs are printed via debug module so invisible by default until enabled
printing log every frame to dev tools via console.warn le basically freezes Safari especially if there is some data attached (e.g. whole command object)
printing the message once requires dirty flags and pollution with magic obj._sth variables attached to e.g. command or the geometry
I'm currently leaning towards keeping option a) as null uniform or missing mesh attribute usually indicates invalid data or algorithm error. If we want to avoid our render loop being broken or app crashing some kind of watchdogs should be in the higher layers. E.g. pex-renderer switches to "show 100% red material" for shaders that failed to compile. In the case of geometry would that be a Cube? what if fullscreen quad fails?
Currently if you provide a mesh with invalid vertex layout e.g. aPosition attribute missing the
pex-context
will crash via failedassert
. e.g.It's annoying because it's breaking e.g. pex-renderer render loop and the whole app stops so the options are as follows
a) crash and ask you to fix code immediately b) don’t render invalid meshes c) don’t render invalid meshes and print warning (forever and ever every frame..)
Currently option a) is implemented. After discussion with @nicknikolov I tried to implement option c) but it's not without issues:
debug
module so invisible by default until enabledI'm currently leaning towards keeping option a) as null uniform or missing mesh attribute usually indicates invalid data or algorithm error. If we want to avoid our render loop being broken or app crashing some kind of watchdogs should be in the higher layers. E.g. pex-renderer switches to "show 100% red material" for shaders that failed to compile. In the case of geometry would that be a Cube? what if fullscreen quad fails?
Thoughts?