iOS and MacOS shader crashes. v4.0

I have been making a game in CLion(CLion: A Cross-Platform IDE for C and C++ by JetBrains) on my mac. Everything worked fine.

Then i tried run the game from xcode and i have got crashes.

validateFunctionArguments:3577: failed assertion Fragment Function(xlatMtlMain2): missing sampler binding at index 0 for _mtlsmp_u_render_texture[0].

-[MTLDebugRenderCommandEncoder setScissorRect:]:2702: failed assertion (rect.x(0) + rect.width(1920))(1920) must be <= render pass width(1792)

The first crash happens i think there

state->setTexture(u_renderTexture, 0, renderTexture->getSprite()->getTexture()->getBackendTexture());

State is a backend::ProgramState

This crashes happen on both Apple platforms only on xcode. CLion works fine.

Are all of your resources added to the resources folder or if using cmake everything is specified there?

Yes, all of mine resources are added to the resources folder.

Did you compare corresponding lines in parameters part, between CLion and Xcode?
For example there should be difference in render pass width variable, as assert say’s.
1792 - it look’s like iphone 11 resolution, while 1920 is less iphone series.
I did not write for apple, but it would be usefull to understand where render pass width is initialized.

After 4 months I return. Hello. Can you explain about it? I have not found any solution.

I do it as in documentation(Sprite & TriangleCommand · GitBook)

state = new (std::nothrow) backend::ProgramState(program);
state->autorelease();
u_render_texture = state->getUniformLocation("u_render_texture");

In update method:

state->setTexture(u_render_texture, 0, renderTexture->getSprite()->getTexture()->getBackendTexture());

As I said before there is not any problem if I run my app from Clion or if I run my app from console like

cocos run . -p mac