yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
0f99286a
main
1#version 450 2 3#extension GL_EXT_buffer_reference : enable 4 5layout ( buffer_reference , std430 ) buffer BlockA { float a ; } ; 6layout ( buffer_reference , std430 ) buffer BlockB { uint b ; } ; 7layout ( buffer_reference ) buffer Node ; 8layout ( buffer_reference , std430 ) buffer Node { int v ; Node next ; } ; 9 10layout ( set = 0 , binding = 0 ) uniform Handles { 11BlockA pa ; 12BlockB pb ; 13Node pn ; 14} handles ; 15 16struct WrapA { BlockA p ; } ; 17struct WrapB { BlockB p ; } ; 18 19// Overloads that differ only in which buffer reference type they take. 20float f ( BlockA p ) { return p . a ; } 21float f ( BlockB p ) { return float ( p . b ) ; } 22 23// The same, one level down, where the reference is a struct member. 24float g ( WrapA w ) { return w . p . a ; } 25float g ( WrapB w ) { return float ( w . p . b ) ; } 26 27// A block that names itself still has to produce a finite mangled name. 28float h ( Node n ) { return float ( n . next . v ) ; } 29 30layout ( location = 0 ) out float o ; 31 32void main () 33{ 34o = f ( handles . pa ) + f ( handles . pb ) 35+ g ( WrapA ( handles . pa )) + g ( WrapB ( handles . pb )) 36+ h ( handles . pn ) ; 37}