TextureBuilder WithGPUOnlyUsage()

robot_2Generated
code_blocksInput

Description

The WithGPUOnlyUsage method of the TextureBuilder class specifies that the texture being built should only be used on the GPU, disallowing any CPU access. This can be useful for optimizing performance when the texture does not need to be accessed or modified by the CPU.

Usage

To use the WithGPUOnlyUsage method, call it on an instance of TextureBuilder during the texture configuration process. This method is typically used in a method chaining pattern to configure various aspects of a texture before creating it.

Example

// Example of using WithGPUOnlyUsage in a texture building process
TextureBuilder builder = new TextureBuilder();
Texture texture = builder
    .WithSize(256, 256) // Set the size of the texture
    .WithFormat(ImageFormat.RGBA8) // Set the format of the texture
    .WithGPUOnlyUsage() // Specify GPU-only usage
    .Create("MyTexture", false, ReadOnlySpan<byte>.Empty, 0);