metal

Add dynamically SKLabelNode to MKTVIew

岁酱吖の 提交于 2020-04-30 07:13:29
问题 I am working on metal view that shows the heart rate graph. between every peak of this graph, I need to add a label. In this process, chart moving from right to left I have an array that dynamically shows the x coordinate of this label for example when one value should show in the screen, this array contain only element and if there are more, it contain more element, this array is named coordinates I use a for loop to get every element for coordinate in coordinates { } I also have another

SpriteKit/Metal memory leak with nothing happening

夙愿已清 提交于 2020-03-21 20:29:35
问题 I have a memory leak that I can't seem to trace. Instruments sees it, and reports it as jet_buffer_Metal, but I don't know what that is pointing me to specifically. It happens regularly. I have tried everything. Removing all my nodes, removing physicsBodies, but it still seems to be there. I don't have anything in Update or any other of the game cycle methods. I can post all that code there, but really I only add two nodes, that can only move on touch. I don't touch the screen, and the memory

How can I get rid of blurry textures in Metal?

蹲街弑〆低调 提交于 2020-03-21 10:55:28
问题 I just created a Metal template and changed up the code a little. I switched out the default colormap with the Minecraft 16x16 lapis ore texture, but for some reason they are blurred out when they are low resolution. I am trying to achieve that pixelated, Minecraft look and so would like to know how to disable this blurring/filtering. Is there a way to load/present assets without this blurring? Here is my load asset function: class func loadTexture(device: MTLDevice, textureName: String)

Using multiple render pipelines in a single MTLRenderCommandEncoder: How to Synchronize MTLBuffer?

孤人 提交于 2020-02-23 10:34:47
问题 Central Issue I have two render pipelines in one single render command encoder. The first pipeline writes to a buffer which is used in the second pipeline. This does not seem to work and I expect it to be a synchronization problem. When I use one separate render command encoder for each render pipeline I get the desired result. Can this be solved with one single render command encoder or do I need two separate encoders to synchronize the buffer? Here is the more specific case: The first

Metal: vertexFunction defined in .metal file becomes nil once setting Compiler and Linker Options for MSL cikernel

亡梦爱人 提交于 2020-02-23 07:14:48
问题 VertexFunction and FragmentFunction defined in .metal file worked nicely, but they became nil once I specified Compiler and Linker Options following Apple's doc: -fcikernel flag in the Other Metal Compiler Flags option, and -cikernel flat in MTLLINKER_FLAGS in User-Defined setting. I need the settings above for cikernel with MSL (metal shading language). Indeed, cikernel with Core Image Kernel Language deprecated in 12.0. How could I use both vertex/fragment Metal shader and MSL cikernel

Why my MTKview is drawn like if there is a dark overlay on the top of it?

梦想与她 提交于 2020-02-21 06:49:04
问题 I'm under macOS and I create an MTKView , and I set this MTKView as a subview of the ContentView of my NSWindow . when I'm inside my MTKView.drawRect method and when I call NSView(Super).getRectsBeingDrawn it returns me nothing! why? But my main problem is that the MTKView is drawn darker (like there is something darker on the top of it) I must have something like this instead: Any idea what can cause this darker effect? 来源: https://stackoverflow.com/questions/60057910/why-my-mtkview-is-drawn

Which are the right Matrix Values to use in a metal shader passed by a SCNProgram to get a correct chrome like reflection

核能气质少年 提交于 2020-02-04 01:46:09
问题 I am working on an App, that should render a chrome-style reflective sphere-like object inside a skybox (using a six faced cube map). I am doing this in Swift using Scenekit with different approaches. Everything is fine and perfectly reflected (see Figure 1 below) as long as I let Scenekit doing all the work - in other words, using a standard SCNMaterial with metalness 1.0, roughness 0.0 and color UIColor.white (using .physicallyBased as lighting model) attached to the firstMaterial of the

issues in Apple Metal API “setVertexBuffer:offset:atIndex:”

风流意气都作罢 提交于 2020-01-24 22:00:46
问题 I am new in Apple Metal, when running the apple sample code "Creating and Sampling Textures", I fond something strange, " Figure 1 " is the result in my Macmini 2018 (the GPU is Intel(R) UHD Graphics 630) , you can see the quad's left bottom corner is squeezed, the origin source use setVertexBuffer:offset:atIndex: to set vertex buffer, I replace it to setVertexBytes:length:atIndex: and run, the result show as " Figure 2 ", it seems everything going fine, then I build and run the origin source

issues in Apple Metal API “setVertexBuffer:offset:atIndex:”

喜夏-厌秋 提交于 2020-01-24 22:00:06
问题 I am new in Apple Metal, when running the apple sample code "Creating and Sampling Textures", I fond something strange, " Figure 1 " is the result in my Macmini 2018 (the GPU is Intel(R) UHD Graphics 630) , you can see the quad's left bottom corner is squeezed, the origin source use setVertexBuffer:offset:atIndex: to set vertex buffer, I replace it to setVertexBytes:length:atIndex: and run, the result show as " Figure 2 ", it seems everything going fine, then I build and run the origin source

MTKView texture correct color build-up

我与影子孤独终老i 提交于 2020-01-24 01:03:30
问题 I am working on a metal-backed drawing application where brushstrokes are drawn on an MTKView by stamping a textured square repeatedly along a path. I am having color-accumulation issues as illustrated with the picture below: For alpha values [0.5 - 1.0] the results are more or less what I expect. However, for small alpha values, the result looks patchy and never achieves the uniform/correctly saturated value of the original fully opaque brush color (i.e. like the top brushstroke in above