Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

writes texture (varianceMap[4]) whose usage (0x01) doesn't specify MTLTextureUsageShaderWrite (0x02) #4

Open
ukman opened this issue Jan 23, 2018 · 2 comments

Comments

@ukman
Copy link

ukman commented Jan 23, 2018

I started the app and I fixed the problem #3 but now I have the following error:

validateComputeFunctionArguments:860: failed assertion `Compute Function(haarCascadePixelParallelFromTexture): writes texture (varianceMap[4]) whose usage (0x01) doesn't specify MTLTextureUsageShaderWrite (0x02)'

It occurs in line https://github.com/christopherhelf/iOS-Metal-HaarCascade/blob/master/iOS-HaarCascade-Improved/MetalComputeShader.swift#L174

@christopherhelf
Copy link
Owner

That requirement is new as well: for textures that are written into/read from, you need to specify the usage flags in the MTLTextureDescriptor object that is used to create the texture like

descriptor.usage = [.shaderRead, .shaderWrite]

@YongilChoi
Copy link

             let outputTextureDescriptor = MTLTextureDescriptor.texture2DDescriptor(pixelFormat: .rgba8Unorm,
                                                                                           width: inputTexture.width,
                                                                                           height: inputTexture.height,
                                                                                           mipmapped: false)
                    outputTextureDescriptor.usage = [.shaderRead, .shaderWrite]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants