Posts

Post not yet marked as solved
2 Replies
221 Views
XPC connection keeps getting interrupted. I'm creating an xpc endpoint in FxPlug plugin for FCP X using xpc_endpoint_create. This endpoint is then passed to a helper mach service running in the background and stored there. Next, our main application is launched and retrieves the stored endpoint from the helper service. It creates the communication channel using xpc_connection_create_from_endpoint The main application communicates with FxPlug plugin using that endpoint. It all works well when I am debugging either our application or FxPlug. The moment I use the release build on both, the connection works fine for a while but is very quickly interrupted (usually 2-10 seconds), FxPlug plugin gets flagged as non-responsive and is unloaded by FCP X. This behavior is erratic and may cease after some time on some machines. We've been working on this and some other issues with FxPlug team for months and some changes have been made, but we're stuck with that one last bit. I want to stress the following: when I use a debug version of either plugin or our app, everything works fine, fxplug is never unloaded or marked as unresponsive, the connection is stable. When both components are using release builds, it all comes apart for no apparent reason. Both plugin and application can normally recover and reconnect after being unloaded and restored. Any thoughts on why an xpc connection would be interrupted in this way?
Posted
by BartW.
Last updated
.
Post marked as solved
3 Replies
509 Views
I have a question about texture3d sampling on M1. I create a 3D texture from 33x33x33 buffer: Objective-C idMTLTexture tex = [device newTextureWithDescriptor:texDescriptor]; [tex replaceRegion:MTLRegionMake3D( 0, 0, 0, 33, 33, 33 )       mipmapLevel:0             slice:0         withBytes:GetRawBuffer()       bytesPerRow:sizeof(vector_float4) * 33     bytesPerImage:sizeof(vector_float4) * 33 * 33)]; It is then of course passed to my Metal compute kernel and then I sample it: metal float4 apply3DLut(const float4 pixel,                  const float3 coords,                   texture3dfloat, access::sample lut) {     constexpr sampler smp (mag_filter::linear, min_filter::linear);     float4 out = float4( lut.sample(smp, pixel.rgb) );     return float4( out.rgb, pixel.a ); } This code worked fine on Intel, but on M1 the sampling seems to always return 0.0f, no matter where I sample, as if the texture was not created or sampling didn't work.
Posted
by BartW.
Last updated
.
Post marked as solved
2 Replies
484 Views
I have the following piece of code: swift extension MTLTexture { public var cgImage: CGImage? { let ctx = CIContext(mtlDevice: self.device) let options: [CIImageOption: Any] = [CIImageOption.colorSpace: CGColorSpace.linearSRGB] guard let image = CIImage(mtlTexture: self, options: options) else { print("CIImage not created") return nil } guard let imageSrgb = image.matchedToWorkingSpace(from: CGColorSpace(name: CGColorSpace.linearSRGB)!) else { print("CIImage not converted to srgb") return nil } let flipped = imageSrgb.transformed(by: CGAffineTransform(scaleX: 1, y: -1)) return ctx.createCGImage(flipped, from: flipped.extent) } } This code crashes on line 14 with EXC_BAD_ACCESS code 1 without additional calls. However, when I set options to nil in CIImage call on line 5, it renders fine. FWIW, there's no change if I remove lines 9-13 and call createCGImage straight from image. It also crashes, if I instantiate the context without the device: return CIContext().createCGImage(...) What am I missing?
Posted
by BartW.
Last updated
.
Post not yet marked as solved
2 Replies
586 Views
Hi all, I don't understand the error: validateFunctionArguments:3487: failed assertion `Fragment Function(MyFunction): Bytes are being bound at index 0 to a shader argument with write access enabled. Does this error pertain to textures or to buffers? What am I doing wrong: // set input texture [commandEncoder setFragmentTexture:srcTexture &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; atIndex:0]; // set params [commandEncoder setFragmentBytes:&params &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;length:sizeof(params) &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; atIndex:0]; [commandEncoder drawPrimitives:MTLPrimitiveTypeTriangleStrip &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; vertexStart:0 &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; vertexCount:4]; The shader function header looks like this: fragment float4 MyFunction(RasterizerData in [[ stage_in ]], device MyParams& params [[ buffer (0) ]], texture2d<half, access::sample> src [[ texture(0) ]]) MyParams is a struct of several floats and simd_float4 (because it seems that I can't use metal's float4 in a C++/Objective-C file. Texture has RenderTarget, ShaderRead and ShaderWrite usage. Note, that this code seems to have worked in another project, but here it throws this error. Any help appreciated.
Posted
by BartW.
Last updated
.
Post marked as solved
2 Replies
538 Views
Hello, I have a following problem. I define an Objective-C interface as such: objective-c extern @interface CGRenderOptions : NSObject (id _Nonnull) init; (void)makeInputTransform:(NSString* _Nullable)transform; (void)makeOutputTransform:(NSString* _Nullable)transform; @property(assign) BOOL ColorManaged; @property(assign) CGBypassOption Bypass; @property(assign) BOOL FalseColor; @property(assign) MTLSize* _Nullable OutputSize; @property(assign) NSString* _Nullable InputTransform; @property(assign) NSString* _Nullable OutputTransform; @property(assign) NSString* _Nullable WatermarkString; @end This header is then imported to a Swift library and the following items are not visible: InputTransform, OutputTransform, makeInputTransform and makeOutputTransform. These were added recently, so I thought it's an issue with build and compilation, but I cleaned all the build folders, and I still can't get it to work. Any ideas?
Posted
by BartW.
Last updated
.
Post marked as solved
4 Replies
717 Views
Hi everyone, I have an executable that handles NSXPC connectivity between apps that I'm installing, and I would like to install it as a launch daemon. I can do this locally with ease by sudo adding the .plist file to /Library/LaunchDaemons/, but when I tried to do this as part of the installation process, the installer complains about lack of permissions, despite me using su in the post install script: &#9;/usr/bin/su - ${loc_user} -c "cp ${plist_path} ${plist_target}" &#9;/usr/bin/su - ${loc_user} -c "chown root:wheel ${plist_target}" &#9;/usr/bin/su - ${loc_user} -c "chmod 644 ${plist_target}" Is there a best practice when it comes to these services? Currently the plist file and the executable are part of a framework that I am installing. Thanks!
Posted
by BartW.
Last updated
.