Direct3D exception on launch - No MapOnDefaultBuffers support
When launching the debugger I get the following exception:
[Content]
A fatal exception (code 0xc0000005) occurred. The process is terminating.
Call stack:
1. [0x7ffe78ec9c10] d3d11
2. [0x7ff77db78f34] r_fill_tex2d_region +452, render_d3d11.cpp line 687
3. [0x7ff77db8447a] f_push_run_from_string +3130, font_cache.c line 744
4. [0x7ff77dc1dcd6] df_window_open +1366, df_gfx.c line 972
5. [0x7ff77dc71272] df_gfx_begin_frame +9106, df_gfx.c line 11578
6. [0x7ff77dc834ee] update_and_render +3646, raddbg.c line 237
7. [0x7ff77dc9aed7] entry_point +5671, raddbg.c line 577
8. [0x7ff77dac245d] WinMain +877, raddbg_main.cpp line 348
9. [0x7ff77dc9cb1e] __scrt_common_main_seh +262, exe_common.inl line 288
10. [0x7ffe7f817344] KERNEL32
11. [0x7ffe7fbc26b1] ntdll
Version: 0.9.8 [c757388-dirty]
I want to emphasize that this is happening on a fairly old machine, that I do not rely on to do serious work with at all However it may still be desirable to handle the error more gracefully.
Graphics card/D3d information:
Card name: Intel(R) HD Graphics 4000
Display Color Space: DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Output Type: Internal
Monitor Capabilities: HDR Not Supported
Display Pixel Format: DISPLAYCONFIG_PIXELFORMAT_32BPP
Advanced Color: Not Supported
Driver Name: igdumdim64.dll,igd10iumd64.dll,igd10iumd64.dll
Driver File Version: 10.18.0010.4252 (English)
Driver Version: 10.18.10.4252
DDI Version: 11.2
Feature Levels: 11_0,10_1,10_0,9_3,9_2,9_1
Driver Model: WDDM 1.3
Hardware Scheduling: Supported:False Enabled:False
Driver Date/Size: 10.07.2015 01:00:00, 11053040 bytes
D3D9 Overlay: Supported
DXVA-HD: Supported
DDraw Status: Enabled
D3D Status: Enabled
AGP Status: Enabled
MPO MaxPlanes: 1
MPO Caps: Not Supported
MPO Stretch: Not Supported
MPO Media Hints: Not Supported
MPO Formats: Not Supported
PanelFitter Caps: Not Supported
PanelFitter Stretch: Not Supported
I already looked into the issue and it seems to originate in the r_tex2d_alloc function when calling CreateTexture2D.
(Called from ´f_push_run_from_string´ in font_cache.c)
Due to the d3d version not supporting MapOnDefaultBuffers and the CPUAccessFlags bits being set to READ and WRITE, the call fails.
This leads to the ID3D11Texture2D pointer to stay NULL which leads to the exception later on.
I did not investigate any further but if Mapping of GPU buffers is relied on somewhere it is probably not easy to fix. As previously mentioned, the maschine/drivers are fairly old so I do not necessarily expect this to be fixed. However it may still be of interest...
I investigated a little further and it seems that Mapping buffers IS in fact supported. Just not if the usage is set to D3D11_USAGE_DEFAULT. When usage is set to D3D11_USAGE_DYNAMIC, the buffer creation is successfull.
(This aligns with what the documentation says about MapOnDefaultBuffers, hence the name).
This leads to the question if Map/Unmap now actually works, however that does not even matter because:
The texture in question is later on actually NOT written via Map/Unmap but via UpdateSubresource. Now UpdateSubresource does require the usage to be set to D3D11_USAGE_DEFAULT again and therefore now fails.
By setting the usage for this specific texture to D3D11_USAGE_DEFAULT and not setting and accessBits, it seems to work fine.
As far as I can tell all the Map/Unmap calls in the code are not getting called on texture buffers anyways, so maybe this would be an option.
How this whole thing would tie into the API and the usage of the R_Tex2DKind_Static/R_Tex2DKind_Dynamic enum, I am not quite sure.
There seems to be some inconsistencies here anyways. R_Tex2DKind_Static creates the texture with D3D11_USAGE_DYNAMIC and D3D11_CPU_ACCESS_WRITE which somewhat defies the meaning of "static".
I get the same exception:
[Content] A fatal exception (code 0xc0000005) occurred. The process is terminating.
Call stack:
- [0x7ff803c49c10] d3d11
- [0x7ff663f98f24] r_fill_tex2d_region +452, render_d3d11.cpp line 687
- [0x7ff663fa446a] f_push_run_from_string +3130, font_cache.c line 744
- [0x7ff66403dcc6] df_window_open +1366, df_gfx.c line 972
- [0x7ff664092d60] df_gfx_begin_frame +16016, df_gfx.c line 11931
- [0x7ff6640a34de] update_and_render +3646, raddbg.c line 237
- [0x7ff6640baec7] entry_point +5671, raddbg.c line 577
- [0x7ff663ee245d] WinMain +877, raddbg_main.cpp line 348
- [0x7ff6640bcb0e] __scrt_common_main_seh +262, exe_common.inl line 288
- [0x7ff80a7f7344] KERNEL32
- [0x7ff80aae26b1] ntdll
Version: 0.9.8
on a netbook with
AMD E-350 and AMD Radeon HD 6310
This should be fixed by #226, but let me know if you still have issues.