BradLarson / GPUImage3

GPUImage 3 is a BSD-licensed Swift framework for GPU-accelerated video and image processing using Metal.
BSD 3-Clause "New" or "Revised" License
2.73k stars 342 forks source link

GPUImage3 podspec not provided. #35

Closed evanxlh closed 5 years ago

evanxlh commented 5 years ago

When I created a Metal.framework based render pod library, the .metal files include other custom .h files. Then I pod lib lint, it reports error: metal_stdlib not found. So I don't know how GPUImage3 handle the problem I encountered.

Here is my sample project: https://github.com/MrEndlesswhy/DeviceOnlyMetalPod

Many thanks!

BradLarson commented 5 years ago

Unfortunately, I can't see the linked project, and I don't fully understand the question asked. I don't use CocoaPods myself, so I don't know much about the process.

evanxlh commented 5 years ago

@BradLarson I've already found a solution, thank you. I'm sorry the link is invalid. For example, in OperationShaderTypes header file, I added #if __METAL_MACOS__ || __METAL_IOS__ to wrap shader header file, it's ok.

#if __METAL_MACOS__ || __METAL_IOS__

#include <metal_stdlib>

using namespace metal;

// Luminance Constants
constant half3 luminanceWeighting = half3(0.2125, 0.7154, 0.0721);  // Values from "Graphics Shaders: Theory and Practice" by Bailey and Cunningham

struct SingleInputVertexIO
{
    float4 position [[position]];
    float2 textureCoordinate [[user(texturecoord)]];
};

struct TwoInputVertexIO
{
    float4 position [[position]];
    float2 textureCoordinate [[user(texturecoord)]];
    float2 textureCoordinate2 [[user(texturecoord2)]];
};

#endif /* __METAL_MACOS__ || __METAL_IOS__ */
BradLarson commented 5 years ago

Oh, OK. It was automatically trying to compile the header files independently of Metal. I wonder if there is a way to prevent that aside from the ifdefs.