Skip to main content
16 votes

What's the main difference of pipeline process between Vulkan and DX12?

D3D12 has 4 separate kinds of command lists: direct, bundle, compute, and copy. Vulkan has similar concepts, but they happen in a different way. Command buffers are allocated from command pools. And ...
Nicol Bolas's user avatar
  • 9,997
7 votes
Accepted

What mechanisms are being used by Directx12 and Vulkan APIs in order to communicate with graphic card drivers internally?

It's very different between the Khronos standards (including Vulkan) and DirectX. In DirectX, Microsoft implements the API, but they publish to GPU vendors a HAL API. There's actually two HALs: one ...
Dan Hulme's user avatar
  • 6,880
5 votes
Accepted

How much does driver quality affect Vulkan and DX12 compared to OpenGL and DX11?

TL;DR: There's some room for optimization in Vulkan drivers, but not nearly to the degree that there is in GL / DX11 drivers. how much do drivers affect performance? It depends a great deal on ...
Jherico's user avatar
  • 556
4 votes
Accepted

mipmap selection process

Mipmap selection is done by looking at adjacent pixels on the screen, and finding how far apart their texture samples fall. The mip level is chosen so as to make the space between adjacent texture ...
Nathan Reed's user avatar
  • 25.3k
4 votes
Accepted

Path tracing - cannot converge diffuse sampling + oversaturation

One point: the Lambert BRDF is not $N\cdot L$, it's just the albedo divided by pi. The $N \cdot L$ factor comes from the $\cos \theta$ in the rendering equation. So, when sampling with a cosine-...
Nathan Reed's user avatar
  • 25.3k
4 votes
Accepted

How does ID3D12Resource::Map work?

There are two general ways the graphics driver can implement Map(). One way is to set up a virtual memory mapping that makes the resource's actual memory (could be ...
Nathan Reed's user avatar
  • 25.3k
4 votes
Accepted

Do we really need a fence event?

In your first example, the call to WaitForSingleObject blocks the thread. This puts it into a waiting state, which takes it off the run queue and allows other ...
Dan Hulme's user avatar
  • 6,880
3 votes
Accepted

Can D3D12 resource barriers be used to synchronize between the compute and 3D engine?

My understanding would be that resource barriers are not at all about synchronization. They are about memory ordering, which is a related but separate concern. Basically, synchronization is about ...
Michael Kenzel's user avatar
2 votes

DX12 compute signature

You're trying to map all three UAVs to the same descriptor slot (slot 0). ...
Nathan Reed's user avatar
  • 25.3k
2 votes

Compute Shader PSO Dx12

If I understand you correctly, you've added a new compute shader. In DX12, you'll need at least one separate PSO for each shader, since the shader code is part of the PSO.
Nathan Reed's user avatar
  • 25.3k
2 votes
Accepted

How can I control memory for command allocators and command queues in D3D12?

You don't. These objects typically work with CPU memory, not device memory. And to the extent that they involve device memory, such allocations tend to be rare and/or fixed in size (a queue may have ...
Nicol Bolas's user avatar
  • 9,997
2 votes
Accepted

Is there an analogue of OpenGL's ImageLoadStore in DirectX 12?

You should be able to use RWTexture3D. The hlsl documentation page about RWTexture2D also has sample code that you might find useful.
wip's user avatar
  • 1,871
2 votes
Accepted

Using array of textures in DX12

I think what you want for this is to create a descriptor table which lists your textures. The individual textures would be created and uploaded as ordinary Texture2Ds. You'd set up the root signature ...
Nathan Reed's user avatar
  • 25.3k
2 votes
Accepted

DXC error when compiling PSO

This can be caused by the compiler creating unsigned bytecode. For the compiler to sign the bytecode, you have to have a copy of dxil.dll in the same folder as the dxcompiler.dll at runtime. See Using ...
Nathan Reed's user avatar
  • 25.3k
2 votes
Accepted

Objects in depth buffer are always black (0.0)

That's how I used to initialize viewport (CD3DX12_VIEWPORT). But I didn't realize that there are two additional fields minDepth and maxDepth. Therefore, I have min/max depth set to 0.0 and objects ...
DirectX_Programmer's user avatar
2 votes

What's different between D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE and D3D12_CPU_PAGE_PROPERTY_WRITE_BACK, and why they're named like that?

These are names for certain kinds of strategies for how the CPU gets to write to certain more CPU-distant memories. Most CPU memory writes are cached; they're bundled together with other writes to ...
Nicol Bolas's user avatar
  • 9,997
1 vote

How to orbit rotate a camera from a C++ program?

In order to orbit the camera around a specific point, you need to have that point available to the function that's doing the orbiting. So lets have the signatures reflect that... ...
Jherico's user avatar
  • 556
1 vote
Accepted

Mesh-Shader and layered rendering

In accord with the GLSL extension, gl_Layer in a mesh shader is part of the predefined gl_MeshPerPrimitiveNV output interface ...
Nicol Bolas's user avatar
  • 9,997
1 vote
Accepted

Generate Hi-Z buffer using single PSO and single UAV

The code for mip1 and mip2 (and higher mips if you have them—SSR ray marching can benefit a lot from higher mips) is identical except for which mip is being read and written; you don't need separate ...
Nathan Reed's user avatar
  • 25.3k
1 vote

what is the range for NDC coordinates to be visible in directx

Like you said... When using a perspective projection, your 'w' can be !=1. Between the vertex pocess stages (Vertex, Tessellation control, Tessellation evaluation, geometry) and the Fragment shader, ...
Thomas's user avatar
  • 1,366
1 vote

What causes buffer access to be significantly slower in DXIL than SPIR-V?

Are you sure the buffer isn't just defined as a host visible buffer? If you allocate it in CPU space it might have to transfer it a lot, I use ByteAddressBuffer a lot and it's not that slow for me. So ...
N Nielsbishere B's user avatar
1 vote
Accepted

How Anisotropic filtering works

Anisotropic filtering (and any other filtering process) will respect the base/max level settings for the texture they're fetching from. So as long as those settings are properly provided, it will ...
Nicol Bolas's user avatar
  • 9,997
1 vote
Accepted

what is the output from rasterizer

You are correct in your understanding that the rasterizer produces fragments. Each fragment can be thought of as a quasi-pixel, in that geometry may generate more than one fragment for the same pixel (...
Straivers's user avatar
  • 126
1 vote
Accepted

Unbound descriptor tables and descriptors for fat root signatures

Everything is allowed to be left unbound / invalid / uninitialized as long as the shader doesn't try to look at it. However, if the shader does try to look at it, it could trigger a GPU crash / TDR. ...
Nathan Reed's user avatar
  • 25.3k
1 vote
Accepted

Worsening sampling quality of raytracing with increasing distance from world origin

Problem was that perspective matrix had very short Z_NEAR and Z_FAR values (0.01f and 200.0f). By changing it to much higher range (10.0f, 20000.0f), problem with jaggies and artifacts disappears.
DirectX_Programmer's user avatar
1 vote

Is it possible to bind dynamic texture samplers to a shader in DX12?

Yes it is possible by putting Samplers in descriptor tables to dynamically assign and index into them. Source: https://youtu.be/Wbnw87tYqVg?t=754 Here's an example that uses the HLSL root signature ...
mbl's user avatar
  • 301
1 vote

Writing data to a shader resource at runtime in DX12

So, I figured it out. While UAV will be necessary when I start manipulating data in Compute Shaders, for the time being, SRV works fine provided the resource is read-only from the fragment shader. ...
Trevor Black's user avatar
1 vote

How does ID3D12Resource::Map work?

First you may want to take a look at the doc. Map basically allows you to retrieve a CPU pointer of a GPU resource. It performs a few operations on the background so the data is up to date. ...
Nacho's user avatar
  • 110
1 vote
Accepted

Readback Data through Buffers

Ok, so I made little example of how to do this. Short version You need to allocate additional buffer with heap type D3D12_HEAP_TYPE_READBACK and resource state ...
Derag's user avatar
  • 606

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