Test for spv1.6 + memory model HelperInvocation

This should generate a Volatile tag on the access, not on the variable
itself.
This commit is contained in:
Graeme Leese 2022-10-14 15:03:14 +01:00
parent d570b2b05b
commit 5c352476c7
3 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,48 @@
spv.1.6.helperInvocation.memmodel.frag
// Module Version 10600
// Generated by (magic number): 8000b
// Id's are bound by 21
Capability Shader
Capability VulkanMemoryModelKHR
Capability DemoteToHelperInvocationEXT
Extension "SPV_EXT_demote_to_helper_invocation"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical VulkanKHR
EntryPoint Fragment 4 "main" 9 14
ExecutionMode 4 OriginUpperLeft
Source ESSL 310
SourceExtension "GL_EXT_demote_to_helper_invocation"
Name 4 "main"
Name 7 "B"
MemberName 7(B) 0 "o"
Name 9 ""
Name 14 "gl_HelperInvocation"
MemberDecorate 7(B) 0 Offset 0
Decorate 7(B) Block
Decorate 9 DescriptorSet 0
Decorate 9 Binding 0
Decorate 14(gl_HelperInvocation) BuiltIn HelperInvocation
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7(B): TypeStruct 6(float)
8: TypePointer StorageBuffer 7(B)
9: 8(ptr) Variable StorageBuffer
10: TypeInt 32 1
11: 10(int) Constant 0
12: TypeBool
13: TypePointer Input 12(bool)
14(gl_HelperInvocation): 13(ptr) Variable Input
16: 6(float) Constant 1065353216
17: 6(float) Constant 0
19: TypePointer StorageBuffer 6(float)
4(main): 2 Function None 3
5: Label
DemoteToHelperInvocationEXT
15: 12(bool) Load 14(gl_HelperInvocation) Volatile
18: 6(float) Select 15 16 17
20: 19(ptr) AccessChain 9 11
Store 20 18
Return
FunctionEnd

View File

@ -0,0 +1,16 @@
#version 310 es
#pragma use_vulkan_memory_model
#extension GL_EXT_demote_to_helper_invocation : require
precision highp float;
layout (set=0, binding=0) buffer B {
float o;
};
void main() {
demote;
o = gl_HelperInvocation ? 1.0 : 0.0;
}

View File

@ -660,6 +660,7 @@ INSTANTIATE_TEST_SUITE_P(
::testing::ValuesIn(std::vector<std::string>({
"spv.1.6.conditionalDiscard.frag",
"spv.1.6.helperInvocation.frag",
"spv.1.6.helperInvocation.memmodel.frag",
"spv.1.6.specConstant.comp",
"spv.1.6.samplerBuffer.frag",
"spv.1.6.separate.frag",