Apparatus and method for quantized convergent direction-based ray sorting
Apparatus and method for grouping rays based on quantized ray directions. For example, one embodiment of an apparatus comprises: An apparatus comprising: a ray generator to generate a plurality of rays; ray direction evaluation circuitry/logic to generate approximate ray direction data for each of the plurality of rays; ray sorting circuitry/logic to sort the rays into a plurality of ray queues based, at least in part, on the approximate ray direction data.
1. An apparatus comprising:
execution circuitry coupled to non-transitory machine-readable storage medium that stores instructions, which when executed by the execution circuitry, are capable of performing:
generating a plurality of rays;
generating ray direction data to estimate directions for the plurality of rays, wherein generation of the ray direction data comprises performing a ray and bounding box intersection test, and encoding a result of the ray and bounding box intersection test in a plurality of bits to generate the ray direction data; and
sorting the plurality of rays into a plurality of ray groups based on the ray direction data.
2. The apparatus of claim 1 , wherein sorting the plurality of rays is based on a direction sort key comprising the plurality of bits.
3. The apparatus of claim 2 , wherein the direction sort key comprises intersection coordinates determined based on the ray and bounding box intersection test.
4. The apparatus of claim 3 , wherein precision of the intersection coordinates is reduced to fit within a specified size of the direction sort key.
5. The apparatus of claim 1 , wherein secondary rays based on the ray and bounding box intersection test are sorted into a same group.
6. The apparatus of claim 1 , wherein sorting the plurality of rays is further based on a shader record identifier.
7. The apparatus of claim 1 , wherein rays within a ray group of the plurality of ray groups are deemed to converge on a same intersection point.
8. The apparatus of claim 1 , wherein rays within a ray group of the plurality of ray groups are stored in a queue.
9. A method comprising:
generating a plurality of rays;
generating ray direction data to estimate directions for the plurality of rays, wherein generation of the ray direction data comprises performing a ray and bounding box intersection test, and encoding a result of the ray and bounding box intersection test in a plurality of bits to generate the ray direction data; and
sorting the plurality of rays into a plurality of ray groups based on the ray direction data.
10. The method of claim 9 , wherein secondary rays based on the ray and bounding box intersection test are sorted into a same group.
11. The method of claim 9 , wherein sorting the plurality of rays is further based on a shader record identifier.
12. The method of claim 9 , wherein rays within a ray group of the plurality of ray groups are stored in a queue.
13. A non-transitory machine-readable medium having program code stored thereon which, when executed by a machine, are capable of causing the machine to perform:
generating a plurality of rays;
generating ray direction data to estimate directions for the plurality of rays, wherein generation of the ray direction data comprises performing a ray and bounding box intersection test, and encoding a result of the ray and bounding box intersection test in a plurality of bits to generate the ray direction data; and
sorting the plurality of rays into a plurality of ray groups based on the ray direction data.
14. The non-transitory machine-readable medium of claim 13 , wherein sorting the plurality of rays is further based on a shader record identifier.
15. The non-transitory machine-readable medium of claim 13 , wherein rays within a ray group of the plurality of ray groups are stored in a queue.