microsoft / microsoft/hlsl-specs

[Feature] Compile VS/PS simultaneously to support interpolant stripping

Open
#331 3 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TeX
Stars
222
Forks
57
Avg merge
4d 16h
Merged PRs (30d)
5

Description

Currently, shaders of different frequencies are fed to the compiler one at a time. This is true not just for vertex and pixel shaders, but other shaders that feed data between stages. The issue is that when compiled in isolation, the compiler has no knowledge of what inter-stage data will or will not be used when the shader module is ultimately linked in the final PSO. To manage this currently, ISVs need to juggle the VS output/PS input data in code-gen or with preprocessor magic.

VS and PS being the common case, it would be great to have an option of compiling both simultaneously, thereby giving the compiler knowledge about what inter-stage data is needed so it can strip unused entries. The interface to DXC becomes a bit more complicated because you conceivable need to namespace all DXC CLI flags/options for the frequency in question. I suggest we have a "separator" option to group flags intended for only one stage vs another. For example:

dxc.exe -I common/include/path \
    -BeginVS -I vs/only -DVSDefinition -EVSMain -Tvs_6_6 VS.hlsl -EndVS \
    -BeginPS -EPSMain -Tps_6_6 PS.hlsl -EndPS

or something to this effect. The mechanism for retrieving outputs would also need to change since the objects (DXC_OUT, pdb, reflection, etc.) are now different for each frequency in one atomic compilation. I would suggest a GetOutput1 method on an IDxcResult1 which accepts an index for the shader to retrieve data from.

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.

Research direction

Start with the DXC command-line interface and the IDxcResult1/GetOutput1 interface described in the issue. Review the proposed per-stage option grouping and output retrieval needs; done means an agreed specification for simultaneous shader compilation, stage-specific options, and separate outputs for each shader frequency.

Written by the indexing model from the issue text.

Assessment

Domain
compilers, computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.