Skip to main content
Share Your Experience: Take the 2024 Developer Survey
8 votes
Accepted

How can I mark a pixel in the stencil buffer?

There are two ways to set the stencil buffer value in Direct3D 11, one of which is only available in Direct3D 11.3 (and Direct3D 12). I will split this answer into two parts accordingly. Direct3D 11 ...
ssell's user avatar
  • 196
7 votes

"DirectX will only draw polygons with an [X,Y] from [-1,-1] to [1,1] and with a Z from 0 to 1.", What does this mean and how to work around it?

The range [-1 ; 1] x [-1 ; 1] x [0 ; 1] mentioned in the tutorial refers to the canonical view volume. It is the final coordinate space vertex data gets mapped to ...
Jelle van Campen's user avatar
5 votes

Getting data from the backbuffer D3D11 using Map

Your code doesn't use your created texture with D3D11_CPU_ACCESS_READ. It creates a texture: ...
Chuck Walbourn's user avatar
4 votes
Accepted

DX11 Handle Device removed

There are two places you can potentially get this scenario: When calling ResizeBuffers or Present and you get either ...
Chuck Walbourn's user avatar
4 votes
Accepted

Color Correction in DirectX

Color correction is commonly done through post processing shaders. Basically first you render the scene to a framebuffer, then draw a fullscreen quad that has a shader that takes that framebuffer and ...
Aaro's user avatar
  • 128
4 votes
Accepted

In game development, what aspects to consider when choosing a 32-bit architecture over a 64-bit architecture?

The most obvious thing to consider is that using a 32-bit architecture for your executable allows you to address about ~4gb of RAM on Windows while using a 64-bit architecture allows the program to ...
Vaillancourt's user avatar
  • 16.3k
3 votes

Is it ok to mix shader types?

Yes you can mix shaders, I have around 25 shaders that run per frame from terrain shaders using the full pipeline to post processing. You are getting the crash because after you bind shaders to hull, ...
Justin William Stanley Bryant's user avatar
3 votes

DirectX11, how do I manage and update multiple shader constant buffers?

There seems to be a lot of confusion around the topic of needing to re-bind constant buffers after updating them. As I'm learning about this myself I have seen a lot of topics and discussions with ...
octo's user avatar
  • 31
3 votes
Accepted

How do multiple shaders in a DirectX Engine work?

Might be misunderstanding your question but from the screenshot, it looks like you have a common library of functions to use with your three different shaders: BasicEffect [VS, PS] Brdf [VS, PS] ...
Haywire Spark's user avatar
3 votes
Accepted

Passing Matrix to shader

Yes, there is no way to pass a float4x4 to an input description. By doing that you'd be passing a matrix for every vertex to your vertex shader. This is bad practice unless you need to bind a ...
Honeybunch's user avatar
  • 1,383
3 votes

Direct3D11 Reading from (Static) Index Buffer

You really don't want to read from buffers because you never know where it is in the pipeline and you will normally end up with +20ms of GPU-CPU synchronization. Even with a copy to a staging ...
Justin William Stanley Bryant's user avatar
3 votes
Accepted

Single pass separable gaussian blur problem

I'm not an expert in compute shaders, but it looks like the memory barriers you're using there say: "Ensure all current writes in progress finish before proceeding to the next step" ...while I ...
DMGregory's user avatar
  • 135k
3 votes

How can you make custom direct3D11 calls in Unreal Engine 4?

I figured out a way to render to texture. Create a new c++ component that has a UTextureRenderTarget* property Create a render target in unreal. I followed the ...
default's user avatar
  • 747
3 votes
Accepted

Why do these DirectXMath functions seem like they return column-major matrics?

You posted a column-major version of the translation matrix for (1,1,-1): 1.0 0.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 0.0 1.0 -1.0 0.0 0.0 0.0 1.0 ...
Chuck Walbourn's user avatar
3 votes

Which DirectX Version to use for a low poly game?

You generally want to use the latest version that is compatible with your target platform. For most people that means DirectX11, since DirectX12 is not supported on versions of Windows (i.e. Windows 7)...
Jack Aidley's user avatar
  • 2,126
3 votes
Accepted

error X4016: SV_InstanceID semantic cannot be used with 10Level9 targets

TL;DR: Edit your shader compilation to use Shader Model 5.1 or later. With the DirectX 12 API, there is no supported device to date that supports anything less than Direct3D Feature Level 11.0. ...
Chuck Walbourn's user avatar
3 votes
Accepted

What actions should I perform in DirectX 11 to correctly process Alt+Tab?

ALT+TAB is generally handled through WM_ACTIVATEAPP and "FSE" games switch out/in of fullscreen mode based on this message. With DXGI you can manually implement ...
Chuck Walbourn's user avatar
3 votes

What actions should I perform in DirectX 11 to correctly process Alt+Tab?

Here is what I've found works. All of this information is probably scattered around the DXGI documentation on various disconnected pages; it's been a while since I've reviewed it. For windowed modes (...
Maximus Minimus's user avatar
3 votes
Accepted

God rays shader - Trouble with sun position

In GLSL (like HLSL), a vec4 (float4 in HLSL) has three different ways to access its four values. You can use (rgba), or (xyzw), or (stpq). They're all identical to each other; Asking for ...
Trevor Powell's user avatar
3 votes

Sampled texture from bitmap font produces blue glow

So in true programmer fashion, I solved the issue after being frustrated with it forever. BITMAPINFO stores in ARGB format, not RGBA like I was expected. The solution is just changing the alpha ...
Kyle Elliott's user avatar
3 votes
Accepted

Constant Buffer Alignment issues

Review the HLSL cbuffer packing rules here: https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-packing-rules HLSL packing rules are similar to performing a #pragma pack 4 ...
Maximus Minimus's user avatar
3 votes
Accepted

Borderless windowed (fake fullscreen) mode doesn't cover the entire screen

It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. This was, of course, all my own fault. I had some code for centering ...
Maximus Minimus's user avatar
3 votes
Accepted

How to sample a TextureCube texture

This doesn't work the way you're expecting because texture slots and sampler slots are decoupled in D3D10/SM4+. So unlike legacy code, you can have a texture at slot x, a sampler state at slot y (and ...
Maximus Minimus's user avatar
3 votes

DirectX11 creating input layout throws error on input signature not matching shader (instancing)

The problem was I was not calculating the number of elements in the CreateInputLayout call. It was fixed at 2 elements. Incorrect ...
koreus737's user avatar
  • 131

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