Fix #114414: Alternative fix for greyscale textures retaining perf #114611
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#114611
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Jason-Fielder/blender:Fix_114414_Alternative"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Alternative solution to #114414 which reduces the scope of
textures for which single-channel greyscale optimization
is removed from.
Some byte buffers are converted to float buffers during
color management. These cases should retain support in
the optimal path.
Authored by Apple: Michael Parkin-White
For a few technical notes, in the process of implementing a more comprehensive solution which allowed single channel textures to be updated from multi-component source buffers, I noticed that in quite a few of the common cases, the colormanagement still allocates a float buffer for a given ImBuf during data preparation.
In this case, these paths could still take the optimal packed channel path, so long as the source eGPUDataType was overriden to float if the source buffer was converted during
imb_gpu_get_data(..)
.Loosening the check as follows to byte buffers with given colorspaces enables the optimized single channel GPUTexture to be used in most cases, while also resolving: #114414
Note that I have only been able to test this in the Metal backend. I have also not been able to test every source format, but the Wanderer appears to work, and the logic should limit this to the cases where the float buffer is later allocated and used.
I agree with the solution, just need to cleanup a parameter as it is always overwritten.
@ -121,2 +131,3 @@
const bool store_premultiplied,
bool *r_freedata)
bool *r_freedata,
eGPUDataFormat *out_data_format)
This makes two ways to determine the data_format.
one by
imb_gpu_get_format
which could be overwritten byimb_gpu_get_data
.Or the correct data_format should be returned by imb_gpu_get_format, or the r_data_format parameter should be removed from that function.
I would prefer the removal of the
r_data_format
Yeah, this is a little non-ideal as it stands.
However, part of what makes this solution work to retain the 4ch->1ch compression is that in
imb_gpu_get_data
, even if the source data is a byte_buffer, some of the colour conversions appear to generate floating point data, in which case, one of the original reasons for the bug was that the wrong data type was being generated.It may still be valid to have the data type return in the original
imb_gpu_get_format
, as I believe this is used in certain cases without the data upload. Although the override inimb_gpu_get_data
allows for the case where the data is flipped to being floating point, to ensure the correct flag is passed toGPU_texture_update(..)
.Although it will likely make sense to refactor both paths to use the same thing, or defer data format determination to a point where the source data type is known.
But yes, it'll likely make the most sense to remove r_data_format from
imb_gpu_get_format
, and leave that to only being the source GPU tex format, to allow for the destination texture format and source data format to allow different types.I approve for now so users can test and report back.
Will perform the removal of the unused parameter on main
Thanks for the feedback, will look into addressing this.