minimal_bug.shader 922 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. shader_type spatial;
  2. render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley,
  3. specular_schlick_ggx, unshaded;
  4. // minimal shader for bug https://github.com/godotengine/godot/issues/43055
  5. uniform float time; // >0
  6. varying vec2 fc[4];
  7. void vertex(){
  8. fc[0]=vec2(0.);
  9. fc[1]=vec2(0.);
  10. fc[2]=vec2(0.);
  11. fc[3]=vec2(0.);
  12. }
  13. void fragment ()
  14. {
  15. float tval=0.;
  16. //tval=min(time,0.); // fix - uncomment this also fix, this tval is 0 always
  17. vec2 m_uv1[4];
  18. m_uv1[0]=fc[0]+tval;
  19. m_uv1[1]=fc[1]+tval;
  20. m_uv1[2]=fc[2]+tval;
  21. m_uv1[3]=fc[3]+tval;
  22. float d=0.0;
  23. ALBEDO = vec3(0.);
  24. for (int i = 0; i < 8; i++) {
  25. int tx=int(min(time,0.)); // fix - moving this out of loop fix crash
  26. if ((tx==0)&&(i<4)) {
  27. d = m_uv1[uint(i)].x;
  28. return;
  29. } else {
  30. d = m_uv1[uint(i - 4)].x; // crash
  31. // d = m_uv1[uint(max((i - 4),0))].x; // fix
  32. }
  33. }
  34. ALBEDO = vec3(d);
  35. }