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:
authorPhilipp Oeser <info@graphics-engineer.com>2020-01-29 22:25:35 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2020-01-29 22:29:20 +0300
commit3984586292855bb6710facf5845b44f5d11dcc6f (patch)
treec649e5d521ad4f9012276fcf0175f4e75db22bb7 /source/blender/draw
parent35c6d68d35699fe088537074ebaa5034c8e6321e (diff)
parente4faed120d9c294ea5d6061b3213ed4f6784db52 (diff)
Merge branch 'blender-v2.82-release'
Merge conflict in source/blender/gpu/GPU_texture.h
Diffstat (limited to 'source/blender/draw')
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_draw_utils.c6
-rw-r--r--source/blender/draw/engines/overlay/overlay_image.c18
-rw-r--r--source/blender/draw/engines/overlay/overlay_paint.c2
-rw-r--r--source/blender/draw/engines/workbench/workbench_forward.c3
-rw-r--r--source/blender/draw/engines/workbench/workbench_materials.c7
-rw-r--r--source/blender/draw/intern/draw_manager_data.c2
6 files changed, 22 insertions, 16 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 4c6ce896ebc..2c6b1315ad4 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -522,7 +522,7 @@ static DRWShadingGroup *gpencil_shgroup_fill_create(GPENCIL_e_data *e_data,
BKE_image_release_ibuf(image, ibuf, NULL);
}
else {
- GPUTexture *texture = GPU_texture_from_blender(gp_style->ima, &iuser, GL_TEXTURE_2D);
+ GPUTexture *texture = GPU_texture_from_blender(gp_style->ima, &iuser, ibuf, GL_TEXTURE_2D);
DRW_shgroup_uniform_texture(grp, "myTexture", texture);
DRW_shgroup_uniform_bool_copy(
grp, "myTexturePremultiplied", (image->alpha_mode == IMA_ALPHA_PREMUL));
@@ -705,7 +705,7 @@ DRWShadingGroup *gpencil_shgroup_stroke_create(GPENCIL_e_data *e_data,
BKE_image_release_ibuf(image, ibuf, NULL);
}
else {
- GPUTexture *texture = GPU_texture_from_blender(gp_style->sima, &iuser, GL_TEXTURE_2D);
+ GPUTexture *texture = GPU_texture_from_blender(gp_style->sima, &iuser, ibuf, GL_TEXTURE_2D);
DRW_shgroup_uniform_texture(grp, "myTexture", texture);
DRW_shgroup_uniform_bool_copy(
grp, "myTexturePremultiplied", (image->alpha_mode == IMA_ALPHA_PREMUL));
@@ -878,7 +878,7 @@ static DRWShadingGroup *gpencil_shgroup_point_create(GPENCIL_e_data *e_data,
BKE_image_release_ibuf(image, ibuf, NULL);
}
else {
- GPUTexture *texture = GPU_texture_from_blender(gp_style->sima, &iuser, GL_TEXTURE_2D);
+ GPUTexture *texture = GPU_texture_from_blender(gp_style->sima, &iuser, ibuf, GL_TEXTURE_2D);
DRW_shgroup_uniform_texture(grp, "myTexture", texture);
DRW_shgroup_uniform_bool_copy(
grp, "myTexturePremultiplied", (image->alpha_mode == IMA_ALPHA_PREMUL));
diff --git a/source/blender/draw/engines/overlay/overlay_image.c b/source/blender/draw/engines/overlay/overlay_image.c
index cda55fcfb5e..cf90c12b357 100644
--- a/source/blender/draw/engines/overlay/overlay_image.c
+++ b/source/blender/draw/engines/overlay/overlay_image.c
@@ -134,6 +134,7 @@ static struct GPUTexture *image_camera_background_texture_get(CameraBGImage *bgp
float *r_aspect,
bool *r_use_alpha_premult)
{
+ void *lock;
Image *image = bgpic->ima;
ImageUser *iuser = &bgpic->iuser;
MovieClip *clip = NULL;
@@ -160,12 +161,19 @@ static struct GPUTexture *image_camera_background_texture_get(CameraBGImage *bgp
camera_background_images_stereo_setup(scene, draw_ctx->v3d, image, iuser);
}
- ImBuf *ibuf = BKE_image_acquire_ibuf(image, iuser, NULL);
+ iuser->scene = draw_ctx->scene;
+ ImBuf *ibuf = BKE_image_acquire_ibuf(image, iuser, &lock);
if (ibuf == NULL) {
+ BKE_image_release_ibuf(image, ibuf, lock);
+ iuser->scene = NULL;
return NULL;
}
+ width = ibuf->x;
+ height = ibuf->y;
+ tex = GPU_texture_from_blender(image, iuser, ibuf, GL_TEXTURE_2D);
+ BKE_image_release_ibuf(image, ibuf, lock);
+ iuser->scene = NULL;
- tex = GPU_texture_from_blender(image, iuser, GL_TEXTURE_2D);
if (tex == NULL) {
return NULL;
}
@@ -173,10 +181,6 @@ static struct GPUTexture *image_camera_background_texture_get(CameraBGImage *bgp
aspect_x = bgpic->ima->aspx;
aspect_y = bgpic->ima->aspy;
- width = ibuf->x;
- height = ibuf->y;
-
- BKE_image_release_ibuf(image, ibuf, NULL);
break;
case CAM_BGIMG_SOURCE_MOVIE:
@@ -376,7 +380,7 @@ void OVERLAY_image_empty_cache_populate(OVERLAY_Data *vedata, Object *ob)
* see: T59347 */
int size[2] = {0};
if (ima != NULL) {
- tex = GPU_texture_from_blender(ima, ob->iuser, GL_TEXTURE_2D);
+ tex = GPU_texture_from_blender(ima, ob->iuser, NULL, GL_TEXTURE_2D);
if (tex) {
size[0] = GPU_texture_orig_width(tex);
size[1] = GPU_texture_orig_height(tex);
diff --git a/source/blender/draw/engines/overlay/overlay_paint.c b/source/blender/draw/engines/overlay/overlay_paint.c
index 047659fbeee..e88a69b695e 100644
--- a/source/blender/draw/engines/overlay/overlay_paint.c
+++ b/source/blender/draw/engines/overlay/overlay_paint.c
@@ -85,7 +85,7 @@ void OVERLAY_paint_cache_init(OVERLAY_Data *vedata)
state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_BLEND_ALPHA;
DRW_PASS_CREATE(psl->paint_color_ps, state | pd->clipping_state);
- GPUTexture *tex = GPU_texture_from_blender(imapaint->stencil, NULL, GL_TEXTURE_2D);
+ GPUTexture *tex = GPU_texture_from_blender(imapaint->stencil, NULL, NULL, GL_TEXTURE_2D);
const bool mask_premult = (imapaint->stencil->alpha_mode == IMA_ALPHA_PREMUL);
const bool mask_inverted = (imapaint->flag & IMAGEPAINT_PROJECT_LAYER_STENCIL_INV) != 0;
diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c
index e5f121a690d..97bea58f31b 100644
--- a/source/blender/draw/engines/workbench/workbench_forward.c
+++ b/source/blender/draw/engines/workbench/workbench_forward.c
@@ -210,7 +210,8 @@ WORKBENCH_MaterialData *workbench_forward_get_or_create_material_data(WORKBENCH_
if (color_type == V3D_SHADING_TEXTURE_COLOR) {
material->shgrp_object_outline = DRW_shgroup_create(sh_data->object_outline_texture_sh,
psl->object_outline_pass);
- GPUTexture *tex = GPU_texture_from_blender(material->ima, material->iuser, GL_TEXTURE_2D);
+ GPUTexture *tex = GPU_texture_from_blender(
+ material->ima, material->iuser, NULL, GL_TEXTURE_2D);
DRW_shgroup_uniform_texture(material->shgrp_object_outline, "image", tex);
}
else {
diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c
index 2219f5cf2dd..fc054b11d55 100644
--- a/source/blender/draw/engines/workbench/workbench_materials.c
+++ b/source/blender/draw/engines/workbench/workbench_materials.c
@@ -376,14 +376,15 @@ void workbench_material_shgroup_uniform(WORKBENCH_PrivateData *wpd,
if (use_texture) {
if (is_tiled) {
GPUTexture *array_tex = GPU_texture_from_blender(
- material->ima, material->iuser, GL_TEXTURE_2D_ARRAY);
+ material->ima, material->iuser, NULL, GL_TEXTURE_2D_ARRAY);
GPUTexture *data_tex = GPU_texture_from_blender(
- material->ima, material->iuser, GL_TEXTURE_1D_ARRAY);
+ material->ima, material->iuser, NULL, GL_TEXTURE_1D_ARRAY);
DRW_shgroup_uniform_texture(grp, "image_tile_array", array_tex);
DRW_shgroup_uniform_texture(grp, "image_tile_data", data_tex);
}
else {
- GPUTexture *tex = GPU_texture_from_blender(material->ima, material->iuser, GL_TEXTURE_2D);
+ GPUTexture *tex = GPU_texture_from_blender(
+ material->ima, material->iuser, NULL, GL_TEXTURE_2D);
DRW_shgroup_uniform_texture(grp, "image", tex);
}
DRW_shgroup_uniform_bool_copy(
diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c
index c6fc244121c..f9a6b663900 100644
--- a/source/blender/draw/intern/draw_manager_data.c
+++ b/source/blender/draw/intern/draw_manager_data.c
@@ -1226,7 +1226,7 @@ static DRWShadingGroup *drw_shgroup_material_inputs(DRWShadingGroup *grp,
else {
textarget = GL_TEXTURE_2D;
}
- *tex_ref = tex = GPU_texture_from_blender(input->ima, input->iuser, textarget);
+ *tex_ref = tex = GPU_texture_from_blender(input->ima, input->iuser, NULL, textarget);
GPU_texture_ref(tex);
}