GPU: Share GPU Textures when using the same file path. #98375

Open
opened 2022-05-25 17:28:34 +02:00 by Jeroen Bakker · 4 comments
Member

Currently the GPU textures that Workbench and Eevee uses are cached inside the image data-block.
In productions scenes were textures are reused by different materials sourcing from different blend files the GPU textures are not shared, although they might use the same file on disk.

The idea is to share the GPU textures between those image data-blocks.

Corner cases

  • GPU textures can only be shared when data-block isn't modifier. This could mean that GPU textures could be shared, until the user starts modify-ing one.
  • GPU textures for movies and sequences can only be shared when they reflect the same frame number. Currently a eevee cannot handle drawing multiple frames from the same image data-block. A work around for this is to duplicate the image block. For the short term we could also not support sharing GPU textures for movies and sequences at all as this isn't used that much to our knowledge.
  • Both single tiled and multi-tiled images should be supported.

Implementation

  • Use a single GPUTexture cache. Store GPU textures with a key. Key could be some values stored as a string. Per key a group of GPU Textures can be retrieved (Tiled, TileIndex, Image, left/right) etc.
  • Additional benefit is that usage tagging can be done faster as we don't need to go over all the image data-blocks in the scene. (although don't think this would be noticeable to users)
  • Key could contain:
    Type of image filename
    ** Optional the IDBlock name+library for when images are modified.
  • eImageTextureResolution isn't used anymore and could be removed. There is no need anymore to support multiple texture resolutions at the same time. Will reduce some code complexity and nano improvement in performance. {f41c7723c93b}
  • IMA_NOCOLLECT can be removed aswell

NOTE: Request made by the Heist project.

Currently the GPU textures that Workbench and Eevee uses are cached inside the image data-block. In productions scenes were textures are reused by different materials sourcing from different blend files the GPU textures are not shared, although they might use the same file on disk. The idea is to share the GPU textures between those image data-blocks. ## Corner cases * GPU textures can only be shared when data-block isn't modifier. This could mean that GPU textures could be shared, until the user starts modify-ing one. * GPU textures for movies and sequences can only be shared when they reflect the same frame number. Currently a eevee cannot handle drawing multiple frames from the same image data-block. A work around for this is to duplicate the image block. For the short term we could also not support sharing GPU textures for movies and sequences at all as this isn't used that much to our knowledge. * Both single tiled and multi-tiled images should be supported. ## Implementation * Use a single GPUTexture cache. Store GPU textures with a key. Key could be some values stored as a string. Per key a group of GPU Textures can be retrieved (Tiled, TileIndex, Image, left/right) etc. * Additional benefit is that usage tagging can be done faster as we don't need to go over all the image data-blocks in the scene. (although don't think this would be noticeable to users) * Key could contain: **Type of image** filename ** Optional the IDBlock name+library for when images are modified. ## Related changes * `eImageTextureResolution` isn't used anymore and could be removed. There is no need anymore to support multiple texture resolutions at the same time. Will reduce some code complexity and nano improvement in performance. {f41c7723c93b} * `IMA_NOCOLLECT` can be removed aswell NOTE: Request made by the Heist project.
Jeroen Bakker self-assigned this 2022-05-25 17:28:34 +02:00
Author
Member

Added subscribers: @Jeroen-Bakker, @SimonThommes

Added subscribers: @Jeroen-Bakker, @SimonThommes
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

Added subscriber: @IihT2cWA9xiP30BsYphz3EiEISNoScoe

Added subscriber: @IihT2cWA9xiP30BsYphz3EiEISNoScoe
Member

Added subscriber: @EAW

Added subscriber: @EAW
Thomas Dinges added this to the 3.3 LTS milestone 2023-02-08 15:37:17 +01:00
Philipp Oeser removed the
Interest
EEVEE & Viewport
label 2023-02-09 15:12:36 +01:00
Brecht Van Lommel removed this from the 3.3 LTS milestone 2023-02-09 19:35:08 +01:00
Sign in to join this conversation.
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
3 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#98375
No description provided.