Hot answers tagged

23

Metal and Vulkan are low-level 3D graphics APIs, in much the same way that OpenGL and Direct3D are 3D graphics APIs. Metal is Apple's API, usable on iOS and MacOS. Vulkan was developed by the Khronos Group, who also oversees the various forms of OpenGL. Vulkan is directly usable on all non-Apple platforms, and there is the MoltenVK project which provides a ...


6

You do it by abstracting away the underlying technology. You know, for example, at a very high level that you'll need to work with images, geometry, and I'm guessing you'll have to write shaders to do your rendering. The textures and geometry can be in the same format for both systems. So from that, you can design an interface for rendering. You'll probably ...


5

The “blend factors” are the amount that the specified component is multiplied by while blending. “Destination” is the existing content that’s being blended “on top of”, while “source” is the new content that’s being blended “onto” it. When the blend operation is set to “add”, the final pixel value is calculated like this: value = source * sourceBlendFactor + ...


4

Most mobile GPUs use tiled rendering, which can make MSAA surprisingly cheap relative to desktop GPUs. If the app is doing simple forward rendering without filtering/blurring passes, the GPU may be able to do MSAA rasterization and resolve directly on chip (per tile) without ever storing the MSAA samples out to memory. This may make MSAA both faster and less ...


4

There's nothing like frame capture for OpenGL on macOS, unfortunately. But there are 2 other tools that are useful for GL debugging: OpenGL Profiler and OpenGL Driver Monitor. You can read about them here. (Warning the images in the article are really old. They look like normal apps today without all the brushed metal, etc.) To download them, you need to log ...


4

This is a similar question to following: When do you need to cook? You can go to a restaurant. Why would you need to know woodworking? You can buy things from a shop. There are two answers here In order for you to claim ownership on some tech. You need to build it. This can be simply because you have chosen to sell a competing product or need to lower your ...


2

I think you're seeing cache effects. The GPU will begin vertex processing for each strip in sequential order, and in configuration 1 the GPU will fetch a different chunk of memory for each triangle in the strip (since, as you said, the strips themselves are not contiguous in memory in this configuration). If I understand correctly, each entry in the ring ...


2

The float2 type in the Metal structure requires an alignment of 8 bytes. The stride of the struct then becomes 24 so every value is aligned properly if you use it in an array. Your Swift structure only uses float which requires an alignment of 4 bytes, and an overall stride of 20. This presentation by Apple goes into some detail (starting at 30:20 of the ...


2

You havent' set the mipFilter property for your samplerDescriptor. The default value for mipFilter is notMipped which means the sampler will never access anything other than level 0. Set it to nearest or linear.


2

Kinda late on reply, but I'm still gonna post it here for future searches. Since all (or many, I'm not sure) macs use Intel GPUs you can use Intel Analyzers. It isn't much, but still got frame capture, texture browser etc. and helps debug many errors.


2

It's important to understand that "anti-aliasing" techniques like FXAA were invented mainly to deal with the fact that standard methods like multisampling do not work well at all in deferred rendering situations. In order to do MSAA in a deferred renderer, you would need to have all of your G-buffers be multisampled, which dramatically increases the size of ...


2

I've seen no answer to my question. But after lots of experimentation and further study of Apple documentation for clues I have figured out how to capture GPU generated frames. First, I gave up on the attempt to have the shader write to the screen and an offscreen buffer in the same render pass. The odd (and undocumented as far as I can tell) behavior of ...


2

float3 in Metal Shading Language has the same size/alignment as float4, i.e. 16 bytes. I think your original code would have worked using packed_float3 (12 bytes) in the vertex shader.


1

http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.htm - here is reference with different geometry shading equations http://jcgt.org/published/0003/02/03/paper.pdf - paper explaining how G term works and on what assumptions it is build. Looking again at your code, I'm not sure (based on first link to Karis blog) if your G term is calculated ...


1

I don't know what Apple have done with Metal per se, but as the iOS devices have PowerVR-derived GPUs, normally I would think that doing as much opaque-only drawing "up front" would usually be beneficial, but if, as in your case, only 5% of the screen is covered by opaque geometry, I'm not sure how much the software overhead will affect things. The reason ...


1

Terminology The source color is the value written by the fragment/pixel shader. The destination color is the color from the image currently in the frame buffer (that will be overridden). Additive blending // The blend formula is defined as: // (source.rgb * sourceRGBBlendFactor ) rgbBlendOperation (destination.rgb * destinationRGBBlendFactor ) // (...


1

This is more a comment than an answer, but since I'm new here with no reputation, I can't comment. I was trying to use your method 2 to read a metal texture (having hit problems with your other methods, too, as well as half a dozen other methods from other threads). I used a .waitUntilCompleted method, so figured my problem didn't have to deal with ...


1

maybe you forget to call MTLBlitCommandEncoder.synchronizeTexture to sync VRAM to system memory. please check: https://forums.developer.apple.com/thread/30488 and document: https://developer.apple.com/documentation/metal/mtlblitcommandencoder/1400757-synchronize


Only top voted, non community-wiki answers of a minimum length are eligible