Skip to content

Commit

Permalink
Make shader model related code generated. (#2629)
Browse files Browse the repository at this point in the history
* Make shader model related code generated.
  • Loading branch information
python3kgae authored Dec 30, 2019
1 parent e8422a4 commit 9c89a1c
Show file tree
Hide file tree
Showing 6 changed files with 461 additions and 137 deletions.
3 changes: 3 additions & 0 deletions include/dxc/DXIL/DxilConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ import hctdb_instrhelp
namespace DXIL {
// DXIL version.
const unsigned kDxilMajor = 1;
/* <py::lines('VALRULE-TEXT')>hctdb_instrhelp.get_dxil_version_minor()</py>*/
// VALRULE-TEXT:BEGIN
const unsigned kDxilMinor = 5;
// VALRULE-TEXT:END

inline unsigned MakeDxilVersion(unsigned DxilMajor, unsigned DxilMinor) {
return 0 | (DxilMajor << 8) | (DxilMinor);
Expand Down
32 changes: 16 additions & 16 deletions include/dxc/DXIL/DxilShaderModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ class ShaderModel {
using Kind = DXIL::ShaderKind;

// Major/Minor version of highest shader model
/* <py::lines('VALRULE-TEXT')>hctdb_instrhelp.get_highest_shader_model()</py>*/
// VALRULE-TEXT:BEGIN
static const unsigned kHighestMajor = 6;
static const unsigned kHighestMinor = 5;
// VALRULE-TEXT:END
static const unsigned kOfflineMinor = 0xF;

bool IsPS() const { return m_Kind == Kind::Pixel; }
Expand All @@ -56,25 +59,20 @@ class ShaderModel {
}
bool IsSM50Plus() const { return IsSMAtLeast(5, 0); }
bool IsSM51Plus() const { return IsSMAtLeast(5, 1); }
bool IsSM60Plus() const { return IsSMAtLeast(6, 0); }
bool IsSM61Plus() const { return IsSMAtLeast(6, 1); }
bool IsSM62Plus() const { return IsSMAtLeast(6, 2); }
bool IsSM63Plus() const { return IsSMAtLeast(6, 3); }
bool IsSM64Plus() const { return IsSMAtLeast(6, 4); }
bool IsSM65Plus() const { return IsSMAtLeast(6, 5); }
/* <py::lines('VALRULE-TEXT')>hctdb_instrhelp.get_is_shader_model_plus()</py>*/
// VALRULE-TEXT:BEGIN
bool IsSM60Plus() const { return IsSMAtLeast(6, 0); }
bool IsSM61Plus() const { return IsSMAtLeast(6, 1); }
bool IsSM62Plus() const { return IsSMAtLeast(6, 2); }
bool IsSM63Plus() const { return IsSMAtLeast(6, 3); }
bool IsSM64Plus() const { return IsSMAtLeast(6, 4); }
bool IsSM65Plus() const { return IsSMAtLeast(6, 5); }
// VALRULE-TEXT:END
const char *GetName() const { return m_pszName; }
const char *GetKindName() const;
unsigned GetNumTempRegs() const { return DXIL::kMaxTempRegCount; }
unsigned GetNumInputRegs() const { return m_NumInputRegs; }
unsigned GetNumOutputRegs() const { return m_NumOutputRegs; }
unsigned GetCBufferSize() const { return DXIL::kMaxCBufferSize; }
unsigned SupportsUAV() const { return m_bUAVs; }
unsigned SupportsTypedUAVs() const { return m_bTypedUavs; }
unsigned GetUAVRegLimit() const { return m_NumUAVRegs; }

DXIL::PackingStrategy GetDefaultPackingStrategy() const { return DXIL::PackingStrategy::PrefixStable; }

static unsigned Count() { return kNumShaderModels - 1; }
static const ShaderModel *Get(unsigned Idx);
static const ShaderModel *Get(Kind Kind, unsigned Major, unsigned Minor);
static const ShaderModel *GetByName(const char *pszName);
static const char *GetKindName(Kind kind);
Expand All @@ -97,8 +95,10 @@ class ShaderModel {
ShaderModel(Kind Kind, unsigned Major, unsigned Minor, const char *pszName,
unsigned m_NumInputRegs, unsigned m_NumOutputRegs,
bool m_bUAVs, bool m_bTypedUavs, unsigned m_UAVRegsLim);

/* <py::lines('VALRULE-TEXT')>hctdb_instrhelp.get_num_shader_models()</py>*/
// VALRULE-TEXT:BEGIN
static const unsigned kNumShaderModels = 65;
// VALRULE-TEXT:END
static const ShaderModel ms_ShaderModels[kNumShaderModels];

static const ShaderModel *GetInvalid();
Expand Down
5 changes: 4 additions & 1 deletion include/dxc/Support/HLSLOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,10 @@ def Oconfig : CommaJoined<["-"], "Oconfig=">, Group<spirv_Group>, Flags<[CoreOpt
// fxc-based flags that don't match those previously defined.

def target_profile : JoinedOrSeparate<["-", "/"], "T">, Flags<[CoreOption]>, Group<hlslcomp_Group>, MetaVarName<"<profile>">,
HelpText<"Set target profile. \n\t<profile>: ps_6_0, ps_6_1, ps_6_2, ps_6_3, ps_6_4, ps_6_5, \n\t\t vs_6_0, vs_6_1, vs_6_2, vs_6_3, vs_6_4, vs_6_5, \n\t\t cs_6_0, cs_6_1, cs_6_2, cs_6_3, cs_6_4, cs_6_5, \n\t\t gs_6_0, gs_6_1, gs_6_2, gs_6_3, gs_6_4, gs_6_5, \n\t\t ds_6_0, ds_6_1, ds_6_2, ds_6_3, ds_6_4, ds_6_5, \n\t\t hs_6_0, hs_6_1, hs_6_2, hs_6_3, hs_6_4, hs_6_5, \n\t\t lib_6_3, lib_6_4, lib_6_5, ms_6_5, as_6_5">;
/* <py::lines('VALRULE-TEXT')>hctdb_instrhelp.get_target_profiles()</py>*/
// VALRULE-TEXT:BEGIN
HelpText<"Set target profile. \n\t<profile>: ps_6_0, ps_6_1, ps_6_2, ps_6_3, ps_6_4, ps_6_5, \n\t\t vs_6_0, vs_6_1, vs_6_2, vs_6_3, vs_6_4, vs_6_5, \n\t\t gs_6_0, gs_6_1, gs_6_2, gs_6_3, gs_6_4, gs_6_5, \n\t\t hs_6_0, hs_6_1, hs_6_2, hs_6_3, hs_6_4, hs_6_5, \n\t\t ds_6_0, ds_6_1, ds_6_2, ds_6_3, ds_6_4, ds_6_5, \n\t\t cs_6_0, cs_6_1, cs_6_2, cs_6_3, cs_6_4, cs_6_5, \n\t\t lib_6_1, lib_6_2, lib_6_3, lib_6_4, lib_6_5, \n\t\t ms_6_5, \n\t\t as_6_5, \n\t\t ">;
// VALRULE-TEXT:END
def entrypoint : JoinedOrSeparate<["-", "/"], "E">, Flags<[CoreOption]>, Group<hlslcomp_Group>,
HelpText<"Entry point name">;
// /I <include> - already defined above
Expand Down
Loading

0 comments on commit 9c89a1c

Please sign in to comment.