Skip to content

Commit f171ae8

Browse files
authored
[NFC] Remove misleading function (microsoft#6088)
The IsRay() function defined in the ShaderModel class can be misleading. It is included in a set of functions that are used to test whether or not the shader in question was targeted to a specific shader stage. However, it is impossible for a shader to be targeted to, say, the "raygeneration" stage, or any other stages associated with the kinds that the IsRay() function checks for. Like the "node" shader kind, a shader can only have these shader kinds if the associated attribute is found on the function declaration. To prevent confusion, and to keep the Is*() functions inside the ShaderModel class restricted to only those targetable shader stages, the IsRay() function can be removed. This PR comes as a response to microsoft#6008
1 parent 8a37a92 commit f171ae8

File tree

3 files changed

+0
-11
lines changed

3 files changed

+0
-11
lines changed

include/dxc/DXIL/DxilShaderModel.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,10 @@ class ShaderModel {
4444
bool IsDS() const { return m_Kind == Kind::Domain; }
4545
bool IsCS() const { return m_Kind == Kind::Compute; }
4646
bool IsLib() const { return m_Kind == Kind::Library; }
47-
bool IsRay() const {
48-
return m_Kind >= Kind::RayGeneration && m_Kind <= Kind::Callable;
49-
}
5047
bool IsMS() const { return m_Kind == Kind::Mesh; }
5148
bool IsAS() const { return m_Kind == Kind::Amplification; }
5249
bool IsValid() const;
5350
bool IsValidForDxil() const;
54-
bool IsValidForModule() const;
5551

5652
Kind GetKind() const { return m_Kind; }
5753
unsigned GetMajor() const { return m_Major; }

lib/DXIL/DxilModule.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ void DxilModule::SetShaderModel(const ShaderModel *pSM, bool bUseMinPrecision) {
117117
"shader model must not change for the module");
118118
DXASSERT(pSM != nullptr && pSM->IsValidForDxil(),
119119
"shader model must be valid");
120-
DXASSERT(pSM->IsValidForModule(),
121-
"shader model must be valid for top-level module use");
122120
m_pSM = pSM;
123121
m_pSM->GetDxilVersion(m_DxilMajor, m_DxilMinor);
124122
m_pMDHelper->SetShaderModel(m_pSM);

lib/DXIL/DxilShaderModel.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ bool ShaderModel::IsValidForDxil() const {
7474
return false;
7575
}
7676

77-
bool ShaderModel::IsValidForModule() const {
78-
// Ray tracing shader model should only be used on functions in a lib
79-
return IsValid() && !IsRay();
80-
}
81-
8277
const ShaderModel *ShaderModel::Get(Kind Kind, unsigned Major, unsigned Minor) {
8378
/* <py::lines('VALRULE-TEXT')>hctdb_instrhelp.get_shader_model_get()</py>*/
8479
// VALRULE-TEXT:BEGIN

0 commit comments

Comments
 (0)