[Bf-blender-cvs] [7bb7c3e5cb0] temp-eeveelightcache: GPUTexture: Fix mipmap size calculation.
Clément Foucault
noreply at git.blender.org
Mon Jul 9 23:03:40 CEST 2018
Commit: 7bb7c3e5cb049d5e3d79c6fe6e2b8dac31c6487c
Author: Clément Foucault
Date: Mon Jul 9 15:34:01 2018 +0200
Branches: temp-eeveelightcache
https://developer.blender.org/rB7bb7c3e5cb049d5e3d79c6fe6e2b8dac31c6487c
GPUTexture: Fix mipmap size calculation.
===================================================================
M source/blender/gpu/intern/gpu_texture.c
===================================================================
diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c
index 2df6ed7ca5b..6bed59cef04 100644
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@ -1068,10 +1068,17 @@ void GPU_texture_update_sub(
void *GPU_texture_read(GPUTexture *tex, GPUDataFormat gpu_data_format, int miplvl)
{
+ int size[3] = {0, 0, 0};
+ GPU_texture_get_mipmap_size(tex, miplvl, size);
+
gpu_validate_data_format(tex->format, gpu_data_format);
size_t buf_size = gpu_texture_memory_footprint_compute(tex);
- size_t samples_count = (buf_size / tex->bytesize);
+ size_t samples_count = max_ii(1, tex->samples);
+
+ samples_count *= size[0];
+ samples_count *= max_ii(1, size[1]);
+ samples_count *= max_ii(1, size[2]);
switch (gpu_data_format) {
case GPU_DATA_FLOAT:
More information about the Bf-blender-cvs
mailing list