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
LoadWholeChains
False: parallelize single mips; True: parallelize whole textures.
public bool LoadWholeChains { get; set; }Property Value
Methods
CancelAllStreaming()
Throws away everything still streaming 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()FinishAllStreaming(CancellationToken)
Keeps working until nothing is left to stream, for when there is no frame loop to spread the work over. Runs to no budget, and sleeps rather than spins while it waits, since the loads are running on the thread pool and spinning here would only take threads away from them. 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.

