RenderBuffer memory of RTT

  • Context

I’m analyzing WebGL memory usage in a post-processing pipeline with 4 samples. Using the Inspector, I observed the following memory increases:

Texture2D: 4,193,256 bytes

RenderBuffer: 8,386,512 bytes

  • Theoretical Calculations

1、Texture2D (resolve target):

1137 (width) × 922 (height) × 4 (RGBA8) = 4,193,256 bytes (matches observation)

2、RenderBuffer (with 4× MSAA)

Color Attachment (RGBA8): 1137 × 922 × 4 × 4 (samples) = 16,773,024 bytes

Depth-Stencil Attachment (DEPTH24_STENCIL8): 1137 × 922 × 4 × 4 (samples) = 16,773,024 bytes

  • Problem

The observed RenderBuffer memory (8,386,512 bytes) is exactly 2× the Texture2D size (4,193,256 × 2), but it should theoretically be 8× the Texture2D size (4,193,256 × 8),why :thinking:

Where do you get this memory usage information? I don’t think we display memory consumption in the inspector?

use this browser plugin. I probably shouldn’t call him inspector, sry

cc @sebavan, I don’t know how these numbers are calculated (I tried with samples=4 and 8 and the result was the same).

MSAA are treated the same way in term of size in spector you can make a PR there if you want to change the way it has been computed.

This would need to be changed around here Spector.js/src/backend/recorders/renderBufferRecorder.ts at master · BabylonJS/Spector.js · GitHub

1 Like

I will give this code a good read and thank you very much for your answer

1 Like