Vixen
02b45cc4
csharp
public sealed class AssetTextureSource

The textures a material's features sample, loaded, uploaded and viewable.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The half of a bindless material that had nothing on the far side. A feature carries the name of a map it wants sampled and the material carries which texture that is; what neither carries is a view, because a material is serialised on machines that have no device. This is what turns the reference into one — read the Texture artefact a build wrote, decode the KTX2, put the pixels on the device, and hand back a TextureViewHandle for MaterialRenderFeature to register in the frame's table.

Three stages, and the split between them is where the costs are. Reading a bundle and decoding a container are file work and happen on a task; creating the texture is a device call and happens on whichever thread asked; recording the copy needs a command list and happens in Update, once a frame. A texture is therefore ready the frame after its bytes were recorded, which is what the fallback slot exists to cover.

⚠ Two dimensions and one layer. A cube map and an array both decode fine and neither is uploaded — FaceCount and LayerCount past one are refused rather than half-copied, because a sky sampled as its first face is a picture that looks deliberate. The environment path builds its own cube today; a material that wants one is the reason this will grow.

Fields and properties (3)

  • public int Requested

    How many distinct textures have been asked for.

  • public int Loaded

    How many are on the device and viewable.

  • public int Failed

    How many will not arrive.

Methods (4)

  • public AssetTextureSource(IGraphicsDevice device, AssetManager assets)

    Builds a source over a device and a content manager.

  • public bool TryGet(AssetReference reference, out TextureViewHandle view)

    The view a reference names, if its pixels are on the device yet.

  • public void Update(ICommandList commands)

    Records the copies for every texture whose bytes are waiting.

  • public void Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Used by (4)

  • AssetMaterialSourceVixen.Engine.Renderer
  • AssetTerrainTexturesVixen.Engine.Renderer
  • AssetTextureSourceTestsVixen.Engine.Renderer.Tests
  • WorldRendererVixen.Engine.Renderer