Page 1 of 1

Is DDS cross platform? (+ related question)

Posted: Fri Oct 23, 2020 9:54 pm
by FloatingBanana
My game have a some huge animations that uses a lot of RAM and takes too long to load, so I tried to convert the animations to .dds files using DXT compression and it really helped me. But since DDS is something from DirectX, would it work on other platforms like Android, PS4, etc?

My other question is: In my previous game the player have a option to change the graphics quality. I made this function to make the image quality lower:

Code: Select all

lg = love.graphics

-- This function is called for every loaded image
-- "lowgraphics" is the quality level, the higher is the number, the lower is the quality
function resizeImage(image)
	local iw, ih = image:getDimensions()
	local resized = lg.newCanvas(iw/div, ih/div)

	lg.setCanvas(resized)
	lg.clear()
	lg.origin()
	lg.draw(image,0,0,0,1/lowgraphics)
	lg.setCanvas()
	image:release()

	return resized
end

-- And for drawing
lg.draw(image, 0, 0, 0, lowgraphics)
But in the documentation says that DXT compression doesn't work on canvases, so there's another way to make a "quality lowerer"? Including smaller versions of the images would increase the file size dramatically, so i don't want to use this approach if possible.

Re: Is DDS cross platform? (+ related question)

Posted: Sat Oct 24, 2020 1:36 pm
by grump
DXTn is widely supported on desktop machines. BCn seems to be the standard on mobile. As far as I know, there is no common denominator that works everywhere.

Re: Is DDS cross platform? (+ related question)

Posted: Sun Oct 25, 2020 12:11 am
by slime
The DDS container file format was created by microsoft but isn't restricted to microsoft-systems. The texture formats that .dds files can store (DXT and BCn mainly) weren't originally created by MS for the most part. All desktop and console GPUs natively support DXT formats (and modern desktop GPUs and all console GPUs support BC4-7 as well). Phones don't support DXT or BC texture formats, but they do support ETC2 (roughly equivalent to DXT5), and newer phones support ASTC (roughly equivalent to BC7) as well.

If you use compressed texture formats and want the game to run on a wide variety of platforms, the usual way to do it is to use DXT on desktops / consoles (not that love natively supports any console at the moment), and ETC on phones. There's a bit more info here: https://www.love2d.org/wiki/PixelFormat#Notes

FloatingBanana wrote:Including smaller versions of the images would increase the file size dramatically, so i don't want to use this approach if possible.
If the tool you use to create .dds files can generate mipmaps (smaller versions of the image all the way down to 1x1, stored in the same file and used automatically) as well, it will only be a 33% file size increase.

An image with a compressed texture format such as DXT will have better drawing performance than a canvas or a rgba8 image of the same dimensions, since more of the compressed texture is able to fit in a GPU's fast cache while drawing. Mipmaps will increase that performance even more since the GPU will use a smaller mipmap level automatically when needed.