ninepoints.just regular fiat Profile picture
Nov 10, 2020 14 tweets 2 min read Read on X
For people interested making an engine that supports both Vulkan and D3D12, here's a quick summary of differences you should plan for. I can't comment about any other proprietary APIs (console), but setting yourself up for Vulkan/D3D12 is a decent start for all of them (1/n)
1. Descriptors in Vulkan are strongly typed and are untyped in D3D12. Descriptors in VK refer to buffers, images, samplers and must be provisioned for in a descriptor pool. Descriptors in D3D12 are simply virtual addresses, without type information
2. D3D12 has no concept of "descriptor sets." Instead, you can bind descriptors to particular "register spaces" and you have to manage this grouping yourself.
3. The binding model for D3D12 is more explicit in how you manage the "root signature" (pipeline layout in VK parlance). You assign data to explicit slots instead of letting the API/driver manage that for you
4. Render passes in D3D12 don't have a notion of subpass dependencies, instead you rely on resource transitions to ensure your render targets are in the proper state
5. "Secondary command buffers" in VK are "command list bundles" in D3D12. In VK, they don't inherit state unless executing within a render pass (in which case they inherit subpass and query state). In D12, they more or less inherit all state.
6. VK secondary CBs can operate on the compute/dma queue, but D12 bundles can't (in practice not often important, VK CBs can't inherit state, so why would you want this)
7. VK supports the "timeline semaphore" via extension which mirrors the D3D12 "fence." There is also VkEvent which is a bit harder to use but doesn't require the extension. In general, VK has more of a "zoo" of synchronization primitives. The semaphore is still needed for present
8. Speaking of extensions, VK requires you to chain extension required data using struct chaining and occasionally to query function pointers. D3D12 has you query for the available interface COM-style, and uses inheritance so you don't have to do the chaining yourself
9. Required alignment is somewhat more "hardcoded" in D3D12, with constants provided to specify alignment restrictions for placement/allocation/etc. In VK, you're expected to query this at runtime. Note that this has implications for compile-time code.
10. D3D12 has a concept of "reserved memory" wherein you allocate a virtual address range and page data in and out of VRAM. It also lets you respond to low-memory warning messages this way. VK doesn't have this so you have to do this in other means
11. From an API standpoint, D3D12 resources are modeled via inheritance. Everything is a "resource" and resources have handles, resource usage, etc. VK resources are typed separately.
Probably forgetting a ton of things. Wrote this in ~10 minutes in sort of a blur. Feel free to comment to fill in the (inevitable gaps). Also, note that I tried not to comment on which API I "preferred." Honestly, strengths and weaknesses in both APIs imo.
Note that there are a lot of differences that are just naming things, so not as disruptive when it comes to implementation. It can be hard to know what to look for sometimes though. For example, ROVs (rasterizer order views) in D3D12 is VK_EXT_fragment_shader_interlock in VK

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with ninepoints.just regular fiat

ninepoints.just regular fiat Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @m_ninepoints

Feb 27, 2022
With all the discussion on the STL, I wanted to make a quick thread to summarize the main reasons why many AAA studios (correctly) opt out of the STL. This isn't to say the STL isn't for *anyone*, but the reasons to avoid using it aren't unfounded either 1/🧵
The STL implementation varies depending on platform/compiler choice. This seems like a small matter, but sometimes we *need* the functions to behave in a controlled manner across all platforms. 2/n
Consistent behavior means similar execution order, deterministic results in scenarios where determinism matters, and even a consistent ABI you can rely on to share code between compatible platforms. 3/n
Read 15 tweets
Feb 27, 2022
When we dubbed "order-independent transparency" as such, we really missed the opportunity to name it "farraginous blending" or something (/s)
Dual-source blending could have been "biparous blending".
Supersampling is actually eellogofusciouhipoppokunurious sampling
Read 4 tweets
Apr 19, 2021
I see a lot of C++ hatemail in my twitter timeline, but before you go "all-in" on Rust, do your due diligence and consider the following things:
Does your job have a lot of specialized low level data structures with self referential pointers/refs? Well, you can't port this to Rust reasonably at all. The language *assumes* that types move destructively. It's a great default, but you can't turn it off.
Do you rely on shared linkage to either save disk space, distribute binaries internally, or hot-reload code? Well make sure you're ok to restricting the library interfaces to the C ABI only. Rust compiler versions are not ABI compatible with each other
Read 8 tweets
Jan 14, 2020
0/n) How to stay up-to-date with math as a working programmer (been asked this a bit after the last thread on learning graphics programming)
1/n) There are a few foundational tasks that I think engineers involved with computation/numerical work need to just *know* on any given day of the year, so if these techniques are a bit rusty, I would start here. These techniques are ...
2/n) Taking a derivative of any polynomial and all common transcendental functions (things to just *know* #1)
Read 18 tweets
Jan 10, 2020
0/n) How to learn graphics programming (but not in a hurry): self-study edition! This thread is highly opinionated, and not what I went through (technology changes), but what I would recommend today. You don't need all of the following to get a job...
but just start the path and continue learning and learning. Interview earlier than you think you're qualified and listen to feedback. Learning on a job is a lot easier than learning on the side.
1/n) Don't use any commercial engine or framework to start. There's far too much "magic" involved that will prevent you from understanding what's going on. You can always reference them or use them later.
Read 20 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(