Add support for extension GL_ARB_shader_storage_buffer_object (#2184)

Enable below features for GL Core version 420:
* layout qualifier "std430"
* storage qualifier "buffer"
* atomic memory functions
This commit is contained in:
pmistryNV
2020-04-22 21:46:52 -07:00
committed by GitHub
parent 02c70ad10e
commit 7d65f09b83
7 changed files with 105 additions and 12 deletions

View File

@@ -17,3 +17,26 @@ uniform writeonly image2D i2D;
ivec2 iv2dim = imageSize(i2D); // ERROR: imageSize called without enabling GL_ARB_shader_image_size extension
#extension GL_ARB_shader_image_size : enable
ivec2 iv2dim1 = imageSize(i2D);
#extension GL_ARB_shader_storage_buffer_object : enable
layout(binding = 0,std430) buffer Buffer
{
int atomi;
uint atomu;
};
void atomicOpPass()
{
int origi = atomicAdd(atomi, 3);
uint origu = atomicAnd(atomu, 7u);
origi = atomicExchange(atomi, 4);
origu = atomicCompSwap(atomu, 10u, 8u);
}
#extension GL_ARB_shader_storage_buffer_object : disable
layout(binding = 1,std430) buffer BufferFail // Error std430 and "buffer" block support disabled
{
int atom1i;
};

View File

@@ -4,11 +4,14 @@ ERROR: 0:11: 'layout qualifier' : can only apply depth layout to gl_FragDepth
ERROR: 0:12: 'gl_FragDepth' : cannot redeclare after use
ERROR: 0:14: 'atomic_uint' : array must be explicitly sized
ERROR: 0:17: 'imageSize' : required extension not requested: GL_ARB_shader_image_size
ERROR: 5 compilation errors. No code generated.
ERROR: 0:39: 'std430' : not supported for this version or the enabled extensions
ERROR: 0:39: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
ERROR: 7 compilation errors. No code generated.
Shader version: 420
Requested GL_ARB_shader_image_size
Requested GL_ARB_shader_storage_buffer_object
using depth_any
ERROR: node is still EOpNull!
0:6 Function Definition: main( ( global void)
@@ -28,6 +31,49 @@ ERROR: node is still EOpNull!
0:19 'iv2dim1' ( global 2-component vector of int)
0:19 imageQuerySize ( global 2-component vector of int)
0:19 'i2D' ( writeonly uniform image2D)
0:29 Function Definition: atomicOpPass( ( global void)
0:29 Function Parameters:
0:31 Sequence
0:31 Sequence
0:31 move second child to first child ( temp int)
0:31 'origi' ( temp int)
0:31 AtomicAdd ( global int)
0:31 atomi: direct index for structure (layout( column_major std430 offset=0) buffer int)
0:31 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430 offset=0) buffer int atomi, layout( column_major std430 offset=4) buffer uint atomu})
0:31 Constant:
0:31 0 (const uint)
0:31 Constant:
0:31 3 (const int)
0:32 Sequence
0:32 move second child to first child ( temp uint)
0:32 'origu' ( temp uint)
0:32 AtomicAnd ( global uint)
0:32 atomu: direct index for structure (layout( column_major std430 offset=4) buffer uint)
0:32 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430 offset=0) buffer int atomi, layout( column_major std430 offset=4) buffer uint atomu})
0:32 Constant:
0:32 1 (const uint)
0:32 Constant:
0:32 7 (const uint)
0:33 move second child to first child ( temp int)
0:33 'origi' ( temp int)
0:33 AtomicExchange ( global int)
0:33 atomi: direct index for structure (layout( column_major std430 offset=0) buffer int)
0:33 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430 offset=0) buffer int atomi, layout( column_major std430 offset=4) buffer uint atomu})
0:33 Constant:
0:33 0 (const uint)
0:33 Constant:
0:33 4 (const int)
0:34 move second child to first child ( temp uint)
0:34 'origu' ( temp uint)
0:34 AtomicCompSwap ( global uint)
0:34 atomu: direct index for structure (layout( column_major std430 offset=4) buffer uint)
0:34 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430 offset=0) buffer int atomi, layout( column_major std430 offset=4) buffer uint atomu})
0:34 Constant:
0:34 1 (const uint)
0:34 Constant:
0:34 10 (const uint)
0:34 Constant:
0:34 8 (const uint)
0:? Linker Objects
0:? 'gl_FragDepth' ( gl_FragDepth float FragDepth)
0:? 'depth' ( smooth in float)
@@ -35,6 +81,7 @@ ERROR: node is still EOpNull!
0:? 'i2D' ( writeonly uniform image2D)
0:? 'iv2dim' ( global 2-component vector of int)
0:? 'iv2dim1' ( global 2-component vector of int)
0:? 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430 offset=0) buffer int atomi, layout( column_major std430 offset=4) buffer uint atomu})
Linked fragment stage:
@@ -42,6 +89,7 @@ Linked fragment stage:
Shader version: 420
Requested GL_ARB_shader_image_size
Requested GL_ARB_shader_storage_buffer_object
using depth_any
ERROR: node is still EOpNull!
0:6 Function Definition: main( ( global void)
@@ -68,4 +116,5 @@ ERROR: node is still EOpNull!
0:? 'i2D' ( writeonly uniform image2D)
0:? 'iv2dim' ( global 2-component vector of int)
0:? 'iv2dim1' ( global 2-component vector of int)
0:? 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430 offset=0) buffer int atomi, layout( column_major std430 offset=4) buffer uint atomu})