Optional hardware ray-tracing backend (Vulkan KHR RT). 更多...
#include <IRayTracing.h>
Public 成员函数 | |
| virtual | ~IRayTracing ()=default |
| I ray tracing. | |
| virtual bool | isAvailable () const =0 |
| True when the active Graphics device enabled the KHR RT path. | |
| virtual RayTracingCaps | caps () const =0 |
| Borrowed device caps; valid while Graphics remains initialized. | |
| virtual Result< PathSceneToken > | preparePathScene (Graphics *gfx, const PathSceneDescription &scene)=0 |
| Prepare an independently owned path-tracing scene and publish it atomically. | |
| virtual Result< PathSceneToken > | updatePathInstances (PathSceneToken token, std::span< const PathInstance > instances)=0 |
| Replace instances of a prepared geometry set without rebuilding its BLAS. | |
| virtual Result< void > | renderPaths (PathSceneToken token, Canvas *dest, const PathTraceView &view)=0 |
| Render a prepared path-tracing sample batch into an HDR canvas. | |
| virtual Result< PathFrameToken > | preparePathFrame (PathSceneToken scene, uint32_t width, uint32_t height)=0 |
| Prepare provider-owned output images for normal-frame path tracing. @ownership Provider owns output images and sampled textures; no caller storage is retained. @thread Render thread, outside frame recording; no callbacks. @cost Allocates images proportional to pixels on resize; equal extents reuse the current output token. | |
| virtual Result< Texture * > | recordPathFrame (PathSceneToken scene, PathFrameToken output, const PathTraceView &view)=0 |
| End the scene pass and record one path batch as this normal frame's HDR resolve source. @ownership Returned texture is borrowed from the provider until output invalidation; use it in this frame only. @thread Render thread; once per present frame, no callbacks or reentrancy. @cost Records pixel/sample/bounce-proportional GPU work; does not submit or wait for this batch. | |
| virtual Result< void > | applyReflections (Graphics *gfx, Texture *sceneColor, Texture *hwDepth, Texture *worldNormal, Canvas *dest, const glm::mat4 &invViewProj, const glm::mat4 &viewProj, const glm::vec3 &eyeWorld)=0 |
Trace mirror-style reflections into dest (RGBA16F, A = hit mask). | |
| virtual Result< void > | rebuildScene ()=0 |
| Rebuild the TLAS from meshes previously registered with the scene. | |
| virtual Result< uint32_t > | addTriangleMesh (const float *positionsXYZ, int vertexCount, const uint32_t *indices, int indexCount, const glm::mat4 &transform)=0 |
| Register a triangle mesh instance for ray tracing. | |
| virtual Result< uint32_t > | addMesh (Mesh *mesh, const glm::mat4 &transform)=0 |
Register a GPU Mesh already uploaded by Graphics. @ownership mesh is borrowed for the call; vertex/index bytes are copied. @lifetime mesh and its gpuHandle must remain valid through this call. | |
| virtual void | clearScene ()=0 |
| Drop every registered mesh and acceleration structure. | |
| virtual void | detachFromGraphics () |
| Release device-owned RT resources before Graphics destroys the device. @thread Render thread only; safe when never attached. | |
静态 Public 属性 | |
| static constexpr const char * | capabilityName = "IRayTracing" |
详细描述
Optional hardware ray-tracing backend (Vulkan KHR RT).
Provided by the graphics_raytracing module when linked. Consumers must tolerate eve::cap::query<IRayTracing>() == nullptr (module trimmed) and isAvailable() == false (GPU lacks the extensions) as supported states.
@lifetime The provider is registered at static init and outlives modules. @thread Render thread only.
在文件 IRayTracing.h 第 28 行定义.
构造及析构函数说明
◆ ~IRayTracing()
|
virtualdefault |
I ray tracing.
成员函数说明
◆ addMesh()
|
pure virtual |
◆ addTriangleMesh()
|
pure virtual |
Register a triangle mesh instance for ray tracing.
- 参数
-
positionsXYZ Packed xyz positions (vertexCount * 3). indices Triangle indices (indexCount, multiple of 3). transform Object-to-world transform for the TLAS instance.
- 返回
- Instance id on success, or Unsupported / InvalidArgument. @ownership Input spans are borrowed only during this call.
◆ applyReflections()
|
pure virtual |
Trace mirror-style reflections into dest (RGBA16F, A = hit mask).
- 参数
-
gfx Active Graphics backend (Vulkan). sceneColor Lit scene color to sample on a hit when no material is bound. hwDepth Hardware depth (D32) matching the scene projection. worldNormal World-space normals (RGB). dest Output canvas; size drives the launch dimensions. invViewProj Inverse view-projection (RH + ZO) for primary rays. viewProj View-projection used to reproject hit points into scene color. eyeWorld Camera eye in world space.
- 返回
- Unsupported when RT is unavailable; NoOp when the TLAS is empty; Failed on GPU errors. Callers must treat NoOp as "no usable output". @ownership All pointers are borrowed for the call; none are retained.
◆ caps()
|
pure virtual |
Borrowed device caps; valid while Graphics remains initialized.
◆ clearScene()
|
pure virtual |
Drop every registered mesh and acceleration structure.
◆ detachFromGraphics()
|
inlinevirtual |
Release device-owned RT resources before Graphics destroys the device. @thread Render thread only; safe when never attached.
被 eve::graphics::raytracing::VulkanRayTracing 重载.
在文件 IRayTracing.h 第 150 行定义.
◆ isAvailable()
|
pure virtual |
True when the active Graphics device enabled the KHR RT path.
◆ preparePathFrame()
|
pure virtual |
Prepare provider-owned output images for normal-frame path tracing. @ownership Provider owns output images and sampled textures; no caller storage is retained. @thread Render thread, outside frame recording; no callbacks. @cost Allocates images proportional to pixels on resize; equal extents reuse the current output token.
- 返回
- Output identity, invalidated by resize, full scene replacement or device detach.
◆ preparePathScene()
|
pure virtual |
Prepare an independently owned path-tracing scene and publish it atomically.
- 参数
-
gfx Initialized graphics device; borrowed until device detachment. scene Borrowed geometry, materials, textures, instances and lights; copied during preparation.
- 返回
- Current token for identical values, new token for changed values, or a failure preserving the prior scene. @cost CPU validation/comparison proportional to input; unchanged values reuse GPU resources. Geometry/material/light/texture changes upload/build; native textures copy GPU bytes proportional to texels. Source content identities amortize unchanged native captures; instance-only changes reuse BLAS and update TLAS. @thread Render thread, outside frame recording; no callbacks or reentrancy. @lifetime Successful preparation of changed inputs invalidates prior tokens/history. Source edits/releases alone leave an existing snapshot intact. Device detachment releases the owned scene.
◆ rebuildScene()
|
pure virtual |
Rebuild the TLAS from meshes previously registered with the scene.
- 返回
- Unsupported when RT is unavailable; Failed on build errors.
◆ recordPathFrame()
|
pure virtual |
End the scene pass and record one path batch as this normal frame's HDR resolve source. @ownership Returned texture is borrowed from the provider until output invalidation; use it in this frame only. @thread Render thread; once per present frame, no callbacks or reentrancy. @cost Records pixel/sample/bounce-proportional GPU work; does not submit or wait for this batch.
- 返回
- Sampleable output for same-frame composition, or a structured failure. Success is recording, not completion.
The caller submits the normal frame. Reset history if a previous recording was not submitted. Subsequent 3D raster draws are not permitted; 2D UI overlays remain supported.
◆ renderPaths()
|
pure virtual |
Render a prepared path-tracing sample batch into an HDR canvas.
- 参数
-
token Token returned by this provider's latest successful preparation. dest Borrowed RGBA16F output canvas; must outlive the call. view Camera, environment and deterministic sampling/accumulation settings.
- 返回
- InvalidArgument for stale tokens or invalid inputs; Failed for GPU errors. @cost GPU work scales with pixels, samples and bounces; currently waits for GPU completion per batch. @thread Render thread, outside frame recording; no callbacks or reentrancy. @ownership Provider owns accumulation; destination remains caller-owned.
◆ updatePathInstances()
|
pure virtual |
Replace instances of a prepared geometry set without rebuilding its BLAS.
- 参数
-
token Current prepared-scene token. instances Complete replacement instance list; geometry indices refer to the prepared geometry set.
- 返回
- New scene token on success; failure preserves the prior token and scene. @ownership Input is borrowed for this call; geometry/material buffers remain provider-owned. @lifetime Success invalidates the old token and accumulation. Detachment invalidates all tokens. @thread Render thread, outside frame recording; no callbacks or reentrancy. @cost TLAS build and emissive-instance upload proportional to instances/emissive triangles; amortize across frames with unchanged instances. Geometry/material/light replacement requires preparation.
类成员变量说明
◆ capabilityName
|
staticconstexpr |
在文件 IRayTracing.h 第 30 行定义.
该类的文档由以下文件生成:
- src/modules/graphics/IRayTracing.h