Skip to content

Commit 9cb683f

Browse files
authored
[NFC] Remove unnecessary copies of D3D_SHADER_MODEL_* (#7940)
Now that we're using recent SDKs we don't need duplicate copies of these.
1 parent bcb1bca commit 9cb683f

File tree

4 files changed

+11
-66
lines changed

4 files changed

+11
-66
lines changed

tools/clang/unittests/HLSLExec/ExecutionTest.cpp

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -516,32 +516,6 @@ class ExecutionTest {
516516
// Do not remove the following line - it is used by TranslateExecutionTest.py
517517
// MARKER: ExecutionTest/DxilConf Shared Implementation Start
518518

519-
// We define D3D_SHADER_MODEL enum values as we don't generally have access to
520-
// the latest D3D headers when adding tests for a new SM being added.
521-
using D3D_SHADER_MODEL = ExecTestUtils::D3D_SHADER_MODEL;
522-
static constexpr ExecTestUtils::D3D_SHADER_MODEL D3D_SHADER_MODEL_6_0 =
523-
ExecTestUtils::D3D_SHADER_MODEL_6_0;
524-
static constexpr ExecTestUtils::D3D_SHADER_MODEL D3D_SHADER_MODEL_6_1 =
525-
ExecTestUtils::D3D_SHADER_MODEL_6_1;
526-
static constexpr ExecTestUtils::D3D_SHADER_MODEL D3D_SHADER_MODEL_6_2 =
527-
ExecTestUtils::D3D_SHADER_MODEL_6_2;
528-
static constexpr ExecTestUtils::D3D_SHADER_MODEL D3D_SHADER_MODEL_6_3 =
529-
ExecTestUtils::D3D_SHADER_MODEL_6_3;
530-
static constexpr ExecTestUtils::D3D_SHADER_MODEL D3D_SHADER_MODEL_6_4 =
531-
ExecTestUtils::D3D_SHADER_MODEL_6_4;
532-
static constexpr ExecTestUtils::D3D_SHADER_MODEL D3D_SHADER_MODEL_6_5 =
533-
ExecTestUtils::D3D_SHADER_MODEL_6_5;
534-
static constexpr ExecTestUtils::D3D_SHADER_MODEL D3D_SHADER_MODEL_6_6 =
535-
ExecTestUtils::D3D_SHADER_MODEL_6_6;
536-
static constexpr ExecTestUtils::D3D_SHADER_MODEL D3D_SHADER_MODEL_6_7 =
537-
ExecTestUtils::D3D_SHADER_MODEL_6_7;
538-
static constexpr ExecTestUtils::D3D_SHADER_MODEL D3D_SHADER_MODEL_6_8 =
539-
ExecTestUtils::D3D_SHADER_MODEL_6_8;
540-
static constexpr ExecTestUtils::D3D_SHADER_MODEL D3D_SHADER_MODEL_6_9 =
541-
ExecTestUtils::D3D_SHADER_MODEL_6_9;
542-
static constexpr ExecTestUtils::D3D_SHADER_MODEL D3D_HIGHEST_SHADER_MODEL =
543-
ExecTestUtils::D3D_HIGHEST_SHADER_MODEL;
544-
545519
bool SaveImages() { return GetTestParamBool(L"SaveImages"); }
546520

547521
// Base class used by raw gather test for polymorphic assignments
@@ -11793,7 +11767,7 @@ bool HelperLaneResultLogAndVerify(const wchar_t *testDesc,
1179311767
return matches;
1179411768
}
1179511769

11796-
bool VerifyHelperLaneWaveResults(ExecutionTest::D3D_SHADER_MODEL sm,
11770+
bool VerifyHelperLaneWaveResults(D3D_SHADER_MODEL sm,
1179711771
HelperLaneWaveTestResult &testResults,
1179811772
HelperLaneWaveTestResult &expectedResults,
1179911773
bool verifyQuads) {
@@ -11861,7 +11835,7 @@ bool VerifyHelperLaneWaveResults(ExecutionTest::D3D_SHADER_MODEL sm,
1186111835
quad_tr_exp.is_helper_across_Diag, quad_tr.is_helper_across_Diag);
1186211836
}
1186311837

11864-
if (sm >= ExecutionTest::D3D_SHADER_MODEL_6_5) {
11838+
if (sm >= D3D_SHADER_MODEL_6_5) {
1186511839
HelperLaneWaveTestResult65 &tr65 = testResults.sm65;
1186611840
HelperLaneWaveTestResult65 &tr65exp = expectedResults.sm65;
1186711841

@@ -11893,7 +11867,7 @@ bool VerifyHelperLaneWaveResults(ExecutionTest::D3D_SHADER_MODEL sm,
1189311867
// to dispatch three waves that each process only a single vertex.
1189411868
// So instead of compare with fixed expected result, calculate the correct
1189511869
// result from ballot.
11896-
bool VerifyHelperLaneWaveResultsForVS(ExecutionTest::D3D_SHADER_MODEL sm,
11870+
bool VerifyHelperLaneWaveResultsForVS(D3D_SHADER_MODEL sm,
1189711871
HelperLaneWaveTestResult &testResults) {
1189811872
bool passed = true;
1189911873
XMUINT4 mask = testResults.sm60.ballot;
@@ -11955,7 +11929,7 @@ bool VerifyHelperLaneWaveResultsForVS(ExecutionTest::D3D_SHADER_MODEL sm,
1195511929
2 * (countBits - 1), tr60.prefixSum);
1195611930
}
1195711931

11958-
if (sm >= ExecutionTest::D3D_SHADER_MODEL_6_5) {
11932+
if (sm >= D3D_SHADER_MODEL_6_5) {
1195911933
HelperLaneWaveTestResult65 &tr65 = testResults.sm65;
1196011934

1196111935
passed &= HelperLaneResultLogAndVerify(

tools/clang/unittests/HLSLExec/HlslExecTestUtils.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,9 @@ static UINT getD3D12SDKVersion(std::wstring SDKPath) {
6767
return SDKVersion;
6868
}
6969

70-
bool createDevice(ID3D12Device **D3DDevice,
71-
ExecTestUtils::D3D_SHADER_MODEL TestModel,
70+
bool createDevice(ID3D12Device **D3DDevice, D3D_SHADER_MODEL TestModel,
7271
bool SkipUnsupported) {
73-
if (TestModel > ExecTestUtils::D3D_HIGHEST_SHADER_MODEL) {
72+
if (TestModel > D3D_HIGHEST_SHADER_MODEL) {
7473
const UINT Minor = (UINT)TestModel & 0x0f;
7574
hlsl_test::LogCommentFmt(L"Installed SDK does not support "
7675
L"shader model 6.%1u",
@@ -170,16 +169,10 @@ bool createDevice(ID3D12Device **D3DDevice,
170169
return false;
171170

172171
if (!useDxbc()) {
173-
// Check for DXIL support.
174-
typedef struct D3D12_FEATURE_DATA_SHADER_MODEL {
175-
ExecTestUtils::D3D_SHADER_MODEL HighestShaderModel;
176-
} D3D12_FEATURE_DATA_SHADER_MODEL;
177-
const UINT D3D12_FEATURE_SHADER_MODEL = 7;
178172
D3D12_FEATURE_DATA_SHADER_MODEL SMData;
179173
SMData.HighestShaderModel = TestModel;
180-
if (FAILED(D3DDeviceCom->CheckFeatureSupport(
181-
(D3D12_FEATURE)D3D12_FEATURE_SHADER_MODEL, &SMData,
182-
sizeof(SMData))) ||
174+
if (FAILED(D3DDeviceCom->CheckFeatureSupport(D3D12_FEATURE_SHADER_MODEL,
175+
&SMData, sizeof(SMData))) ||
183176
SMData.HighestShaderModel < TestModel) {
184177
const UINT Minor = (UINT)TestModel & 0x0f;
185178
hlsl_test::LogCommentFmt(L"The selected device does not support "

tools/clang/unittests/HLSLExec/HlslExecTestUtils.h

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,12 @@
66

77
#include "dxc/Support/dxcapi.use.h"
88

9-
namespace ExecTestUtils {
10-
// This is defined in d3d.h for Windows 10 Anniversary Edition SDK, but we
11-
// only require the Windows 10 SDK.
12-
typedef enum D3D_SHADER_MODEL {
13-
D3D_SHADER_MODEL_5_1 = 0x51,
14-
D3D_SHADER_MODEL_6_0 = 0x60,
15-
D3D_SHADER_MODEL_6_1 = 0x61,
16-
D3D_SHADER_MODEL_6_2 = 0x62,
17-
D3D_SHADER_MODEL_6_3 = 0x63,
18-
D3D_SHADER_MODEL_6_4 = 0x64,
19-
D3D_SHADER_MODEL_6_5 = 0x65,
20-
D3D_SHADER_MODEL_6_6 = 0x66,
21-
D3D_SHADER_MODEL_6_7 = 0x67,
22-
D3D_SHADER_MODEL_6_8 = 0x68,
23-
D3D_SHADER_MODEL_6_9 = 0x69,
24-
D3D_HIGHEST_SHADER_MODEL = D3D_SHADER_MODEL_6_9
25-
} D3D_SHADER_MODEL;
26-
} // namespace ExecTestUtils
27-
289
bool useDxbc();
2910
HRESULT enableDebugLayer();
3011
HRESULT enableExperimentalMode(HMODULE Runtime);
3112
HRESULT enableAgilitySDK(HMODULE Runtime);
3213
bool createDevice(ID3D12Device **D3DDevice,
33-
ExecTestUtils::D3D_SHADER_MODEL TestModel =
34-
ExecTestUtils::D3D_SHADER_MODEL_6_0,
14+
D3D_SHADER_MODEL TestModel = D3D_SHADER_MODEL_6_0,
3515
bool SkipUnsupported = true);
3616

3717
void readHlslDataIntoNewStream(LPCWSTR RelativePath, IStream **Stream,

tools/clang/unittests/HLSLExec/LongVectors.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,8 +1709,7 @@ class DxilConf_SM69_Vectorized {
17091709
L"FailIfRequirementsNotMet", FailIfRequirementsNotMet);
17101710

17111711
const bool SkipUnsupported = !FailIfRequirementsNotMet;
1712-
createDevice(&D3DDevice, ExecTestUtils::D3D_SHADER_MODEL_6_9,
1713-
SkipUnsupported);
1712+
createDevice(&D3DDevice, D3D_SHADER_MODEL_6_9, SkipUnsupported);
17141713
}
17151714

17161715
return true;
@@ -1722,8 +1721,7 @@ class DxilConf_SM69_Vectorized {
17221721
if (!D3DDevice || D3DDevice->GetDeviceRemovedReason() != S_OK) {
17231722
hlsl_test::LogCommentFmt(
17241723
L"Device was lost: Attempting to create a new D3D12 device.");
1725-
VERIFY_IS_TRUE(
1726-
createDevice(&D3DDevice, ExecTestUtils::D3D_SHADER_MODEL_6_9, false));
1724+
VERIFY_IS_TRUE(createDevice(&D3DDevice, D3D_SHADER_MODEL_6_9, false));
17271725
}
17281726

17291727
return true;

0 commit comments

Comments
 (0)