I noticed that composing frames in a big texture will consume more RAM rather than having 1 frame per texture (or sprite if you would like).
The renderer is SDL2 backed by Direct3D.
Is there any reason why Direct3D (or SDL2 /w Direct3D) is consuming more RAM with 1 big texture containing 10 frames, rather than 10 textures with 1 frame each? basically the size is:
num_textures * num_frames * frame_width * frame_height * RGBA_bytes so 1 big textures theoretically is equal to 10 single frame textures, e.g.:
big texure size = 1 * 100 * 100 * 100 * 4 => 4000000 (~4MB) frame_texures size = 100 * 1 * 100 * 100 * 4 => 4000000 (~4MB) but in practice the big texture has a 5-6 times factor of RAM usage:
- Having multiple big textures containing around 10 different animations the RAM consumption goes up around ~1.2GB
- loading the same data into single frame/sprite texture the RAM consumption is around 220MB.
Is there any reason why this discrepancy in D3D Texture RAM usage?
P.S.
The texture size in both cases are exactly the size needed to store the frame/frames
P.P.S
I know that probably I shouldn't be using GPU in this basic case, but i would like to know the why of the RAM consumption if anyone knows, as rotating 2D sprites might be faster anyway using GPUs rather than CPU operations.