vulkan.frag 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #version 450
  2. uniform sampler s; // ERROR, no binding
  3. uniform sampler sA[4]; // ERROR, no binding
  4. uniform texture2D t2d; // ERROR, no binding
  5. uniform texture3D t3d[4]; // ERROR, no binding
  6. int i;
  7. uniform samplerShadow sShadow;
  8. uniform texture3D t3d5[5];
  9. writeonly uniform image2D i2d;
  10. void badConst()
  11. {
  12. sampler2D(t2d); // ERROR, need 2 args
  13. sampler2D(s, s); // ERROR, wrong type
  14. sampler2D(i, i); // ERROR, wrong type
  15. sampler2D(t2d, i); // ERROR, wrong type
  16. sampler2D(t2d, t2d); // ERROR, wrong type
  17. sampler2D(t2d, sA); // ERROR, wrong type
  18. sampler3D[4](t3d5, sA[2]); // ERROR, can't make array
  19. sampler2D(i2d, s); // ERROR, image instead of texture
  20. sampler2D(t3d[1], s); // ERROR, 3D not 2D
  21. sampler2D(t2d, sShadow);
  22. sampler2DShadow(t2d, s);
  23. }
  24. sampler2D s2D = sampler2D(t2d, s); // ERROR, no sampler constructor
  25. sampler3D s3d[4] = sampler3D[4](t3d, sA[2]); // ERROR, no sampler constructor
  26. out vec4 color; // ERROR, no location
  27. void main()
  28. {
  29. color = texture(s2D, vec2(0.5));
  30. color += texture(s3d[i], vec3(0.5));
  31. }
  32. layout(push_constant) buffer pcb { // ERROR, not on a buffer
  33. int a;
  34. } pcbInst;
  35. layout(push_constant) uniform float pcfloat; // ERROR 2X: not on a non-block, and non-opaque outside block
  36. layout(push_constant) uniform; // ERROR, needs an object
  37. layout(std430, push_constant) uniform pcb1 { int a; } pcb1inst;
  38. layout(push_constant) uniform pcb2 {
  39. int a;
  40. }; // Okay now to have no instance name
  41. layout(input_attachment_index = 2) uniform subpassInput subD;
  42. layout(input_attachment_index = 3) uniform texture2D subDbad1; // ERROR, not a texture
  43. layout(input_attachment_index = 4) writeonly uniform image2D subDbad2; // ERROR, not an image
  44. uniform subpassInput subDbad3; // ERROR, need attachment number
  45. layout(input_attachment_index = 2) uniform subpassInputMS subDMS;
  46. void foo()
  47. {
  48. vec4 v = subpassLoad(subD);
  49. v += subpassLoadMS(subD); // ERROR, no such function
  50. v += subpassLoad(subD, 2); // ERROR, no such sig.
  51. v += subpassLoad(subDMS, 2);
  52. v += subpassLoadMS(subDMS, 2); // ERROR, no such function
  53. }
  54. subroutine int fooS; // ERROR, not in SPV
  55. subroutine int fooSub(); // ERROR, not in SPV
  56. uniform vec4 dv4; // ERROR, no default uniforms
  57. void fooTex()
  58. {
  59. texture(t2d, vec2(1.0)); // ERROR, need a sampler, not a pure texture
  60. imageStore(t2d, ivec2(4, 5), vec4(1.2)); // ERROR, need an image, not a pure texture
  61. }
  62. precision highp float;
  63. layout(location=0) in vec2 vTexCoord;
  64. layout(location=0) out vec4 FragColor;
  65. vec4 userTexture(mediump sampler2D samp, vec2 coord)
  66. {
  67. return texture(samp, coord);
  68. }
  69. bool cond;
  70. void callUserTexture()
  71. {
  72. userTexture(sampler2D(t2d,s), vTexCoord); // ERROR, not point of use
  73. userTexture((sampler2D(t2d,s)), vTexCoord); // ERROR, not point of use
  74. userTexture((sampler2D(t2d,s), sampler2D(t2d,s)), vTexCoord); // ERROR, not point of use
  75. userTexture(cond ? sampler2D(t2d,s) : sampler2D(t2d,s), vTexCoord); // ERROR, no ?:, not point of use
  76. gl_NumSamples; // ERROR, not for Vulkan
  77. }
  78. void noise()
  79. {
  80. noise1(dv4);
  81. noise2(4.0);
  82. noise3(vec2(3));
  83. noise4(dv4);
  84. }