You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've written a custom shader that renders polygons using the SDF math for general polygons. The code copies verbatim the Inigo Quilez's implementation that can be found here at this shadertoy. The only difference being that if the SDF distance is positive then we call discard and stop any writing to the fragment buffer.
This renders perfectly, and has been working for a long time in production without problem. After receiving a new laptop it seems that the logic still works with the rendering pass, but fails with picking on my Mac M3 Max. The issue is that with the picking pass, the call to readpixels always reads a [0,0,0,0] color which doesn't map to any object.
There are some suboptimal workarounds:
set the frag color and return instead of calling discard
restrict the for loop over the polygons to 16 vertices
use inigo's original shader that does less work per for loop, but more for loops.
The first solution leads to issues when polygons overlap.
The second solution means I can't render polygons with more points.
The third solution is slower due to more looping and extra local state.
All of these partial solutions all seem very unrelated, so I assume there is something weird going on either in Angle or in the proprietary gpu driver itself.
My question is for next steps. Has anyone seen anything like this? Or heard of similar bugs? Any magic #pragmas to try (optimze and debug do nothing). Any thoughts on why the render pass is working, but not the picking? I have verified that I can render the picking colors as the frag colors, so those seem to be created correctly.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I've written a custom shader that renders polygons using the SDF math for general polygons. The code copies verbatim the Inigo Quilez's implementation that can be found here at this shadertoy. The only difference being that if the SDF distance is positive then we call
discard
and stop any writing to the fragment buffer.This renders perfectly, and has been working for a long time in production without problem. After receiving a new laptop it seems that the logic still works with the rendering pass, but fails with picking on my Mac M3 Max. The issue is that with the picking pass, the call to
readpixels
always reads a[0,0,0,0]
color which doesn't map to any object.There are some suboptimal workarounds:
for
loop over the polygons to 16 verticesfor
loop, but more for loops.The first solution leads to issues when polygons overlap.
The second solution means I can't render polygons with more points.
The third solution is slower due to more looping and extra local state.
All of these partial solutions all seem very unrelated, so I assume there is something weird going on either in Angle or in the proprietary gpu driver itself.
My question is for next steps. Has anyone seen anything like this? Or heard of similar bugs? Any magic
#pragma
s to try (optimze and debug do nothing). Any thoughts on why the render pass is working, but not the picking? I have verified that I can render the picking colors as the frag colors, so those seem to be created correctly.Nothing in the angle bugs here jumps out to me.
Beta Was this translation helpful? Give feedback.
All reactions