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-07-29 16:50:46 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-07-29 16:54:51 +0300
commit2d89cd7dd5b2345ca5cc36cb20edacb04ef90036 (patch)
tree2a0f47059f83383ce7a55a32984c14708cf77d4a
parent99d0b3b79377d38d3936fd9beba8d647e938f0c1 (diff)
Cleanup: GPU: Move Image based function to GPU_draw.h
This makes it less confusing what functions are for blender structures.
-rw-r--r--source/blender/blenkernel/intern/movieclip.c1
-rw-r--r--source/blender/draw/engines/overlay/overlay_image.c2
-rw-r--r--source/blender/draw/engines/workbench/workbench_materials.c1
-rw-r--r--source/blender/draw/intern/DRW_render.h1
-rw-r--r--source/blender/draw/intern/draw_manager_data.c1
-rw-r--r--source/blender/gpu/GPU_draw.h45
-rw-r--r--source/blender/gpu/GPU_texture.h21
-rw-r--r--source/blender/gpu/intern/gpu_texture_image.c4
-rw-r--r--source/blender/makesdna/DNA_image_types.h8
9 files changed, 44 insertions, 40 deletions
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 4a65c6ff5e7..d79ef9525cd 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -72,6 +72,7 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
+#include "GPU_draw.h"
#include "GPU_texture.h"
#ifdef WITH_OPENEXR
diff --git a/source/blender/draw/engines/overlay/overlay_image.c b/source/blender/draw/engines/overlay/overlay_image.c
index 7aad84629e0..12b6799f426 100644
--- a/source/blender/draw/engines/overlay/overlay_image.c
+++ b/source/blender/draw/engines/overlay/overlay_image.c
@@ -232,7 +232,7 @@ static void OVERLAY_image_free_movieclips_textures(OVERLAY_Data *data)
LinkData *link;
while ((link = BLI_pophead(&data->stl->pd->bg_movie_clips))) {
MovieClip *clip = (MovieClip *)link->data;
- GPU_free_texture_movieclip(clip);
+ GPU_free_movieclip(clip);
MEM_freeN(link);
}
}
diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c
index 0493b42f9c6..9956ba5da11 100644
--- a/source/blender/draw/engines/workbench/workbench_materials.c
+++ b/source/blender/draw/engines/workbench/workbench_materials.c
@@ -33,6 +33,7 @@
#include "DNA_mesh_types.h"
#include "DNA_node_types.h"
+#include "GPU_draw.h"
#include "GPU_uniformbuffer.h"
#include "ED_uvedit.h"
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 7a889d9399e..84a2a5f7fda 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -45,6 +45,7 @@
#include "DNA_scene_types.h"
#include "DNA_world_types.h"
+#include "GPU_draw.h"
#include "GPU_framebuffer.h"
#include "GPU_primitive.h"
#include "GPU_shader.h"
diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c
index a8105785d53..00cd91323f0 100644
--- a/source/blender/draw/intern/draw_manager_data.c
+++ b/source/blender/draw/intern/draw_manager_data.c
@@ -47,6 +47,7 @@
#endif
#include "GPU_buffers.h"
+#include "GPU_draw.h"
#include "GPU_material.h"
#include "intern/gpu_codegen.h"
diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h
index 8110920527d..0d8acfa0279 100644
--- a/source/blender/gpu/GPU_draw.h
+++ b/source/blender/gpu/GPU_draw.h
@@ -25,6 +25,8 @@
#define __GPU_DRAW_H__
#include "BLI_utildefines.h"
+
+#include "DNA_image_types.h"
#include "DNA_object_enums.h"
#ifdef __cplusplus
@@ -32,38 +34,49 @@ extern "C" {
#endif
struct FluidModifierData;
-struct ImBuf;
+struct GPUTexture;
struct Image;
struct ImageUser;
+struct ImBuf;
struct Main;
+struct MovieClip;
+struct MovieClipUser;
-/* OpenGL drawing functions related to shading. */
+/* Texture creation from blender datablocks. */
+struct GPUTexture *GPU_texture_from_blender(struct Image *ima,
+ struct ImageUser *iuser,
+ struct ImBuf *ibuf,
+ eGPUTextureTarget target);
-/* Mipmap settings
- * - these will free textures on changes */
+struct GPUTexture *GPU_texture_from_movieclip(struct MovieClip *clip,
+ struct MovieClipUser *cuser,
+ eGPUTextureTarget target);
-void GPU_paint_set_mipmap(struct Main *bmain, bool mipmap);
-
-/* Image updates and free
- * - these deal with images bound as opengl textures */
+/* Fluid simulation. */
+void GPU_create_smoke(struct FluidModifierData *fmd, int highres);
+void GPU_create_smoke_coba_field(struct FluidModifierData *fmd);
+void GPU_create_smoke_velocity(struct FluidModifierData *fmd);
-void GPU_paint_update_image(
- struct Image *ima, struct ImageUser *iuser, int x, int y, int w, int h);
+/* Image updates and free. */
void GPU_free_image(struct Image *ima);
+void GPU_free_movieclip(struct MovieClip *clip);
+void GPU_free_smoke(struct FluidModifierData *fmd);
+void GPU_free_smoke_velocity(struct FluidModifierData *fmd);
+
void GPU_free_images(struct Main *bmain);
void GPU_free_images_anim(struct Main *bmain);
void GPU_free_images_old(struct Main *bmain);
-/* gpu_draw_smoke.c */
-void GPU_free_smoke(struct FluidModifierData *fmd);
-void GPU_free_smoke_velocity(struct FluidModifierData *fmd);
-void GPU_create_smoke(struct FluidModifierData *fmd, int highres);
-void GPU_create_smoke_coba_field(struct FluidModifierData *fmd);
-void GPU_create_smoke_velocity(struct FluidModifierData *fmd);
+void GPU_paint_update_image(
+ struct Image *ima, struct ImageUser *iuser, int x, int y, int w, int h);
+void GPU_paint_set_mipmap(struct Main *bmain, bool mipmap);
/* Delayed free of OpenGL buffers by main thread */
void GPU_free_unused_buffers(void);
+/* For internal use. */
+struct GPUTexture *GPU_texture_create_error(eGPUTextureTarget target);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h
index 42afe2b63bf..31b8e6c9b6a 100644
--- a/source/blender/gpu/GPU_texture.h
+++ b/source/blender/gpu/GPU_texture.h
@@ -25,6 +25,7 @@
#define __GPU_TEXTURE_H__
#include "BLI_utildefines.h"
+
#include "GPU_state.h"
struct GPUVertBuf;
@@ -38,14 +39,6 @@ struct PreviewImage;
struct GPUFrameBuffer;
typedef struct GPUTexture GPUTexture;
-/* Used to get the correct gpu texture from an Image datablock. */
-typedef enum eGPUTextureTarget {
- TEXTARGET_2D = 0,
- TEXTARGET_2D_ARRAY,
- TEXTARGET_TILE_MAPPING,
- TEXTARGET_COUNT,
-} eGPUTextureTarget;
-
/* GPU Samplers state
* - Specify the sampler state to bind a texture with.
* - Internally used by textures.
@@ -237,21 +230,9 @@ GPUTexture *GPU_texture_create_cube_array(
GPUTexture *GPU_texture_create_from_vertbuf(struct GPUVertBuf *vert);
GPUTexture *GPU_texture_create_buffer(eGPUTextureFormat data_type, const uint buffer);
-GPUTexture *GPU_texture_create_error(eGPUTextureTarget target);
GPUTexture *GPU_texture_create_compressed(
int w, int h, int miplen, eGPUTextureFormat format, const void *data);
-GPUTexture *GPU_texture_from_blender(struct Image *ima,
- struct ImageUser *iuser,
- struct ImBuf *ibuf,
- eGPUTextureTarget target);
-
-/* movie clip drawing */
-GPUTexture *GPU_texture_from_movieclip(struct MovieClip *clip,
- struct MovieClipUser *cuser,
- eGPUTextureTarget target);
-void GPU_free_texture_movieclip(struct MovieClip *clip);
-
void GPU_texture_add_mipmap(GPUTexture *tex,
eGPUDataFormat gpu_data_format,
int miplvl,
diff --git a/source/blender/gpu/intern/gpu_texture_image.c b/source/blender/gpu/intern/gpu_texture_image.c
index cd422c6ee04..436b7257db1 100644
--- a/source/blender/gpu/intern/gpu_texture_image.c
+++ b/source/blender/gpu/intern/gpu_texture_image.c
@@ -54,8 +54,6 @@
#include "GPU_draw.h"
#include "GPU_extensions.h"
-#include "GPU_matrix.h"
-#include "GPU_platform.h"
#include "GPU_texture.h"
#include "PIL_time.h"
@@ -982,7 +980,7 @@ void GPU_free_image(Image *ima)
gpu_free_image(ima, BLI_thread_is_main());
}
-void GPU_free_texture_movieclip(struct MovieClip *clip)
+void GPU_free_movieclip(struct MovieClip *clip)
{
/* number of gpu textures to keep around as cache
* We don't want to keep too many GPU textures for
diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h
index 7be244d7ddc..70512c5094b 100644
--- a/source/blender/makesdna/DNA_image_types.h
+++ b/source/blender/makesdna/DNA_image_types.h
@@ -117,6 +117,14 @@ typedef struct ImageTile {
#define IMA_NEED_FRAME_RECALC (1 << 3)
#define IMA_SHOW_STEREO (1 << 4)
+/* Used to get the correct gpu texture from an Image datablock. */
+typedef enum eGPUTextureTarget {
+ TEXTARGET_2D = 0,
+ TEXTARGET_2D_ARRAY,
+ TEXTARGET_TILE_MAPPING,
+ TEXTARGET_COUNT,
+} eGPUTextureTarget;
+
typedef struct Image {
ID id;