public sealed class TextureUploadsTurns CPU pixels into the textures a plan's external images are read from.
Remarks
The one step Evaluate does not do, and every external image needs it. A TextureImage marked External says "the caller supplies this one", and Evaluate takes a dictionary of handles the caller has already created — so a plan has always been able to express a picture that came from somewhere other than a kernel, and nothing in this assembly could produce one. Externals is what goes into that parameter.
⚠ This is what doc 48 § 4.1's Text and Svg Path reach the GPU through, and it is why neither is a kernel — #687. A compute kernel has no rasteriser and cannot reach a font or a path parser — ⚠ a .rvn cannot call managed code, which is the reason that survives now that a kernel is compiled with the library beside it. Nor could it be given one: both of those shapes are filled on the CPU, by Vixen.Ui.Text's GlyphRasterizer, and arrive here as coverage. AddCoverage is that door.
A type of its own rather than a method on the evaluator, and the reason is a lifetime. A TextureBake owns its textures and destroys them when it is disposed; an uploaded bitmap outlives any one bake, because the interactive preview of doc 48 § M4 re-evaluates the same plan over the same imported picture many times a second. An upload owned by a bake would be destroyed by the evaluation after the one that made it, and re-uploading a 4K bitmap per keystroke is the cost that arrangement hides. So the two lifetimes are two objects, and this one is disposed when the *document* closes.
⚠ It records and submits on ComputeQueue, and the command list's kind comes from that same submitter rather than being spelled. Every texture a bake touches is ResourceSharing.Exclusive, so filling one from a second queue family without an ownership transfer leaves its contents undefined by specification, the validation layers say nothing because it is undefined behaviour rather than invalid usage, and on every adapter this engine has been developed on the two families are one — a clean picture here and a corrupt one on a discrete card. #617 was that defect in the evaluator and #679 was the same defect in the tests' own upload helper, three months apart, because the queue was chosen in two places. It is chosen once here.
⚠ An upload is not a frame. It opens one, submits a single command list and waits, exactly as Evaluate does — so it must not be called between a caller's own BeginFrame and EndFrame.
⚠ What no test here proves: that the transition to ShaderRead at the end of the copy is needed. Deleting it leaves every case in TextureUploadDeviceTests green on MoltenVK — measured, not assumed. Metal has no image layouts, so the barrier a Vulkan implementation insists on costs nothing here and says nothing. It is the same blind spot as the queue above and has the same answer: the rule is written down and followed, because the machine it protects is not this one.
Fields and properties (3)
public const TextureUsage UploadUsageWhat every upload is created with, and therefore what it is declared as.
public IReadOnlyDictionary<int, TextureExternal> ExternalsWhat to hand Evaluate as its externals.
public int CountHow many images have been uploaded.
Methods (5)
public TextureUploads(IGraphicsDevice device)Builds an upload set on a device.
public TextureHandle Add(TexturePlan plan, int image, int width, int height, ReadOnlySpan<byte> texels)Uploads texels for one of a plan's external images.
public TextureHandle AddCoverage(TexturePlan plan, int image, int width, int height, ReadOnlySpan<float> coverage)Uploads a coverage field — one float per texel — as a single-channel mask.
public Int2 SizeOf(int image)How big one uploaded image actually is.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Used by (22)
- FilterLayerTestsVixen.Editor.Texturing.Tests
- LayerCoverageDeviceTestsVixen.Editor.Texturing.Tests
- LayerStackBakeDeviceTestsVixen.Editor.Texturing.Tests
- LayerStackPreviewVixen.Editor.Texturing
- MaskStackTestsVixen.Editor.Texturing.Tests
- MaterialBakeRouteVixen.Editor.Texturing
- SplatCoverageDeviceTestsVixen.Editor.Texturing.Tests
- TextureCompoundBakeDeviceTestsVixen.Editor.TextureGraph.Tests
- TextureExternalGraphDeviceTestsVixen.Editor.TextureGraph.Tests
- TextureExternalImagesVixen.Editor.Texturing
- TextureGraphExternalsVixen.Editor.TextureGraph
- TextureGraphPreviewVixen.Editor.Texturing
- TextureGraphPreviewsVixen.Editor.TextureGraph
- TextureGraphRunnerVixen.Cli
- TextureHarnessPatternTestsVixen.Editor.TextureGraph.Tests
- TextureNormalToHeightDeviceTestsVixen.Editor.TextureGraph.Tests
- TextureProjectImagesVixen.Editor.TextureGraph
- TextureProjectImagesTestsVixen.Editor.TextureGraph.Tests
- TextureTextDeviceTestsVixen.Editor.TextureGraph.Tests
- TextureTextTestsVixen.Editor.TextureGraph.Tests
- TextureUploadDeviceTestsVixen.Editor.TextureGraph.Tests
- TextureUploadTestsVixen.Editor.TextureGraph.Tests