Internal UE5-style runtime virtual texture session: feedback → decode → atomic publish. 更多...
#include <VirtualTextureStreaming.h>
Public 成员函数 | |
| eve::Result< std::uint32_t > | addLayer (const VirtualTextureBlendLayer &layer) |
| Copy and append one material layer through the owned producer. | |
| eve::Result< void > | initializePhysicalCache () |
| Allocate CPU atlases and a page table with only the substitute slot resident. | |
| eve::Result< void > | recordFeedback (int pageX, int pageY, int mipLevel=0) |
| Record one page request (cheap; retained until the next update compact). | |
| eve::Result< void > | recordFeedbackUv (float u, float v, int mipLevel=0) |
| Record the page covering normalized UV (fract). | |
| eve::Result< void > | ingestPackedFeedback (std::span< const std::uint32_t > packed) |
| Ingest a packed feedback buffer (UE-style page IDs). @cost Cheap relative to update(); copies and retains samples up to feedbackCapacity. @amortized Per feedback readback / frame ingest. | |
| eve::Result< void > | recordFeedbackGrid (int gridW, int gridH, int mipLevel=0) |
| Record every cell centre of a low-resolution UV grid (CPU feedback stand-in). @cost Linear in gridW*gridH retained samples; still cheaper than page decode. @amortized Per simulated feedback pass. | |
| eve::Result< void > | invalidateRect (float u0, float v0, float u1, float v1, int mipLevel=0) |
| Mark resident pages covering a UV rectangle dirty so the next update re-decodes them. | |
| eve::Result< void > | invalidatePage (int pageX, int pageY, int mipLevel=0) |
| Mark one page dirty for writer-style attribute edits. | |
| eve::Result< VirtualTextureStreamingStats > | update () |
| Compact feedback, decode up to budget, and stage an incremental upload batch. @cost Expensive relative to recordFeedback: page compose plus atlas/page-table staging. @amortized Per streaming update / frame. | |
| eve::Result< VirtualTextureUploadBatch > | takePendingUploads () |
| Take the staged upload batch for GPU application. | |
| eve::Result< void > | commitPublish (std::uint64_t expectedGeneration) |
| Publish working state after successful GPU uploads (bumps generation). | |
| eve::Result< void > | abandonPublish () |
| Discard staged working changes and restore the last published mapping. | |
| eve::Result< void > | syncToMaterial (Graphics &gfx, Material &material) |
| Create or refresh GPU textures and bind them to a material. @cost Expensive on first call (full atlas upload); later calls apply pending regions only. @amortized Per material sync after update(). | |
| VirtualTextureStreamingStats | stats () const |
| Snapshot counters. | |
| const image::ImageData & | albedoAtlas () const |
| Published albedo atlas (valid after initializePhysicalCache). | |
| const image::ImageData & | normalAtlas () const |
| Published normal atlas. | |
| const image::ImageData & | pageTable () const |
| Published page table. | |
| int | atlasSlotsX () const |
| Atlas slots x. | |
| int | atlasSlotsY () const |
| Atlas slots y. | |
| int | pageExtent () const |
| Page extent including gutter. | |
| float | borderFraction () const |
| Border texels / pageExtent. | |
| int | pageCountX () const |
| Mip-zero page count x. | |
| int | pageCountY () const |
| Mip-zero page count y. | |
| std::uint64_t | generation () const |
| Published generation. | |
| VirtualTextureBlend & | producer () |
| Borrowed producer. | |
| const VirtualTextureBlend & | producer () const |
| Borrowed producer. | |
静态 Public 成员函数 | |
| static eve::Result< std::unique_ptr< VirtualTextureStreaming > > | create (const VirtualTextureStreamingConfig &config) |
| Validate config and create an empty streaming session. | |
| static std::uint32_t | packFeedback (int pageX, int pageY, int mipLevel) noexcept |
| Pack a feedback sample into the 32-bit GPU/CPU wire format. | |
| static eve::Result< VirtualTextureFeedbackSample > | unpackFeedback (std::uint32_t packed) |
| Unpack a feedback sample into page coordinates. | |
详细描述
Internal UE5-style runtime virtual texture session: feedback → decode → atomic publish.
Owned by Material (enableVirtualTexture / addVirtualTextureLayer). Game scripts do not construct or tick this type; Material::bind advances residency once per Graphics::mesh3dDrawEpoch(). GPU resources stay in Graphics; this object only stages CPU pixels and generation-qualified upload batches.
@thread Not thread-safe; record feedback, update, and publish on one authoring/render thread. @reentrancy Does not invoke callbacks.
在文件 VirtualTextureStreaming.h 第 95 行定义.
成员函数说明
◆ abandonPublish()
| eve::Result< void > eve::graphics::VirtualTextureStreaming::abandonPublish | ( | ) |
Discard staged working changes and restore the last published mapping.
- 返回
- Failure when there is no pending batch to abandon.
在文件 VirtualTextureStreaming.cpp 第 453 行定义.
引用了 eve::graphics::VirtualTextureStreamingStats::abandonedPublishes, eve::Result< T >::failure(), eve::graphics::VirtualTextureStreamingStats::pendingUploads, eve::graphics::VirtualTextureStreamingStats::residentPages , 以及 eve::Result< T >::success().
被这些函数引用 syncToMaterial().
◆ addLayer()
| eve::Result< std::uint32_t > eve::graphics::VirtualTextureStreaming::addLayer | ( | const VirtualTextureBlendLayer & | layer | ) |
Copy and append one material layer through the owned producer.
- 返回
- Stable zero-based layer index, or a structured validation failure.
在文件 VirtualTextureStreaming.cpp 第 83 行定义.
引用了 layer, eve::graphics::VirtualTextureStreamingStats::pagesInvalidated, result , 以及 slot.
◆ albedoAtlas()
| const image::ImageData & eve::graphics::VirtualTextureStreaming::albedoAtlas | ( | ) | const |
Published albedo atlas (valid after initializePhysicalCache).
在文件 VirtualTextureStreaming.cpp 第 493 行定义.
◆ atlasSlotsX()
|
inline |
Atlas slots x.
在文件 VirtualTextureStreaming.h 第 200 行定义.
◆ atlasSlotsY()
|
inline |
Atlas slots y.
在文件 VirtualTextureStreaming.h 第 202 行定义.
◆ borderFraction()
|
inline |
Border texels / pageExtent.
在文件 VirtualTextureStreaming.h 第 206 行定义.
◆ commitPublish()
| eve::Result< void > eve::graphics::VirtualTextureStreaming::commitPublish | ( | std::uint64_t | expectedGeneration | ) |
Publish working state after successful GPU uploads (bumps generation).
- 参数
-
expectedGeneration Must equal the batch's expectedGeneration.
在文件 VirtualTextureStreaming.cpp 第 438 行定义.
引用了 eve::Result< T >::failure(), eve::graphics::VirtualTextureStreamingStats::generation, eve::graphics::VirtualTextureStreamingStats::pendingUploads, eve::graphics::VirtualTextureStreamingStats::publishes, eve::graphics::VirtualTextureStreamingStats::residentPages , 以及 eve::Result< T >::success().
被这些函数引用 syncToMaterial().
◆ create()
|
static |
Validate config and create an empty streaming session.
在文件 VirtualTextureStreaming.cpp 第 65 行定义.
引用了 eve::graphics::VirtualTextureStreamingConfig::blend, eve::graphics::VirtualTextureBlend::create(), eve::graphics::VirtualTextureStreamingConfig::feedbackCapacity, eve::graphics::VirtualTextureStreamingConfig::maxDecodesPerUpdate, producer() , 以及 value.
◆ generation()
|
inline |
Published generation.
在文件 VirtualTextureStreaming.h 第 212 行定义.
◆ ingestPackedFeedback()
| eve::Result< void > eve::graphics::VirtualTextureStreaming::ingestPackedFeedback | ( | std::span< const std::uint32_t > | packed | ) |
Ingest a packed feedback buffer (UE-style page IDs). @cost Cheap relative to update(); copies and retains samples up to feedbackCapacity. @amortized Per feedback readback / frame ingest.
在文件 VirtualTextureStreaming.cpp 第 186 行定义.
引用了 recordFeedback(), eve::Result< T >::success(), unpackFeedback() , 以及 word.
◆ initializePhysicalCache()
| eve::Result< void > eve::graphics::VirtualTextureStreaming::initializePhysicalCache | ( | ) |
Allocate CPU atlases and a page table with only the substitute slot resident.
- 返回
- Success after publishing generation zero, or a structured failure.
在文件 VirtualTextureStreaming.cpp 第 99 行定义.
引用了 eve::Result< T >::failure(), eve::graphics::VirtualTextureStreamingStats::generation, eve::graphics::VirtualTextureStreamingStats::residentPages, state , 以及 eve::Result< T >::success().
◆ invalidatePage()
| eve::Result< void > eve::graphics::VirtualTextureStreaming::invalidatePage | ( | int | pageX, |
| int | pageY, | ||
| int | mipLevel = 0 |
||
| ) |
Mark one page dirty for writer-style attribute edits.
在文件 VirtualTextureStreaming.cpp 第 219 行定义.
引用了 found, eve::graphics::VirtualTextureStreamingStats::pagesInvalidated, eve::Result< T >::success() , 以及 valid.
被这些函数引用 invalidateRect().
◆ invalidateRect()
| eve::Result< void > eve::graphics::VirtualTextureStreaming::invalidateRect | ( | float | u0, |
| float | v0, | ||
| float | u1, | ||
| float | v1, | ||
| int | mipLevel = 0 |
||
| ) |
Mark resident pages covering a UV rectangle dirty so the next update re-decodes them.
- 返回
- Failure when uninitialized or the rectangle is empty/non-finite.
在文件 VirtualTextureStreaming.cpp 第 231 行定义.
引用了 eve::Result< T >::failure(), invalidatePage(), pageCountX(), pageCountY(), eve::Result< T >::success(), x , 以及 y.
◆ normalAtlas()
| const image::ImageData & eve::graphics::VirtualTextureStreaming::normalAtlas | ( | ) | const |
Published normal atlas.
在文件 VirtualTextureStreaming.cpp 第 494 行定义.
◆ packFeedback()
|
staticnoexcept |
Pack a feedback sample into the 32-bit GPU/CPU wire format.
在文件 VirtualTextureStreaming.cpp 第 136 行定义.
◆ pageCountX()
| int eve::graphics::VirtualTextureStreaming::pageCountX | ( | ) | const |
Mip-zero page count x.
在文件 VirtualTextureStreaming.cpp 第 497 行定义.
被这些函数引用 invalidateRect(), recordFeedbackUv() , 以及 syncToMaterial().
◆ pageCountY()
| int eve::graphics::VirtualTextureStreaming::pageCountY | ( | ) | const |
Mip-zero page count y.
在文件 VirtualTextureStreaming.cpp 第 498 行定义.
被这些函数引用 invalidateRect(), recordFeedbackUv() , 以及 syncToMaterial().
◆ pageExtent()
|
inline |
Page extent including gutter.
在文件 VirtualTextureStreaming.h 第 204 行定义.
◆ pageTable()
| const image::ImageData & eve::graphics::VirtualTextureStreaming::pageTable | ( | ) | const |
Published page table.
在文件 VirtualTextureStreaming.cpp 第 495 行定义.
◆ producer() [1/2]
|
inline |
◆ producer() [2/2]
|
inline |
Borrowed producer.
在文件 VirtualTextureStreaming.h 第 216 行定义.
◆ recordFeedback()
| eve::Result< void > eve::graphics::VirtualTextureStreaming::recordFeedback | ( | int | pageX, |
| int | pageY, | ||
| int | mipLevel = 0 |
||
| ) |
Record one page request (cheap; retained until the next update compact).
- 返回
- Failure when the physical cache is uninitialized or the coordinate is invalid.
在文件 VirtualTextureStreaming.cpp 第 165 行定义.
引用了 eve::graphics::VirtualTextureStreamingConfig::feedbackCapacity, eve::graphics::VirtualTextureStreamingStats::feedbackSamples, eve::Result< T >::success() , 以及 valid.
被这些函数引用 ingestPackedFeedback() , 以及 recordFeedbackUv().
◆ recordFeedbackGrid()
| eve::Result< void > eve::graphics::VirtualTextureStreaming::recordFeedbackGrid | ( | int | gridW, |
| int | gridH, | ||
| int | mipLevel = 0 |
||
| ) |
Record every cell centre of a low-resolution UV grid (CPU feedback stand-in). @cost Linear in gridW*gridH retained samples; still cheaper than page decode. @amortized Per simulated feedback pass.
在文件 VirtualTextureStreaming.cpp 第 205 行定义.
引用了 eve::Result< T >::failure(), recordFeedbackUv(), eve::Result< T >::success(), u, v, x , 以及 y.
◆ recordFeedbackUv()
| eve::Result< void > eve::graphics::VirtualTextureStreaming::recordFeedbackUv | ( | float | u, |
| float | v, | ||
| int | mipLevel = 0 |
||
| ) |
Record the page covering normalized UV (fract).
- 返回
- Failure when the physical cache is uninitialized.
在文件 VirtualTextureStreaming.cpp 第 176 行定义.
引用了 eve::Result< T >::failure(), pageCountX(), pageCountY(), recordFeedback(), u , 以及 v.
被这些函数引用 recordFeedbackGrid().
◆ stats()
| VirtualTextureStreamingStats eve::graphics::VirtualTextureStreaming::stats | ( | ) | const |
Snapshot counters.
在文件 VirtualTextureStreaming.cpp 第 482 行定义.
引用了 eve::graphics::VirtualTextureStreamingStats::generation , 以及 out.
被这些函数引用 update().
◆ syncToMaterial()
| eve::Result< void > eve::graphics::VirtualTextureStreaming::syncToMaterial | ( | Graphics & | gfx, |
| Material & | material | ||
| ) |
Create or refresh GPU textures and bind them to a material. @cost Expensive on first call (full atlas upload); later calls apply pending regions only. @amortized Per material sync after update().
在文件 VirtualTextureStreaming.cpp 第 519 行定义.
引用了 abandonPublish(), albedo, eve::graphics::TextureRegionUpload::bytesPerRow, commitPublish(), eve::Result< T >::failure(), eve::graphics::TextureCreateInfo::generateMipmaps, eve::graphics::TextureRegionUpload::height, info, material, eve::graphics::Graphics::newTexture(), normal, pageCountX(), pageCountY(), eve::graphics::TextureRegionUpload::rgba, eve::Result< T >::success(), takePendingUploads(), eve::graphics::Graphics::updateTextureRegions() , 以及 eve::graphics::TextureRegionUpload::width.
◆ takePendingUploads()
| eve::Result< VirtualTextureUploadBatch > eve::graphics::VirtualTextureStreaming::takePendingUploads | ( | ) |
Take the staged upload batch for GPU application.
- 返回
- Failure when nothing is pending or a previous batch was not committed/abandoned.
在文件 VirtualTextureStreaming.cpp 第 426 行定义.
引用了 eve::graphics::VirtualTextureUploadBatch::expectedGeneration, eve::Result< T >::failure(), eve::graphics::VirtualTextureStreamingStats::pendingUploads , 以及 eve::Result< T >::success().
被这些函数引用 syncToMaterial().
◆ unpackFeedback()
|
static |
Unpack a feedback sample into page coordinates.
- 返回
- Success with the decoded sample, or InvalidArgument when fields exceed the bit budget.
在文件 VirtualTextureStreaming.cpp 第 141 行定义.
引用了 eve::Result< T >::failure() , 以及 eve::Result< T >::success().
被这些函数引用 ingestPackedFeedback().
◆ update()
| eve::Result< VirtualTextureStreamingStats > eve::graphics::VirtualTextureStreaming::update | ( | ) |
Compact feedback, decode up to budget, and stage an incremental upload batch. @cost Expensive relative to recordFeedback: page compose plus atlas/page-table staging. @amortized Per streaming update / frame.
- 返回
- Snapshot stats after the tick; failure leaves the previous published mapping intact.
在文件 VirtualTextureStreaming.cpp 第 349 行定义.
引用了 a, eve::graphics::VirtualTextureUploadBatch::albedoRegions, b, eve::graphics::VirtualTextureUploadBatch::expectedGeneration, eve::Result< T >::failure(), found, eve::graphics::VirtualTextureStreamingStats::generation, eve::graphics::VirtualTextureStreamingConfig::maxDecodesPerUpdate, eve::graphics::VirtualTextureUploadBatch::normalRegions, ordered, eve::graphics::VirtualTextureUploadBatch::pageTableClears, eve::graphics::VirtualTextureUploadBatch::pageTableSets, eve::graphics::VirtualTextureStreamingStats::pendingFeedback, eve::graphics::VirtualTextureStreamingStats::pendingUploads, record, eve::graphics::VirtualTextureStreamingStats::residentPages, slot, stats(), eve::Result< T >::success(), eve::graphics::VirtualTextureStreamingStats::uniqueFeedback , 以及 weight.
该类的文档由以下文件生成:
- src/modules/graphics/VirtualTextureStreaming.h
- src/modules/graphics/VirtualTextureStreaming.cpp