Skip to content

Commit

Permalink
[NFC] Remove misleading function (microsoft#6088)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bob80905 authored Dec 2, 2023
1 parent 8a37a92 commit f171ae8
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 11 deletions.
4 changes: 0 additions & 4 deletions include/dxc/DXIL/DxilShaderModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,10 @@ class ShaderModel {
bool IsDS() const { return m_Kind == Kind::Domain; }
bool IsCS() const { return m_Kind == Kind::Compute; }
bool IsLib() const { return m_Kind == Kind::Library; }
bool IsRay() const {
return m_Kind >= Kind::RayGeneration && m_Kind <= Kind::Callable;
}
bool IsMS() const { return m_Kind == Kind::Mesh; }
bool IsAS() const { return m_Kind == Kind::Amplification; }
bool IsValid() const;
bool IsValidForDxil() const;
bool IsValidForModule() const;

Kind GetKind() const { return m_Kind; }
unsigned GetMajor() const { return m_Major; }
Expand Down
2 changes: 0 additions & 2 deletions lib/DXIL/DxilModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ void DxilModule::SetShaderModel(const ShaderModel *pSM, bool bUseMinPrecision) {
"shader model must not change for the module");
DXASSERT(pSM != nullptr && pSM->IsValidForDxil(),
"shader model must be valid");
DXASSERT(pSM->IsValidForModule(),
"shader model must be valid for top-level module use");
m_pSM = pSM;
m_pSM->GetDxilVersion(m_DxilMajor, m_DxilMinor);
m_pMDHelper->SetShaderModel(m_pSM);
Expand Down
5 changes: 0 additions & 5 deletions lib/DXIL/DxilShaderModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ bool ShaderModel::IsValidForDxil() const {
return false;
}

bool ShaderModel::IsValidForModule() const {
// Ray tracing shader model should only be used on functions in a lib
return IsValid() && !IsRay();
}

const ShaderModel *ShaderModel::Get(Kind Kind, unsigned Major, unsigned Minor) {
/* <py::lines('VALRULE-TEXT')>hctdb_instrhelp.get_shader_model_get()</py>*/
// VALRULE-TEXT:BEGIN
Expand Down

0 comments on commit f171ae8

Please sign in to comment.