Skip to main content
24 votes

What are Metal and Vulkan?

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 ...
Nicol Bolas's user avatar
  • 9,932
6 votes
Accepted

How do you design the code of a graphics engine to target multiple frameworks

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 ...
user1118321's user avatar
  • 3,441
5 votes

How to perform additive blending in Metal. What do these terms mean?

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 ...
Noah Witherspoon's user avatar
4 votes

FXAA vs MSAA on modern hardware

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 ...
Nathan Reed's user avatar
  • 25.2k
4 votes
Accepted

When do people need to work directly with a graphical API (eg: Direct3D) instead of using already made software?

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 ...
joojaa's user avatar
  • 8,447
4 votes

Debugging tools for OpenGL on macOS

UPD: Intel GPA dropped macOS support for some reason. Intel GPA Metal support page says Metal is not supported too, maybe that was before they dropped macOS version completely. If you're lucky you can ...
Max Philippov's user avatar
4 votes
Accepted

Debugging tools for OpenGL on macOS

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 ...
user1118321's user avatar
  • 3,441
4 votes

Passing parameters in Metal Compute Kernel using Swift 4

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 ...
MemoryStomp's user avatar
3 votes
Accepted

Is it possible to fill in Stencil Buffer programmatically via fragment shader?

There are a few confusing statements in your question. However, I'll still assume you're largely aware of how the stencil buffer and the stencil test actually work. I'll also talk about OpenGL, based ...
Christian Rau's user avatar
2 votes

Same draw call causing extremely different GPU usage under different triangle orders

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 ...
John Calsbeek's user avatar
2 votes

Mipmap sampler in Metal compute kernel (not vertex or fragment shader)

You havent' set the mipFilter property for your samplerDescriptor. The default value for ...
GroverManheim's user avatar
2 votes

FXAA vs MSAA on modern hardware

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 ...
Nicol Bolas's user avatar
  • 9,932
2 votes

How to capture frames in a MacOS MTKView for recording to a video

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 ...
Richard Stover's user avatar
2 votes
Accepted

Are stencil buffer dimensions required to match render target dimensions?

When the framebuffer attachment sizes differ, rendering will only happen to the smallest size supported by all attachments (i.e. a rectangle of minimal width & height among all the attachments). ...
lisyarus's user avatar
  • 225
2 votes
Accepted

Metal API clips all primitives?

float3 in Metal Shading Language has the same size/alignment as float4, i.e. 16 bytes. I think your original code would have ...
Noah Witherspoon's user avatar
1 vote

Ray Tracing, why does the GGX make my rendering result darker and darker for each frame?

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 ...
DirectX_Programmer's user avatar
1 vote

Are the benefits of a Metal early depth test limited to one draw call

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 ...
Simon F's user avatar
  • 4,306
1 vote

How to perform additive blending in Metal. What do these terms mean?

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 ...
Matthias's user avatar
  • 1,084
1 vote

MTLTexture getBytes returning blank image

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 ...
Scott Heeschen's user avatar
1 vote

MTLTexture getBytes returning blank image

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....
andrewchan2022's user avatar

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