diff options
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/GPU_texture.h | 2 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_texture.cc | 36 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_texture_private.hh | 8 |
3 files changed, 23 insertions, 23 deletions
diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h index 5bd20b7be98..d76185fc71d 100644 --- a/source/blender/gpu/GPU_texture.h +++ b/source/blender/gpu/GPU_texture.h @@ -193,7 +193,7 @@ unsigned int GPU_texture_memory_usage_get(void); * \note \a data is expected to be float. If the \a format is not compatible with float data or if * the data is not in float format, use GPU_texture_update to upload the data with the right data * format. - * \a mips is the number of mip level to allocate. It must be >= 1. + * \a mip_len is the number of mip level to allocate. It must be >= 1. */ GPUTexture *GPU_texture_create_1d( const char *name, int w, int mip_len, eGPUTextureFormat format, const float *data); diff --git a/source/blender/gpu/intern/gpu_texture.cc b/source/blender/gpu/intern/gpu_texture.cc index 218d22ddf53..9b3ecfea2f8 100644 --- a/source/blender/gpu/intern/gpu_texture.cc +++ b/source/blender/gpu/intern/gpu_texture.cc @@ -51,13 +51,13 @@ Texture::~Texture() #endif } -bool Texture::init_1D(int w, int layers, int mips, eGPUTextureFormat format) +bool Texture::init_1D(int w, int layers, int mip_len, eGPUTextureFormat format) { w_ = w; h_ = layers; d_ = 0; - int mips_max = 1 + floorf(log2f(w)); - mipmaps_ = min_ii(mips, mips_max); + int mip_len_max = 1 + floorf(log2f(w)); + mipmaps_ = min_ii(mip_len, mip_len_max); format_ = format; format_flag_ = to_format_flag(format); type_ = (layers > 0) ? GPU_TEXTURE_1D_ARRAY : GPU_TEXTURE_1D; @@ -67,13 +67,13 @@ bool Texture::init_1D(int w, int layers, int mips, eGPUTextureFormat format) return this->init_internal(); } -bool Texture::init_2D(int w, int h, int layers, int mips, eGPUTextureFormat format) +bool Texture::init_2D(int w, int h, int layers, int mip_len, eGPUTextureFormat format) { w_ = w; h_ = h; d_ = layers; - int mips_max = 1 + floorf(log2f(max_ii(w, h))); - mipmaps_ = min_ii(mips, mips_max); + int mip_len_max = 1 + floorf(log2f(max_ii(w, h))); + mipmaps_ = min_ii(mip_len, mip_len_max); format_ = format; format_flag_ = to_format_flag(format); type_ = (layers > 0) ? GPU_TEXTURE_2D_ARRAY : GPU_TEXTURE_2D; @@ -83,13 +83,13 @@ bool Texture::init_2D(int w, int h, int layers, int mips, eGPUTextureFormat form return this->init_internal(); } -bool Texture::init_3D(int w, int h, int d, int mips, eGPUTextureFormat format) +bool Texture::init_3D(int w, int h, int d, int mip_len, eGPUTextureFormat format) { w_ = w; h_ = h; d_ = d; - int mips_max = 1 + floorf(log2f(max_iii(w, h, d))); - mipmaps_ = min_ii(mips, mips_max); + int mip_len_max = 1 + floorf(log2f(max_iii(w, h, d))); + mipmaps_ = min_ii(mip_len, mip_len_max); format_ = format; format_flag_ = to_format_flag(format); type_ = GPU_TEXTURE_3D; @@ -99,13 +99,13 @@ bool Texture::init_3D(int w, int h, int d, int mips, eGPUTextureFormat format) return this->init_internal(); } -bool Texture::init_cubemap(int w, int layers, int mips, eGPUTextureFormat format) +bool Texture::init_cubemap(int w, int layers, int mip_len, eGPUTextureFormat format) { w_ = w; h_ = w; d_ = max_ii(1, layers) * 6; - int mips_max = 1 + floorf(log2f(w)); - mipmaps_ = min_ii(mips, mips_max); + int mip_len_max = 1 + floorf(log2f(w)); + mipmaps_ = min_ii(mip_len, mip_len_max); format_ = format; format_flag_ = to_format_flag(format); type_ = (layers > 0) ? GPU_TEXTURE_CUBE_ARRAY : GPU_TEXTURE_CUBE; @@ -237,29 +237,29 @@ static inline GPUTexture *gpu_texture_create(const char *name, const int h, const int d, const eGPUTextureType type, - int mips, + int mip_len, eGPUTextureFormat tex_format, eGPUDataFormat data_format, const void *pixels) { - BLI_assert(mips > 0); + BLI_assert(mip_len > 0); Texture *tex = GPUBackend::get()->texture_alloc(name); bool success = false; switch (type) { case GPU_TEXTURE_1D: case GPU_TEXTURE_1D_ARRAY: - success = tex->init_1D(w, h, mips, tex_format); + success = tex->init_1D(w, h, mip_len, tex_format); break; case GPU_TEXTURE_2D: case GPU_TEXTURE_2D_ARRAY: - success = tex->init_2D(w, h, d, mips, tex_format); + success = tex->init_2D(w, h, d, mip_len, tex_format); break; case GPU_TEXTURE_3D: - success = tex->init_3D(w, h, d, mips, tex_format); + success = tex->init_3D(w, h, d, mip_len, tex_format); break; case GPU_TEXTURE_CUBE: case GPU_TEXTURE_CUBE_ARRAY: - success = tex->init_cubemap(w, d, mips, tex_format); + success = tex->init_cubemap(w, d, mip_len, tex_format); break; default: break; diff --git a/source/blender/gpu/intern/gpu_texture_private.hh b/source/blender/gpu/intern/gpu_texture_private.hh index 00bcc9fac00..8521b0fd77f 100644 --- a/source/blender/gpu/intern/gpu_texture_private.hh +++ b/source/blender/gpu/intern/gpu_texture_private.hh @@ -101,10 +101,10 @@ class Texture { virtual ~Texture(); /* Return true on success. */ - bool init_1D(int w, int layers, int mips, eGPUTextureFormat format); - bool init_2D(int w, int h, int layers, int mips, eGPUTextureFormat format); - bool init_3D(int w, int h, int d, int mips, eGPUTextureFormat format); - bool init_cubemap(int w, int layers, int mips, eGPUTextureFormat format); + bool init_1D(int w, int layers, int mip_len, eGPUTextureFormat format); + bool init_2D(int w, int h, int layers, int mip_len, eGPUTextureFormat format); + bool init_3D(int w, int h, int d, int mip_len, eGPUTextureFormat format); + bool init_cubemap(int w, int layers, int mip_len, eGPUTextureFormat format); bool init_buffer(GPUVertBuf *vbo, eGPUTextureFormat format); bool init_view(const GPUTexture *src, eGPUTextureFormat format, |