Prowl’s texture system is built on top of Veldrid and provides strongly-typed wrappers for GPU texture resources. The abstractDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ProwlEngine/Prowl/llms.txt
Use this file to discover all available pages before exploring further.
Texture base class handles resource creation, mipmap generation, CPU-to-GPU data upload, and GPU-to-CPU readback. Texture2D is the most common 2D image type, while RenderTexture is the engine’s off-screen render target — pairing colour and depth Texture2D buffers with a Veldrid Framebuffer and a pool system for temporary allocations. Every texture carries a TextureSampler that controls filtering and address-mode behaviour at the shader level. Additional specialised types (Texture3D, TextureCubemap, Texture2DArray) exist in Prowl.Runtime.Rendering for volumetric and array use cases.
Texture (abstract base)
All texture types inherit fromTexture, which lives in Prowl.Runtime.Rendering.
Properties
The Veldrid texture dimensionality:
Texture1D, Texture2D, Texture3D, or Texture2DArray.The GPU pixel format (e.g.,
R8_G8_B8_A8_UNorm, R32_G32_B32_A32_Float).Veldrid usage flags:
Sampled, RenderTarget, DepthStencil, Storage, GenerateMipmaps, Staging.Number of mip levels allocated for this texture.
true after GenerateMipmaps() has been called. Resets to false if the texture is recreated.true if the texture was created with the TextureUsage.GenerateMipmaps flag.The sampler attached to this texture. Defaults to a linear sampler. Assign a new
TextureSampler to change filter or wrap modes.Multisampling count. Values above
Count1 require resolve via CommandBuffer.ResolveMultisampledTexture.true if this object created the underlying Veldrid texture (and will dispose it). false if wrapping an externally owned texture.GenerateMipmaps
IsMipmappable to be true (i.e., the texture was created with TextureUsage.GenerateMipmaps). Throws InvalidOperationException otherwise.
GetMemoryUsage
width × height × depth × arrayLayers × bytesPerPixel.
Texture2D
Texture2D is the most common texture type — 2D images with optional multisampling.
Properties
Texture width in pixels.
Texture height in pixels.
Constructor
Width in pixels.
Height in pixels.
Number of mip levels. Pass
0 to let the driver choose the full chain.Pixel format.
Usage flags.
MSAA sample count.
Built-in Defaults
Several staticAssetRef<Texture2D> properties provide built-in default textures:
| Property | Description |
|---|---|
Texture2D.White | 1×1 white texture |
Texture2D.Black | 1×1 black texture |
Texture2D.Gray | 1×1 50% grey texture |
Texture2D.Normal | 1×1 flat normal map (0.5, 0.5, 1.0) |
Texture2D.Red | 1×1 red texture |
Texture2D.Surface | Default PBR surface texture |
Texture2D.Grid | Default grid texture |
Texture2D.EmptyRW | 1×1 black storage (read-write) texture |
Uploading Pixel Data
SetData
Span<T> to the full texture or a sub-rectangle.
Pixel data.
T must match the texture’s PixelFormat (e.g., use Color32 for R8_G8_B8_A8_UNorm).Mip level to write to.
SetDataPtr (unsafe)
Reading Pixel Data
CopyData
data. The span must be large enough to hold all pixels.
GetPixel
Resize
RenderTexture
RenderTexture is Prowl’s off-screen render target. It combines one or more colour Texture2D buffers, an optional depth Texture2D buffer, and a Veldrid Framebuffer into a single object.
Properties
Render target width in pixels.
Render target height in pixels.
Array of colour attachment textures. Index 0 is the primary colour buffer.
The depth/stencil attachment texture. May be
null if no depth format was specified.The underlying Veldrid
Framebuffer. Pass this to CommandBuffer.SetRenderTarget.true if colour buffers carry TextureUsage.Sampled, making them bindable as shader inputs.true if colour buffers carry TextureUsage.Storage for compute shader read/write access.MSAA sample count of all colour buffers.
Constructors
- Simple (RGBA + auto depth)
- Custom formats
- From description
Implicit Conversions
Temporary RT Pool
Prowl provides a pooling system for short-lived render textures. Pooled textures are automatically aged and destroyed if not re-requested within 10 frames.GetTemporaryRT
RenderTexture matching the description, or creates a new one if none is available.
ReleaseTemporaryRT
TextureSampler
EveryTexture carries a TextureSampler that wraps a Veldrid SamplerDescription. The default sampler is linear filtering with clamped addresses.
TextureSampler.CreateLinear()—MinLinear_MagLinear_MipLinear, clampedTextureSampler.CreatePoint()—MinPoint_MagPoint_MipPoint, clamped
Using Textures in Materials
Asset textures are referenced asAssetRef<Texture2D> and assigned to material shader properties by name: