Drawing a citro2d scene with 2 shaders?

Post Reply
TheGag96
Posts: 7
Joined: Wed Oct 23, 2019 1:33 am

Drawing a citro2d scene with 2 shaders?

Post by TheGag96 » Tue Sep 14, 2021 4:18 am

Hi, all. In trying to create an effect for the homebrew I'm working on, I created an example where I modified citro2d to use a shader I wrote. I then tried extending citro2d to be able to use one of two shaders at will, and created a scene where I draw some sprites with one shader then switch to using the other. The moment I attempt to draw something with the other shader active, the GPU hangs when running on real hardware. On Citra, everything works as I intend.

I'm really at my wit's end. Anyone have any idea as to what kinds of stuff hangs the GPU? It baffles me because the composite-scene example in the 3ds-examples repo I'm taking cues from of course works just fine...

Thanks!!

TheGag96
Posts: 7
Joined: Wed Oct 23, 2019 1:33 am

Re: Drawing a citro2d scene with 2 shaders?

Post by TheGag96 » Tue Oct 12, 2021 4:49 am

After struggling a little while with this, I finally figured it out. The issue appears to be that the GPU does not like it if you try to draw using a shader program with a geo component and another without one in the same frame. (I'm assuming it's not just some quirk of citro3d/2d, at least.) You could draw one frame with only a vertex shader, then the next with both a vertex and geo shader, and it would work just fine. They just have to match from frame to frame.

Why hasn't this been documented anywhere? Has anyone else come across this?

elhobbs
Posts: 356
Joined: Thu Jul 02, 2009 1:19 pm

Re: Drawing a citro2d scene with 2 shaders?

Post by elhobbs » Sun Oct 17, 2021 4:16 am

I think I may have experienced a similar issue. I was trying to add a geo shader for a particle system. The geo shader was only used in frames where particles were visible. It would work for a little while but the gpu would hang after particles were rendered. I assumed I was doing something wrong - but maybe not? This makes me think there is an issue with citro3d.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest