Questions tagged [metal]
Metal is a proprietary framework for GPU-accelerated advanced 3D graphics rendering and data-parallel computation workloads. Made by Apple.
2,243
questions
1
vote
0
answers
45
views
Performant alternative to scaling a CIImage / PixelBuffer
I’m building a camera app where I am applying real time effects to the view finder. One of those effects is a variable blur, so to improve performance I am scaling down the input image using CIFilter....
0
votes
1
answer
14
views
MTLBuffer didModifyRange not required
I think the MTLBuffer method didModifyRange is not required on my computer (late 2013 macbook, IntelHD4000 graphics card). Why is this the case? In what cases will it be required?
Is it because this ...
1
vote
0
answers
47
views
How to return a pointer containing data from Swift to C
I am writing a program in Swift that does computation on the GPU. Below is the code that generates a random matrix using Metal performance shaders:
func randomMatrix(
rows: Int,
columns: Int,
...
1
vote
1
answer
65
views
Best way to create a MTLTexture from a CVPixelBuffer for real-time processing
I'm trying to process video frames in real-time using AVFoundation's AVCaptureDevice but having trouble getting a "clean" MTLTexture from a CVPixelBuffer. AVPlayer buffers do not seem to ...
-1
votes
1
answer
25
views
When debug metal app connected by ipad in xcode, There is some logs about Cache data printed on xcode console, why?
When run metal app connected by ipad in xcode, the console printed the log of "Cache loaded with 5598 pre-cached in CacheData and 56 items in CacheExtra.", How can I disable these logs?
0
votes
0
answers
26
views
SwiftUI with Metal synchronize issue
I am writing a SwiftUI with Metal project on macOS, and that drawing the screen capture on external monitor with renderer in SwiftUI. I uses triple buffering with semaphore for synchronizing the CPU ...
1
vote
1
answer
49
views
What is the info property of SwiftUI::Layer
What is the info property of SwiftUI::Layer?
I couldn't find any document or resource about it.
It appears in SwiftUI::Layer's definition:
struct Layer {
metal::texture2d<half> tex;
float2 ...
0
votes
0
answers
15
views
How do I detect when the user dismisses an ImmersiveSpace that uses CompositorServices to render with Metal
I want my app to know that the immersive space is no longer open, so that other UI can be updated accordingly.
I have tried using ‘.onChange(of: scenePhase)’ on the ‘ImmersiveSpace’ to detect changes ...
0
votes
2
answers
36
views
What is a "_status < MTLCommandBufferStatusCommitted" assertion failure?
I'm using Metal to execute a compute kernel, but I'm receiving the following error:
failed assertion _status < MTLCommandBufferStatusCommitted at line 316 in -[IOGPUMetalCommandBuffer ...
1
vote
1
answer
57
views
Performing a reduce operation with Metal
The Metal Shading Language Specification (PDF) includes a piece of sample code for performing a parallelized reduction (specifically, a summation) over an input array:
#error /!\ READER BEWARE - ...
0
votes
1
answer
32
views
Error loading default Metal library for command line Swift tool
The Metal framework function MTLLibrary.makeDefaultLibrary() loads "your app’s default Metal library." However, it doesn't specify where it finds this default library.
When I build an ...
0
votes
0
answers
28
views
Metal Texture with Overlay comes in Green
I am trying to use Metal to overlay two textures together. The base layer is from the camera a CMSampleBuffer in 420f format and the secondary is a texture generated from a UIImage with no background ...
0
votes
0
answers
28
views
Why do I get a “Texture usage flags mismatch” shader validation error when declaring an imageblock in a compute pass?
Suppose I want to draw a red rectangle onto my render target using a compute shader.
id<MTLComputeCommandEncoder> encoder = [commandBuffer computeCommandEncoder];
[encoder ...
0
votes
0
answers
59
views
Use os_log_default in Metal
I want to do logging from a .metal file.
From the specification:
Metal defines the logging functions and types in <metal_logging>. To enable logging, you need to set -fmetal-enable-logging (see ...
0
votes
0
answers
72
views
Unexpected results from Metal computing
EDIT:
In the comment below, pmdj pointed out 2 bugs in my code.
For clarity, I will not copy all the code and output buffer contents. Instead I modified both and left the originals as comments.
...