"Sampler binding cc_spriteTexture at set 2 binding 12 is not bounded" crash IOS cc 3.8.7

my ios device crashed and got log when entering scene 2nd time ( cocos 3.8.7 , xcode 16.4, ios 18.5)

10:52:34 [DEBUG]: JS: [SceneManager] :: switchToScene >> from:  GameRoomScene  to:  GameRoomScene
10:52:34 [DEBUG]: JS: load scene GameRoomScene from bundle main
10:52:34 [WARN]: Triple buffer enabled for infrequently-updated buffer, consider using MemoryUsageBit::DEVICE instead
10:52:34 [DEBUG]: Init Stacktrace:  - [0]anonymous@src/cocos-js/cc.9f18a.js:27063:22
 - [1]tick@src/cocos-js/cc.9f18a.js:35114:24
 - [2]_updateCallback@src/cocos-js/cc.9f18a.js:37304:22
 - [3]anonymous@src/cocos-js/cc.9f18a.js:35246:20
 - [4]tick@jsb-adapter/web-adapter.js:551:7
10:52:34 [WARN]: Triple buffer enabled for infrequently-updated buffer, consider using MemoryUsageBit::DEVICE instead
10:52:34 [DEBUG]: Init Stacktrace:  - [0]anonymous@src/cocos-js/cc.9f18a.js:27063:22
 - [1]tick@src/cocos-js/cc.9f18a.js:35114:24
 - [2]_updateCallback@src/cocos-js/cc.9f18a.js:37304:22
 - [3]anonymous@src/cocos-js/cc.9f18a.js:35246:20
 - [4]tick@jsb-adapter/web-adapter.js:551:7
10:52:34 [WARN]: Triple buffer enabled for infrequently-updated buffer, consider using MemoryUsageBit::DEVICE instead
10:52:34 [DEBUG]: Init Stacktrace:  - [0]anonymous@src/cocos-js/cc.9f18a.js:27063:22
 - [1]tick@src/cocos-js/cc.9f18a.js:35114:24
 - [2]_updateCallback@src/cocos-js/cc.9f18a.js:37304:22
 - [3]anonymous@src/cocos-js/cc.9f18a.js:35246:20
 - [4]tick@jsb-adapter/web-adapter.js:551:7
10:52:34 [WARN]: Triple buffer enabled for infrequently-updated buffer, consider using MemoryUsageBit::DEVICE instead
10:52:34 [DEBUG]: Init Stacktrace:  - [0]anonymous@src/cocos-js/cc.9f18a.js:27063:22
 - [1]tick@src/cocos-js/cc.9f18a.js:35114:24
 - [2]_updateCallback@src/cocos-js/cc.9f18a.js:37304:22
 - [3]anonymous@src/cocos-js/cc.9f18a.js:35246:20
 - [4]tick@jsb-adapter/web-adapter.js:551:7
10:52:34 [DEBUG]: JS: [BaseScene] :: onDisable >>  ShopScene
10:52:34 [ERROR]: JS: TypeError: Cannot read properties of undefined (reading 'blendState')
TypeError: Cannot read properties of undefined (reading 'blendState')
    at Sprite._updateBlendFunc (src/cocos-js/cc.9f18a.js:42520:59)
    at Sprite.updateMaterial (src/cocos-js/cc.9f18a.js:42477:16)
    at Sprite.changeMaterialForDefine (src/cocos-js/cc.9f18a.js:43501:18)
    at Sprite.__preload (src/cocos-js/cc.9f18a.js:43449:16)
    at eval (eval at createInvokeImplJit (src/cocos-js/cc.9f18a.js:30845:63), <anonymous>:3:65)
    at UnsortedInvoker._invoke (src/cocos-js/cc.9f18a.js:30852:13)
    at UnsortedInvoker.invoke (src/cocos-js/cc.9f18a.js:31012:16)
    at NodeActivator.activateNode (src/cocos-js/cc.9f18a.js:31058:28)
    at Scene._activate (src/cocos-js/cc.9f18a.js:30684:42)
    at Director.runSceneImmediate (src/cocos-js/cc.9f18a.js:34968:17)
10:52:34 [DEBUG]: JS: [BaseScene] :: onEnable >>  GameRoomScene
10:52:34 [ERROR]: [ERROR] file /Users/lap15568-local/Downloads/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/application/CocosApplication.cpp: line 173 
10:52:34 [ERROR]: 
Uncaught Exception:
 - location :  src/cocos-js/cc.9f18a.js:42520:58: 
          let target = this.getRenderMaterial(0).passes[0].blendState.targets[0];
                                                          ^

 - msg : TypeError: Cannot read properties of undefined (reading 'blendState')

 - detail : 
      TypeError: Cannot read properties of undefined (reading 'blendState')
    at Sprite._updateBlendFunc (src/cocos-js/cc.9f18a.js:42520:59)
    at Sprite.updateMaterial (src/cocos-js/cc.9f18a.js:42477:16)
    at Sprite.onEnable (src/cocos-js/cc.9f18a.js:42377:16)
    at Sprite.onEnable (src/cocos-js/cc.9f18a.js:43453:17)
    at OneOffInvoker.invokeOnEnable [as _invoke] (src/cocos-js/cc.9f18a.js:30882:18)
    at OneOffInvoker.invoke (src/cocos-js/cc.9f18a.js:30800:18)
    at NodeActivator.activateNode (src/cocos-js/cc.9f18a.js:31060:29)
    at Scene._activate (src/cocos-js/cc.9f18a.js:30684:42)
    at Director.runSceneImmediate (src/cocos-js/cc.9f18a.js:34968:17)
    at src/cocos-js/cc.9f18a.js:34986:18

10:52:34 [ERROR]: JS: src/cocos-js/cc.9f18a.js:42520:58: 
          let target = this.getRenderMaterial(0).passes[0].blendState.targets[0];
                                                          ^
 TypeError: Cannot read properties of undefined (reading 'blendState')
 TypeError: Cannot read properties of undefined (reading 'blendState')
    at Sprite._updateBlendFunc (src/cocos-js/cc.9f18a.js:42520:59)
    at Sprite.updateMaterial (src/cocos-js/cc.9f18a.js:42477:16)
    at Sprite.onEnable (src/cocos-js/cc.9f18a.js:42377:16)
    at Sprite.onEnable (src/cocos-js/cc.9f18a.js:43453:17)
    at OneOffInvoker.invokeOnEnable [as _invoke] (src/cocos-js/cc.9f18a.js:30882:18)
    at OneOffInvoker.invoke (src/cocos-js/cc.9f18a.js:30800:18)
    at NodeActivator.activateNode (src/cocos-js/cc.9f18a.js:31060:29)
    at Scene._activate (src/cocos-js/cc.9f18a.js:30684:42)
    at Director.runSceneImmediate (src/cocos-js/cc.9f18a.js:34968:17)
    at src/cocos-js/cc.9f18a.js:34986:18
10:52:34 [ERROR]: [SE_ERROR]  (/Users/lap15568-local/Downloads/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/bindings/jswrapper/v8/Object.cpp, 821): Invoking function (0x13047c8c0) failed!
10:52:34 [DEBUG]: JS: [golden-treasure] :: getGoldenTreasure >> resp:  [object Object]
10:52:34 [DEBUG]: JS: %c%s %c%s | %c%s background:#282A36;color:#8BE9FD  | INFO   background:#6272A4;color:white 2025-07-09 10:52:34 color:#8BE9FD  ▶ [BasePlugin] :: start >> key:  GameRoomScene
10:52:34 [DEBUG]: JS: %c%s %c%s | %c%s background:#282A36;color:#8BE9FD  | INFO   background:#6272A4;color:white 2025-07-09 10:52:34 color:#8BE9FD  ▶ [BasePlugin] :: start >> key:  GameRoomScene
10:52:34 [DEBUG]: JS: %c%s %c%s | %c%s background:#282A36;color:#8BE9FD  | INFO   background:#6272A4;color:white 2025-07-09 10:52:34 color:#8BE9FD  ▶ [BasePlugin] :: start >> key:  GameRoomScene
10:52:34 [DEBUG]: JS: %c%s %c%s | %c%s background:#282A36;color:#8BE9FD  | INFO   background:#6272A4;color:white 2025-07-09 10:52:34 color:#8BE9FD  ▶ [BasePlugin] :: start >> key:  GameRoomScene
10:52:34 [DEBUG]: JS: [GameRoomScene] :: GAME START!!!
10:52:34 [DEBUG]: JS: [GameRoomScene] :: reactToTreasureActivatedOrNot >> value:  false
10:52:34 [ERROR]: [ERROR] file /Users/lap15568-local/Downloads/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/renderer/gfx-metal/MTLCommandBuffer.mm: line 908 
10:52:34 [ERROR]: Sampler binding cc_spriteTexture at set 2 binding 12 is not bounded.
10:52:34 [ERROR]: [ERROR] file /Users/lap15568-local/Downloads/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/renderer/gfx-metal/MTLCommandBuffer.mm: line 908 
10:52:34 [ERROR]: Sampler binding cc_spriteTexture at set 2 binding 12 is not bounded.
10:52:34 [ERROR]: [ERROR] file /Users/lap15568-local/Downloads/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/renderer/gfx-metal/MTLCommandBuffer.mm: line 908 
10:52:34 [ERROR]: Sampler binding cc_spriteTexture at set 2 binding 12 is not bounded.
-[MTLDebugRenderCommandEncoder validateCommonDrawErrors:]:5843: failed assertion `Draw Errors Validation
Fragment Function(main0): missing sampler binding at index 0 for cc_spriteTextureSmplr[0].
'
-[MTLDebugRenderCommandEncoder validateCommonDrawErrors:]:5843: failed assertion `Draw Errors Validation
Fragment Function(main0): missing sampler binding at index 0 for cc_spriteTextureSmplr[0].
'

Read this https_forum.cocosengine.org/t/cocos-creator-v3-8-6-break-astc-texture-compression/62018 (sorry, the system does not allow me to to post links)

1 Like

@enj0y thanks for reply this post. I have already read this post. I have already chose option Skip Compress Texture in build option and have already tried set cache mode of label from char to none but nothing work :frowning:

still can’t find out where the error is :frowning:. @Tom_k @zhangxm need some help please

The issue means shader use the cc_spriteTexture but not bound the set and binding. Could you please find which shader occurs the error, and provide the shader to us for a check.


Normally you can use layout to set the binding to cc_spriteTexture.

Hi @Tom_k thanks for reply. i finally resolve this bug. i have to custom enginge to pass this bug with if check because i got this log ‘Cannot read properties of undefined (reading ‘blendState’)’

.
I use render texture and camera use render texture to render shadow fish and fish

1 Like