Closed archimedus closed 5 months ago
Awesome, thanks a lot for putting this together. Reading through the MD file a few questions/comments.
Listing things as I read through the doc, some of these refer to prior points I make (and some are potential modifications of those points).
I think we should make BLAS
and TLAS
more descriptive as names. Suggest something like ACCELERATION_STRUCTURE BOTTOM_LEVEL
and ACCELERATION_STRUCTURE TOP_LEVEL
. They're longer (we could drop the _LEVEL
). But, they make it a lot clearer for someone that my not have as much ray tracing knowledge what they are.
SBT
is very short, maybe SHADER_BIND_TABLE
to be more descriptive?
I think AABB
is fine, it's a pretty common acronym so I think having it as the shortened form doesn't hurt anything
BLAS_INSTANCE USE
. Could this just be BOTTOM_LEVEL {name}
? Is that too short? or even just something like ATTACH
which would be similar to how things are attached to a pipeline?
For the TRIANGLE
geometry, do we need the VERTEX
keyword? Could we just have:
TRIANGLE x0 y0 z0 x1 y1 z1 x2 y2 z2
?
Similar for AABB
geometry as it looks like you end up with AABB
twice?
For GEOMETRY
we allow multiple triangles and aabbs, so possibly pluralize the names GEOMETRY TRIANGLES
and GEOMETRY AABBS
?
Or, maybe for both GEOMETRY TRIANGLE
and GEOMETRY AABB
it would be better to do something like:
GEOMETRY TRIANGLES
TRIANGLE x0 y0 z0 x1 y1 z1 x2 y2 z2
TRIANGLE x0 y0 z0 ...
END
GEOMETRY AABBS
AABB x0 y0 z0 x1 y1 z1
AABB ...
END
I think I like that better, thoughts?
The flags with the optional END
feels a bit weird. Could we change it to just be a comma separated list, remove the ability to spread over multiple lines? (Or does that become too long because you often want to specify multiples of them?) Or, comma separated but allow line breaks, so no END needed, if there is no comma then then the list ends?
I don't understand what goes in transform
. 12 space separated values
, are those numbers, strings flags? Is this a 3x4 matrix transform?
For the SHADER_GROUP
it says the ordering is essential. Is that the order of the SHADER_GROUP
commands in the Amberscript, or the order of the shaders listed in the shader group command (like any_hit
, closest_hit
, etc). If it's the order in the Amber file is there something we can do to remove that restriction and fix the order up afterwards? Like SHADER_GROUP GENERATION {name} {ray_generation_shader_name}
, SHADER_GROUP MISS {name} {miss_shader_name}
and then I can put those in whatever order and we always reorder them to be raygen, miss, call, others after parsing the script?
What does the group_count
mean on SBT
? Does that mean that the group_name_1
shader group will be attached to the binding table that many times?
Reading the note on shader bind tables needed, could we do something like have named shader bind table entries. So, combined with point 11 above we end up with something like:
SHADER_GROUP MISS miss1 my_miss_shader
SHADER_GROUP MISS miss2 another_miss_shader
SHADER_GROUP RAYGEN gen my_gen_shader
SHADER_GROUP CALL call my_call_shader
SHADER_GROUP HIT hit1 my_any_hit my_closest_hit my_intersection
SHADER_GROUP HIT hit2 any_hit2 closest_hit2 intersection2
SHADER_BIND_GROUP MISS miss_group
USE miss1
USE miss2 MULTIPLE 3
END
SHADER_BIND_GROUP HIT hit_group
USE hit1
USE hit2
END
SHADER_BIND_GROUP CALL call_group
USE call
END
SHADER_BIND_GROUP RAYGEN ray_group
USE gen
END
We can then validate that the shader_bind_group types match up to the shader_group types what we defined above?
I think for BIND
we should make the type required. So, BIND ACCELERATION_STRUCTURE TOP_LEVEL {name} DESCRIPTOR_SET _id_ BINDING _id_
or something like that
Not a huge fan of using NULL
in the RUN
command, what about using named params:
RUN {pipeline_name} RAYGEN {ray_gen_sbt_name} MISS {miss_sbt_name} HIT {hit_sbt_name} [CALL {call_sbt_name}]? _x_ _y_ _z_
ACCELERATION_STRUCTURE
a bunch, maybe ACCEL_STRUCTURE
?For the GEOMETRY TRIANGLES
should we take something more complex then just vertex values? It seems like it actually takes a vertex and index buffer of a given stride, so, should we be able to attach a BUFFER
?
For 13 above, after watching more of the rt video, I don't think it's necessarily the best way. Maybe something like the following would be better?
SHADER_BIND_GROUP gen generation_group
RAYGEN my_gen_shader
END
SHADER_BIND_GROUP miss_group1
MISS my_miss_shader
END
SHADER_BIND_GROUP miss_group2
MISS another_miss_shader
END
SHADER_BIND_GROUP sphere_group
ANY_HIT my_any_hit
CLOSEST_HIT my_closest_hit
INTERSECTION intersection2
END
SHADER_BIND_GROUP triangle_group
CLOSEST_HIT closest_hit2
END
SHADER_BIND_TABLE bind_table
generation_group
sphere_group
triangle_group
miss_group1
miss_group2
END
The bind group can contain either a MISS
, a RAYGEN
or (ANY_HIT
?, CLOSEST_HIT
, INTERSECTION
?). I don't have the group_count
as it maybe better to just be explicit here and duplicate the names into the bind_table
?
GEOMETRY TRIANGLES
x0 y0 z0 x1 y1 z1 x2 y2 z2
xn yn zn ...
END
GEOMETRY AABBS
x0a y0a z0a x0b y0b z0b x1a y1a z1a x1b y1b z1b
xna yna zna xnb ynb znb ...
END
For the GEOMETRY TRIANGLES should we take something more complex then just vertex values? It seems like it actually takes a vertex and index buffer of a given stride, so, should we be able to attach a BUFFER?
Yes, though this is complicated subject. You are right that this is just a buffer with vertices or indices and in Vulkan RT it is more advanced: several types are allowed for both vertices and indices. Vertices formats are implementation dependent. I would leave this for future. Indexing vertices does not seem natural for scripting languages, but giving names to vertices will complicate approach.
PIPELINE ...
SHADER_GROUP generation_group
my_gen_shader
END
SHADER_GROUP miss_group1
my_miss_shader
END
SHADER_GROUP miss_group2
another_miss_shader
END
SHADER_GROUP sphere_group
my_any_hit
my_closest_hit
intersection2
END
SHADER_GROUP triangle_group
closest_hit2
END
SHADER_BINDING_TABLE bind_table
generation_group
sphere_group
triangle_group
miss_group1
miss_group2
END
END
Syntax updated https://github.com/google/amber/commit/d4a407943094bff32cc498addbfae394bfbf5ad6
Also link to example CTS implementation added into head.
The changes to the doc look good to me. One note, you can't assume that you'll be able to determine the type of a thing from the name. So SHADER_GROUP MISS miss1 my_miss_shader
could also be SHADER_GROUP MISS some_random_name
and you won't know it's a miss shader without MISS
in there.
the type of a thing from the name.
Yes I was incorrect, I meant that it is deduced from shader types included into group, not shader group name.
I merged fixes found by @nhaehnle.
I think we have enough for initial RT support, thus I created PR for this issue https://github.com/google/amber/pull/1035
Should we close this now and file followup issues for anything new to be added?
I think we can go with part 2 within this issue that is in https://github.com/google/amber/pull/1039 Edit: We have https://github.com/google/amber/issues/1038 for it, thus closing this one.
Add support for ray tracing in Amber scripts. New syntax should include:
Syntax changes proposed at https://github.com/archimedus/amber/blob/main/docs/amber_script.md
Example CTS: https://gerrit.khronos.org/c/vk-gl-cts/+/12867