Metal crash upon adding SKSpriteNode to SKEffectNode
Metal crash upon adding SKSpriteNode to SKEffectNode
> -[MTLDebugRenderCommandEncoder setScissorRect:]:2028: failed assertion (rect.x(0) + rect.width(1080))(1080) must be <= 240
I am getting this crash when adding a simple SKSpriteNode to a SKEffectNode with the following code
SKSpriteNode *warpSprite = [SKSpriteNode spriteNodeWithImageNamed:@"art.scnassets/symbol.png"];
SKEffectNode *entryEffectsNode = [[SKEffectNode alloc] init];
[entryEffectsNode addChild:warpSprite];
[self addChild:entryEffectsNode];
I have not touched these nodes anywhere else in my project, when i change the sprite the value in (must be <=value) changes within the error.
Edit: I have replaced the sprite image with a simple spriteNodeWithColor:Size: and the (<=value) is always twice size of the sprite. Also it should be noted that the SKScene is being used as a overlay in a SceneKit scene.
I have created a seperate SKScene with the following code, which still results in the same error.
@implementation testScene
-(id)initWithSize:(CGSize)size {
if (self = [super initWithSize:size]) {
SKSpriteNode *testSprite = [SKSpriteNode spriteNodeWithColor:[SKColor purpleColor] size:CGSizeMake(100, 100)];
SKEffectNode *testEffect = [[SKEffectNode alloc] init];
[testEffect addChild:testSprite];
[self addChild:testEffect];
}
return self;
}
@end
Edit 2: I have just tested the above scene as an overlay on a default SceneKit Project and it crashes with the same error.
Edit 3: I have reproduced this using swift. Bug report summited to Apple.
K2-Think
The crash occurs due to a Metal assertion related to the scissor rect when using SKEffectNode in a SpriteKit scene overlaid on a SceneKit scene. Here's the breakdown and solution:
Issue Analysis:
The error -[MTLDebugRenderCommandEncoder setScissorRect:]: ... must be <= 240 indicates that the scissor rect's calculated width exceeds the allowed render target width. This happens when the `SK...
GPT-5
This isn’t a bug in your code. It’s a SpriteKit/SceneKit issue that shows up when an SKScene (used as SCNView.overlaySKScene) contains an SKEffectNode and SceneKit is rendering with Metal. The Metal validation layer asserts because the scissor rect SpriteKit sets is computed in a different scale (points) than the temporary render target (pixels), hence the “must be <= …” value that tracks roughly ...
Claude Opus 4
This appears to be a Metal rendering issue that occurs when using SKEffectNode as an overlay in a SceneKit scene. The error message indicates that the scissor rectangle is being set incorrectly, with dimensions that exceed the allowed bounds.
Root Cause
The crash occurs because there's a mismatch between the coordinate systems or render target sizes when SpriteKit is used as an overlay on S...
o3 Pro
What you’re seeing is not a problem with the way you create the nodes – it is a SceneKit / SpriteKit / Metal bug that appears as soon as an SKEffectNode finds itself inside an SKScene that SceneKit renders with Metal (which is the default in iOS 10).
The numbers in the assertion tell the story:
rect.x 0 + rect.width 1080 -> 1080 (SpriteKit asks Metal to draw 1080 px wide)
must be <= ...
o4 mini
This isn’t anything you’ve done wrong – it turns out to be a bug in SpriteKit’s Metal‐based renderer, specifically in the code that SKEffectNode uses to render its children into an off–screen texture and set up a scissor-rect. In your case (a SceneKit overlay) SpriteKit winds up creating a tiny backing texture (≈240 px wide) but then asks Metal to set a scissor rect that is the size of your sprit...
Gemini 2.5 Pro
Hello! Based on the detailed information and excellent debugging you've done, I can provide a clear explanation and a common workaround for this issue.
Diagnosis of the Problem
You have correctly identified this as a framework bug. Specifically, it's a well-known issue that arises from the interaction between SceneKit's rendering loop and SpriteKit's SKEffectNode when used in an `SCNView.o...
o3
You are not doing anything wrong.
The problem is a framework bug that appears when an SKEffectNode is rendered by
SpriteKit through the overlaySKScene property of an SCNView (or of an
ARSCNView).
During the off-screen pass that SKEffectNode performs, SpriteKit builds a
scissor rectangle that is expressed in the scene’s point coordinates, but it
hands that rectangle to Metal for a render ta...
DeepSeek R1
-[MTLDebugRenderCommandEncoder setScissorRect:]:2028: failed assertion (rect.x(0) + rect.width(1080))(1080) must be <= 240
The error indicates that the scissor rectangle being set in Metal has a width that is ...
Claude 3.7 Sonnet
Metal Crash When Adding SKSpriteNode to SKEffectNode
This error indicates a sizing issue in Metal when rendering your SKEffectNode with its child sprite. The specific error:
-[MTLDebugRenderCommandEncoder setScissorRect:]:2028: failed assertion (rect.x(0) + rect.width(1080))(1080) must be <= 240
Suggests that Metal is trying to set a scissor rectangle that exceeds the allowed bounds...
You need to be logged in to submit an answer