Enum rokol::gfx::PixelFormat [−][src]
#[repr(u32)]
pub enum PixelFormat {
Show 64 variants
_Default,
Bc1Rgba,
Bc2Rgba,
Bc3Rgba,
Bc4R,
Bc4Rsc,
Bc5Rg,
Bc5Rgsn,
Bc6hRgf,
Bc6hRgbuf,
Bc7Rgba,
Bgra8,
Depth,
DepthStencil,
Etc2Rg11,
Etc2Rg11Sn,
Etc2Rgb8,
Etc2Rgb8A1,
Etc2Rgba8,
None,
PvrtcRgba2Bpp,
PvrtcRgba24pp,
PvrtcRgb2Bpp,
PvrtcRgb4Bpp,
R8,
R8Si,
R8Sn,
R8Ui,
R16,
R16F,
R16Si,
R16Sn,
R16Ui,
R32F,
R32Si,
R32Ui,
Rg8,
Rg8Si,
Rg8Sn,
Rg8Ui,
Rg11B10F,
Rg16,
Rg16F,
Rg16Si,
Rg16Sn,
Rg16Ui,
Rg32F,
Rg32Si,
Rg32Ui,
Rgb10A2,
Rgba8,
Rgba8Si,
Rgba8Sn,
Rgba8Ui,
Rgba16,
Rgba16F,
Rgba16Si,
Rgba16Sn,
Rgba16Ui,
Rgba32F,
Rgba32Si,
Rgba32Ui,
_ForceU32,
_Num,
}
Expand description
Pixel format
Features
sokol_gfx.h
basically uses the same pixel formats as WebGPU, since these
are supported on most newer GPUs. GLES2 and WebGL has a much smaller
subset of available pixel formats. Call sg_query_pixelformat()
to check
at runtime if a pixel format supports the desired features.
Naming convension
A pixelformat name consist of three parts:
- components (R, RG, RGB or RGBA)
- bit width per component (8, 16 or 32)
- component data type:
- unsigned normalized (no postfix)
- signed normalized (SN postfix)
- unsigned integer (UI postfix)
- signed integer (SI postfix)
- float (F postfix)
Supported formats
Not all pixel formats can be used for everything, call sg_query_pixelformat()
to inspect the capabilities of a given pixelformat. The function returns
an sg_pixelformat_info
struct with the following bool members:
- sample: the pixelformat can be sampled as texture at least with nearest filtering
- filter: the pixelformat can be samples as texture with linear filtering
- render: the pixelformat can be used for render targets
- blend: blending is supported when using the pixelformat for render targets
- msaa: multisample-antialiasing is supported when using the pixelformat for render targets
- depth: the pixelformat can be used for depth-stencil attachments
When targeting GLES2/WebGL, the only safe formats to use
as texture are SG_PIXELFORMAT_R8
and SG_PIXELFORMAT_RGBA8
. For rendering
in GLES2/WebGL, only SG_PIXELFORMAT_RGBA8
is safe. All other formats
must be checked via sg_query_pixelformats().
Default pixel format
The default pixel format for texture images is SG_PIXELFORMAT_RGBA8
.
The default pixel format for render target images is platform-dependent:
- for Metal and D3D11 it is
SG_PIXELFORMAT_BGRA8
- for GL backends it is
SG_PIXELFORMAT_RGBA8
This is mainly because of the default framebuffer which is setup outside
of sokol_gfx.h
. On some backends, using BGRA for the default frame buffer
allows more efficient frame flips. For your own offscreen-render-targets,
use whatever renderable pixel format is convenient for you.
Variants
_Default
Bc1Rgba
Bc2Rgba
Bc3Rgba
Bc4R
Bc4Rsc
Bc5Rg
Bc5Rgsn
Bc6hRgf
Bc6hRgbuf
Bc7Rgba
Bgra8
Depth
DepthStencil
Etc2Rg11
Etc2Rg11Sn
Etc2Rgb8
Etc2Rgb8A1
Etc2Rgba8
None
PvrtcRgba2Bpp
PvrtcRgba24pp
PvrtcRgb2Bpp
PvrtcRgb4Bpp
R8
R8Si
R8Sn
R8Ui
R16
R16F
R16Si
R16Sn
R16Ui
R32F
R32Si
R32Ui
Rg8
Rg8Si
Rg8Sn
Rg8Ui
Rg11B10F
Rg16
Rg16F
Rg16Si
Rg16Sn
Rg16Ui
Rg32F
Rg32Si
Rg32Ui
Rgb10A2
Rgba8
Rgba8Si
Rgba8Sn
Rgba8Ui
Rgba16
Rgba16F
Rgba16Si
Rgba16Sn
Rgba16Ui
Rgba32F
Rgba32Si
Rgba32Ui
_ForceU32
_Num
Implementations
Trait Implementations
Performs the conversion.
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for PixelFormat
impl Send for PixelFormat
impl Sync for PixelFormat
impl Unpin for PixelFormat
impl UnwindSafe for PixelFormat
Blanket Implementations
Mutably borrows from an owned value. Read more