Fix: Use correct byte size for GPU_DEPTH_COMPONENT24

Every depth component has a trailing byte for alignment.
So it should be 4 bytes, not 3 bytes.
This commit is contained in:
Jeroen Bakker
2023-08-22 14:16:25 +02:00
parent fccab83bc8
commit 47b431d3b6

View File

@@ -470,7 +470,9 @@ inline size_t to_bytesize(eGPUTextureFormat format)
case GPU_DEPTH_COMPONENT32F:
return 32 / 8;
case GPU_DEPTH_COMPONENT24:
return 24 / 8;
/* Depth component 24 uses 3 bytes to store the depth value, and reserved 1 byte for
* alignment. */
return (24 + 8) / 8;
case GPU_DEPTH_COMPONENT16:
return 16 / 8;
}