Page MenuHome

Fix T73188: RenderResult as Camera BG Image
ClosedPublic

Authored by Jeroen Bakker (jbakker) on Jan 27 2020, 4:37 PM.

Details

Summary

In blender 2.79 you could use a render result as a camera background
image. This is useful during layout/compositing. During Blender 2.80
development there were 2 changes that removed this feature.

  • to receive a render result the image required a lock. This lock wasn't passed and therefore no image was read from the result. Generating an GPUTexture from an Blender image also didn't do the locking.
  • the iuser->scene field wasn't set what is required for render results.

This change adds an optional ibuf parameter to GPU_texture_from_blender that can be passed when available.

Diff Detail

Repository
rB Blender
Branch
T73188 (branched from master)
Build Status
Buildable 6402
Build 6402: arc lint + arc unit

Event Timeline

Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Jan 27 2020, 4:40 PM
Jeroen Bakker (jbakker) added inline comments.
source/blender/blenloader/intern/versioning_280.c
4369

I am not sure what is the best way to do this. Perhaps we should use the first scene where the camera is used.

source/blender/gpu/intern/gpu_draw.c
854

add comment that this function is similar to GPU_texture_from_blender.

The GPU side of things makes sense to me. But maybe add another reviewer to have a second eye on the general approach. It's not 100% familiar with the iuser management.

This revision is now accepted and ready to land.Jan 27 2020, 5:08 PM

Code cleanup: Merged GPU_texture_from_blender_with_ibuf into GPU_texture_from_blender.

This revision now requires review to proceed.Jan 28 2020, 7:59 AM

@Brecht Van Lommel (brecht) I added you as reviewer as this is related to how the ImBuf can be acquired for a RenderResult. In this case it is required to have a valid iuser->scene and the ImBuf needs to be guarded by a lock.

Brecht Van Lommel (brecht) requested changes to this revision.Jan 28 2020, 10:21 AM

Don't set the scene pointer in the image user permanently, do it only temporarily from the context and then clear it again immediately.

See rB38f0d5f75af7: Fix T61714, T61712: crash reloading images after recent changes..

This revision now requires changes to proceed.Jan 28 2020, 10:21 AM
source/blender/draw/engines/overlay/overlay_image.c
166

You still have to call BKE_image_release_ibuf if the image buffer returned is NULL.

Jeroen Bakker (jbakker) updated this revision to Diff 21216.EditedJan 28 2020, 2:01 PM

Update the iuser->scene when needed.

This patch shows 2 other changes that aren't in master yet, but they are in blender-v2.82-release branch. These changes are the files:

  • source/blender/editors/interface/interface_handlers.c
  • source/blender/editors/interface/interface_icons.c
Brecht Van Lommel (brecht) requested changes to this revision.Jan 28 2020, 2:17 PM
Brecht Van Lommel (brecht) added inline comments.
source/blender/draw/engines/overlay/overlay_image.c
147

Move this code to right above BKE_image_acquire_ibuf, now there are cases where it's not cleared.

This revision now requires changes to proceed.Jan 28 2020, 2:17 PM
Jeroen Bakker (jbakker) marked an inline comment as done.

Moved assignment of iuser->scene just before the BKE_image_acquire_ibuf so it is set when actually being used

Jeroen Bakker (jbakker) marked an inline comment as done.Jan 28 2020, 3:50 PM
Jeroen Bakker (jbakker) added inline comments.
source/blender/blenloader/intern/versioning_280.c
4369

During loading we should always set the iuser->scene to NULL.
changes are done in readfile

This revision is now accepted and ready to land.Jan 28 2020, 4:17 PM