aboutsummaryrefslogtreecommitdiff
path: root/Sources/PixelSort.swift
diff options
context:
space:
mode:
authory-jan137 <yousefjan24000@gmail.com>2026-04-29 09:10:29 +0300
committery-jan137 <yousefjan24000@gmail.com>2026-04-29 09:10:29 +0300
commit063eb03c20e467c2841c53aaf1f005503ece9c89 (patch)
tree70c24f06634b000900da2afdcd59167d12f816ba /Sources/PixelSort.swift
parentef7ee12c4af07387a4961fd5c2e0314712d408c1 (diff)
Replace selection sort with bitonic sort
Diffstat (limited to 'Sources/PixelSort.swift')
-rw-r--r--Sources/PixelSort.swift4
1 files changed, 2 insertions, 2 deletions
diff --git a/Sources/PixelSort.swift b/Sources/PixelSort.swift
index 7fc1ce2..139bcca 100644
--- a/Sources/PixelSort.swift
+++ b/Sources/PixelSort.swift
@@ -179,7 +179,7 @@ struct PixelSort: ParsableCommand {
prepareIndirectArgsPipeline.arguments.indirectArgs = .buffer(indirectArgsBuffer)
try compute.run(pipeline: prepareIndirectArgsPipeline, width: 1, height: 1)
- // Sort each span into sortedTex (one thread per span)
+ // Sort each span into sortedTex (one threadgroup per span, bitonic sort)
try compute.task(label: "pixelSort") { task in
try task.run { dispatch in
let enc = dispatch.commandEncoder
@@ -192,7 +192,7 @@ struct PixelSort: ParsableCommand {
enc.dispatchThreadgroups(
indirectBuffer: indirectArgsBuffer,
indirectBufferOffset: 0,
- threadsPerThreadgroup: MTLSize(width: 1, height: 1, depth: 1)
+ threadsPerThreadgroup: MTLSize(width: 1024, height: 1, depth: 1)
)
}
}