microsoft / microsoft/DirectXShaderCompiler

How to remove unused cbuffer?

Open
#4,273 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement rewriter
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

Hi, I used IDxcRewriter2::RewriteWithOptions rewrite my shader.
The options set with L"-E", L"vsMain", L"-remove-unused-globals", L"-remove-unused-functions", L"-extract-entry-uniforms".
I expected the result code not contain the "psMain" entry used cbuffer.
Actually, the code contain.
Entry "vsMain" & "psMain" in the same file.
How to remove it? I cann't find the options.
Thanks.

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 reproducing the issue through IDxcRewriter2::RewriteWithOptions using the listed options, with vsMain and psMain in the same shader. Trace how -remove-unused-globals, -remove-unused-functions, and -extract-entry-uniforms handle the cbuffer used by psMain. Done means confirming whether the cbuffer is removed for the selected entry point or documenting the supported behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.