Skip to content
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9887b09
Added rewriter option ConsistentBindings (-consistent-bindings) for t…
Nielsbishere Jul 14, 2025
8454274
Option -consistent-bindings now properly generates bindings for not f…
Nielsbishere Jul 15, 2025
f60c594
Added a test for generating consistent bindings and changed tests to …
Nielsbishere Jul 15, 2025
74283d1
Applied clang format
Nielsbishere Jul 16, 2025
6f5689d
Now supporting multi dimensional register arrays for -consistent-bind…
Nielsbishere Aug 3, 2025
26a7f54
Removed rewriter option -consistent-bindings and now doing it in the …
Nielsbishere Sep 1, 2025
b63cdd2
Reset some incorrect merges
Nielsbishere Sep 1, 2025
8d7dc86
Cleanup for PR
Nielsbishere Sep 1, 2025
298ff34
clang format
Nielsbishere Sep 1, 2025
28b24f1
Clang format again
Nielsbishere Sep 1, 2025
cb9f345
Added two unit tests; one for more complex scenarios (e.g. overlappin…
Nielsbishere Nov 5, 2025
777a50e
RemoveResourcesWithUnusedSymbolsHelper and RemoveResourcesWithUnusedS…
Nielsbishere Nov 6, 2025
3fc2f2e
Applied clang format
Nielsbishere Nov 6, 2025
f5c545b
Merge upstream into fork
Nielsbishere Nov 6, 2025
ea760bf
Fixed an issue where resources without a global variable would not pr…
Nielsbishere Nov 7, 2025
9169ce0
Added -fhlsl-unused-resource-bindings<value> with options strip or re…
Nielsbishere Nov 12, 2025
6a15db9
Updated unit tests
Nielsbishere Nov 12, 2025
895724d
Merge branch 'main' of https://github.com/Microsoft/DirectXShaderComp…
Nielsbishere Nov 12, 2025
a633dc6
Clang format that somehow doesn't get formatted correctly?
Nielsbishere Nov 12, 2025
316e493
PR feedback, re. reserve-all, bChanged and revert formatting done to …
Nielsbishere Nov 13, 2025
68f20d6
Merge branch 'rewriter_generate_consistent_bindings' of https://githu…
Nielsbishere Nov 13, 2025
6d0531b
Removed ConsistentBindings from intermediate flags and moved it to Dx…
Nielsbishere Nov 13, 2025
75f9cc0
Clang format
Nielsbishere Nov 13, 2025
c2b24ed
Changed modif to Changed
NielsbishereAlt Nov 19, 2025
d018f94
Removed leftover b in front of bUnusedResourceBinding, removed unused…
Nielsbishere Nov 19, 2025
c8efa7b
RemoveResourcesWithUnusedSymbolsHelper is now the one properly skippi…
Nielsbishere Nov 19, 2025
5c96b53
Removed leftover code
Nielsbishere Nov 19, 2025
77275a4
Clang format and remove leftover dxil shader flag enum class
Nielsbishere Nov 19, 2025
ba1b43b
Moved legacyResourceReservation into UnusedResourceBinding::ReserveEx…
Nielsbishere Nov 21, 2025
2f482a9
Clang format
Nielsbishere Nov 21, 2025
4492c44
HLModule::RemoveGlobal now relies on DxilCondenseResources to remove …
Nielsbishere Nov 21, 2025
118363f
Clang format
Nielsbishere Nov 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The included licenses apply to the following files:
- Fixed regression: [#7508](https://github.com/microsoft/DirectXShaderCompiler/issues/7508) crash when calling `Load` with `status`.
- Header file `dxcpix.h` was added to the release package.
- Moved Linear Algebra (Cooperative Vector) DXIL Opcodes to experimental Shader Model 6.10
- Added `-fhlsl-unused-resource-bindings=<value>` an option to allow deciding on how to treat unused resource bindings in DXIL; `strip` (default) or `reserve-all`. `strip` will strip unused resources before generating bindings for resources without a `: register`, and `reserve-all` will keep them reserved for generated bindings while stripping them afterwards. See [explanation](https://github.com/microsoft/DirectXShaderCompiler/pull/7643#issuecomment-3496917202) for more details.

### Version 1.8.2505

Expand Down
6 changes: 6 additions & 0 deletions include/dxc/DXIL/DxilConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@

namespace hlsl {

enum class UnusedResourceBinding : uint32_t { Strip, ReserveAll, Count };

static_assert(UnusedResourceBinding::Count <= UnusedResourceBinding(7),
"Only 3 bits are reserved for UnusedResourceBinding by HLOptions "
"and ShaderFlags");

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this!

/* <py>
import hctdb_instrhelp
</py> */
Expand Down
10 changes: 6 additions & 4 deletions include/dxc/DXIL/DxilModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class DxilModule {
const std::vector<std::unique_ptr<DxilResource>> &GetUAVs() const;

void RemoveUnusedResources();
void RemoveResourcesWithUnusedSymbols();
bool RemoveResourcesWithUnusedSymbols();
void RemoveFunction(llvm::Function *F);

bool RenameResourcesWithPrefix(const std::string &prefix);
Expand Down Expand Up @@ -287,6 +287,9 @@ class DxilModule {
// Intermediate options that do not make it to DXIL
void SetLegacyResourceReservation(bool legacyResourceReservation);
bool GetLegacyResourceReservation() const;

void SetUnusedResourceBinding(UnusedResourceBinding unusedResourceBinding);
UnusedResourceBinding GetUnusedResourceBinding() const;
void ClearIntermediateOptions();

// Hull and Domain shaders.
Expand Down Expand Up @@ -344,9 +347,7 @@ class DxilModule {
DXIL::PrimitiveTopology::Undefined;
unsigned m_ActiveStreamMask = 0;

enum IntermediateFlags : uint32_t {
LegacyResourceReservation = 1 << 0,
};
enum IntermediateFlags : uint32_t { LegacyResourceReservation = 1 << 0 };

llvm::LLVMContext &m_Ctx;
llvm::Module *m_pModule = nullptr;
Expand Down Expand Up @@ -383,6 +384,7 @@ class DxilModule {
bool m_bUseMinPrecision = true; // use min precision by default;
bool m_bAllResourcesBound = false;
bool m_bResMayAlias = false;
UnusedResourceBinding m_unusedResourceBinding = UnusedResourceBinding::Strip;

// properties from HLModule that should not make it to the final DXIL
uint32_t m_IntermediateFlags = 0;
Expand Down
13 changes: 12 additions & 1 deletion include/dxc/DXIL/DxilShaderFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
namespace hlsl {
class DxilModule;
struct DxilFunctionProps;
enum class UnusedResourceBinding : uint32_t;
}

namespace llvm {
Expand Down Expand Up @@ -219,6 +220,14 @@ class ShaderFlags {
void SetRequiresGroup(bool flag) { m_bRequiresGroup = flag; }
bool GetRequiresGroup() const { return m_bRequiresGroup; }

void SetUnusedResourceBinding(UnusedResourceBinding bindings) {
m_UnusedResourceBinding = unsigned(bindings);
}

UnusedResourceBinding GetUnusedResourceBinding() {
return UnusedResourceBinding(m_UnusedResourceBinding);
}

private:
// Bit: 0
unsigned
Expand Down Expand Up @@ -359,7 +368,9 @@ class ShaderFlags {
unsigned m_bRequiresGroup : 1; // SHADER_FEATURE_OPT_REQUIRES_GROUP
// (OptFeatureInfo_RequiresGroup)

uint32_t m_align1 : 23; // align to 64 bit.
unsigned m_UnusedResourceBinding : 3;

uint32_t m_align1 : 20; // align to 64 bit.
};

} // namespace hlsl
5 changes: 3 additions & 2 deletions include/dxc/HLSL/HLModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct HLOptions {
bDisableOptimizations(false), PackingStrategy(0),
bUseMinPrecision(false), bDX9CompatMode(false), bFXCCompatMode(false),
bLegacyResourceReservation(false), bForceZeroStoreLifetimes(false),
unused(0) {}
bUnusedResourceBinding(0), unused(0) {}
uint32_t GetHLOptionsRaw() const;
void SetHLOptionsRaw(uint32_t data);
unsigned bDefaultRowMajor : 1;
Expand All @@ -70,7 +70,8 @@ struct HLOptions {
unsigned bLegacyResourceReservation : 1;
unsigned bForceZeroStoreLifetimes : 1;
unsigned bResMayAlias : 1;
unsigned unused : 19;
unsigned bUnusedResourceBinding : 3;
unsigned unused : 17;
};

typedef std::unordered_map<const llvm::Function *,
Expand Down
5 changes: 4 additions & 1 deletion include/dxc/Support/HLSLOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Option/ArgList.h"

#include "dxc/DXIL/DxilConstants.h"
#include "dxc/Support/WinIncludes.h"

#include "dxc/dxcapi.h"
Expand Down Expand Up @@ -227,7 +228,9 @@ class DxcOpts {
std::string TimeTrace = ""; // OPT_ftime_trace[EQ]
unsigned TimeTraceGranularity = 500; // OPT_ftime_trace_granularity_EQ
bool VerifyDiagnostics = false; // OPT_verify
bool Verbose = false; // OPT_verbose
UnusedResourceBinding UnusedResourceBinding =
UnusedResourceBinding::Strip; // OPT_fhlsl_unused_resource_bindings_EQ
bool Verbose = false; // OPT_verbose

// Optimization pass enables, disables and selects
OptimizationToggles
Expand Down
3 changes: 3 additions & 0 deletions include/dxc/Support/HLSLOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,9 @@ def getprivate : JoinedOrSeparate<["-", "/"], "getprivate">, Flags<[DriverOption
def nologo : Flag<["-", "/"], "nologo">, Group<hlslcore_Group>, Flags<[DriverOption, HelpHidden]>,
HelpText<"Suppress copyright message">;

def fhlsl_unused_resource_bindings_EQ : Joined<["-"], "fhlsl-unused-resource-bindings=">, Group<hlslcomp_Group>, Flags<[CoreOption]>,
HelpText<"Control handling of unused resource bindings:\n\t\t\t'strip' (default, unused resources are stripped and their binding slots are freed up).\n\t\t\t'reserve-all' (do not use binding slots of unused resources when assigning bindings).">;

//////////////////////////////////////////////////////////////////////////////
// Rewriter Options

Expand Down
27 changes: 21 additions & 6 deletions lib/DXIL/DxilModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,15 @@ bool DxilModule::GetLegacyResourceReservation() const {
return (m_IntermediateFlags & LegacyResourceReservation) != 0;
}

void DxilModule::SetUnusedResourceBinding(
UnusedResourceBinding unusedResourceBinding) {
m_unusedResourceBinding = unusedResourceBinding;
}

UnusedResourceBinding DxilModule::GetUnusedResourceBinding() const {
return m_unusedResourceBinding;
}

void DxilModule::ClearIntermediateOptions() { m_IntermediateFlags = 0; }

unsigned DxilModule::GetInputControlPointCount() const {
Expand Down Expand Up @@ -1021,8 +1030,9 @@ void DxilModule::RemoveUnusedResources() {

namespace {
template <typename TResource>
static void RemoveResourcesWithUnusedSymbolsHelper(
static bool RemoveResourcesWithUnusedSymbolsHelper(
std::vector<std::unique_ptr<TResource>> &vec) {
bool modif = false;
unsigned resID = 0;
std::unordered_set<GlobalVariable *>
eraseList; // Need in case of duplicate defs of lib resources
Expand All @@ -1034,6 +1044,7 @@ static void RemoveResourcesWithUnusedSymbolsHelper(
p = vec.erase(c);
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(symbol))
eraseList.insert(GV);
modif = true;
continue;
}
if ((*c)->GetID() != resID) {
Expand All @@ -1044,14 +1055,17 @@ static void RemoveResourcesWithUnusedSymbolsHelper(
for (auto gv : eraseList) {
gv->eraseFromParent();
}
return modif;
}
} // namespace

void DxilModule::RemoveResourcesWithUnusedSymbols() {
RemoveResourcesWithUnusedSymbolsHelper(m_SRVs);
RemoveResourcesWithUnusedSymbolsHelper(m_UAVs);
RemoveResourcesWithUnusedSymbolsHelper(m_CBuffers);
RemoveResourcesWithUnusedSymbolsHelper(m_Samplers);
bool DxilModule::RemoveResourcesWithUnusedSymbols() {
bool modif = false;
modif |= RemoveResourcesWithUnusedSymbolsHelper(m_SRVs);
modif |= RemoveResourcesWithUnusedSymbolsHelper(m_UAVs);
modif |= RemoveResourcesWithUnusedSymbolsHelper(m_CBuffers);
modif |= RemoveResourcesWithUnusedSymbolsHelper(m_Samplers);
return modif;
}

namespace {
Expand Down Expand Up @@ -1533,6 +1547,7 @@ void DxilModule::LoadDxilMetadata() {
m_bUseMinPrecision = !m_ShaderFlags.GetUseNativeLowPrecision();
m_bDisableOptimizations = m_ShaderFlags.GetDisableOptimizations();
m_bAllResourcesBound = m_ShaderFlags.GetAllResourcesBound();
m_unusedResourceBinding = m_ShaderFlags.GetUnusedResourceBinding();
m_bResMayAlias = !m_ShaderFlags.GetResMayNotAlias();
}

Expand Down
3 changes: 2 additions & 1 deletion lib/DXIL/DxilShaderFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ShaderFlags::ShaderFlags()
m_bAdvancedTextureOps(false), m_bWriteableMSAATextures(false),
m_bReserved(false), m_bSampleCmpGradientOrBias(false),
m_bExtendedCommandInfo(false), m_bUsesDerivatives(false),
m_bRequiresGroup(false), m_align1(0) {
m_bRequiresGroup(false), m_UnusedResourceBinding(0), m_align1(0) {
// Silence unused field warnings
(void)m_align1;
}
Expand Down Expand Up @@ -412,6 +412,7 @@ ShaderFlags ShaderFlags::CollectShaderFlags(const Function *F,
flag.SetUseNativeLowPrecision(!M->GetUseMinPrecision());
flag.SetDisableOptimizations(M->GetDisableOptimization());
flag.SetAllResourcesBound(M->GetAllResourcesBound());
flag.SetUnusedResourceBinding(M->GetUnusedResourceBinding());

bool hasDouble = false;
// ddiv dfma drcp d2i d2u i2d u2d.
Expand Down
15 changes: 15 additions & 0 deletions lib/DxcSupport/HLSLOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,21 @@ int ReadDxcOpts(const OptTable *optionTable, unsigned flagsToInclude,
opts.TimeReport = Args.hasFlag(OPT_ftime_report, OPT_INVALID, false);
opts.TimeTrace = Args.hasFlag(OPT_ftime_trace, OPT_INVALID, false) ? "-" : "";
opts.VerifyDiagnostics = Args.hasFlag(OPT_verify, OPT_INVALID, false);

std::string UnusedResources =
Args.getLastArgValue(OPT_fhlsl_unused_resource_bindings_EQ, "strip");

if (UnusedResources == "strip")
opts.UnusedResourceBinding = UnusedResourceBinding::Strip;
else if (UnusedResources == "reserve-all")
opts.UnusedResourceBinding = UnusedResourceBinding::ReserveAll;
else {
errors << "Error: Invalid value for -fhlsl-unused-resource-bindings option "
"specified ("
<< UnusedResources << "). Must be one of: strip, reserve-all";
return 1;
}

opts.Verbose = Args.hasFlag(OPT_verbose, OPT_INVALID, false);
if (Args.hasArg(OPT_ftime_trace_EQ))
opts.TimeTrace = Args.getLastArgValue(OPT_ftime_trace_EQ);
Expand Down
12 changes: 8 additions & 4 deletions lib/HLSL/DxilCondenseResources.cpp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need an IR-based pass test for changes that impact this pass.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do I add that? Any examples? (Same with the comment on DxilGenerationPass.cpp)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding these IR-based tests, there's a helper script: utils/hct/ExtractIRForPassTest.py -h for option help.
You pass in the desired pass and it stops at that point and generates the test output with the needed RUN line. You'll want to add -hlsl-dxilemit to the end of the pass list to emit the metadata.

However, as I was anticipating questions related to how to target this specific area, I tried crafting a test myself. Along the way, I ran into a bug in the pass, so I put a PR up to fix the bug, along with a couple pass tests.

Here's the PR: #7934
You could copy and modify the legalize-resource-phi.ll pass test for the purposes of testing changes to this hlsl-dxil-lower-handle-for-lib pass.

Notice how the metadata indicates unbound resources, then it checks the binding. For this change, this should check several things:

  • The unused resources are removed from the resource list, like the example test already checks.
  • The binding remains as-if the removed resources reserved registers (so u2 has binding 2 instead of 0 as this test currently checks).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do in a bit. Already pulled your PR into mine locally.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tex3d I have a bit of trouble trying to wrap my head around this process. So if I simplify it in steps maybe you can see where it goes wrong.

  1. python3 utils\hct\ExtractIRForPassTest.py D:\programming\repos\DirectXShaderCompiler\tools\clang\test\HLSLFileCheck\d3dreflect\consistent_bindings_simple.hlsl -p hlsl-dxil-lower-handle-for-lib -o test.txt -- -T cs_6_3 -E mainB -auto-binding-space 0 -fhlsl-unused-resource-bindings=reserve-all
  2. Changing the RUN %dxopt line in the file it generated and adding -hlsl-dxilemit there like your example
  3. Changing the UAV line/other checks to my example as well as the other checks to ensure it goes well?
  4. Running the dxopt manually can allow me to see what I should be checking against/validate it goes well

So a few questions:

  • I still get DI (debug info?) in my ll, as well as the dxc version info and resource info. How did you end up stripping that? Qstrip_debug doesn't work.
  • Do I need to use the same HLSL file you generated the IL from so it behaves about the same? Or is the consistent bindings simple test fine as long as I keep similar checks as yours regarding the resources (e.g. check for u1 and u0 to be stripped)

Original file line number Diff line number Diff line change
Expand Up @@ -550,27 +550,31 @@ class DxilLowerCreateHandleForLib : public ModulePass {
ResourceRegisterAllocator.GatherReservedRegisters(DM);

// Remove unused resources.
DM.RemoveResourcesWithUnusedSymbols();
if (DM.GetUnusedResourceBinding() == UnusedResourceBinding::Strip)
bChanged |= DM.RemoveResourcesWithUnusedSymbols();

unsigned newResources = DM.GetCBuffers().size() + DM.GetUAVs().size() +
DM.GetSRVs().size() + DM.GetSamplers().size();
bChanged = bChanged || (numResources != newResources);

if (0 == newResources)
return bChanged;

{
DxilValueCache *DVC = &getAnalysis<DxilValueCache>();
bool bLocalChanged = LegalizeResources(M, DVC);
if (bLocalChanged) {
if (bLocalChanged &&
DM.GetUnusedResourceBinding() == UnusedResourceBinding::Strip) {
// Remove unused resources.
DM.RemoveResourcesWithUnusedSymbols();
bChanged |= DM.RemoveResourcesWithUnusedSymbols();
}
bChanged |= bLocalChanged;
}

bChanged |= ResourceRegisterAllocator.AllocateRegisters(DM);

if (DM.GetUnusedResourceBinding() == UnusedResourceBinding::ReserveAll)
bChanged |= DM.RemoveResourcesWithUnusedSymbols();

// Fill in top-level CBuffer variable usage bit
UpdateCBufferUsage();

Expand Down
2 changes: 2 additions & 0 deletions lib/HLSL/DxilGenerationPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ void InitDxilModuleFromHLModule(HLModule &H, DxilModule &M, bool HasDebugInfo) {
// bool m_bDisableOptimizations;
M.SetDisableOptimization(H.GetHLOptions().bDisableOptimizations);
M.SetLegacyResourceReservation(H.GetHLOptions().bLegacyResourceReservation);
M.SetUnusedResourceBinding(
UnusedResourceBinding(H.GetHLOptions().bUnusedResourceBinding));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need IR-based pass test to ensure intermediate options passed along.

// bool m_bDisableMathRefactoring;
// bool m_bEnableDoublePrecision;
// bool m_bEnableDoubleExtensions;
Expand Down
18 changes: 12 additions & 6 deletions lib/HLSL/HLModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,17 +231,20 @@ void HLModule::RemoveFunction(llvm::Function *F) {
namespace {
template <typename TResource>
bool RemoveResource(std::vector<std::unique_ptr<TResource>> &vec,
GlobalVariable *pVariable, bool keepAllocated) {
GlobalVariable *pVariable, bool keepAllocated,
UnusedResourceBinding unusedResourceBinding) {
for (auto p = vec.begin(), e = vec.end(); p != e; ++p) {
if ((*p)->GetGlobalSymbol() != pVariable)
continue;

if (keepAllocated && (*p)->IsAllocated()) {
if ((keepAllocated && (*p)->IsAllocated()) ||
unusedResourceBinding == UnusedResourceBinding::ReserveAll) {
// Keep the resource, but it has no more symbol.
(*p)->SetGlobalSymbol(UndefValue::get(pVariable->getType()));
} else {
// Erase the resource alltogether and update IDs of subsequent ones
p = vec.erase(p);

for (e = vec.end(); p != e; ++p) {
unsigned ID = (*p)->GetID() - 1;
(*p)->SetID(ID);
Expand All @@ -262,16 +265,19 @@ void HLModule::RemoveGlobal(llvm::GlobalVariable *GV) {
// register range from being allocated to other resources.
bool keepAllocated = GetHLOptions().bLegacyResourceReservation;

UnusedResourceBinding unusedResourceBinding =
UnusedResourceBinding(GetHLOptions().bUnusedResourceBinding);

// This could be considerably faster - check variable type to see which
// resource type this is rather than scanning all lists, and look for
// usage and removal patterns.
if (RemoveResource(m_CBuffers, GV, keepAllocated))
if (RemoveResource(m_CBuffers, GV, keepAllocated, unusedResourceBinding))
return;
if (RemoveResource(m_SRVs, GV, keepAllocated))
if (RemoveResource(m_SRVs, GV, keepAllocated, unusedResourceBinding))
return;
if (RemoveResource(m_UAVs, GV, keepAllocated))
if (RemoveResource(m_UAVs, GV, keepAllocated, unusedResourceBinding))
return;
if (RemoveResource(m_Samplers, GV, keepAllocated))
if (RemoveResource(m_Samplers, GV, keepAllocated, unusedResourceBinding))
return;
// TODO: do m_TGSMVariables and m_StreamOutputs need maintenance?
}
Expand Down
3 changes: 3 additions & 0 deletions tools/clang/include/clang/Frontend/CodeGenOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ class CodeGenOptions : public CodeGenOptionsBase {
bool HLSLOnlyWarnOnUnrollFail = false;
/// Whether use legacy resource reservation.
bool HLSLLegacyResourceReservation = false;
/// How to handle unused resource bindings.
hlsl::UnusedResourceBinding HLSLUnusedResourceBinding =
hlsl::UnusedResourceBinding::Strip;
/// Set [branch] on every if.
bool HLSLPreferControlFlow = false;
/// Set [flatten] on every if.
Expand Down
2 changes: 2 additions & 0 deletions tools/clang/lib/CodeGen/CGHLSLMS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ CGMSHLSLRuntime::CGMSHLSLRuntime(CodeGenModule &CGM)
opts.PackingStrategy = CGM.getCodeGenOpts().HLSLSignaturePackingStrategy;
opts.bLegacyResourceReservation =
CGM.getCodeGenOpts().HLSLLegacyResourceReservation;
opts.bUnusedResourceBinding =
unsigned(CGM.getCodeGenOpts().HLSLUnusedResourceBinding);
opts.bForceZeroStoreLifetimes =
CGM.getCodeGenOpts().HLSLForceZeroStoreLifetimes;

Expand Down
Loading