Skip to content

Commit

Permalink
Add more nontemporal tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HildarTheDorf authored and jeremy-lunarg committed Feb 6, 2025
1 parent c8927c3 commit 2b7f94a
Show file tree
Hide file tree
Showing 4 changed files with 214 additions and 73 deletions.
112 changes: 79 additions & 33 deletions Test/baseResults/spv.1.6.nontemporalimage.frag.out
Original file line number Diff line number Diff line change
@@ -1,52 +1,98 @@
spv.1.6.nontemporalimage.frag
// Module Version 10600
// Generated by (magic number): 8000b
// Id's are bound by 24
// Id's are bound by 54

Capability Shader
Capability VulkanMemoryModelKHR
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical VulkanKHR
EntryPoint Fragment 4 "main" 9 12 18
EntryPoint Fragment 4 "main" 22 36 43 49 51
ExecutionMode 4 OriginUpperLeft
Source GLSL 460
SourceExtension "GL_EXT_nontemporal_keyword"
Name 4 "main"
Name 9 "out_color"
Name 12 "u_image"
Name 16 "UNIFORMS"
MemberName 16(UNIFORMS) 0 "u_uv"
Name 18 ""
Decorate 9(out_color) Location 0
Decorate 12(u_image) NonWritable
Decorate 12(u_image) Binding 1
Decorate 12(u_image) DescriptorSet 0
Decorate 16(UNIFORMS) Block
MemberDecorate 16(UNIFORMS) 0 Offset 0
Decorate 18 Binding 0
Decorate 18 DescriptorSet 0
Name 11 "function_accepting_nontemporal(I21;"
Name 10 "image"
Name 14 "function_not_accepting_nontemporal(I21;"
Name 13 "image"
Name 19 "uv"
Name 22 "in_uv"
Name 36 "u_nontempimage"
Name 43 "u_image"
Name 49 "u_nontempnoformatimage"
Name 51 "u_noformatimage"
Decorate 10(image) NonReadable
Decorate 13(image) NonReadable
Decorate 22(in_uv) Location 0
Decorate 36(u_nontempimage) Binding 1
Decorate 36(u_nontempimage) DescriptorSet 0
Decorate 43(u_image) Binding 2
Decorate 43(u_image) DescriptorSet 0
Decorate 49(u_nontempnoformatimage) NonReadable
Decorate 49(u_nontempnoformatimage) Binding 3
Decorate 49(u_nontempnoformatimage) DescriptorSet 0
Decorate 51(u_noformatimage) NonReadable
Decorate 51(u_noformatimage) Binding 4
Decorate 51(u_noformatimage) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Output 7(fvec4)
9(out_color): 8(ptr) Variable Output
10: TypeImage 6(float) 2D nonsampled format:Rgba8
11: TypePointer UniformConstant 10
12(u_image): 11(ptr) Variable UniformConstant
14: TypeInt 32 1
15: TypeVector 14(int) 2
16(UNIFORMS): TypeStruct 15(ivec2)
17: TypePointer Uniform 16(UNIFORMS)
18: 17(ptr) Variable Uniform
19: 14(int) Constant 0
20: TypePointer Uniform 15(ivec2)
7: TypeImage 6(float) 2D nonsampled format:Unknown
8: TypePointer UniformConstant 7
9: TypeFunction 2 8(ptr)
16: TypeInt 32 1
17: TypeVector 16(int) 2
18: TypePointer Function 17(ivec2)
20: TypeVector 6(float) 2
21: TypePointer Input 20(fvec2)
22(in_uv): 21(ptr) Variable Input
23: TypeInt 32 0
24: 23(int) Constant 0
25: TypePointer Input 6(float)
29: 23(int) Constant 1
34: TypeImage 6(float) 2D nonsampled format:Rgba8
35: TypePointer UniformConstant 34
36(u_nontempimage): 35(ptr) Variable UniformConstant
41: TypeVector 6(float) 4
43(u_image): 35(ptr) Variable UniformConstant
49(u_nontempnoformatimage): 8(ptr) Variable UniformConstant
51(u_noformatimage): 8(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
13: 10 Load 12(u_image)
21: 20(ptr) AccessChain 18 19
22: 15(ivec2) Load 21
23: 7(fvec4) ImageRead 13 22 Nontemporal
Store 9(out_color) 23
19(uv): 18(ptr) Variable Function
26: 25(ptr) AccessChain 22(in_uv) 24
27: 6(float) Load 26
28: 16(int) ConvertFToS 27
30: 25(ptr) AccessChain 22(in_uv) 29
31: 6(float) Load 30
32: 16(int) ConvertFToS 31
33: 17(ivec2) CompositeConstruct 28 32
Store 19(uv) 33
37: 34 Load 36(u_nontempimage)
38: 17(ivec2) Load 19(uv)
39: 34 Load 36(u_nontempimage)
40: 17(ivec2) Load 19(uv)
42: 41(fvec4) ImageRead 39 40 Nontemporal
ImageWrite 37 38 42 Nontemporal
44: 34 Load 43(u_image)
45: 17(ivec2) Load 19(uv)
46: 34 Load 43(u_image)
47: 17(ivec2) Load 19(uv)
48: 41(fvec4) ImageRead 46 47
ImageWrite 44 45 48
50: 2 FunctionCall 11(function_accepting_nontemporal(I21;) 49(u_nontempnoformatimage)
52: 2 FunctionCall 11(function_accepting_nontemporal(I21;) 51(u_noformatimage)
53: 2 FunctionCall 14(function_not_accepting_nontemporal(I21;) 51(u_noformatimage)
Return
FunctionEnd
11(function_accepting_nontemporal(I21;): 2 Function None 9
10(image): 8(ptr) FunctionParameter
12: Label
Return
FunctionEnd
14(function_not_accepting_nontemporal(I21;): 2 Function None 9
13(image): 8(ptr) FunctionParameter
15: Label
Return
FunctionEnd
121 changes: 90 additions & 31 deletions Test/baseResults/spv.nontemporalbuffer.frag.out
Original file line number Diff line number Diff line change
@@ -1,53 +1,112 @@
spv.nontemporalbuffer.frag
// Module Version 10000
// Generated by (magic number): 8000b
// Id's are bound by 24
// Id's are bound by 48

Capability Shader
Capability VulkanMemoryModelKHR
Extension "SPV_KHR_vulkan_memory_model"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical VulkanKHR
EntryPoint Fragment 4 "main" 9
EntryPoint Fragment 4 "main" 47
ExecutionMode 4 OriginUpperLeft
Source GLSL 460
SourceExtension "GL_EXT_nontemporal_keyword"
Name 4 "main"
Name 9 "out_color"
Name 12 "u_image"
Name 16 "UNIFORMS"
MemberName 16(UNIFORMS) 0 "u_uv"
Name 7 "NONTEMPORAL_BUFFER"
MemberName 7(NONTEMPORAL_BUFFER) 0 "b_i"
MemberName 7(NONTEMPORAL_BUFFER) 1 "b_o"
Name 9 ""
Name 16 "BUFFER_NONTEMPORAL"
MemberName 16(BUFFER_NONTEMPORAL) 0 "bntemp_i"
MemberName 16(BUFFER_NONTEMPORAL) 1 "bntemp_o"
Name 18 ""
Decorate 9(out_color) Location 0
Decorate 12(u_image) NonWritable
Decorate 12(u_image) Binding 1
Decorate 12(u_image) DescriptorSet 0
Decorate 16(UNIFORMS) Block
MemberDecorate 16(UNIFORMS) 0 Offset 0
Decorate 18 Binding 0
Name 22 "NONTEMPORAL_ATOMIC"
MemberName 22(NONTEMPORAL_ATOMIC) 0 "bn_atom"
Name 24 ""
Name 30 "ATOMIC_NONTEMPORAL"
MemberName 30(ATOMIC_NONTEMPORAL) 0 "b_natom"
MemberName 30(ATOMIC_NONTEMPORAL) 1 "b_atom"
Name 32 ""
Name 38 "NONTEMPORAL_UNIFORMS"
MemberName 38(NONTEMPORAL_UNIFORMS) 0 "u_uv"
Name 40 ""
Name 44 "u_image"
Name 47 "out_color"
Decorate 7(NONTEMPORAL_BUFFER) BufferBlock
MemberDecorate 7(NONTEMPORAL_BUFFER) 0 Offset 0
MemberDecorate 7(NONTEMPORAL_BUFFER) 1 Offset 4
Decorate 9 Binding 0
Decorate 9 DescriptorSet 0
Decorate 16(BUFFER_NONTEMPORAL) BufferBlock
MemberDecorate 16(BUFFER_NONTEMPORAL) 0 Offset 0
MemberDecorate 16(BUFFER_NONTEMPORAL) 1 Offset 4
Decorate 18 Binding 1
Decorate 18 DescriptorSet 0
Decorate 22(NONTEMPORAL_ATOMIC) BufferBlock
MemberDecorate 22(NONTEMPORAL_ATOMIC) 0 Offset 0
Decorate 24 Binding 3
Decorate 24 DescriptorSet 0
Decorate 30(ATOMIC_NONTEMPORAL) BufferBlock
MemberDecorate 30(ATOMIC_NONTEMPORAL) 0 Offset 0
MemberDecorate 30(ATOMIC_NONTEMPORAL) 1 Offset 4
Decorate 32 Binding 4
Decorate 32 DescriptorSet 0
Decorate 38(NONTEMPORAL_UNIFORMS) Block
MemberDecorate 38(NONTEMPORAL_UNIFORMS) 0 Offset 0
Decorate 40 Binding 2
Decorate 40 DescriptorSet 0
Decorate 44(u_image) NonWritable
Decorate 44(u_image) Binding 5
Decorate 44(u_image) DescriptorSet 0
Decorate 47(out_color) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Output 7(fvec4)
9(out_color): 8(ptr) Variable Output
10: TypeImage 6(float) 2D nonsampled format:Rgba8
11: TypePointer UniformConstant 10
12(u_image): 11(ptr) Variable UniformConstant
14: TypeInt 32 1
15: TypeVector 14(int) 2
16(UNIFORMS): TypeStruct 15(ivec2)
17: TypePointer Uniform 16(UNIFORMS)
6: TypeInt 32 1
7(NONTEMPORAL_BUFFER): TypeStruct 6(int) 6(int)
8: TypePointer Uniform 7(NONTEMPORAL_BUFFER)
9: 8(ptr) Variable Uniform
10: 6(int) Constant 1
11: 6(int) Constant 0
12: TypePointer Uniform 6(int)
16(BUFFER_NONTEMPORAL): TypeStruct 6(int) 6(int)
17: TypePointer Uniform 16(BUFFER_NONTEMPORAL)
18: 17(ptr) Variable Uniform
19: 14(int) Constant 0
20: TypePointer Uniform 15(ivec2)
22(NONTEMPORAL_ATOMIC): TypeStruct 6(int)
23: TypePointer Uniform 22(NONTEMPORAL_ATOMIC)
24: 23(ptr) Variable Uniform
26: TypeInt 32 0
27: 26(int) Constant 5
28: 26(int) Constant 0
30(ATOMIC_NONTEMPORAL): TypeStruct 6(int) 6(int)
31: TypePointer Uniform 30(ATOMIC_NONTEMPORAL)
32: 31(ptr) Variable Uniform
37: TypeVector 6(int) 2
38(NONTEMPORAL_UNIFORMS): TypeStruct 37(ivec2)
39: TypePointer Uniform 38(NONTEMPORAL_UNIFORMS)
40: 39(ptr) Variable Uniform
41: TypeFloat 32
42: TypeImage 41(float) 2D nonsampled format:Rgba8
43: TypePointer UniformConstant 42
44(u_image): 43(ptr) Variable UniformConstant
45: TypeVector 41(float) 4
46: TypePointer Output 45(fvec4)
47(out_color): 46(ptr) Variable Output
4(main): 2 Function None 3
5: Label
13: 10 Load 12(u_image)
21: 20(ptr) AccessChain 18 19
22: 15(ivec2) Load 21 Nontemporal
23: 7(fvec4) ImageRead 13 22
Store 9(out_color) 23
13: 12(ptr) AccessChain 9 11
14: 6(int) Load 13 Nontemporal
15: 12(ptr) AccessChain 9 10
Store 15 14 Nontemporal
19: 12(ptr) AccessChain 18 10
20: 6(int) Load 19 Nontemporal
21: 12(ptr) AccessChain 18 11
Store 21 20 Nontemporal
25: 12(ptr) AccessChain 24 11
29: 6(int) AtomicIAdd 25 27 28 10
33: 12(ptr) AccessChain 32 11
34: 6(int) AtomicIAdd 33 27 28 10
35: 12(ptr) AccessChain 32 10
36: 6(int) AtomicIAdd 35 27 28 10
Return
FunctionEnd
28 changes: 22 additions & 6 deletions Test/spv.1.6.nontemporalimage.frag
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,29 @@

#extension GL_EXT_nontemporal_keyword: require

layout(binding=0) uniform UNIFORMS {
ivec2 u_uv;
};
layout(binding=1, rgba8) uniform readonly nontemporal image2D u_image;
layout(location=0) in vec2 in_uv;

layout(location=0) out vec4 out_color;
layout(binding=1, rgba8) uniform nontemporal image2D u_nontempimage;
layout(binding=2, rgba8) uniform image2D u_image;
layout(binding=3) uniform writeonly nontemporal image2D u_nontempnoformatimage;
layout(binding=4) uniform writeonly image2D u_noformatimage;

void function_accepting_nontemporal(nontemporal writeonly image2D image) {

}

void function_not_accepting_nontemporal(writeonly image2D image) {

}

void main() {
out_color = imageLoad(u_image, u_uv);
const ivec2 uv = ivec2(in_uv.x, in_uv.y);
imageStore(u_nontempimage, uv, imageLoad(u_nontempimage, uv));
imageStore(u_image, uv, imageLoad(u_image, uv));

function_accepting_nontemporal(u_nontempnoformatimage);
function_accepting_nontemporal(u_noformatimage);
function_not_accepting_nontemporal(u_noformatimage);
// This would fail to compile
// function_not_accepting_nontemporal(u_nontempnoformatimage);
}
26 changes: 23 additions & 3 deletions Test/spv.nontemporalbuffer.frag
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,33 @@

#extension GL_EXT_nontemporal_keyword: require

layout(binding=0) uniform nontemporal UNIFORMS {
layout(binding=0) buffer nontemporal NONTEMPORAL_BUFFER {
int b_i;
int b_o;
};
layout(binding=1) buffer BUFFER_NONTEMPORAL {
nontemporal int bntemp_i;
nontemporal int bntemp_o;
};
layout(binding=2) uniform nontemporal NONTEMPORAL_UNIFORMS {
ivec2 u_uv;
};
layout(binding=1, rgba8) uniform readonly image2D u_image;
layout(binding=3) buffer nontemporal NONTEMPORAL_ATOMIC {
int bn_atom;
};
layout(binding=4) buffer ATOMIC_NONTEMPORAL {
nontemporal int b_natom;
int b_atom;
};
layout(binding=5, rgba8) uniform readonly image2D u_image;

layout(location=0) out vec4 out_color;

void main() {
out_color = imageLoad(u_image, u_uv);
b_o = b_i;
bntemp_i = bntemp_o;

atomicAdd(bn_atom, 1);
atomicAdd(b_natom, 1);
atomicAdd(b_atom, 1);
}

0 comments on commit 2b7f94a

Please sign in to comment.