microsoft / microsoft/DirectX-Graphics-Samples

Sporadic crashes in MiniEngine caused by bug in code

Open
#751 0 comments 0 reactions 1 assignee View on GitHub

@stanard is already working on this.

Since Jan 11, 2022.

bug miniengine
Dominant language
C++
Stars
6.8k
Forks
2.2k
PR merge metrics
No merged PRs in 30d

Description

The D3D12RaytracingMiniEngineSample project sporadically crashes from time to time.
This is caused by a bug in the code in ModelViewer.cpp, function InitializeRaytracingStateObjects():

D3D12_STATE_SUBOBJECT &rayGenDxilLibSubobject = subObjects.back();
...
rayGenDxilLibSubobject = CreateDxilLibrary(rayGenShaderExportName, g_pRayGenerationShaderLib, sizeof(g_pRayGenerationShaderLib), rayGenDxilLibDesc, rayGenExportDesc);
...
D3D12_STATE_SUBOBJECT hitGroupLibSubobject = CreateDxilLibrary(closestHitExportName, g_phitShaderLib, sizeof(g_phitShaderLib), hitGroupDxilLibDesc, hitGroupExportDesc);
subObjects.push_back(hitGroupLibSubobject);
...
rayGenDxilLibSubobject = CreateDxilLibrary(rayGenShaderExportName, g_pRayGenerationShaderSSRLib, sizeof(g_pRayGenerationShaderSSRLib), rayGenDxilLibDesc, rayGenExportDesc);

The problem is that the code saves a reference to an element in a vector, but the vector is resized and the reference is no longer valid, and the assignment later on can crash the app.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.