16 lines
765 B
Text
16 lines
765 B
Text
#pragma once
|
|
|
|
// Archived experiment; excluded from the teaching sequence and normal build.
|
|
// Stage 03b (mode 31): flatten the whole (seed,x,z) product into fine work items.
|
|
template<int stage> __global__ void positionKernel(
|
|
DeviceArgs a, show::Hit* hits, unsigned long long* count
|
|
) {
|
|
const uint64_t area=a.width*a.height, total=a.seeds*area;
|
|
const uint64_t stride=uint64_t(gridDim.x)*blockDim.x;
|
|
for(uint64_t i=uint64_t(blockIdx.x)*blockDim.x+threadIdx.x;i<total;i+=stride) {
|
|
const uint64_t s=i/area, p=i%area;
|
|
const int32_t x=int32_t(int64_t(a.x0)+int64_t(p/a.height));
|
|
const int32_t z=int32_t(int64_t(a.z0)+int64_t(p%a.height));
|
|
if(show::solid<stage>(a.seed+s,x,z,a.n)) emit(a,hits,count,a.seed+s,x,z);
|
|
}
|
|
}
|