Draw: Custom IDs #105261
No reviewers
Labels
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#105261
Loading…
Reference in New Issue
No description provided.
Delete Branch "pragma37/blender:pull-thin-handles"
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?
(Opening a new pull request because Gitea refuses to reopen the previous one (#105034))
This pull request adds a new tipe of resource handles (thin handles).
These are intended for cases where a resource buffer with more than one entry for each object is needed (for example, one entry per material slot).
While it's already possible to have multiple regular handles for the same object, they have a non-trivial overhead in terms of uploaded data (matrix, bounds, object info) and computation (visibility culling).
Thin handles store an indirection buffer pointing to their "parent" regular handle, therefore multiple thin handles can share the same per-object data and visibility culling computation.
Thin handles can only be used in their own Pass type (PassMainThin), so passes that don't need them don't have to pay the overhead.
This pull request also includes the update of the Workbench Next pre-pass to use PassMainThin, which is the main reason for the implementation of this feature.
The main change from the previous PR is that the thin handles are now stored directly in the main resource_id_buf, to avoid wasting an extra bind slot.
I'm not convinced
Thin
is a good subtype prefix.As one of my comment point out,
DrawPrototype
has some padding byte you should reuse for the "Thin" ID. This alone should remove the need for many duplicate types. I would like to avoid this for this particular purpose. So maybe a runtime boolean to enable this is preferable (doesn't add much overhead I think).I'm also considering if this is better to just let the engine choose what data to pass to this ID and call it
drw_CustomID
. This way it could be used for selection IDs for instance without being specifically target at a "Thin" or subobject concept.As for the thin handle, well, this would become obsolete, and you would just have an extra parameter for the
draw()
methods. This parameter is going to be sent with theDrawPrototype
anyway. The only saving you get for not using it is the reduced size of the finalresource_id_buf
.@ -56,1 +56,4 @@
uint resource_index = (proto.resource_handle & 0x7FFFFFFFu);
uint visibility_index = resource_index;
#ifdef WITH_THIN_HANDLES
visibility_index = thin_map_buf[resource_index] & 0x7FFFFFFFu;
Scrap this
thin_map_buf
. There is auint _pad0
you can replace insideDrawPrototype
.@ -206,0 +212,4 @@
GPU_SHADER_CREATE_INFO(draw_resource_id_new_with_thin)
.define("UNIFORM_RESOURCE_ID_NEW")
.define("WITH_THIN_HANDLES")
/*TODO (Miguel Pozo): Should be uint2 ? */
It isn't
uint2
because of compatibility with older code. This should become a TODO.@ -121,12 +121,16 @@ void GLVertArray::update_bindings(const GLuint vao,
if (batch->resource_id_buf) {
const ShaderInput *input = interface->attr_get("drw_ResourceID");
int size = 1;
Use
comp_len
orcomponent_len
.size
is generally reserved for size in bytes use_len
suffix for the rest.Try to avoid calling variable just
len
orsize
. They are always size of length of something.Yes, the
Thin
prefix is just a leftover.I used that term because that's the way we were initially refering to them.
The other patch used
Sub
, but IMO thedrw_CustomID
approach makes more sense.So, do you mean that custom handles should always be added to
resource_id_buf
?bea7e1e18a
to242fc6ff92
@ -210,1 +209,3 @@
Material &mat = resources.material_buf.get_or_resize(_handle.resource_index());
uint material_buf_index = material_buf_len++;
Material &mat = resources.material_buf.get_or_resize(material_buf_index);
I think we should add
append_and_get_index
to theStorageVectorBuffer
class. This would remove the need for thematerial_buf_index
.It can be retrieved with
.size()
.This is what I tried at first, but it didn't work correctly with
get_or_resize()
, which I think it's the real issue.Maybe in
.get_or_resize()
we should doitems_len_ = max(items_len_, index)
?@ -210,6 +219,13 @@ GPU_SHADER_CREATE_INFO(draw_resource_id_fallback)
.define("UNIFORM_RESOURCE_ID_NEW")
.vertex_in(15, Type::INT, "drw_ResourceID");
GPU_SHADER_CREATE_INFO(draw_resource_and_custom_id_fallback)
Rename
draw_resource_and_custom_id
todraw_resource_with_custom_id
.@ -220,3 +236,3 @@
* \{ */
GPU_SHADER_CREATE_INFO(draw_modelmat_new)
GPU_SHADER_CREATE_INFO(draw_modelmat_new_common_)
Remove the
_
suffix here.242fc6ff92
to68d46fb6f4
68d46fb6f4
to462da1c87c
WIP: Draw: Thin Handlesto Draw: Custom IDs