-
Notifications
You must be signed in to change notification settings - Fork 959
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
374 additions
and
9 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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 |
---|---|---|
|
@@ -642,6 +642,7 @@ pub enum StorageFormat { | |
Rg11b10Ufloat, | ||
|
||
// 64-bit formats | ||
R64Uint, | ||
Rg32Uint, | ||
Rg32Sint, | ||
Rg32Float, | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
( | ||
god_mode: true, | ||
spv: ( | ||
version: (1, 0), | ||
capabilities: [ Int64, Int64ImageEXT, Int64Atomics ], | ||
), | ||
hlsl: ( | ||
shader_model: V6_6, | ||
binding_map: {}, | ||
fake_missing_bindings: true, | ||
special_constants_binding: Some((space: 1, register: 0)), | ||
push_constants_target: Some((space: 0, register: 0)), | ||
zero_initialize_workgroup_memory: true, | ||
restrict_indexing: true | ||
), | ||
msl: ( | ||
lang_version: (3, 1), | ||
per_entry_point_map: {}, | ||
inline_samplers: [], | ||
spirv_cross_compatibility: false, | ||
fake_missing_bindings: true, | ||
zero_initialize_workgroup_memory: true, | ||
), | ||
) |
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,12 @@ | ||
@group(0) @binding(0) | ||
var image: texture_storage_2d<r64uint, atomic>; | ||
|
||
@compute | ||
@workgroup_size(2) | ||
fn cs_main(@builtin(local_invocation_id) id: vec3<u32>) { | ||
imageAtomicMax(image, vec2<i32>(0, 0), 1lu); | ||
|
||
workgroupBarrier(); | ||
|
||
imageAtomicMin(image, vec2<i32>(0, 0), 1lu); | ||
} |
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 @@ | ||
struct NagaConstants { | ||
int first_vertex; | ||
int first_instance; | ||
uint other; | ||
}; | ||
ConstantBuffer<NagaConstants> _NagaConstants: register(b0, space1); | ||
|
||
RWTexture2D<uint64_t> image : register(u0); | ||
|
||
int ZeroValueint() { | ||
return (int)0; | ||
} | ||
|
||
[numthreads(2, 1, 1)] | ||
void cs_main(uint3 id : SV_GroupThreadID) | ||
{ | ||
InterlockedMax(image[int2(0, 0)],1uL); | ||
GroupMemoryBarrierWithGroupSync(); | ||
InterlockedMin(image[int2(0, 0)],1uL); | ||
return; | ||
} |
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,12 @@ | ||
( | ||
vertex:[ | ||
], | ||
fragment:[ | ||
], | ||
compute:[ | ||
( | ||
entry_point:"cs_main", | ||
target_profile:"cs_6_6", | ||
), | ||
], | ||
) |
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,18 @@ | ||
// language: metal3.1 | ||
#include <metal_stdlib> | ||
#include <simd/simd.h> | ||
|
||
using metal::uint; | ||
|
||
|
||
struct cs_mainInput { | ||
}; | ||
kernel void cs_main( | ||
metal::uint3 id [[thread_position_in_threadgroup]] | ||
, metal::texture2d<ulong, metal::access::read_write> image [[user(fake0)]] | ||
) { | ||
image.atomic_max(metal::uint2(metal::int2(0, 0)), 1uL); | ||
metal::threadgroup_barrier(metal::mem_flags::mem_threadgroup); | ||
image.atomic_min(metal::uint2(metal::int2(0, 0)), 1uL); | ||
return; | ||
} |
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,50 @@ | ||
; SPIR-V | ||
; Version: 1.0 | ||
; Generator: rspirv | ||
; Bound: 32 | ||
OpCapability Shader | ||
OpCapability Int64ImageEXT | ||
OpCapability Int64 | ||
OpCapability Int64Atomics | ||
OpExtension "SPV_EXT_shader_image_int64" | ||
%1 = OpExtInstImport "GLSL.std.450" | ||
OpMemoryModel Logical GLSL450 | ||
OpEntryPoint GLCompute %15 "cs_main" %12 | ||
OpExecutionMode %15 LocalSize 2 1 1 | ||
OpDecorate %9 DescriptorSet 0 | ||
OpDecorate %9 Binding 0 | ||
OpDecorate %12 BuiltIn LocalInvocationId | ||
%2 = OpTypeVoid | ||
%4 = OpTypeInt 64 0 | ||
%3 = OpTypeImage %4 2D 0 0 0 2 R64ui | ||
%6 = OpTypeInt 32 0 | ||
%5 = OpTypeVector %6 3 | ||
%7 = OpTypeInt 32 1 | ||
%8 = OpTypeVector %7 2 | ||
%10 = OpTypePointer UniformConstant %3 | ||
%9 = OpVariable %10 UniformConstant | ||
%13 = OpTypePointer Input %5 | ||
%12 = OpVariable %13 Input | ||
%16 = OpTypeFunction %2 | ||
%18 = OpConstant %7 0 | ||
%19 = OpConstantComposite %8 %18 %18 | ||
%20 = OpConstantNull %7 | ||
%21 = OpConstant %4 1 | ||
%23 = OpTypePointer Image %4 | ||
%26 = OpConstant %7 4 | ||
%27 = OpConstant %6 0 | ||
%28 = OpConstant %6 2 | ||
%29 = OpConstant %6 264 | ||
%15 = OpFunction %2 None %16 | ||
%11 = OpLabel | ||
%14 = OpLoad %5 %12 | ||
%17 = OpLoad %3 %9 | ||
OpBranch %22 | ||
%22 = OpLabel | ||
%24 = OpImageTexelPointer %23 %9 %19 %20 | ||
%25 = OpAtomicUMax %4 %24 %26 %27 %21 | ||
OpControlBarrier %28 %28 %29 | ||
%30 = OpImageTexelPointer %23 %9 %19 %20 | ||
%31 = OpAtomicUMin %4 %30 %26 %27 %21 | ||
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,10 @@ | ||
@group(0) @binding(0) | ||
var image: texture_storage_2d<r64uint,atomic>; | ||
|
||
@compute @workgroup_size(2, 1, 1) | ||
fn cs_main(@builtin(local_invocation_id) id: vec3<u32>) { | ||
imageAtomicMax(image, vec2<i32>(0i, 0i), 1lu); | ||
workgroupBarrier(); | ||
imageAtomicMin(image, vec2<i32>(0i, 0i), 1lu); | ||
return; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@group(0) @binding(0) | ||
var image: texture_storage_2d<r64uint, atomic>; | ||
|
||
@compute | ||
@workgroup_size(4, 4, 1) | ||
fn cs_main(@builtin(local_invocation_id) id: vec3<u32>, @builtin(workgroup_id) group_id: vec3<u32>) { | ||
let pixel = id + group_id * 4; | ||
imageAtomicMax(image, pixel.xy, u64(pixel.x)); | ||
|
||
storageBarrier(); | ||
|
||
imageAtomicMin(image, pixel.xy, u64(pixel.y)); | ||
} |
Oops, something went wrong.