yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
2ff6f609
main
1#version 460 core 2 3#extension GL_ARB_bindless_texture : require 4 5// These two are declared before any other bindless construct in the file, so only 6// the extension itself can enable the opaque out and inout parameters. 7void setSampler ( out sampler2D s , uvec2 handle ) 8{ 9s = sampler2D ( handle ) ; 10} 11 12void copyBuffers ( inout samplerBuffer bufs [ 2 ] , samplerBuffer src ) 13{ 14bufs [ 0 ] = src ; 15bufs [ 1 ] = src ; 16} 17 18uniform sampler2D tex ; 19uniform samplerBuffer buf ; 20uniform uvec2 handle ; 21uniform vec2 coord ; 22layout ( rgba8 ) uniform image2D img ; 23 24out vec4 color0 ; 25out vec4 color1 ; 26out uvec2 handleOut ; 27 28void main () 29{ 30sampler2D local = tex ; // sampler as a temporary 31setSampler ( local , handle ) ; // written through an out parameter 32color0 = texture ( local , coord ) ; 33 34samplerBuffer bufs [ 2 ] ; 35copyBuffers ( bufs , buf ) ; // array of samplers through inout 36color1 = texelFetch ( bufs [ 1 ] , 0 ) ; 37 38image2D localImage = img ; // images are handles too 39color1 += imageLoad ( localImage , ivec2 ( 0 , 0 )) ; 40 41handleOut = uvec2 ( tex ) ; // handle out of a sampler 42}