Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-09-05 18:33:56 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-09-05 18:49:14 +0300
commitab95cdaba970a30127d804bd1e66ad25ab021ec1 (patch)
treed0da883e11f81253cb7b3e5a75288ca69598e437 /source/blender/draw/intern/draw_manager_texture.c
parentbac4606937514405641659d91a30bf3e6832cdf7 (diff)
GPUTexture: Change texture creation API
This is to modernize the API: - Add meaningful name to all textures (except DRW textures). - Remove unused err_out argument: only used for offscreen python. - Add mipmap count to creation functions for future changes. - Clarify the data usage in creation functions. This is a cleanup commit, there is no functional change. # Conflicts: # source/blender/gpu/GPU_texture.h
Diffstat (limited to 'source/blender/draw/intern/draw_manager_texture.c')
-rw-r--r--source/blender/draw/intern/draw_manager_texture.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/source/blender/draw/intern/draw_manager_texture.c b/source/blender/draw/intern/draw_manager_texture.c
index 083d5224e16..8562a5ba8fb 100644
--- a/source/blender/draw/intern/draw_manager_texture.c
+++ b/source/blender/draw/intern/draw_manager_texture.c
@@ -81,7 +81,8 @@ GPUTexture *DRW_texture_create_1d(int w,
DRWTextureFlag flags,
const float *fpixels)
{
- GPUTexture *tex = GPU_texture_create_1d(w, format, fpixels, NULL);
+ int mips = (flags & DRW_TEX_MIPMAP) ? 9999 : 1;
+ GPUTexture *tex = GPU_texture_create_1d(__func__, w, mips, format, fpixels);
drw_texture_set_parameters(tex, flags);
return tex;
@@ -90,7 +91,8 @@ GPUTexture *DRW_texture_create_1d(int w,
GPUTexture *DRW_texture_create_2d(
int w, int h, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
{
- GPUTexture *tex = GPU_texture_create_2d(w, h, format, fpixels, NULL);
+ int mips = (flags & DRW_TEX_MIPMAP) ? 9999 : 1;
+ GPUTexture *tex = GPU_texture_create_2d(__func__, w, h, mips, format, fpixels);
drw_texture_set_parameters(tex, flags);
return tex;
@@ -99,7 +101,8 @@ GPUTexture *DRW_texture_create_2d(
GPUTexture *DRW_texture_create_2d_array(
int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
{
- GPUTexture *tex = GPU_texture_create_2d_array(w, h, d, format, fpixels, NULL);
+ int mips = (flags & DRW_TEX_MIPMAP) ? 9999 : 1;
+ GPUTexture *tex = GPU_texture_create_2d_array(__func__, w, h, d, mips, format, fpixels);
drw_texture_set_parameters(tex, flags);
return tex;
@@ -108,7 +111,8 @@ GPUTexture *DRW_texture_create_2d_array(
GPUTexture *DRW_texture_create_3d(
int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
{
- GPUTexture *tex = GPU_texture_create_3d(w, h, d, format, fpixels, NULL);
+ int mips = (flags & DRW_TEX_MIPMAP) ? 9999 : 1;
+ GPUTexture *tex = GPU_texture_create_3d(__func__, w, h, d, mips, format, fpixels);
drw_texture_set_parameters(tex, flags);
return tex;
@@ -119,7 +123,8 @@ GPUTexture *DRW_texture_create_cube(int w,
DRWTextureFlag flags,
const float *fpixels)
{
- GPUTexture *tex = GPU_texture_create_cube(w, format, fpixels, NULL);
+ int mips = (flags & DRW_TEX_MIPMAP) ? 9999 : 1;
+ GPUTexture *tex = GPU_texture_create_cube(__func__, w, mips, format, fpixels);
drw_texture_set_parameters(tex, flags);
return tex;
}
@@ -127,7 +132,8 @@ GPUTexture *DRW_texture_create_cube(int w,
GPUTexture *DRW_texture_create_cube_array(
int w, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
{
- GPUTexture *tex = GPU_texture_create_cube_array(w, d, format, fpixels, NULL);
+ int mips = (flags & DRW_TEX_MIPMAP) ? 9999 : 1;
+ GPUTexture *tex = GPU_texture_create_cube_array(__func__, w, d, mips, format, fpixels);
drw_texture_set_parameters(tex, flags);
return tex;
}