Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/metal/mtl_backend.mm
| Show First 20 Lines • Show All 392 Lines • ▼ Show 20 Lines | void MTLBackend::capabilities_init(MTLContext *ctx) | ||||
| /* Feature support */ | /* Feature support */ | ||||
| GCaps.mem_stats_support = false; | GCaps.mem_stats_support = false; | ||||
| GCaps.shader_image_load_store_support = ([device supportsFamily:MTLGPUFamilyApple3] || | GCaps.shader_image_load_store_support = ([device supportsFamily:MTLGPUFamilyApple3] || | ||||
| MTLBackend::capabilities.supports_family_mac1 || | MTLBackend::capabilities.supports_family_mac1 || | ||||
| MTLBackend::capabilities.supports_family_mac2); | MTLBackend::capabilities.supports_family_mac2); | ||||
| /* TODO(Metal): Add support? */ | /* TODO(Metal): Add support? */ | ||||
| GCaps.shader_draw_parameters_support = false; | GCaps.shader_draw_parameters_support = false; | ||||
| GCaps.compute_shader_support = false; /* TODO(Metal): Add compute support. */ | GCaps.compute_shader_support = true; | ||||
| GCaps.geometry_shader_support = false; | GCaps.geometry_shader_support = false; | ||||
| GCaps.shader_storage_buffer_objects_support = | GCaps.shader_storage_buffer_objects_support = | ||||
| false; /* TODO(Metal): implement Storage Buffer support. */ | false; /* TODO(Metal): implement Storage Buffer support. */ | ||||
| /* Maximum buffer bindings: 31. Consider required slot for uniforms/UBOs/Vertex attributes. | /* Maximum buffer bindings: 31. Consider required slot for uniforms/UBOs/Vertex attributes. | ||||
| * Can use argument buffers if a higher limit is required. */ | * Can use argument buffers if a higher limit is required. */ | ||||
| GCaps.max_shader_storage_buffer_bindings = 24; | GCaps.max_shader_storage_buffer_bindings = 24; | ||||
| Show All 27 Lines | void MTLBackend::capabilities_init(MTLContext *ctx) | ||||
| /* Metal related workarounds. */ | /* Metal related workarounds. */ | ||||
| /* Minimum per-vertex stride is 4 bytes in Metal. | /* Minimum per-vertex stride is 4 bytes in Metal. | ||||
| * A bound vertex buffer must contribute at least 4 bytes per vertex. */ | * A bound vertex buffer must contribute at least 4 bytes per vertex. */ | ||||
| GCaps.minimum_per_vertex_stride = 4; | GCaps.minimum_per_vertex_stride = 4; | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | |||||
| /** \name Compute dispatch. | |||||
| * \{ */ | |||||
| void MTLBackend::compute_dispatch(int groups_x_len, int groups_y_len, int groups_z_len) | |||||
| { | |||||
| /* Fetch Context. | |||||
| * With Metal, workload submission and resource management occurs within the context. | |||||
| * Call compute dispatch on valid context. */ | |||||
| MTLContext *ctx = MTLContext::get(); | |||||
| BLI_assert(ctx != nullptr); | |||||
| if (ctx) { | |||||
| ctx->compute_dispatch(groups_x_len, groups_y_len, groups_z_len); | |||||
| } | |||||
| } | |||||
| /** \} */ | |||||
| } // blender::gpu | } // blender::gpu | ||||