some d3d problem

本文分享了从Debug模式切换到Release模式过程中遇到的一些问题,包括Direct3D9错误提示、预处理器NDEBUG的问题以及d3drenderstatecache的管理方式等。通过对比Debug和Release版本的差异,最终定位并解决了问题。

遇到些蛋疼无聊的问题,share下

 

1, NDEBUG preprocessor:

怪了,以为debug下ok就全ok,release下不就是开个优化么。

结果无穷多的无语的问题困扰了很久,遇到如下这些:

Direct3D9: (ERROR) :Need to call BeginScene before rendering.(我当然是call了BeginScene)

DrawIndexedPrimitive也会fail

DrawIndexedPrimitive内部会有long memory exception...

 

实在无语,不知道怎么回事,只好和debug版一项项比较,最后发现是preprocessor NDEBUG的问题。

换成RELEASE就好了.

 

进一步尽到dxsdk的include下面也找不到NDEBUG相关定义的东西。

就不再花时间了。

 

2, d3d render state cache

本来在console上面因为driver给的灵活性很大(也就是给实现的东西很少),对rendertstate这种东西做cache进而避免掉重复设置是很有效的优化。

(之前这里认识不足,sorry,幸亏楼下有人指出,thx)

pc上create device的时候可以指定是否来做cache等管理的,如果选择puredevice就可以不作任何这种管理,就可以自己来弄了。

我想可能要根据pix截出来的东西来看最准了。

 

有种情况pc上是有可能自动cache的,也就是内部就不用自己去做和driver一样的cache了。

可以自己开d3d debug模式下,输出所有log会有这种东西:

Direct3D9: (WARN) :Ignoring redundant SetRenderState - 7

 

 

 

Loading User Symbols Loading unloaded module list .............................. For analysis of this file, run !analyze -v 3: kd> !analyze -v ******************************************************************************* * * * Bugcheck Analysis * * * ******************************************************************************* SYSTEM_THREAD_EXCEPTION_NOT_HANDLED_M (1000007e) This is a very common BugCheck. Usually the exception address pinpoints the driver/function that caused the problem. Always note this address as well as the link date of the driver/image that contains this address. Some common problems are exception code 0x80000003. This means a hard coded breakpoint or assertion was hit, but this system was booted /NODEBUG. This is not supposed to happen as developers should never have hardcoded breakpoints in retail code, but ... If this happens, make sure a debugger gets connected, and the system is booted /DEBUG. This will let us see why this breakpoint is happening. Arguments: Arg1: ffffffffc0000005, The exception code that was not handled Arg2: fffff8069d55369e, The address that the exception occurred at Arg3: ffff8b0605d40748, Exception Record Address Arg4: ffff8b0605d3ff80, Context Record Address Debugging Details: ------------------ *** WARNING: Unable to verify timestamp for Netwtw12.sys *** WARNING: Unable to verify timestamp for win32k.sys KEY_VALUES_STRING: 1 Key : AV.Dereference Value: NullClassPtr Key : AV.Fault Value: Write Key : Analysis.CPU.mSec Value: 8359 Key : Analysis.DebugAnalysisManager Value: Create Key : Analysis.Elapsed.mSec Value: 631590 Key : Analysis.Init.CPU.mSec Value: 5171 Key : Analysis.Init.Elapsed.mSec Value: 13485 Key : Analysis.Memory.CommitPeak.Mb Value: 132 Key : WER.OS.Branch Value: vb_release Key : WER.OS.Timestamp Value: 2019-12-06T14:06:00Z Key : WER.OS.Version Value: 10.0.19041.1 FILE_IN_CAB: 120925-12703-01.dmp BUGCHECK_CODE: 7e BUGCHECK_P1: ffffffffc0000005 BUGCHECK_P2: fffff8069d55369e BUGCHECK_P3: ffff8b0605d40748 BUGCHECK_P4: ffff8b0605d3ff80 EXCEPTION_RECORD: ffff8b0605d40748 -- (.exr 0xffff8b0605d40748) ExceptionAddress: fffff8069d55369e (Netwtw12+0x000000000019369e) ExceptionCode: c0000005 (Access violation) ExceptionFlags: 00000000 NumberParameters: 2 Parameter[0]: 0000000000000001 Parameter[1]: 0000000000000318 Attempt to write to address 0000000000000318 CONTEXT: ffff8b0605d3ff80 -- (.cxr 0xffff8b0605d3ff80) rax=ffffd903052d6508 rbx=0000000000000044 rcx=0000000000000000 rdx=000000000000001a rsi=fffff8069d7e7000 rdi=0000000000000000 rip=fffff8069d55369e rsp=ffff8b0605d40980 rbp=0000000000000000 r8=ffffd903052d6508 r9=ffff8b0605d409f0 r10=ffffd903059d8bc0 r11=0000000000000200 r12=ffffd903161abb70 r13=fffff8069d81ce54 r14=ffffd90307cb6000 r15=ffffd903059d8bc0 iopl=0 nv up ei ng nz na pe nc cs=0010 ss=0018 ds=002b es=002b fs=0053 gs=002b efl=00050282 Netwtw12+0x19369e: fffff806`9d55369e 89b918030000 mov dword ptr [rcx+318h],edi ds:002b:00000000`00000318=???????? Resetting default scope BLACKBOXBSD: 1 (!blackboxbsd) BLACKBOXNTFS: 1 (!blackboxntfs) BLACKBOXPNP: 1 (!blackboxpnp) BLACKBOXWINLOGON: 1 CUSTOMER_CRASH_COUNT: 1 PROCESS_NAME: System WRITE_ADDRESS: fffff80634cfb390: Unable to get MiVisibleState Unable to get NonPagedPoolStart Unable to get NonPagedPoolEnd Unable to get PagedPoolStart Unable to get PagedPoolEnd unable to get nt!MmSpecialPagesInUse 0000000000000318 ERROR_CODE: (NTSTATUS) 0xc0000005 - 0x%p 0x%p %s EXCEPTION_CODE_STR: c0000005 EXCEPTION_PARAMETER1: 0000000000000001 EXCEPTION_PARAMETER2: 0000000000000318 EXCEPTION_STR: 0xc0000005 STACK_TEXT: ffff8b06`05d40980 00000000`00000040 : ffffd903`052d4480 ffffd903`161abb70 fffff806`9d757478 ffffd903`1546b490 : Netwtw12+0x19369e ffff8b06`05d40988 ffffd903`052d4480 : ffffd903`161abb70 fffff806`9d757478 ffffd903`1546b490 0000ffff`00030013 : 0x40 ffff8b06`05d40990 ffffd903`161abb70 : fffff806`9d757478 ffffd903`1546b490 0000ffff`00030013 ffff8b06`05d40a00 : 0xffffd903`052d4480 ffff8b06`05d40998 fffff806`9d757478 : ffffd903`1546b490 0000ffff`00030013 ffff8b06`05d40a00 ffffd902`fca02000 : 0xffffd903`161abb70 ffff8b06`05d409a0 ffffd903`1546b490 : 0000ffff`00030013 ffff8b06`05d40a00 ffffd902`fca02000 ffffd903`1546b4a0 : Netwtw12+0x397478 ffff8b06`05d409a8 0000ffff`00030013 : ffff8b06`05d40a00 ffffd902`fca02000 ffffd903`1546b4a0 fffff806`9d460089 : 0xffffd903`1546b490 ffff8b06`05d409b0 ffff8b06`05d40a00 : ffffd902`fca02000 ffffd903`1546b4a0 fffff806`9d460089 00000000`00000001 : 0x0000ffff`00030013 ffff8b06`05d409b8 ffffd902`fca02000 : ffffd903`1546b4a0 fffff806`9d460089 00000000`00000001 fffff840`00000001 : 0xffff8b06`05d40a00 ffff8b06`05d409c0 ffffd903`1546b4a0 : fffff806`9d460089 00000000`00000001 fffff840`00000001 ffff8b06`05d40b40 : 0xffffd902`fca02000 ffff8b06`05d409c8 fffff806`9d460089 : 00000000`00000001 fffff840`00000001 ffff8b06`05d40b40 ffff8b06`05d40bd0 : 0xffffd903`1546b4a0 ffff8b06`05d409d0 00000000`00000001 : fffff840`00000001 ffff8b06`05d40b40 ffff8b06`05d40bd0 ffffd903`052d6508 : Netwtw12+0xa0089 ffff8b06`05d409d8 fffff840`00000001 : ffff8b06`05d40b40 ffff8b06`05d40bd0 ffffd903`052d6508 ffffd903`052d6508 : 0x1 ffff8b06`05d409e0 ffff8b06`05d40b40 : ffff8b06`05d40bd0 ffffd903`052d6508 ffffd903`052d6508 fffff806`9d755240 : 0xfffff840`00000001 ffff8b06`05d409e8 ffff8b06`05d40bd0 : ffffd903`052d6508 ffffd903`052d6508 fffff806`9d755240 00000000`00000002 : 0xffff8b06`05d40b40 ffff8b06`05d409f0 ffffd903`052d6508 : ffffd903`052d6508 fffff806`9d755240 00000000`00000002 ffff8b06`05d40aa0 : 0xffff8b06`05d40bd0 ffff8b06`05d409f8 ffffd903`052d6508 : fffff806`9d755240 00000000`00000002 ffff8b06`05d40aa0 00000000`00000004 : 0xffffd903`052d6508 ffff8b06`05d40a00 fffff806`9d755240 : 00000000`00000002 ffff8b06`05d40aa0 00000000`00000004 fffff806`9d757478 : 0xffffd903`052d6508 ffff8b06`05d40a08 00000000`00000002 : ffff8b06`05d40aa0 00000000`00000004 fffff806`9d757478 00000000`00000005 : Netwtw12+0x395240 ffff8b06`05d40a10 ffff8b06`05d40aa0 : 00000000`00000004 fffff806`9d757478 00000000`00000005 ffffb9d9`969fa0f2 : 0x2 ffff8b06`05d40a18 00000000`00000004 : fffff806`9d757478 00000000`00000005 ffffb9d9`969fa0f2 00000000`00000005 : 0xffff8b06`05d40aa0 ffff8b06`05d40a20 fffff806`9d757478 : 00000000`00000005 ffffb9d9`969fa0f2 00000000`00000005 fffff806`9d57d400 : 0x4 ffff8b06`05d40a28 00000000`00000005 : ffffb9d9`969fa0f2 00000000`00000005 fffff806`9d57d400 fffff806`9d3c0000 : Netwtw12+0x397478 ffff8b06`05d40a30 ffffb9d9`969fa0f2 : 00000000`00000005 fffff806`9d57d400 fffff806`9d3c0000 00000000`00000000 : 0x5 ffff8b06`05d40a38 00000000`00000005 : fffff806`9d57d400 fffff806`9d3c0000 00000000`00000000 fffff806`9d7e7000 : 0xffffb9d9`969fa0f2 ffff8b06`05d40a40 fffff806`9d57d400 : fffff806`9d3c0000 00000000`00000000 fffff806`9d7e7000 00000000`00000001 : 0x5 ffff8b06`05d40a48 fffff806`9d3c0000 : 00000000`00000000 fffff806`9d7e7000 00000000`00000001 ffff8b06`05d40b40 : Netwtw12+0x1bd400 ffff8b06`05d40a50 00000000`00000000 : fffff806`9d7e7000 00000000`00000001 ffff8b06`05d40b40 ffff8b06`05d40bd0 : Netwtw12 SYMBOL_NAME: Netwtw12+19369e MODULE_NAME: Netwtw12 IMAGE_NAME: Netwtw12.sys STACK_COMMAND: .cxr 0xffff8b0605d3ff80 ; kb BUCKET_ID_FUNC_OFFSET: 19369e FAILURE_BUCKET_ID: AV_Netwtw12!unknown_function OS_VERSION: 10.0.19041.1 BUILDLAB_STR: vb_release OSPLATFORM_TYPE: x64 OSNAME: Windows 10 FAILURE_ID_HASH: {07241ecd-a108-bbe5-b32a-cd88c60dba5a} Followup: MachineOwner ---------
最新发布
12-11
D:\anconda\envs\ultralytics-main\python.exe D:/Program Files/JetBrains/PyCharm 2025.2.1.1/plugins/python-ce/helpers/packaging_tool.py install albumentations Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple, https://mirrors.tuna.tsinghua.edu.cn/pytorch-wheels/cu128 Collecting albumentations Using cached https://pypi.tuna.tsinghua.edu.cn/packages/8e/64/013409c451a44b61310fb757af4527f3de57fc98a00f40448de28b864290/albumentations-2.0.8-py3-none-any.whl (369 kB) Requirement already satisfied: numpy>=1.24.4 in d:\anconda\envs\ultralytics-main\lib\site-packages (from albumentations) (2.0.1) Collecting scipy>=1.10.0 (from albumentations) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d1/84/55bc4881973d3f79b479a5a2e2df61c8c9a04fcb986a213ac9c02cfb659b/scipy-1.15.3-cp310-cp310-win_amd64.whl (41.3 MB) Requirement already satisfied: PyYAML in d:\anconda\envs\ultralytics-main\lib\site-packages (from albumentations) (6.0.2) Collecting pydantic>=2.9.2 (from albumentations) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/3e/d3/108f2006987c58e76691d5ae5d200dd3e0f532cb4e5fa3560751c3a1feba/pydantic-2.11.9-py3-none-any.whl (444 kB) Collecting albucore==0.0.24 (from albumentations) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/0a/e2/91f145e1f32428e9e1f21f46a7022ffe63d11f549ee55c3b9265ff5207fc/albucore-0.0.24-py3-none-any.whl (15 kB) Collecting opencv-python-headless>=4.9.0.80 (from albumentations) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/f2/35/0858e9e71b36948eafbc5e835874b63e515179dc3b742cbe3d76bc683439/opencv_python_headless-4.12.0.88-cp37-abi3-win_amd64.whl (38.9 MB) Collecting stringzilla>=3.10.4 (from albucore==0.0.24->albumentations) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/36/e7/80a4151062f83b581630a4972619db0d14cdebaabbf394348187125a4efd/stringzilla-4.0.11.tar.gz (465 kB) Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Preparing metadata (pyproject.toml): started Preparing metadata (pyproject.toml): finished with status 'done' Collecting simsimd>=5.9.2 (from albucore==0.0.24->albumentations) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/e9/2c/6e66858a6150351e74238357d3b01718f743b405f79a16b9184f07f91748/simsimd-6.5.3-cp310-cp310-win_amd64.whl (94 kB) Collecting annotated-types>=0.6.0 (from pydantic>=2.9.2->albumentations) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl (13 kB) Collecting pydantic-core==2.33.2 (from pydantic>=2.9.2->albumentations) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/66/ff/172ba8f12a42d4b552917aa65d1f2328990d3ccfc01d5b7c943ec084299f/pydantic_core-2.33.2-cp310-cp310-win_amd64.whl (2.0 MB) Requirement already satisfied: typing-extensions>=4.12.2 in d:\anconda\envs\ultralytics-main\lib\site-packages (from pydantic>=2.9.2->albumentations) (4.12.2) Collecting typing-inspection>=0.4.0 (from pydantic>=2.9.2->albumentations) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/17/69/cd203477f944c353c31bade965f880aa1061fd6bf05ded0726ca845b6ff7/typing_inspection-0.4.1-py3-none-any.whl (14 kB) Building wheels for collected packages: stringzilla Building wheel for stringzilla (pyproject.toml): started Building wheel for stringzilla (pyproject.toml): finished with status 'error' Failed to build stringzilla error: subprocess-exited-with-error Building wheel for stringzilla (pyproject.toml) did not run successfully. exit code: 1 [10 lines of output] running bdist_wheel running build running build_py creating build\lib.win-amd64-cpython-310\cli copying cli\split.py -> build\lib.win-amd64-cpython-310\cli copying cli\wc.py -> build\lib.win-amd64-cpython-310\cli copying cli\__init__.py -> build\lib.win-amd64-cpython-310\cli running build_ext building 'stringzilla' extension error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for stringzilla error: failed-wheel-build-for-install Failed to build installable wheels for some pyproject.toml based projects stringzilla Process finished with exit code 1
09-18
评论 4
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值