• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

HTML5 draw_texture_flush() doesn't work in HTML5?

Ricardo

Member
Hi there! I'm working in a visual novel game that has a LOT of images, and that's why I ensure to use draw_texture_flush() when changing levels no keep VRAM usage as low as possible.

Doing some test with GPU-Z, I've noticed that, in Windows (with "Create textures on demand" option enabled), draw_texture_flush() do its works perfectly and memory usage drops consistently when the function is called.

On the other hand, in HTML5 (using Chrome or Firefox), I've noticed that the VRAM usage is not affected in any way by draw_texture_flush(). The amount of VRAM increase during the game progress and no matter what I do, It simply never drops unless I close the tab. I tracked this using GPU-Z,Chrome's task manager and Firefox's about:memory option - the result is congruent in all tools.

The manual doesn't state that draw_texture_flush() doesn't work in HTML5, so I presume that this behaviour is a bug - or maybe the manual is outdated or perhaps this conduct is expected in these browser I tested.

Someone know something about this problem? I really need this function working in my game.
 

Ricardo

Member
Looks like simulate a WebGL context loss does the trick and the memory is released:
E.g.:
var WEBGL_lose_context = gl.getExtension('WEBGL_lose_context');
WEBGL_lose_context.loseContext();

However, when restoring the context ( E.g.: WEBGL_lose_context.restoreContext() ) the game break with erros like "WebGL: INVALID_OPERATION: useProgram: object not from this context".

GMS's JS engine must have a WebGL context loss/restore system. Anyone know how can I call it manually?
 
Top