ToyGine2 26.2.0
Game Engine for retro consoles
Loading...
Searching...
No Matches
toy::render Namespace Reference

Rendering types and utilities: clear flags, pixel formats, and related APIs. More...

Enumerations

enum class  ClearFlags : uint8_t {
  None = 0x00 , Target = 0x01 , Depth = 0x02 , Stencil = 0x04 ,
  All = Target | Depth | Stencil
}
 Bit flags specifying which framebuffer attachments to clear. More...
enum class  PixelFormat : uint8_t {
  A8R8G8B8 , X8R8G8B8 , A4R4G4B4 , R5G6B5 ,
  A8 , S3TC1 , S3TC5 , PVRTC2 ,
  PVRTC4 , D16Lockable , D32 , D15S1 ,
  D24S8 , D24X8 , D24X4S4 , D16 ,
  Unknown
}
 Pixel or surface format for colour, compression, or depth/stencil. More...

Functions

CStringView pixelFormatName (PixelFormat format) noexcept
 Returns the canonical string name for a pixel format.
PixelFormat pixelFormatFromName (CStringView name) noexcept
 Parses a format name and returns the corresponding toy::render::PixelFormat.

Variables

static constexpr array< CStringView, std::to_underlying(PixelFormat::Unknown)> _formatNames

Detailed Description

Rendering types and utilities: clear flags, pixel formats, and related APIs.

Enumeration Type Documentation

◆ ClearFlags

enum class toy::render::ClearFlags : uint8_t
strong

Bit flags specifying which framebuffer attachments to clear.

Values can be combined with operator|, operator&, and operator^ for bitwise operations.

Enumerator
None 

Clear nothing.

Target 

Clear the color/diffuse target (back buffer or render target).

Depth 

Clear the depth buffer.

Stencil 

Clear the stencil buffer.

All 

Clear color, depth, and stencil.

◆ PixelFormat

enum class toy::render::PixelFormat : uint8_t
strong

Pixel or surface format for colour, compression, or depth/stencil.

Covers common formats: 32-bit ARGB/XRGB, 16-bit, alpha-only, block-compressed (S3TC, PVRTC), and depth/stencil. Exact interpretation is backend-dependent.

Enumerator
A8R8G8B8 

32-bit ARGB (8 bits per channel, alpha premultiplied or straight).

X8R8G8B8 

32-bit XRGB (8 bits per channel; alpha unused).

A4R4G4B4 

16-bit ARGB (4 bits per channel).

R5G6B5 

16-bit RGB (5-6-5).

A8 

8-bit alpha only.

S3TC1 

S3TC/BC1 block-compressed (e.g. DXT1).

S3TC5 

S3TC/BC3 block-compressed (e.g. DXT5).

PVRTC2 

PVRTC 2 bpp.

PVRTC4 

PVRTC 4 bpp.

D16Lockable 

16-bit lockable depth.

D32 

32-bit depth.

D15S1 

15-bit depth, 1-bit stencil.

D24S8 

24-bit depth, 8-bit stencil.

D24X8 

24-bit depth (stencil unused).

D24X4S4 

24-bit depth, 4-bit stencil.

D16 

16-bit depth.

Unknown 

Format not specified or unknown.

Function Documentation

◆ pixelFormatFromName()

PixelFormat toy::render::pixelFormatFromName ( CStringView name)
nodiscardnoexcept

Parses a format name and returns the corresponding toy::render::PixelFormat.

Parameters
nameThe format name (case-sensitive). Empty or unknown names yield toy::render::PixelFormat::Unknown.
Returns
The matching format, or toy::render::PixelFormat::Unknown if no format matches.

◆ pixelFormatName()

CStringView toy::render::pixelFormatName ( PixelFormat format)
nodiscardnoexcept

Returns the canonical string name for a pixel format.

Parameters
formatThe format to name.
Returns
A non-null view of the format name (e.g. "A8R8G8B8", "D24S8"). For toy::render::PixelFormat::Unknown returns "Unknown".

Variable Documentation

◆ _formatNames

array<CStringView, std::to_underlying(PixelFormat::Unknown)> toy::render::_formatNames
staticconstexpr
Initial value:
{{
CStringView("A8R8G8B8"),
CStringView("X8R8G8B8"),
CStringView("A4R4G4B4"),
CStringView("R5G6B5"),
CStringView("A8"),
CStringView("S3TC1"),
CStringView("S3TC5"),
CStringView("PVRTC2"),
CStringView("PVRTC4"),
CStringView("D16Lockable"),
CStringView("D32"),
CStringView("D15S1"),
CStringView("D24S8"),
CStringView("D24X8"),
CStringView("D24X4S4"),
CStringView("D16"),
}}
Non-owning string view class for C-style strings.
Definition c_string_view.hpp:109