Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation with exceptions disabled on MSVC and remove use of alloca #58

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

AlpyneDreams
Copy link
Contributor

When compiling NVRHI with exceptions disabled (not necessarily supported, but not uncommon in game engines), the use of alloca in d3d12-raytracing.cpp causes a compilation errors on MSVC because alloca is defined in <malloc.h> which is included by <exception> (which is included by <string>) only when _HAS_EXCEPTIONS is not 0.

Instead of just including <malloc.h> which is compiler and OS-specific I decided to just replace the usage of alloca with a preallocated vector since it is generally considered bad practice to use alloca and it's only used in this one specific place in NVRHI.

Copy link

github-actions bot commented Sep 2, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@AlpyneDreams
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@apanteleev apanteleev merged commit 52794a5 into NVIDIAGameWorks:main Sep 3, 2024
5 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Sep 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants