microsoft / microsoft/DirectXShaderCompiler
Crash while linking two shaders
Open
Nobody has claimed this yet.
bug
crash
shader-linking
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
First file TestLinkEntry.hlsl
float4 TestPos(in float4 posin);
struct VSInput
{
float4 Pos : POSITION0;
};
struct VSOutput
{ float4 Pos : SV_POSITION;
};
[shader("vertex")]
VSOutput vs_main(VSInput input)
{
VSOutput output;
float4 newPos =float4(input.Pos.xyz, 1.0f);
output.Pos = TestPos(newPos);
return output;
};
LPCWSTR argsLink[] = { L"-auto-binding-space",L"0" };
LPCWSTR pTargetProfile = L"lib_6_x";
IDxcCompiler->Compile() and IDxcLinker->RegisterLibrary() as first dxclink lib
second file TestFunction.hlsl
struct CameraMat
{
float4x4 projection;
float4x4 view;
float4x4 model;
};
cbuffer UBO
{
CameraMat cameraMat;
};
float4 TestPos(in float4 posin){
float4 Pos = mul(cameraMat.projection, mul(cameraMat.view, mul(cameraMat.model, posin)));
return Pos;
};
LPCWSTR argsLink[] = { L"-auto-binding-space",L"0" };
LPCWSTR pTargetProfile = L"lib_6_x";
IDxcCompiler->Compile() and IDxcLinker->RegisterLibrary() as second dxclink lib
last link two lib:
LPCWSTR libNames[] = { firstlib ,secondlib };
pLinker->Link(L"vs_main", L"vs_6_0", libNames,2, argsLink, _countof(argsLink), &pLinkResult));
then will crash
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Begin by reproducing the crash with fistlib.txt and secondlib.txt, following the IDxcCompiler->Compile(), IDxcLinker->RegisterLibrary(), and pLinker->Link() calls shown in the issue. Trace the two-library link path for the vs_main entry point; done means linking these libraries no longer crashes and the result is handled normally.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers, computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100