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:
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/GPU_draw.h2
-rw-r--r--source/blender/gpu/intern/gpu_draw.c17
2 files changed, 14 insertions, 5 deletions
diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h
index 467adbe10b8..285acb6bdde 100644
--- a/source/blender/gpu/GPU_draw.h
+++ b/source/blender/gpu/GPU_draw.h
@@ -119,7 +119,7 @@ void GPU_set_gpu_mipmapping(int gpu_mipmap);
/* Image updates and free
* - these deal with images bound as opengl textures */
-void GPU_paint_update_image(struct Image *ima, int x, int y, int w, int h, int mipmap);
+void GPU_paint_update_image(struct Image *ima, int x, int y, int w, int h);
void GPU_update_images_framechange(void);
int GPU_update_image_time(struct Image *ima, double time);
int GPU_verify_image(struct Image *ima, struct ImageUser *iuser, int tftile, int compare, int mipmap, int ncd);
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 9aed843659d..9ae505ef0d0 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -878,13 +878,13 @@ void GPU_paint_set_mipmap(int mipmap)
}
}
-void GPU_paint_update_image(Image *ima, int x, int y, int w, int h, int mipmap)
+void GPU_paint_update_image(Image *ima, int x, int y, int w, int h)
{
ImBuf *ibuf;
ibuf = BKE_image_get_ibuf(ima, NULL);
- if (ima->repbind || (GPU_get_mipmap() && mipmap) || !ima->bindcode || !ibuf ||
+ if (ima->repbind || (GPU_get_mipmap() && !GTS.gpu_mipmap) || !ima->bindcode || !ibuf ||
(!is_power_of_2_i(ibuf->x) || !is_power_of_2_i(ibuf->y)) ||
(w == 0) || (h == 0))
{
@@ -911,8 +911,13 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h, int mipmap)
MEM_freeN(buffer);
- if (ima->tpageflag & IMA_MIPMAP_COMPLETE)
+ /* we have already accounted for the case where GTS.gpu_mipmap is false
+ * so we will be using GPU mipmap generation here */
+ if (GPU_get_mipmap()) {
+ glGenerateMipmapEXT(GL_TEXTURE_2D);
+ } else {
ima->tpageflag &= ~IMA_MIPMAP_COMPLETE;
+ }
return;
}
@@ -934,8 +939,12 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h, int mipmap)
glPixelStorei(GL_UNPACK_SKIP_PIXELS, skip_pixels);
glPixelStorei(GL_UNPACK_SKIP_ROWS, skip_rows);
- if (ima->tpageflag & IMA_MIPMAP_COMPLETE)
+ /* see comment above as to why we are using gpu mipmap generation here */
+ if (GPU_get_mipmap()) {
+ glGenerateMipmapEXT(GL_TEXTURE_2D);
+ } else {
ima->tpageflag &= ~IMA_MIPMAP_COMPLETE;
+ }
}
}