---
title: shaderWrite
framework: metal
role: symbol
role_heading: Type Property
path: metal/mtltextureusage/shaderwrite
---

# shaderWrite

An option for writing to the texture in a shader.

## Declaration

```swift
static var shaderWrite: MTLTextureUsage { get }
```

## Mentioned in

Optimizing texture data

## Discussion

Discussion Set this option if you access the given texture with a write() function in any shader. This option enables the access::write attribute for the texture. For more information about texture functions and access attributes, see Metal Shading Language Guide. If the texture is a read-write texture that you also access with a read() function in the same shader, set the shaderRead option to enable the access::read_write attribute. In iOS devices with GPU family 5, Metal doesn’t apply lossless compression to the given texture if you set this option. important: Rendering and writing to a texture are different operations, and you don’t need to combine their usage options. Set the renderTarget option if you render to a given texture, but don’t set the shaderWrite option if you don’t write to the texture. The renderTarget and shaderWrite options aren’t equivalent, and setting renderTarget doesn’t require you to also set shaderWrite.

## See Also

### Specifying texture usage options

- [unknown](metal/mtltextureusage/unknown.md)
- [shaderRead](metal/mtltextureusage/shaderread.md)
- [shaderAtomic](metal/mtltextureusage/shaderatomic.md)
- [renderTarget](metal/mtltextureusage/rendertarget.md)
- [pixelFormatView](metal/mtltextureusage/pixelformatview.md)
