microsoft / microsoft/DirectXShaderCompiler

Segmentation fault (null deref) when missing patchconstantfunc in lib

Open
#7,635 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug crash incorrect-code shader-linking
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

Description

When a hull shader is compiled with the wrong patchconstantfunc, it can yield to a segmentation fault when building with lib_ instead of hs_.
When building for hs_, we correctly get a patch constant function toto must be defined.

Steps to Reproduce

https://godbolt.org/z/bY3WKn6xz

// RUN: %dxc -T lib_6_6 %s

[patchconstantfunc("SubDToBezierConstantsHS")]
[outputtopology("triangle_cw")]
[outputcontrolpoints(16)]
void hs_main() { }

Environment

  • DXC version: a11702ef0a393a9e0b78f982f9f0fa66d919c867
  • Host Operating System: linux

Contributor guide

Open the contributing guide

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.

Research direction

Start by running the Godbolt reproduction with dxc -T lib_6_6 and compare it with the hs_ target, which reports the missing patch constant function instead. Trace handling of the patchconstantfunc attribute in the lib_ path; done means the invalid shader produces a diagnostic rather than a segmentation fault.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.