Realtime Compositor: Implement Texture node #107291

Merged
Omar Emara merged 1 commits from OmarEmaraDev/blender:cached-texture into main 2023-04-25 09:04:41 +02:00
Member

This patch implements the Texture node for the realtime compositor. The
evaluation of the texture is not GPU accelerated, but is cached as a
form of temporary implementation since the Texture node is deprecated
and will be removed in the future. Furthermore, texture node evaluation
is not supported for now.

This patch also introduces the concept of an ID static cache, which
uses the DrawDataList mechanism to invalidate the cache as needed,
consequently, a DrawDataList was added to the Tex ID structure.

An improvement that should be implemented outside of this patch is to
implement support for proxy textures in results to avoid redundant
copies in the execute method of the texture node. This should be
straightforward bit will be implemented in a separate patch.

This patch implements the Texture node for the realtime compositor. The evaluation of the texture is not GPU accelerated, but is cached as a form of temporary implementation since the Texture node is deprecated and will be removed in the future. Furthermore, texture node evaluation is not supported for now. This patch also introduces the concept of an ID static cache, which uses the DrawDataList mechanism to invalidate the cache as needed, consequently, a DrawDataList was added to the Tex ID structure. An improvement that should be implemented outside of this patch is to implement support for proxy textures in results to avoid redundant copies in the execute method of the texture node. This should be straightforward bit will be implemented in a separate patch.
Omar Emara added 1 commit 2023-04-24 12:30:10 +02:00
74522a1b29 Realtime Compositor: Implement Texture node
This patch implements the Texture node for the realtime compositor. The
evaluation of the texture is not GPU accelerated, but is cached as a
form of temporary implementation since the Texture node is deprecated
and will be removed in the future. Furthermore, texture node evaluation
is not supported for now.

This patch also introduces the concept of an ID static cache, which
uses the DrawDataList mechanism to invalidate the cache as needed,
consequently, a DrawDataList was added to the Tex ID structure.

An improvement that should be implemented outside of this patch is to
implement support for proxy textures in results to avoid redundant
copies in the execute method of the texture node. This should be
straightforward bit will be implemented in a separate patch.
Omar Emara requested review from Clément Foucault 2023-04-24 12:30:22 +02:00
Omar Emara added the
Module
EEVEE & Viewport
Interest
Compositing
labels 2023-04-24 12:30:45 +02:00
Clément Foucault reviewed 2023-04-24 22:30:27 +02:00
Clément Foucault left a comment
Member

Is there a reason to use DrawDataList (itself quite bad) instead of just storing one of multiple GPUTextures inside the Texture ID runtime?

Is there a reason to use DrawDataList (itself quite bad) instead of just storing one of multiple `GPUTexture`s inside the Texture ID runtime?
Author
Member

@fclem I wanted to store the cache on the compositor side, and DrawDataList seemed to be the best option since depsgraph updates were not granular enough to implement that efficiently. But I also didn't realize it was "quite bad" since the rest of render engines depend on it and there is no indication in the code that it shouldn't be used. Can you elaborate on that?

As for why I wanted to store the cache in the compositor side, there are multiple reasons.
The first is that the compositor evaluates the textures in a special way, so if we store the cached evaluation in the texture ID runtime, it will have to be specific to the compositor. So it is not like image IDs where the cache can be used by anyone since the result is unified.
Second, the implementation is much easier and less error prone on the compositor side, and since this is a temporary implementation and textures are deprecated and will be removed anyways, it didn't make sense to invest in a solution for ID runtime cache.

@fclem I wanted to store the cache on the compositor side, and DrawDataList seemed to be the best option since depsgraph updates were not granular enough to implement that efficiently. But I also didn't realize it was "quite bad" since the rest of render engines depend on it and there is no indication in the code that it shouldn't be used. Can you elaborate on that? As for why I wanted to store the cache in the compositor side, there are multiple reasons. The first is that the compositor evaluates the textures in a special way, so if we store the cached evaluation in the texture ID runtime, it will have to be specific to the compositor. So it is not like image IDs where the cache can be used by anyone since the result is unified. Second, the implementation is much easier and less error prone on the compositor side, and since this is a temporary implementation and textures are deprecated and will be removed anyways, it didn't make sense to invest in a solution for ID runtime cache.

@OmarEmaraDev My bad. If DrawDataList is only to used for its recalc flag, then it is ok to use. This usage could be easily refactored. The "bad" usage starts when we are storing engine resources in it.

So I guess the approach for this patch is sound.

@OmarEmaraDev My bad. If `DrawDataList` is only to used for its `recalc` flag, then it is ok to use. This usage could be easily refactored. The "bad" usage starts when we are storing engine resources in it. So I guess the approach for this patch is sound.
Clément Foucault approved these changes 2023-04-25 08:40:09 +02:00
Omar Emara merged commit 151a53110c into main 2023-04-25 09:04:41 +02:00
Omar Emara deleted branch cached-texture 2023-04-25 09:04:42 +02:00
Howard Trickey referenced this issue from a commit 2023-05-29 02:51:44 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#107291
No description provided.