WebGL Error: bindTexture - attempt to bind a deleted texture

WebGL Error: bindTexture - attempt to bind a deleted texture
0.0 0

#1

Hi Guys,

I got this error when testing cc.loader.release on Cocos Creator V1.4.1 and Chrome.

You can reproduce the error by calling cc.loader.getDependsRecursively followed by cc.loader.release on a prefab that you have loaded and instantiate dynamically.


Cocos Creator v1.5.0 Release!
#2

@nantas @pandamicro don’t mind having a look at this. many thanks


#3

I’m still having this issue on 1.4.2. Anyone got any idea?


#4

Hi @jake72,

did you try 1.5 beta? It contains a lot of improvements. Give it a try… :slight_smile:

Best regards,
Zsolt


#5

I tried the official release of v 1.5.0, this issue is still there


#6

You are probably releasing some textures which are still in use, then it will report this.

I assume the asset you are releasing depends on some texture / sprite frame which are shared with other assets or the scene it self. But the loader don’t know that, so it just release them for you, and during the rendering process, the renderer complain that it can’t find the texture.

The right way is to eliminate all shared assets from the dependencies, if you don’t know which ones are shared, maybe you should use a white list to release assets, don’t release anything you don’t know, and do not release their dependencies


#7

Thanks for replying. I did destroy all the node before releasing its dependencies. It is weird that on Native platform the same code works fine?


#8

Hello, it might have some relationship to animation that have textures in it. I have created a test project that able to reproduce the issue. Please have a look.

testRelease.zip (250.5 KB)


#9

@pandamicro are you guys fixing this issue? Im sorry to rush you but we need it quite urgently.


#10

Hi,@jake72, just take a look at your project

Indeed it’s related to the animation, your animation rely on single color sprite frame, so does the background in the scene.

When you release the prefab and all its dependencies, you release the single color sprite frame, which cause the background trigger the gl error.

The solution is to eliminate the single color texture / sprite frame.

The reason that it’s working on native is because native has a reference count system, it won’t release the gl texture unless nothing is using it. But on web, we can’t have the same system because JS doesn’t expose its destruction process, so we decide to delete gl texture when user release a texture asset, otherwise it could be a gpu memory leak.


#11

Hi @pandamicro,

Can we keep track of the reference count manually and add a check at the release process? It doesn’t make any sense to not share texture assets. Our projects have lots of texture and effects, most of our projects are not playable without releasing memory.


#12

Excuse me, has this problem been solved? How is it solved?


#13

What we done on our projects is keeping track each resource reference count each time it is loaded and prevent it from being release unless the reference count is 0.