Texture2DBuilder WithGPUOnlyUsage()

robot_2Generated
code_blocksInput

Description

The WithGPUOnlyUsage method is part of the Texture2DBuilder class in the Sandbox namespace. This method configures the texture to be used exclusively on the GPU, meaning it will not be accessible from the CPU. This can be beneficial for performance in scenarios where the texture is only needed for rendering and not for any CPU-side operations.

Usage

To use the WithGPUOnlyUsage method, you should first create an instance of Texture2DBuilder. Then, call the method on this instance to set the texture usage to GPU-only. This method returns the same Texture2DBuilder instance, allowing for method chaining.

Example

// Example of using WithGPUOnlyUsage
Texture2DBuilder builder = new Texture2DBuilder();
builder.WithSize(256, 256)
       .WithFormat(ImageFormat.RGBA8)
       .WithGPUOnlyUsage();

Texture texture = builder.Finish();
// The texture is now configured for GPU-only usage.