TextureBuilder WithGPUOnlyUsage()

book_4_sparkGenerated
code_blocksInput

Description

The WithGPUOnlyUsage method of the TextureBuilder class specifies that the texture being built is intended to be used exclusively on the GPU, without any access from the CPU. This can be beneficial for performance optimization in scenarios where CPU access is unnecessary, allowing the GPU to manage the texture more efficiently.

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 fluent interface style, allowing for chaining with other configuration methods.

Example

// Example of using WithGPUOnlyUsage in a texture building process
TextureBuilder builder = new TextureBuilder();
Texture texture = builder
    .WithSize(1024, 1024) // Set the texture size
    .WithFormat(ImageFormat.RGBA8) // Set the texture format
    .WithGPUOnlyUsage() // Specify GPU-only usage
    .Create("MyTexture", false, data, data.Length);