Advertisement
Guest User

Untitled

a guest
Jun 29th, 2023
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. [require]
  2. GL >= 3.3
  3. GLSL >= 3.30
  4. GL_ARB_bindless_texture
  5. GL_ARB_shader_image_load_store
  6.  
  7. [vertex shader passthrough]
  8.  
  9. [fragment shader]
  10. #version 330
  11. #extension GL_ARB_bindless_texture: require
  12. #extension GL_ARB_shader_image_load_store: enable
  13. #extension GL_ARB_uniform_buffer_object: enable
  14.  
  15. struct Struct {
  16. vec4 color;
  17. writeonly image2D img;
  18. };
  19.  
  20. //layout (std140) uniform Block {
  21. // Struct s;
  22. //} block;
  23.  
  24. uniform Struct s;
  25.  
  26. out vec4 outcolor;
  27.  
  28. void main()
  29. {
  30. imageStore(s.img, ivec2(gl_FragCoord.xy), s.color);
  31. outcolor = vec4(0.0, 0.0, 0.0, 1.0);
  32. }
  33.  
  34. [test]
  35. # Texture 0 is the imageStore output.
  36. texture rgbw 0 (16, 16) GL_RGBA8
  37. resident image texture 0 GL_RGBA8
  38. uniform handle s.img 0
  39.  
  40. # Texture 1 is the rendering output. We don't care about this.
  41. texture rgbw 1 (16, 16) GL_RGBA8
  42.  
  43. # Store red using imageStore
  44. uniform vec4 s.color 1.0 0.0 0.0 1.0
  45. fb tex 2d 1
  46. draw rect -1 -1 2 2
  47.  
  48. # Test the result of imageStore
  49. memory barrier GL_FRAMEBUFFER_BARRIER_BIT
  50. fb tex 2d 0
  51. probe all rgba 1.0 0.0 0.0 1.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement