precision.frag 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #version 100
  2. varying vec3 color; // ERRROR, there is no default qualifier for float
  3. lowp vec2 foo(mediump vec3 mv3)
  4. {
  5. highp vec4 hv4;
  6. return hv4.xy;
  7. }
  8. int global_medium;
  9. uniform lowp sampler2D samplerLow;
  10. uniform mediump sampler2D samplerMed;
  11. uniform highp sampler2D samplerHigh;
  12. precision highp int;
  13. precision highp ivec2; // ERROR
  14. precision mediump int[2]; // ERROR
  15. vec4 uint; // okay
  16. precision mediump vec4; // ERROR
  17. int global_high;
  18. void main()
  19. {
  20. lowp int sum = global_medium + global_high;
  21. gl_FragColor = vec4(color, 1.0);
  22. int level1_high;
  23. sum += level1_high;
  24. precision lowp int;
  25. int level1_low;
  26. sum += level1_low;
  27. // test maxing precisions of args to get precision of builtin
  28. lowp float arg1;
  29. mediump float arg2;
  30. lowp float d = distance(arg1, arg2);
  31. {
  32. int level2_low;
  33. sum += level2_low;
  34. precision highp int;
  35. int level2_high;
  36. sum += level2_high;
  37. do {
  38. if (true) {
  39. precision mediump int;
  40. int level4_medium;
  41. sum += level4_medium;
  42. }
  43. int level3_high;
  44. sum += level3_high;
  45. } while (true);
  46. int level2_high2;
  47. sum += level2_high2;
  48. }
  49. int level1_low3;
  50. sum += level1_low3;
  51. sum += 4 + ((ivec2(level1_low3) * ivec2(level1_high) + ivec2((/* comma operator */level1_low3, level1_high)))).x;
  52. texture2D(samplerLow, vec2(0.1, 0.2));
  53. texture2D(samplerMed, vec2(0.1, 0.2));
  54. texture2D(samplerHigh, vec2(0.1, 0.2));
  55. }
  56. precision mediump bool; // ERROR
  57. //precision mediump struct { int a; } s; // ERROR
  58. struct s {int a;};
  59. precision mediump s; // ERROR
  60. mediump bvec2 b2; // ERROR