Zakhar
January 26, 2021, 2:57pm
#1
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?
Zakhar
January 26, 2021, 3:06pm
#3
Yes, all of mine resources are added to the resources folder.
solan
January 27, 2021, 12:10am
#4
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.
Zakhar
June 10, 2021, 1:45pm
#5
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