-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2449 from KhronosGroup/glsl-atomic-fixes
GLSL: Fix some issues with atomics
- Loading branch information
Showing
7 changed files
with
132 additions
and
5 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
reference/shaders-no-opt/asm/comp/atomic-on-bda-pod.asm.nocompat.vk.comp.vk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#version 450 | ||
#extension GL_EXT_buffer_reference2 : require | ||
#extension GL_EXT_buffer_reference_uvec2 : require | ||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; | ||
|
||
layout(buffer_reference) buffer uintPointer; | ||
layout(buffer_reference, buffer_reference_align = 4) buffer uintPointer | ||
{ | ||
uint value; | ||
}; | ||
|
||
layout(push_constant, std430) uniform Registers | ||
{ | ||
uvec2 va; | ||
} _6; | ||
|
||
void main() | ||
{ | ||
uint _24 = atomicMax(uintPointer(_6.va).value, 10u); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#version 450 | ||
#if defined(GL_ARB_gpu_shader_int64) | ||
#extension GL_ARB_gpu_shader_int64 : require | ||
#elif defined(GL_NV_gpu_shader5) | ||
#extension GL_NV_gpu_shader5 : require | ||
#else | ||
#error No extension available for 64-bit integers. | ||
#endif | ||
#extension GL_EXT_shader_atomic_int64 : require | ||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; | ||
|
||
layout(binding = 0, std430) buffer SSBO | ||
{ | ||
uint64_t v; | ||
} _9; | ||
|
||
void main() | ||
{ | ||
uint64_t _18 = atomicMax(_9.v, 10ul); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
shaders-no-opt/asm/comp/atomic-on-bda-pod.asm.nocompat.vk.comp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
; SPIR-V | ||
; Version: 1.0 | ||
; Generator: Khronos Glslang Reference Front End; 11 | ||
; Bound: 25 | ||
; Schema: 0 | ||
OpCapability Shader | ||
OpCapability PhysicalStorageBufferAddresses | ||
OpExtension "SPV_KHR_physical_storage_buffer" | ||
%1 = OpExtInstImport "GLSL.std.450" | ||
OpMemoryModel PhysicalStorageBuffer64 GLSL450 | ||
OpEntryPoint GLCompute %main "main" | ||
OpExecutionMode %main LocalSize 1 1 1 | ||
OpSource GLSL 450 | ||
OpSourceExtension "GL_EXT_buffer_reference" | ||
OpSourceExtension "GL_EXT_buffer_reference_uvec2" | ||
OpName %main "main" | ||
OpName %Registers "Registers" | ||
OpMemberName %Registers 0 "va" | ||
OpName %_ "" | ||
OpDecorate %Registers Block | ||
OpMemberDecorate %Registers 0 Offset 0 | ||
%void = OpTypeVoid | ||
%3 = OpTypeFunction %void | ||
%uint = OpTypeInt 32 0 | ||
%v2uint = OpTypeVector %uint 2 | ||
%Registers = OpTypeStruct %v2uint | ||
%_ptr_PushConstant_Registers = OpTypePointer PushConstant %Registers | ||
%_ = OpVariable %_ptr_PushConstant_Registers PushConstant | ||
%int = OpTypeInt 32 1 | ||
%int_0 = OpConstant %int 0 | ||
%_ptr_PushConstant_v2uint = OpTypePointer PushConstant %v2uint | ||
%_ptr_PhysicalStorageBuffer_uint = OpTypePointer PhysicalStorageBuffer %uint | ||
%uint_10 = OpConstant %uint 10 | ||
%uint_1 = OpConstant %uint 1 | ||
%uint_0 = OpConstant %uint 0 | ||
%main = OpFunction %void None %3 | ||
%5 = OpLabel | ||
%14 = OpAccessChain %_ptr_PushConstant_v2uint %_ %int_0 | ||
%15 = OpLoad %v2uint %14 | ||
%18 = OpBitcast %_ptr_PhysicalStorageBuffer_uint %15 | ||
%24 = OpAtomicUMax %uint %18 %uint_1 %uint_0 %uint_10 | ||
OpReturn | ||
OpFunctionEnd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#version 450 | ||
#extension GL_EXT_shader_atomic_int64 : require | ||
#extension GL_ARB_gpu_shader_int64 : require | ||
layout(local_size_x = 1) in; | ||
|
||
layout(set = 0, binding = 0) buffer SSBO | ||
{ | ||
uint64_t v; | ||
}; | ||
|
||
void main() | ||
{ | ||
atomicMax(v, 10ul); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters