RDTextureView
Format and channel selection for reading a GPU texture.
RDTextureView describes texture interpretation for TextureCreate or TextureCreateShared. It is not a UI Texture2D, a viewport or an image crop rectangle. By default FormatOverride=DataFormat.Max inherits the base format, while SwizzleR/G/B/A select their matching input channels.
Swizzle selects each output channel source: R/G/B/A or Zero/One. For example, SwizzleR=B and SwizzleB=R exchange red and blue selection when reading through the view. They neither rearrange storage bytes nor change UVs. TextureGetData returns storage data, not the image after shader sampling.
For another FormatOverride, prepare the base RDTextureFormat: if the shareable-format list is nonempty, it must include the base format and required override. Support depends on the device and format compatibility. R8G8B8A8Srgb specifies color interpretation, not arbitrary resizing or new-file encoding. The shared path can use a driver-dependent fallback, so it is not guaranteed to avoid copying at all times.
TextureCreateShared returns a separate RID dependent on the source texture. Keep the owner alive while using it. Free owned views through the same RenderingDevice.FreeRid; freeing the owner invalidates dependent views. A copied Rid.IsValid can still be true because it checks a nonzero identifier; query texture state with TextureIsValid on the correct device. Do not free a borrowed RID from another framebuffer.
You own a descriptor created with new RDTextureView and can Dispose it after creation. Later descriptor edits do not reconfigure an existing GPU view. The main RenderingDevice is borrowed; work in a render-thread callback and do not Dispose it.
The executed Windows/Vulkan Forward+ probe created distinct swizzled/sRGB views, read original storage bytes and checked invalidation when freeing the owner. It did not test shader-sampled swizzle output or sRGB conversion; the Vulkan loader warning remains. Texture creation example: RDTextureFormat.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
RDTextureViewConstructor
public RDTextureView();Creates a view descriptor: FormatOverride=DataFormat.Max and R→R, G→G, B→B, A→A channel mapping. Allocates no GPU view and owns no texture. Dispose your own descriptor after TextureCreate or TextureCreateShared.
Properties5
FormatOverrideProperty
public RenderingDevice.DataFormat FormatOverride { get; set; }View format, initially DataFormat.Max to inherit the texture format. Max is a sentinel here, not a valid RDTextureFormat storage format. Another format must be allowed with AddShareableFormat and supported by the device; this is not a general image converter.
SwizzleAProperty
public RenderingDevice.TextureSwizzle SwizzleA { get; set; }Source for output channel A when reading through the view, initially TextureSwizzle.A. Select an input R/G/B/A channel or the Zero/One constant. Swizzling does not rewrite storage bytes, change UVs or replace the format setting.
SwizzleBProperty
public RenderingDevice.TextureSwizzle SwizzleB { get; set; }Source for output channel B when reading through the view, initially TextureSwizzle.B. Select an input R/G/B/A channel or the Zero/One constant. Swizzling does not rewrite storage bytes, change UVs or replace the format setting.
SwizzleGProperty
public RenderingDevice.TextureSwizzle SwizzleG { get; set; }Source for output channel G when reading through the view, initially TextureSwizzle.G. Select an input R/G/B/A channel or the Zero/One constant. Swizzling does not rewrite storage bytes, change UVs or replace the format setting.
SwizzleRProperty
public RenderingDevice.TextureSwizzle SwizzleR { get; set; }Source for output channel R when reading through the view, initially TextureSwizzle.R. Select an input R/G/B/A channel or the Zero/One constant. Swizzling does not rewrite storage bytes, change UVs or replace the format setting.
Methods10
GetFormatOverrideRenderingDevice.DataFormat
public RenderingDevice.DataFormat GetFormatOverride();Returns the stored descriptor value for FormatOverride. View format, initially DataFormat.Max to inherit the texture format. Max is a sentinel here, not a valid RDTextureFormat storage format. Another format must be allowed with AddShareableFormat and supported by the device; this is not a general image converter.
RenderingDevice.DataFormatStored FormatOverride of this descriptor, not a query of a current GPU resource.
GetSwizzleARenderingDevice.TextureSwizzle
public RenderingDevice.TextureSwizzle GetSwizzleA();Returns the stored descriptor value for SwizzleA. Source for output channel A when reading through the view, initially TextureSwizzle.A. Select an input R/G/B/A channel or the Zero/One constant. Swizzling does not rewrite storage bytes, change UVs or replace the format setting.
RenderingDevice.TextureSwizzleStored SwizzleA of this descriptor, not a query of a current GPU resource.
GetSwizzleBRenderingDevice.TextureSwizzle
public RenderingDevice.TextureSwizzle GetSwizzleB();Returns the stored descriptor value for SwizzleB. Source for output channel B when reading through the view, initially TextureSwizzle.B. Select an input R/G/B/A channel or the Zero/One constant. Swizzling does not rewrite storage bytes, change UVs or replace the format setting.
RenderingDevice.TextureSwizzleStored SwizzleB of this descriptor, not a query of a current GPU resource.
GetSwizzleGRenderingDevice.TextureSwizzle
public RenderingDevice.TextureSwizzle GetSwizzleG();Returns the stored descriptor value for SwizzleG. Source for output channel G when reading through the view, initially TextureSwizzle.G. Select an input R/G/B/A channel or the Zero/One constant. Swizzling does not rewrite storage bytes, change UVs or replace the format setting.
RenderingDevice.TextureSwizzleStored SwizzleG of this descriptor, not a query of a current GPU resource.
GetSwizzleRRenderingDevice.TextureSwizzle
public RenderingDevice.TextureSwizzle GetSwizzleR();Returns the stored descriptor value for SwizzleR. Source for output channel R when reading through the view, initially TextureSwizzle.R. Select an input R/G/B/A channel or the Zero/One constant. Swizzling does not rewrite storage bytes, change UVs or replace the format setting.
RenderingDevice.TextureSwizzleStored SwizzleR of this descriptor, not a query of a current GPU resource.
SetFormatOverridevoid
public void SetFormatOverride(RenderingDevice.DataFormat pMember);Stores FormatOverride without GPU allocation or full-configuration validation. View format, initially DataFormat.Max to inherit the texture format. Max is a sentinel here, not a valid RDTextureFormat storage format. Another format must be allowed with AddShareableFormat and supported by the device; this is not a general image converter.
| Name | Type | Default |
|---|---|---|
pMember | RenderingDevice.DataFormat | — |
pMemberView format, initially DataFormat.Max to inherit the texture format. Max is a sentinel here, not a valid RDTextureFormat storage format. Another format must be allowed with AddShareableFormat and supported by the device; this is not a general image converter.
SetSwizzleAvoid
public void SetSwizzleA(RenderingDevice.TextureSwizzle pMember);Stores SwizzleA without GPU allocation or full-configuration validation. Source for output channel A when reading through the view, initially TextureSwizzle.A. Select an input R/G/B/A channel or the Zero/One constant. Swizzling does not rewrite storage bytes, change UVs or replace the format setting.
| Name | Type | Default |
|---|---|---|
pMember | RenderingDevice.TextureSwizzle | — |
pMemberSource for output channel A when reading through the view, initially TextureSwizzle.A. Select an input R/G/B/A channel or the Zero/One constant. Swizzling does not rewrite storage bytes, change UVs or replace the format setting.
SetSwizzleBvoid
public void SetSwizzleB(RenderingDevice.TextureSwizzle pMember);Stores SwizzleB without GPU allocation or full-configuration validation. Source for output channel B when reading through the view, initially TextureSwizzle.B. Select an input R/G/B/A channel or the Zero/One constant. Swizzling does not rewrite storage bytes, change UVs or replace the format setting.
| Name | Type | Default |
|---|---|---|
pMember | RenderingDevice.TextureSwizzle | — |
pMemberSource for output channel B when reading through the view, initially TextureSwizzle.B. Select an input R/G/B/A channel or the Zero/One constant. Swizzling does not rewrite storage bytes, change UVs or replace the format setting.
SetSwizzleGvoid
public void SetSwizzleG(RenderingDevice.TextureSwizzle pMember);Stores SwizzleG without GPU allocation or full-configuration validation. Source for output channel G when reading through the view, initially TextureSwizzle.G. Select an input R/G/B/A channel or the Zero/One constant. Swizzling does not rewrite storage bytes, change UVs or replace the format setting.
| Name | Type | Default |
|---|---|---|
pMember | RenderingDevice.TextureSwizzle | — |
pMemberSource for output channel G when reading through the view, initially TextureSwizzle.G. Select an input R/G/B/A channel or the Zero/One constant. Swizzling does not rewrite storage bytes, change UVs or replace the format setting.
SetSwizzleRvoid
public void SetSwizzleR(RenderingDevice.TextureSwizzle pMember);Stores SwizzleR without GPU allocation or full-configuration validation. Source for output channel R when reading through the view, initially TextureSwizzle.R. Select an input R/G/B/A channel or the Zero/One constant. Swizzling does not rewrite storage bytes, change UVs or replace the format setting.
| Name | Type | Default |
|---|---|---|
pMember | RenderingDevice.TextureSwizzle | — |
pMemberSource for output channel R when reading through the view, initially TextureSwizzle.R. Select an input R/G/B/A channel or the Zero/One constant. Swizzling does not rewrite storage bytes, change UVs or replace the format setting.