Skip to content

Commit ba362c6

Browse files
committed
integrate film refactor + kernelabstractions
1 parent aeaa63c commit ba362c6

18 files changed

+294
-498
lines changed

docs/code/TraceMakie.jl

Lines changed: 0 additions & 320 deletions
This file was deleted.

src/Trace.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ macro real_assert(expr, msg="")
3232
end
3333
end
3434

35+
const ENABLE_INBOUNDS = true
36+
37+
macro _inbounds(ex)
38+
if ENABLE_INBOUNDS
39+
esc(:(@inbounds $ex))
40+
else
41+
esc(ex)
42+
end
43+
end
44+
45+
3546
# GeometryBasics.@fixed_vector Normal StaticVector
3647
include("typeNormal3f.jl")
3748
include("mempool.jl")

src/accel/bvh.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,9 @@ end
243243
to_visit_offset, current_node_i = Int32(1), Int32(1)
244244
nodes_to_visit = zeros(MVector{64,Int32})
245245
primitives = bvh.primitives
246-
@inbounds primitive = primitives[1]
246+
@_inbounds primitive = primitives[1]
247247
nodes = bvh.nodes
248-
@inbounds while true
248+
@_inbounds while true
249249
ln = nodes[current_node_i]
250250
if intersect_p(ln.bounds, ray, inv_dir, dir_is_neg)
251251
if !ln.is_interior && ln.n_primitives > Int32(0)
@@ -295,7 +295,7 @@ end
295295
to_visit_offset, current_node_i = Int32(1), Int32(1)
296296
nodes_to_visit = zeros(MVector{64,Int32})
297297
primitives = bvh.primitives
298-
@inbounds while true
298+
@_inbounds while true
299299
ln = bvh.nodes[current_node_i]
300300
if intersect_p(ln.bounds, ray, inv_dir, dir_is_neg)
301301
if !ln.is_interior && ln.n_primitives > Int32(0)

src/bounds.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ end
154154

155155
function intersect(b::Bounds3, ray::AbstractRay)::Tuple{Bool,Float32,Float32}
156156
t0, t1 = 0f0, ray.t_max
157-
@inbounds for i in 1:3
157+
@_inbounds for i in 1:3
158158
# Update interval for i-th bbox slab.
159159
inv_ray_dir = 1f0 / ray.d[i]
160160
t_near = (b.p_min[i] - ray.o[i]) * inv_ray_dir
@@ -171,7 +171,7 @@ function intersect(b::Bounds3, ray::AbstractRay)::Tuple{Bool,Float32,Float32}
171171
end
172172

173173
@inline function is_dir_negative(dir::Vec3f)
174-
@inbounds Point3{UInt8}(
174+
@_inbounds Point3{UInt8}(
175175
dir[1] < 0 ? 2 : 1,
176176
dir[2] < 0 ? 2 : 1,
177177
dir[3] < 0 ? 2 : 1,
@@ -185,7 +185,7 @@ dir_is_negative: 1 -- false, 2 -- true
185185
b::Bounds3, ray::AbstractRay,
186186
inv_dir::Vec3f, dir_is_negative::Point3{UInt8},
187187
)::Bool
188-
@inbounds begin
188+
@_inbounds begin
189189
tx_min = (b[dir_is_negative[1]][1] - ray.o[1]) * inv_dir[1]
190190
tx_max = (b[3-dir_is_negative[1]][1] - ray.o[1]) * inv_dir[1]
191191
ty_min = (b[dir_is_negative[2]][2] - ray.o[2]) * inv_dir[2]

0 commit comments

Comments
 (0)