SRM  v0.10.0-1
Simple Rendering Manager
SRMFormat

Buffer formats and conversions. More...

Detailed Description

Buffer formats and conversions.

The SRMFormat module provides structures and functions for working with various buffer formats, including conversions between DRM and OpenGL formats, format lists, and format-related operations.

Functions

const SRMGLFormatsrmFormatDRMToGL (SRM_BUFFER_FORMAT format)
 Convert a DRM buffer format to an equivalent OpenGL format. More...
 
SRMListItemsrmFormatsListAddFormat (SRMList *formatsList, UInt32 format, UInt64 modifier)
 Add a buffer format to a list of formats. More...
 
UInt8 srmFormatIsInList (SRMList *formatsList, UInt32 format, UInt64 modifier)
 Check if a format/modifier pair is in the list. More...
 
SRMFormatsrmFormatListFirstMatchFormat (SRMList *formatsList, UInt32 format)
 Find the first format matching the specified format code in a list of formats. More...
 
UInt8 srmFormatGetDepthBpp (SRM_BUFFER_FORMAT format, UInt32 *depth, UInt32 *bpp)
 Get the depth and bits per pixel (BPP) of a buffer format. More...
 
SRMListsrmFormatsListCopy (SRMList *formatsList)
 Create a copy of a list of formats. More...
 
void srmFormatsListDestroy (SRMList **formatsList)
 Destroy a list of formats and free associated resources. More...
 
UInt32 srmFormatGetAlphaSubstitute (UInt32 format)
 Returns an equivalent format with (or without) alpha channel. More...
 

Function Documentation

◆ srmFormatDRMToGL()

const SRMGLFormat* srmFormatDRMToGL ( SRM_BUFFER_FORMAT  format)

Convert a DRM buffer format to an equivalent OpenGL format.

Parameters
formatThe DRM buffer format code to convert.
Returns
A pointer to the SRMGLFormat structure representing the equivalent OpenGL format.

◆ srmFormatsListAddFormat()

SRMListItem* srmFormatsListAddFormat ( SRMList formatsList,
UInt32  format,
UInt64  modifier 
)

Add a buffer format to a list of formats.

Parameters
formatsListA list of formats to add to.
formatThe buffer format code to add.
modifierThe modifier associated with the format.
Returns
A pointer to the newly added SRMFormat structure.

◆ srmFormatIsInList()

UInt8 srmFormatIsInList ( SRMList formatsList,
UInt32  format,
UInt64  modifier 
)

Check if a format/modifier pair is in the list.

Parameters
formatThe buffer format code.
modifierThe modifier associated with the format.
Returns
1 if in the list, 0 otherwise.

◆ srmFormatListFirstMatchFormat()

SRMFormat* srmFormatListFirstMatchFormat ( SRMList formatsList,
UInt32  format 
)

Find the first format matching the specified format code in a list of formats.

Parameters
formatsListA list of formats to search in.
formatThe buffer format code to match.
Returns
A pointer to the first SRMFormat structure matching the format code, or NULL if not found.

◆ srmFormatGetDepthBpp()

UInt8 srmFormatGetDepthBpp ( SRM_BUFFER_FORMAT  format,
UInt32 depth,
UInt32 bpp 
)

Get the depth and bits per pixel (BPP) of a buffer format.

Parameters
formatThe buffer format code.
depthA pointer to store the depth of the format.
bppA pointer to store the bits per pixel (BPP) of the format.
Returns
1 if the depth and BPP were successfully retrieved, 0 if the format is not recognized.

◆ srmFormatsListCopy()

SRMList* srmFormatsListCopy ( SRMList formatsList)

Create a copy of a list of formats.

Parameters
formatsListA list of formats to copy.
Returns
A new list containing a copy of the input formats.

◆ srmFormatsListDestroy()

void srmFormatsListDestroy ( SRMList **  formatsList)

Destroy a list of formats and free associated resources.

Parameters
formatsListA pointer to the list of formats to destroy. The pointer is set to NULL after destruction.

◆ srmFormatGetAlphaSubstitute()

UInt32 srmFormatGetAlphaSubstitute ( UInt32  format)

Returns an equivalent format with (or without) alpha channel.

If the format doesn't have a substitute, the same value is returned.