mkxjun / directx11-with-windows-sdk Goto Github PK
View Code? Open in Web Editor NEW现代DX11系列教程:使用Windows SDK(C++)开发Direct3D 11.x
Home Page: https://directx11.tech
License: MIT License
现代DX11系列教程:使用Windows SDK(C++)开发Direct3D 11.x
Home Page: https://directx11.tech
License: MIT License
交换链更换FLIP Model后,拉伸窗口会在窗口右下角出现白边
然后再拖动一下窗口好像就没掉了。刚找到一篇文章,后续参考着看看能不能解决这个问题
https://www.gamedev.net/forums/topic/708865-dxgi-flip-model-flickering-during-live-resize/
可能存在bug的代码段 EffectHelper.cpp Lines 646~651
某一个Effect中存在两个Shader:Shader1和Shader2
有一个CBuffer内有若干个成员变量,但Shader1只使用了其中的某几个,C++段反射生成的Buffer的buffer size大小并不是完整的CBuffer的大小。(我的情况:CBuffer完整应是576bytes,但Shader1反射生成的Buffer只有560bytes)
而Shader2使用了完整的CBuffer,反射生成的Buffer大小为完整CBuffer大小(我的情况:Shader2反射生成的Buffer为576bytes)。但是因为在m_CBuffers中已经存在BindPoint相同的Buffer,所以Shader2反射生成的Buffer并没有覆盖到m_CBuffers中。
最终我的情况:渲染是没有问题的,但在关闭程序,析构CBufferData中的cbufferData数组(在m_CBuffers[x]中)时,会报内存越界的错误 (error: crt detected that the application wrote to memory after end of heap buffer)。
我的解决方法:
Lines 647
if (it == m_CBuffers.end()) 改成 if (it == m_CBuffers.end() || it->second.cbufferData.size() < cbDesc.Size)
Lines 649
m_CBuffers.emplace(...)
改成
if (!m_CBuffers.emplace(...).second) { m_CBuffers[sibDesc.BindPoint] = CBufferData(...); }
这样改的话对于目前我的项目来说是没有报内存越界的错了。
因为我的水平有限,这样改目前还不知道会不会引起其他问题。
如果有,请回复告知我一下,谢谢。
换成VS2019后,以Debug模式打开教程项目,在调试输出窗口会看到以下内容:
DXGI WARNING: IDXGIFactory::CreateSwapChain: Blt-model swap effects (DXGI_SWAP_EFFECT_DISCARD and DXGI_SWAP_EFFECT_SEQUENTIAL) are legacy swap effects that are predominantly superceded by their flip-model counterparts (DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL and DXGI_SWAP_EFFECT_FLIP_DISCARD). Please consider updating your application to leverage flip-model swap effects to benefit from modern presentation enhancements. More information is available at http://aka.ms/dxgiflipmodel. [ MISCELLANEOUS WARNING #294: ]
directX 现在是否支持 clang-cl编译呢
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.