Merge pull request #937 from JoseEmilio-ARM/patch-1

Ray Query example: shader optimization
This commit is contained in:
Sascha Willems 2022-04-10 09:36:30 +02:00 committed by GitHub
commit 5aa182b604
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,10 +25,10 @@ void main()
outFragColor = vec4(diffuse, 1.0); outFragColor = vec4(diffuse, 1.0);
rayQueryEXT rayQuery; rayQueryEXT rayQuery;
rayQueryInitializeEXT(rayQuery, topLevelAS, gl_RayFlagsTerminateOnFirstHitEXT, 0xFF, inWorldPos, 0.01, L, 1000.0); rayQueryInitializeEXT(rayQuery, topLevelAS, gl_RayFlagsTerminateOnFirstHitEXT | gl_RayFlagsSkipAABBEXT, 0xFF, inWorldPos, 0.01, L, 1000.0);
// Start the ray traversal, rayQueryProceedEXT returns false if the traversal is complete // Traverse the acceleration structure and store information about the first intersection (if any)
while (rayQueryProceedEXT(rayQuery)) { } rayQueryProceedEXT(rayQuery);
// If the intersection has hit a triangle, the fragment is shadowed // If the intersection has hit a triangle, the fragment is shadowed
if (rayQueryGetIntersectionTypeEXT(rayQuery, true) == gl_RayQueryCommittedIntersectionTriangleEXT ) { if (rayQueryGetIntersectionTypeEXT(rayQuery, true) == gl_RayQueryCommittedIntersectionTriangleEXT ) {