Skip to content

Commit 14cb713

Browse files
committed
Writing intersection results out to memory
1 parent 6b0c026 commit 14cb713

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

RadeonRays/src/kernels/GLSL/bvh2.comp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
#define INVALID_ADDR 0xffffffffu
2828
#define INTERNAL_NODE(node) ((node).addr_left != INVALID_ADDR)
2929

30+
#define HIT_MARKER 0x1u
31+
#define MISS_MARKER 0xffffffffu
32+
3033
#define GROUP_SIZE 64
3134
#define STACK_SIZE 32
3235
#define LDS_STACK_SIZE 8
@@ -45,9 +48,9 @@ struct BvhNode
4548

4649
struct Intersection
4750
{
48-
int shape_id;
49-
int prim_id;
50-
ivec2 padding;
51+
uint shape_id;
52+
uint prim_id;
53+
uvec2 padding;
5154
vec4 uvwt;
5255
};
5356

@@ -280,15 +283,12 @@ void intersect_main()
280283

281284
#endif
282285

283-
#if 0
284286
// TODO: what, why?!? (gboisse)
285287
Intersection isect;
286288
isect.padding.x = 667;
287-
isect.padding.y = r.padding.x;
289+
isect.padding.y = isect.padding.x;
288290
isect.uvwt = vec4(0.0f, 0.0f, 0.0f, closest_t);
289291

290-
#if 0
291-
292292
// Check if we have found an intersection
293293
if (closest_addr != INVALID_ADDR)
294294
{
@@ -305,20 +305,18 @@ void intersect_main()
305305
);
306306

307307
// Update hit information
308-
hit.prim_id = node.prim_id;
309-
hit.shape_id = node.mesh_id;
308+
isect.prim_id = node.prim_id;
309+
isect.shape_id = node.mesh_id;
310310
}
311311
else
312-
#endif
313312
{
314313
// Miss here
315-
isect.prim_id = -1;
316-
isect.shape_id = -1;
314+
isect.prim_id = MISS_MARKER;
315+
isect.shape_id = MISS_MARKER;
317316
}
318317

319318
// Write result to memory
320319
Hits[index] = isect;
321-
#endif
322320
}
323321

324322
void occluded_main()

0 commit comments

Comments
 (0)