mirror of
https://github.com/status-im/Vulkan-Docs.git
synced 2025-01-23 20:59:02 +00:00
b59ec03ee3
* Update release number to 99. Public Issues: * Add missing pname:pMemoryHostPointerProperties description to flink:vkGetMemoryHostPointerPropertiesEXT.txt (public pull request 896). * Minor markup fixes (public pull request 900). * Minor update to `khronos.css` and markup fixes (originally proposed in public pull request 901, but done via an internal MR). Internal Issues: * Document restrictions on image queries for Y'CbCr formats in the <<features-formats-requiring-sampler-ycbcr-conversion>> table as well as for slink:sname:VkImageFormatProperties and slink:VkImageCreateInfo (internal issue 1361). * Correct type of the code:FragSizeEXT built-in in the <<interfaces-builtin-variables, Built-In Variables>> section (internal issue 1526). * Clean up math in the <<textures, Image Operations>> chapter by refactoring, using better naming conventions, updating diagrams to use the correct orientation, etc. (internal merge request 2968). * Fix minor typos for slink:VkImageCreateInfo and slink:VkImageStencilUsageCreateInfoEXT. * Add missing documentation for tlink:VkResolveModeFlagsKHR. * Fix extension dependency of pname:scalarBlockLayout in the <<features-features-requirements, Feature Requirements>> section. * Fix indexing math for shader binding table calculations in the <<shader-binding-table-indexing-rules, Indexing Rules>> section, and use spelling "`any-hit`" consistently. * Reconcile valid usage statement and text for sampled image layouts in slink:VkWriteDescriptorSet (https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/551). * Make SPIR-V code:OpConvertUToPtr and code:OpConvertPtrToU operations require a 64-bit integer for physical storage buffer pointers in the <<spirvenv-module-validation, Validation Rules within a Module>> section. * Update to KaTeX 10.0. New Extensions: * `VK_EXT_filter_cubic` * `VK_NV_dedicated_allocation_image_aliasing`
110 lines
3.9 KiB
Plaintext
110 lines
3.9 KiB
Plaintext
// This section is included inside the Shaders chapter (shaders.txt)
|
|
|
|
[[shaders-raytracing-shaders]]
|
|
[[shaders-ray-generation]]
|
|
== Ray Generation Shaders
|
|
|
|
A ray generation shader is similar to a compute shader.
|
|
Its main purpose is to execute ray tracing queries using code:OpTraceNV
|
|
instructions and process the results.
|
|
|
|
[[shaders-ray-generation-execution]]
|
|
=== Ray Generation Shader Execution
|
|
|
|
One ray generation shader is executed per ray tracing dispatch.
|
|
Its location in the shader binding table (see <<shader-binding-table,Shader
|
|
Binding Table>> for details) is passed directly into fname:vkCmdTraceRaysNV
|
|
using the pname:raygenShaderBindingTableBuffer and
|
|
pname:raygenShaderBindingOffset parameters.
|
|
|
|
[[shaders-intersection]]
|
|
== Intersection Shaders
|
|
|
|
Intersection shaders enable the implementation of arbitrary, application
|
|
defined geometric primitives.
|
|
An intersection shader for a primitive is executed whenever its axis-aligned
|
|
bounding box is hit by a ray.
|
|
|
|
A built-in intersection shader for triangle primitives that is used
|
|
automatically whenever geometry of type ename:VK_GEOMETRY_TYPE_TRIANGLES_NV
|
|
is specified.
|
|
|
|
Like other ray tracing shader domains, an intersection shader operates on a
|
|
single ray at a time.
|
|
It also operates on a single primitive at a time.
|
|
It is therefore the purpose of an intersection shader to compute the
|
|
ray-primitive intersections and report them.
|
|
To report an intersection, the shader calls the code:OpReportIntersectionNV
|
|
instruction.
|
|
|
|
An intersection shader communicates with any-hit and closest shaders by
|
|
generating attribute values that they can: read.
|
|
Intersection shaders cannot: read or modify the ray payload.
|
|
|
|
[[shaders-intersection-execution]]
|
|
=== Intersection Shader Execution
|
|
The order in which intersections are found along a ray, and therefore the
|
|
order in which intersection shaders are executed, is unspecified.
|
|
|
|
The intersection shader of the closest AABB which intersects the ray is
|
|
guaranteed to be executed at some point during traversal, unless the ray is
|
|
forcibly terminated.
|
|
|
|
[[shaders-any-hit]]
|
|
== Any-Hit Shaders
|
|
|
|
The any-hit shader is executed after the intersection shader reports an
|
|
intersection that lies within the current [eq]#[tmin,tmax]# of the ray.
|
|
The main use of any-hit shaders is to programmatically decide whether or not
|
|
an intersection will be accepted.
|
|
The intersection will be accepted unless the shader calls the
|
|
code:OpIgnoreIntersectionNV instruction.
|
|
|
|
[[shaders-any-hit-execution]]
|
|
=== Any-Hit Shader Execution
|
|
|
|
The order in which intersections are found along a ray, and therefore the
|
|
order in which any-hit shaders are executed, is unspecified.
|
|
|
|
The any-hit shader of the closest hit is guaranteed to be executed at some
|
|
point during traversal, unless the ray is forcibly terminated.
|
|
|
|
[[shaders-closest-hit]]
|
|
== Closest Hit Shaders
|
|
|
|
Closest hit shaders have read-only access to the attributes generated by the
|
|
corresponding intersection shader, and can: read or modify the ray payload.
|
|
They also have access to a number of system-generated values.
|
|
Closest hit shaders can: call code:OpTraceNV to recursively trace rays.
|
|
|
|
[[shaders-closest-hit-execution]]
|
|
=== Closest Hit Shader Execution
|
|
|
|
Exactly one closest hit shader is executed when traversal is finished and an
|
|
intersection has been found and accepted.
|
|
|
|
[[shaders-miss]]
|
|
== Miss Shaders
|
|
|
|
Miss shaders can: access the ray payload and can: trace new rays through the
|
|
code:OpTraceNV instruction, but cannot: access attributes since they are not
|
|
associated with an intersection.
|
|
|
|
[[shaders-miss-execution]]
|
|
=== Miss Shader Execution
|
|
|
|
A miss shader is executed instead of a closest hit shader if no intersection
|
|
was found during traversal.
|
|
|
|
[[shaders-callable]]
|
|
== Callable Shaders
|
|
|
|
Callable shaders can: access a callable payload that works similarly to ray
|
|
payloads to do subroutine work.
|
|
|
|
[[shaders-callable-execution]]
|
|
=== Callable Shader Execution
|
|
|
|
A callable shader is executed by calling code:OpExecuteCallableNV from an
|
|
allowed shader stage.
|