DirectXShaderCompiler icon indicating copy to clipboard operation
DirectXShaderCompiler copied to clipboard

No way to remove struct names from shaders

Open GlassBeaver opened this issue 7 months ago • 3 comments

Description Struct names are left in shaders even when using -Qstrip_debug -Qstrip_priv -Qstrip_reflect IDxcContainerBuilder::RemovePart also fails to remove them.

Steps to Reproduce Compile any shader that's using a structured buffer with a named struct e.g. struct CSomething { ... } using the following command line arguments:

"-T" "ps_6_6" "-Zpr" "-Qstrip_debug" "-Qstrip_priv" "-Qstrip_reflect" "-E" "BlackholePS" "-Ges" "-Wshadow" "-WX" "-Fo" "out.cso" "test.hlsl"

Make sure to run IDxcContainerBuilder::RemovePart with all the removable fourcc codes ("ILDB", "ILDN", "PRIV", etc.)

Actual Behavior PIX is still able to detect struct names in the stripped DXIL, e.g.: %ResourceIndexRootConstants = type { %struct.CResourceIndexRootConstants }

Environment

  • DXC version 1.8.2505.28
  • Host Operating System Windows 11 x64 24H2 26100.4349

GlassBeaver avatar Jul 05 '25 22:07 GlassBeaver

While this isn't something we'll be scheduling time to work on, we'd gladly consider any PR's that strip these names out.

damyanp avatar Oct 28 '25 17:10 damyanp

https://github.com/microsoft/DirectXShaderCompiler/pull/7868

GlassBeaver avatar Nov 02 '25 15:11 GlassBeaver

@damyanp Hi, sorry for the ping but I've implemented PR https://github.com/microsoft/DirectXShaderCompiler/pull/7868 to fix this. A review had started on it but got stalled and now I'm not sure if it's going to get picked up again any time soon. Wondering if you could maybe take a look or assign it to someone. I understand that it's not the most important PR in the world but since you've said you'd consider a PR I thought I'd ask.

GlassBeaver avatar Nov 28 '25 15:11 GlassBeaver