Is DDS cross platform? (+ related question)

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
FloatingBanana
Prole
Posts: 22
Joined: Sat Mar 02, 2019 4:57 pm
Contact:

Is DDS cross platform? (+ related question)

Post 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.

Code: Select all

if anyMistake(self.english) then
    print("Sorry, english is not my first language")
end
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

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

Post 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.
User avatar
slime
Solid Snayke
Posts: 3166
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

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

Post 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.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 7 guests