Cause #1: Stride doesn't match the buffer format (most common)
This error, STATUS_GRAPHICS_INVALID_STRIDE with code 0xC01E033C, means your application told DirectX that each row of pixels (the stride) is a different size than what the buffer format expects. This happens a lot when you're writing your own DirectX 11 or 12 code, or using a library that doesn't align things right.
The quickest fix is to check every place you set up a D3D11_TEXTURE2D_DESC or a D3D12_RESOURCE_DESC. You need to make sure the Width and Format fields produce a stride that matches what you pass to UpdateSubresource or CopyResource.
Real-world trigger: I've seen this in custom video players and image editors that load raw data. Say you're loading a 640x480 32-bit RGBA image. The correct stride should be 640 * 4 = 2560 bytes. But if you accidentally set it to 640 (forgetting to multiply by bytes per pixel), you get this error.
Step-by-step fix
- Open your code or the tool you're using to create the texture.
- Find the
D3D11_TEXTURE2D_DESCorD3D12_RESOURCE_DESCstructure. - Check the
WidthandFormat. For example,DXGI_FORMAT_R8G8B8A8_UNORMuses 4 bytes per pixel. - Calculate the stride:
Width * bytesPerPixel. For 640 width and 4 bytes per pixel, stride should be 2560. - If you're using
UpdateSubresourceorMap, make sure thepSrcRowPitch(stride) matches that calculation. - If the texture is created with a
MiscFlagslikeD3D11_RESOURCE_MISC_GENERATE_MIPS, the stride for each mip level changes. Calculate it per level. - After you fix the stride, rebuild your application. The error should go away.
Expected outcome: The app should no longer throw 0xC01E033C. If it still crashes, move to the next cause.
Cause #2: Outdated or corrupted GPU drivers
Sometimes the driver itself has a bug where it miscalculates the stride for certain formats. This is rarer, but I've seen it with older NVIDIA drivers (before version 472.12) on Windows 10 20H2. The driver would report a wrong supported format, and the app would use that wrong format, causing the stride mismatch.
Step-by-step fix
- Press Win + R, type
dxdiag, and hit Enter. Wait for the tool to load. - In the Display tab, note your driver version (e.g., 30.0.14.7141).
- Go to your GPU vendor's site:
- NVIDIA: nvidia.com/download
- AMD: amd.com/support
- Intel: intel.com/download-center
- Select your exact GPU model and download the latest driver. For NVIDIA, I recommend using the Studio Driver if you're not gaming — they're more stable for development.
- Right-click the downloaded file and choose Run as administrator.
- Select Custom (Advanced) installation, then check Perform a clean installation. This wipes old driver files.
- Restart your PC when prompted.
Expected outcome: After restarting, the error should be gone. If not, it's likely a code issue, not a driver issue.
Cause #3: Swap chain buffer stride mismatch (less common, specific to fullscreen apps)
This one's tricky. When you create a swap chain with DXGI_SWAP_CHAIN_DESC, the BufferDesc has a Width and Height. DirectX expects the stride for the back buffer to be Width * bytesPerPixel. But if you later Map the back buffer and write to it with a different stride, you get 0xC01E033C. I've seen this in fullscreen video capture tools that change the resolution without re-creating the swap chain.
Step-by-step fix
- Check your swap chain creation code. Look for
DXGI_SWAP_CHAIN_DESC(orDXGI_SWAP_CHAIN_DESC1). - Make sure the
WidthandHeightmatch the actual back buffer size. - When you call
IDXGISwapChain::GetBuffer(0, ...)to get the back buffer, verify the texture description: callID3D11Texture2D::GetDescand compareWidthandFormatwith your swap chain desc. - If they don't match, recreate the swap chain with the correct size. For DirectX 11, you can call
ResizeBufferswith the new width and height. - After resizing, get the new back buffer and re-calculate the stride. Then write your data with
Mapusing apRowPitchthat matches. - Test the app in windowed mode first. If it works there but fails in fullscreen, you might have a resolution mismatch. Force the app to use the desktop resolution.
Expected outcome: The error stops occurring after the swap chain is properly sized.
Quick-reference summary table
| Cause | Symptoms | Fix | Difficulty |
|---|---|---|---|
| Stride mismatch in texture creation | App crashes on startup or when loading a specific image | Check Width * bytesPerPixel vs pSrcRowPitch |
Intermediate |
| Corrupt/old GPU driver | Error occurs across multiple apps, or after driver update | Clean install latest driver | Beginner |
| Swap chain buffer stride mismatch | Error in fullscreen mode only, or after resolution change | Resize swap chain to match back buffer desc | Advanced |
If none of these work, enable the DirectX Debug Layer. In your code, call D3D11CreateDevice with D3D11_CREATE_DEVICE_DEBUG. Then run PIX on Windows (free from Microsoft) to capture a frame. PIX will show you exactly which resource has the wrong stride. I've fixed dozens of cases that way.