Post

Replies

Boosts

Views

Activity

Draw something to CAMetalLayer cause it shows all red
I am writing something about video decoding. Now I have met some problems on darwin. First init the layer and bind it to a view CAMetalLayer *layer = [[CAMetalLayer alloc] init]; layer.device = MTLCreateSystemDefaultDevice(); layer.pixelFormat = MTLPixelFormatBGRA8Unorm; layer.drawableSize = self.view.frame.size; layer.contentsGravity = kCAGravityCenter; self.view.wantsLayer = YES; self.view.layer = layer; next when the video decoded frame coming, id <CAMetalDrawable> drawable = [metal_layer_ nextDrawable]; if (!drawable) { return; } id <MTLTexture> texture = [drawable texture]; IOSurfaceRef surface = [texture iosurface]; void *base_address = IOSurfaceGetBaseAddress(surface); int pitch[] = {(int) (IOSurfaceGetBytesPerRow(surface)), 0}; uint8_t *pixels[] = {static_cast<uint8_t *>(base_address), nullptr}; fn(pixels, pitch); // Which is ffmpeg swscale. [drawable present]; This does not work at all, the whole screen is red and would never change while new frame is coming. And I tried another way to present the video frame. It is still red. Is there any thing wrong or missed.
1
0
1.4k
Mar ’23
Dylib with bitcode missing
Hi there, Currently we are developing a dynamic library written in C++, target to run on arm64 ios. Things become wired when we try to archive the final project. It says, bitcode bundle could not be generated because 'the_path_to.dylib' was built without full bitcode. Some brief arch of this project lists below, we use cmake and this toolchain to build this dylib. It has an argument named ENABLE_BITCODE. It would append -fembed-bitcode to C_FLAGS & CXX_FLAGS. BTW, we use clang & clang++ as C and C++ compiler. this dylib has several dependencies, such as libcurl, libffi. We download them from vcpkg then build with bitcode enabled. As mentioned above, running it directly on the phone works as we expected. But we can't archive it. using otool -l the_path_to.dylib | grep bitcode shows nothing. We still want to make it support bitcode feature. Is there anything we miss to do to enable this? About bitcode, is there anything to learn? Is there an accurate way to find out that the dylib support bitcode or not? Thanks in advance.
0
0
816
Dec ’21
Draw something to CAMetalLayer cause it shows all red
I am writing something about video decoding. Now I have met some problems on darwin. First init the layer and bind it to a view CAMetalLayer *layer = [[CAMetalLayer alloc] init]; layer.device = MTLCreateSystemDefaultDevice(); layer.pixelFormat = MTLPixelFormatBGRA8Unorm; layer.drawableSize = self.view.frame.size; layer.contentsGravity = kCAGravityCenter; self.view.wantsLayer = YES; self.view.layer = layer; next when the video decoded frame coming, id <CAMetalDrawable> drawable = [metal_layer_ nextDrawable]; if (!drawable) { return; } id <MTLTexture> texture = [drawable texture]; IOSurfaceRef surface = [texture iosurface]; void *base_address = IOSurfaceGetBaseAddress(surface); int pitch[] = {(int) (IOSurfaceGetBytesPerRow(surface)), 0}; uint8_t *pixels[] = {static_cast<uint8_t *>(base_address), nullptr}; fn(pixels, pitch); // Which is ffmpeg swscale. [drawable present]; This does not work at all, the whole screen is red and would never change while new frame is coming. And I tried another way to present the video frame. It is still red. Is there any thing wrong or missed.
Replies
1
Boosts
0
Views
1.4k
Activity
Mar ’23
Dylib with bitcode missing
Hi there, Currently we are developing a dynamic library written in C++, target to run on arm64 ios. Things become wired when we try to archive the final project. It says, bitcode bundle could not be generated because 'the_path_to.dylib' was built without full bitcode. Some brief arch of this project lists below, we use cmake and this toolchain to build this dylib. It has an argument named ENABLE_BITCODE. It would append -fembed-bitcode to C_FLAGS & CXX_FLAGS. BTW, we use clang & clang++ as C and C++ compiler. this dylib has several dependencies, such as libcurl, libffi. We download them from vcpkg then build with bitcode enabled. As mentioned above, running it directly on the phone works as we expected. But we can't archive it. using otool -l the_path_to.dylib | grep bitcode shows nothing. We still want to make it support bitcode feature. Is there anything we miss to do to enable this? About bitcode, is there anything to learn? Is there an accurate way to find out that the dylib support bitcode or not? Thanks in advance.
Replies
0
Boosts
0
Views
816
Activity
Dec ’21