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>2018-07-10 14:17:32 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-07-10 16:31:34 +0300
commitdfd192ce41f7e4923db0642f22a587862656bbdd (patch)
treed47f25e7fd3a162f8d3fb6fcf4d441ce735dd63f /source/blender/gpu/GPU_texture.h
parent785159e6e4dfc5c010baab626667132020e1ddc7 (diff)
GPUTexture: Refactor of texture creation & new feature
- Texture creation now requires explicit data type. - GPU_texture_add_mipmap enable explicit mipmap upload. - GPU_texture_get_mipmap_size can be used to get the size of a mipmap level of an existing GPUTexture - GPU_texture_read let you read back data from a gpu texture.
Diffstat (limited to 'source/blender/gpu/GPU_texture.h')
-rw-r--r--source/blender/gpu/GPU_texture.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h
index 341abeba72f..3ed9014d431 100644
--- a/source/blender/gpu/GPU_texture.h
+++ b/source/blender/gpu/GPU_texture.h
@@ -144,8 +144,23 @@ typedef enum GPUTextureFormat {
GPU_DEPTH_COMPONENT16,
} GPUTextureFormat;
+typedef enum GPUDataFormat {
+ GPU_DATA_FLOAT,
+ GPU_DATA_INT,
+ GPU_DATA_UNSIGNED_INT,
+ GPU_DATA_UNSIGNED_BYTE,
+ GPU_DATA_UNSIGNED_INT_24_8,
+ GPU_DATA_10_11_11_REV,
+} GPUDataFormat;
+
unsigned int GPU_texture_memory_usage_get(void);
+/* TODO make it static function again. (create function with GPUDataFormat exposed) */
+GPUTexture *GPU_texture_create_nD(
+ int w, int h, int d, int n, const void *pixels,
+ GPUTextureFormat tex_format, GPUDataFormat gpu_data_format, int samples,
+ const bool can_rescale, char err_out[256]);
+
GPUTexture *GPU_texture_create_1D(
int w, GPUTextureFormat data_type, const float *pixels, char err_out[256]);
GPUTexture *GPU_texture_create_2D(
@@ -168,11 +183,15 @@ GPUTexture *GPU_texture_from_blender(
struct Image *ima, struct ImageUser *iuser, int textarget, bool is_data, double time);
GPUTexture *GPU_texture_from_preview(struct PreviewImage *prv, int mipmap);
-void GPU_texture_update(GPUTexture *tex, const void *pixels);
+void GPU_texture_add_mipmap(GPUTexture *tex, GPUDataFormat gpu_data_format, int miplvl, const void *pixels);
+
+void GPU_texture_update(GPUTexture *tex, GPUDataFormat data_format, const void *pixels);
void GPU_texture_update_sub(
- GPUTexture *tex, const void *pixels,
+ GPUTexture *tex, GPUDataFormat gpu_data_format, const void *pixels,
int offset_x, int offset_y, int offset_z, int width, int height, int depth);
+void *GPU_texture_read(GPUTexture *tex, GPUDataFormat gpu_data_format, int miplvl);
+
void GPU_invalid_tex_init(void);
void GPU_invalid_tex_bind(int mode);
void GPU_invalid_tex_free(void);
@@ -202,6 +221,7 @@ int GPU_texture_detach_framebuffer(GPUTexture *tex, struct GPUFrameBuffer *fb);
int GPU_texture_target(const GPUTexture *tex);
int GPU_texture_width(const GPUTexture *tex);
int GPU_texture_height(const GPUTexture *tex);
+int GPU_texture_layers(const GPUTexture *tex);
GPUTextureFormat GPU_texture_format(const GPUTexture *tex);
int GPU_texture_samples(const GPUTexture *tex);
bool GPU_texture_cube(const GPUTexture *tex);
@@ -210,6 +230,8 @@ bool GPU_texture_stencil(const GPUTexture *tex);
bool GPU_texture_integer(const GPUTexture *tex);
int GPU_texture_opengl_bindcode(const GPUTexture *tex);
+void GPU_texture_get_mipmap_size(GPUTexture *tex, int lvl, int *size);
+
#ifdef __cplusplus
}
#endif