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 02:47:28 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-09-05 02:58:07 +0300
commitbd081711d6920ea1d4dcc29557ea4c82401a3600 (patch)
tree2f1440ff2678742bee304c77e5b7eaec85470e7c /source/blender/gpu/GPU_texture.h
parent42e5de3f4d76c29aa8b6cacf4d7c0db3cfffe6ae (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.
Diffstat (limited to 'source/blender/gpu/GPU_texture.h')
-rw-r--r--source/blender/gpu/GPU_texture.h66
1 files changed, 26 insertions, 40 deletions
diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h
index 7039277dcf8..8f0b8b920a2 100644
--- a/source/blender/gpu/GPU_texture.h
+++ b/source/blender/gpu/GPU_texture.h
@@ -183,54 +183,40 @@ typedef enum eGPUDataFormat {
unsigned int GPU_texture_memory_usage_get(void);
-/* TODO make it static function again. (create function with eGPUDataFormat exposed) */
-GPUTexture *GPU_texture_create_nD(int w,
- int h,
- int d,
- int n,
- const void *pixels,
- eGPUTextureFormat tex_format,
- eGPUDataFormat gpu_data_format,
- int samples,
- const bool can_rescale,
- char err_out[256]);
-GPUTexture *GPU_texture_cube_create(int w,
- int d,
- const void *pixels,
- eGPUTextureFormat tex_format,
- eGPUDataFormat gpu_data_format,
- char err_out[256]);
-
-GPUTexture *GPU_texture_create_1d(int w,
- eGPUTextureFormat data_type,
- const float *pixels,
- char err_out[256]);
+/**
+ * \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.
+ */
+GPUTexture *GPU_texture_create_1d(
+ const char *name, int w, int mips, eGPUTextureFormat format, const float *data);
GPUTexture *GPU_texture_create_1d_array(
- int w, int h, eGPUTextureFormat data_type, const float *pixels, char err_out[256]);
+ const char *name, int w, int h, int mips, eGPUTextureFormat format, const float *data);
GPUTexture *GPU_texture_create_2d(
- int w, int h, eGPUTextureFormat data_type, const float *pixels, char err_out[256]);
+ const char *name, int w, int h, int mips, eGPUTextureFormat format, const float *data);
GPUTexture *GPU_texture_create_2d_array(
- int w, int h, int d, eGPUTextureFormat data_type, const float *pixels, char err_out[256]);
+ const char *name, int w, int h, int d, int mips, eGPUTextureFormat format, const float *data);
GPUTexture *GPU_texture_create_3d(
- int w, int h, int d, eGPUTextureFormat data_type, const float *pixels, char err_out[256]);
-GPUTexture *GPU_texture_create_cube(int w,
- eGPUTextureFormat data_type,
- const float *pixels,
- char err_out[256]);
+ const char *name, int w, int h, int d, int mips, eGPUTextureFormat format, const float *data);
+GPUTexture *GPU_texture_create_cube(
+ const char *name, int w, int mips, eGPUTextureFormat format, const float *data);
GPUTexture *GPU_texture_create_cube_array(
- int w, int d, eGPUTextureFormat data_type, const float *pixels, char err_out[256]);
-
-GPUTexture *GPU_texture_create_from_vertbuf(struct GPUVertBuf *vert);
-
-GPUTexture *GPU_texture_create_compressed(
- int w, int h, int miplen, eGPUTextureFormat format, const void *data);
+ const char *name, int w, int d, int mips, eGPUTextureFormat format, const float *data);
+/* Special textures. */
+GPUTexture *GPU_texture_create_from_vertbuf(const char *name, struct GPUVertBuf *vert);
+/**
+ * \a data should hold all the data for all mipmaps.
+ */
+GPUTexture *GPU_texture_create_compressed_2d(
+ const char *name, int w, int h, int miplen, eGPUTextureFormat format, const void *data);
GPUTexture *GPU_texture_create_error(int dimension, bool array);
-void GPU_texture_add_mipmap(GPUTexture *tex,
- eGPUDataFormat gpu_data_format,
- int miplvl,
- const void *pixels);
+void GPU_texture_update_mipmap(GPUTexture *tex,
+ int miplvl,
+ eGPUDataFormat gpu_data_format,
+ const void *pixels);
void GPU_texture_update(GPUTexture *tex, eGPUDataFormat data_format, const void *pixels);
void GPU_texture_update_sub(GPUTexture *tex,