Metal: Support for Storage Buffers. #104870
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#104870
Loading…
Reference in New Issue
No description provided.
Delete Branch "(deleted):metal-ssbo"
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?
Adds support for SSBOs to the Metal backend. Also includes small compilation fixes for EEVEE Next shaders which are now compiled under build time testing.
One requirement being explicit address space tagging on reference types pased into functions which write to SSBOs, if an SSBO buffer reference is passed. Previously, all reference types were treated as being within thread address space.
For testing and stability, storage buffer feature flag remains disabled on macOS, however, this can now be toggled in mtl_backend for testing of future work.
Authored by Apple: Michael Parkin-White
Ref #96261
Very minor touch ups required.
@ -37,3 +37,3 @@
BLI_INLINE eParticleRefineShaderType drw_hair_shader_type_get()
{
if (GPU_compute_shader_support() && GPU_shader_storage_buffer_objects_support()) {
/* NOTE: Hair refine is faster using transform feedback via vertex processing pipeline with Metal
I just created #105241 to keep track of this.
@ -74,3 +71,1 @@
out vec4 top,
out vec4 near,
out vec4 far)
DEVICE_OUT(vec4, left),
I would prefer have a return struct instead of this (maybe
ProjectionPlanes
). This is more refactor I would very much avoid these types of defines.@ -90,3 +90,3 @@
}
void frustum_culling_planes_calc(mat4 winmat, mat4 viewmat, out vec4 planes[6])
void frustum_culling_planes_calc(mat4 winmat, mat4 viewmat, DEVICE_OUT_ARRAY(vec4, planes, 6))
Same here
@ -101,3 +101,3 @@
}
vec4 frustum_culling_sphere_calc(vec4 corners[8])
vec4 frustum_culling_sphere_calc(device vec4 corners[8])
Same here. You can use
struct Box
for that matter.@ -22,0 +23,4 @@
* - Argument buffer for bindless resources (e.g. samplers)
* - Transform feedback buffer
* - Default push constant block
* Along with up to 6+1 buffers for vertex data, and index data. */
Does this mean they are also counting towards the limit of
MTL_MAX_BUFFER_BINDINGS
?@ -1180,0 +1226,4 @@
BLI_assert(ssbo_size > 0);
}
else {
MTL_LOG_INFO(
Should be
MTL_LOG_ERROR
. This should mandatory. Same for UBOs.@ -108,0 +116,4 @@
* Default Push constant block for uniforms <-- MTL_uniform_buffer_base_index
* Uniform buffers <-- MTL_uniform_buffer_base_index+1
* Storage buffers <-- MTL_storage_buffer_base_index
* Samplers/argument buffer table <-- last buffer + 1
Why not put all reserved ones first? This would simplify this mapping.
@ -1125,0 +1156,4 @@
template<typename T> T findMSB(T x)
{
/* clz returns the number of leading zeroes. To fetch the index of the LSB, we can also use this
The comment need to be reworked. It mention LSB.
@ -1125,0 +1158,4 @@
{
/* clz returns the number of leading zeroes. To fetch the index of the LSB, we can also use this
* value as index when offset by 1. however need to filter out the case where the input value is
* zero to match GLSL functionality. 000000010*/
Nice
000000010
you got here.@ -1125,0 +1159,4 @@
/* clz returns the number of leading zeroes. To fetch the index of the LSB, we can also use this
* value as index when offset by 1. however need to filter out the case where the input value is
* zero to match GLSL functionality. 000000010*/
return (x == T(0)) ? T(-1) : (clz(T(0)) - clz(x) - T(1));
I think the 0 case here already handled by the logic:
clz(0) - clz(0) - 1 = -1
Also can we make sure that
clz(T(0)) - T(1)
is compiled time constant folded? Or it can be replaced bysizeof(T) * -8 - 1
.@ -16,2 +16,4 @@
#define depth2DArrayShadow sampler2DArrayShadow
/* Memory scope and pass by reference types.
* NOTE: These are required by Metal, but are not required in all cases by GLSL. */
Not sure why this is here. Any GLSL code targeted at Metal should be using
#ifdef GPU_METAL
.Like mentioned in the GLSL files, I would really like to avoid these.
Pull request closed