Class TextureStreamingHelper
Namespace: ValveResourceFormat.Renderer.Materials
Assembly: Renderer.dll
Reads texture mip data on background threads and gives it to the GPU over the frames that follow. A streamed texture starts out holding only its smallest mip and grows one level at a time as data arrives.
public sealed class TextureStreamingHelperInheritance
object ← TextureStreamingHelper
Constructors
TextureStreamingHelper(RendererContext)
Reads texture mip data on background threads and gives it to the GPU over the frames that follow. A streamed texture starts out holding only its smallest mip and grows one level at a time as data arrives.
public TextureStreamingHelper(RendererContext rendererContext)Parameters
rendererContext RendererContext
Properties
Mode
How textures load. Safe to change at any point; chains already under way finish either way.
public TextureStreamingMode Mode { get; set; }Property Value
Methods
CancelAllStreaming()
Throws away everything queued and hands its buffers back to the pool. Makes no GL calls, so it is safe during teardown with no current context.
public void CancelAllStreaming()DrainPendingLoads()
Waits for dispatched loads to land, so no thread is left reading a texture resource that the caller is about to dispose. Makes no GL calls. Never call this on the UI thread.
public void DrainPendingLoads()FinishAllStreaming(CancellationToken)
Blocks until nothing is left to stream, to no budget. Must be called on a thread with a GL context.
public void FinishAllStreaming(CancellationToken cancellationToken = default)Parameters
cancellationToken CancellationToken
Stops early, leaving chains unfinished.
Timeslice(float)
Does one frame's worth of streaming: starts the loads it can, and gives the GPU whatever mip data has arrived since last time. Call once per frame, on a thread with a GL context.
public void Timeslice(float frameTime = 0.016666668)Parameters
frameTime float
Length of the previous frame in seconds. This call gets 20% of it, minus what the previous call spent, so its own cost cannot grow its budget.

