Initial implementation Ray Tracing support in Amber#1035
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
dj2
left a comment
There was a problem hiding this comment.
I'm not quite done the review yet, I'm about half way through engine_vulkan and then have the following files to do. Wanted to send this out as I have to leave for the day and am off until Tuesday of next week. I'll finish the review when I'm back on Tuesday.
|
The script expects to find `clang-format` on your path, so you'll need
clang-format somewhere. (The script is just a thin wrapper around
clang-format to call it for the various folders, if you have another way to
run clang-format, that also works)
dan
…On Thu, Apr 11, 2024 at 10:01 AM archimedus ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/vulkan/blas.cc
<#1035 (comment)>:
> + (uint32_t)geometryData->getPrimitiveCount(), // uint32_t primitiveCount;
+ 0, // uint32_t primitiveOffset;
+ 0, // uint32_t firstVertex;
+ 0 // uint32_t firstTransform;
+ };
+
+ accelerationStructureGeometriesKHR_[geometryNdx] = accelerationStructureGeometryKHR;
+ accelerationStructureBuildRangeInfoKHR_[geometryNdx] = accelerationStructureBuildRangeInfosKHR;
+ maxPrimitiveCounts_[geometryNdx] = accelerationStructureBuildRangeInfosKHR.primitiveCount;
+ vertexBufferOffsets[geometryNdx] = vertexBufferSize;
+ size_t s1 = sizeof(
+ *geometryData->GetData().data());
+ vertexBufferSize += align(geometryData->GetData().size() * s1, 8);
+ }
+
+ const VkAccelerationStructureGeometryKHR* accelerationStructureGeometriesKHRPointer = accelerationStructureGeometriesKHR_.data();
./tools/format
find: ‘clang-format’: No such file or directory
Any hints?
—
Reply to this email directly, view it on GitHub
<#1035 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAACLC6CATL2ZTJOCDOK3UTY42JTXAVCNFSM6AAAAABFXNG7XKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTSOJUGI3TCOJWGY>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
|
You can download |
jasilvanus
left a comment
There was a problem hiding this comment.
My questions are regarding the planned final script format. I'm aware this is in an initial state as of now.
How can max payload and hit attribute sizes be specified?
Are pipeline libraries (planned to be) supported?
| ```groovy | ||
| # Four possible shader group definitions | ||
| SHADER_GROUP {group_name_1} {ray_generation_shader_name} | ||
| SHADER_GROUP {group_name_2} {miss_shader_name} | ||
| SHADER_GROUP {group_name_3} {call_shader_name} | ||
| SHADER_GROUP {group_name_4} {any_hit_shader_name} {closest_hit_shader_name} {intersection_shader_name} | ||
| ``` | ||
|
|
||
| Each group name must be unique within a pipeline. The same shader can be used within one or more | ||
| shader groups. The shader group order is important, further commands as shader code might refer | ||
| them directly. With the shader groups defined, they are then added into shader binding tables: | ||
|
|
||
| ```groovy | ||
| # Create shader binding tables and set shader groups into it | ||
| SHADER_BINDING_TABLE {sbt_name} | ||
| {group_name_1} | ||
| [ | {group_name_n}] | ||
| END | ||
| ``` |
There was a problem hiding this comment.
How are non-existing/null shaders (e.g. null AHS) specified here?
There was a problem hiding this comment.
How can max payload and hit attribute sizes be specified?
I am not sure what do you mean. These values are fully inside shader interfaces and do not need any regulation through scripting language.
Are pipeline libraries (planned to be) supported?
Not sure yet.
How are non-existing/null shaders (e.g. null AHS) specified here?
I should update documentation to:
SHADER_GROUP {group_name_4} [any_hit_shader_name] [closest_hit_shader_name] [intersection_shader_name]
i.e. you can skip unused shaders, actually code does not enforce shader order two only things checked: (1) is that code does not mix general shaders with hit shaders; (2) there are no two same types within group (i.e. group does not include two+ intersection shaders or two+ anyhit shaders or two+ closesthit shaders).
I was referring to https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkRayTracingPipelineInterfaceCreateInfoKHR.html but that might only be relevant when using libraries. Or is there an alternate shader-level mechanism to specify the max payload and hit attribute size of other shaders in the pipeline, say when early-compiling an Intersection shader that doesn't know the payload types it will be used with?
Supporting libraries would be very helpful. It doesn't have to be in the initial version, but we should have an idea how it should look like so we don't have to break back-compat when introducing it.
I see, sounds good. We should mention though that the order doesn't matter, and that shader types are automatically derived. |
|
For raytracing libraries (probably it can be later extended for graphics, though I am interested in RT only here) I think following syntax should cover subject: PIPELINE ... [RAY_PAYLOAD_SIZE <integer>] [RAY_HIT_ATTRIBUTE_SIZE <integer>] The first line should declare library. What do you think? |
|
Thanks! I'm not sure whether the formatting is as-intended, why start one line with The keywords |
Well, indentation is lost. It should be like this:
Will add
I was thinking about something like this (I hope it is feasible): |
|
Thanks, the syntax looks good to me. |
|
Are there other pipeline flags we may want to set? Having it |
Well I agree that |
|
I accepted CLA, but it seems github added you as a co-author, thus it requires you to accept the CLA. |
|
Fixed, needed to associate the email github picked with my account. Is this ready for me to do another round of reviews? |
|
Thanks. Yes, I think it is ready for review. The library support I think I should add as next pull request. |
|
kokoro:run |
0bc9ba1 to
2418678
Compare
|
Rebased. |
a09783f to
b68334c
Compare
Is that expected or something was broken by this PR? |
|
They all passed with the DeviceProperties CL, and with my fixup CL. So, it seems like something in this PR is causing the failures. |
|
I will investigate |
b9d0be1 to
74b7c71
Compare
74b7c71 to
5054fb6
Compare
5054fb6 to
2af40d7
Compare
2af40d7 to
3f7feb0
Compare
|
@dj2 |
dj2
left a comment
There was a problem hiding this comment.
This looks pretty close, I think the only outstanding was the last use of shared_ptr which I think could be a unique_ptr.
src/acceleration_structure.h
Outdated
|
|
||
| private: | ||
| std::string name_; | ||
| std::vector<std::shared_ptr<Geometry>> geometry_; |
There was a problem hiding this comment.
std::vector<std::unique_ptr<Geometry>> should work fine. It also makes the ownership clear.
|
Merged. Thank you very much for the design, implementation, and patience as we worked through the bot issues. Very much appreciate the contribution. |
Ray Tracing support in Amber #1033