Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [require]
- GL >= 3.3
- GLSL >= 3.30
- GL_ARB_bindless_texture
- GL_ARB_shader_image_load_store
- [vertex shader passthrough]
- [fragment shader]
- #version 330
- #extension GL_ARB_bindless_texture: require
- #extension GL_ARB_shader_image_load_store: enable
- #extension GL_ARB_uniform_buffer_object: enable
- struct Struct {
- vec4 color;
- writeonly image2D img;
- };
- //layout (std140) uniform Block {
- // Struct s;
- //} block;
- uniform Struct s;
- out vec4 outcolor;
- void main()
- {
- imageStore(s.img, ivec2(gl_FragCoord.xy), s.color);
- outcolor = vec4(0.0, 0.0, 0.0, 1.0);
- }
- [test]
- # Texture 0 is the imageStore output.
- texture rgbw 0 (16, 16) GL_RGBA8
- resident image texture 0 GL_RGBA8
- uniform handle s.img 0
- # Texture 1 is the rendering output. We don't care about this.
- texture rgbw 1 (16, 16) GL_RGBA8
- # Store red using imageStore
- uniform vec4 s.color 1.0 0.0 0.0 1.0
- fb tex 2d 1
- draw rect -1 -1 2 2
- # Test the result of imageStore
- memory barrier GL_FRAMEBUFFER_BARRIER_BIT
- fb tex 2d 0
- probe all rgba 1.0 0.0 0.0 1.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement