Skip to content

Commit d43662d

Browse files
committed
Implement DXC layout cli options.
1 parent 0b809d5 commit d43662d

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9320,6 +9320,16 @@ def fspv_extension_EQ
93209320
Group<dxc_Group>,
93219321
HelpText<"Specify the available SPIR-V extensions. If this option is not "
93229322
"specified, then all extensions are available.">;
9323+
def fvk_use_dx_layout
9324+
: DXCFlag<"fvk-use-dx-layout">,
9325+
HelpText<"Use DirectX memory layout for Vulkan resources.">;
9326+
def fvk_use_gl_layout
9327+
: DXCFlag<"fvk-use-gl-layout">,
9328+
HelpText<"Use strict OpenGL std140/std430 memory layout for Vulkan resources.">;
9329+
def fvk_use_scalar_layout
9330+
: DXCFlag<"fvk-use-scalar-layout">,
9331+
HelpText<"Use scalar memory layout for Vulkan resources.">;
9332+
93239333
def no_wasm_opt : Flag<["--"], "no-wasm-opt">,
93249334
Group<m_Group>,
93259335
HelpText<"Disable the wasm-opt optimizer">,

clang/lib/Driver/ToolChains/HLSL.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ bool checkExtensionArgsAreValid(ArrayRef<std::string> SpvExtensionArgs,
200200
for (auto Extension : SpvExtensionArgs) {
201201
if (!isValidSPIRVExtensionName(Extension)) {
202202
Driver.Diag(diag::err_drv_invalid_value)
203-
<< "-fspv_extension" << Extension;
203+
<< "-fspv-extension" << Extension;
204204
AllValid = false;
205205
}
206206
}
@@ -330,6 +330,25 @@ HLSLToolChain::TranslateArgs(const DerivedArgList &Args, StringRef BoundArch,
330330
A->claim();
331331
continue;
332332
}
333+
334+
if (A->getOption().getID() == options::OPT_fvk_use_dx_layout) {
335+
// This is the only implemented layout so far.
336+
A->claim();
337+
continue;
338+
}
339+
340+
if (A->getOption().getID() == options::OPT_fvk_use_scalar_layout) {
341+
getDriver().Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
342+
A->claim();
343+
continue;
344+
}
345+
346+
if (A->getOption().getID() == options::OPT_fvk_use_gl_layout) {
347+
getDriver().Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
348+
A->claim();
349+
continue;
350+
}
351+
333352
DAL->append(A);
334353
}
335354

clang/test/Driver/dxc_fspv_extension.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
// Check for the error message if the extension name is not properly formed.
1414
// RUN: not %clang_dxc -spirv -Tlib_6_7 -### %s -fspv-extension=TEST1 -fspv-extension=SPV_GOOD -fspv-extension=TEST2 2>&1 | FileCheck %s -check-prefix=FAIL
15-
// FAIL: invalid value 'TEST1' in '-fspv_extension'
16-
// FAIL: invalid value 'TEST2' in '-fspv_extension'
15+
// FAIL: invalid value 'TEST1' in '-fspv-extension'
16+
// FAIL: invalid value 'TEST2' in '-fspv-extension'
1717

1818
// If targeting DXIL, the `-spirv-ext` should not be passed to the backend.
1919
// RUN: %clang_dxc -Tlib_6_7 -### %s 2>&1 | FileCheck %s -check-prefix=DXIL

0 commit comments

Comments
 (0)