diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-02-15 02:01:04 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-02-15 02:01:04 +0300 |
commit | 19b21563d613c333039c80c4bca62d7af2a4d9c6 (patch) | |
tree | e3260ceda1be1d7867ac40cb8d19106a9eee5543 /source/blender/gpu | |
parent | 33d5ecd5b5e073c230a1960010110c5f11adb5ab (diff) |
GPUTexture: Fix missing enum cases in `to_component_len()`
This might have caused undersized buffer if using the wrong formats with
`GPU_texture_read()`.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/intern/gpu_texture_private.hh | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_texture_private.hh b/source/blender/gpu/intern/gpu_texture_private.hh index 3195e98da5e..4370453c605 100644 --- a/source/blender/gpu/intern/gpu_texture_private.hh +++ b/source/blender/gpu/intern/gpu_texture_private.hh @@ -371,10 +371,15 @@ inline int to_component_len(eGPUTextureFormat format) { switch (format) { case GPU_RGBA8: + case GPU_RGBA8I: case GPU_RGBA8UI: - case GPU_RGBA16F: case GPU_RGBA16: + case GPU_RGBA16F: + case GPU_RGBA16I: + case GPU_RGBA16UI: case GPU_RGBA32F: + case GPU_RGBA32I: + case GPU_RGBA32UI: case GPU_SRGB8_A8: case GPU_RGB10_A2: return 4; @@ -382,11 +387,15 @@ inline int to_component_len(eGPUTextureFormat format) case GPU_R11F_G11F_B10F: return 3; case GPU_RG8: + case GPU_RG8I: + case GPU_RG8UI: case GPU_RG16: case GPU_RG16F: case GPU_RG16I: case GPU_RG16UI: case GPU_RG32F: + case GPU_RG32I: + case GPU_RG32UI: return 2; default: return 1; |