love.graphics.getTextureFormats

Available since LÖVE 12.0
This function is not supported in earlier versions.

Gets the available pixel formats, and whether each is supported for the given Texture usage configuration.

Function

Synopsis

formats = love.graphics.getTextureFormats( usage )

Arguments

table usage
A table containing fields describing how the pixel formats will be used.
boolean canvas
If true, the returned formats will only be listed as supported if they can be used with a canvas-capable Texture.
boolean readable (nil)
If true, the returned formats will only be listed as supported if they can be used with the readable flag set to true for a Texture using that format, and vice versa if the field is false. When the field is nil, color pixel formats are assumed to be readable and depth/stencil formats are non-readable.
boolean computewrite (false)
If true, the returned formats will only be listed as supported if they can be used with the computewrite flag set to true for a Texture using that format.

Returns

table formats
A table containing PixelFormats as keys, and a boolean indicating whether the format is supported for the given usage configuration as values. Not all systems support all formats.

Examples

Create a canvas with the format 'rgba16f' if it is supported

local formats = love.graphics.getPixelFormats({canvas=true})
if formats.rgba16f then
    canvas = love.graphics.newCanvas(800, 600, {format="rgba16f"} )
else
    -- The 'rgba16f' format isn't supported. We could have some fallback code, or trigger a message telling the user their system is unsupported.
end

See Also


Other Languages