From 0b808453407f8feef8574cae99afd90771712185 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 24 Aug 2022 13:09:07 -0400 Subject: Use enums with backing types in Slang API (#2375) * #include an absolute path didn't work - because paths were taken to always be relative. * Use enum types and specify backing rather than use typedefs so as to get enum type safety. * Add version of TextureFlavor that uses internal types. Co-authored-by: Yong He --- source/slang/slang-options.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/slang/slang-options.cpp') diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp index a28217fd8..f88f02221 100644 --- a/source/slang/slang-options.cpp +++ b/source/slang/slang-options.cpp @@ -1126,7 +1126,7 @@ struct OptionsParser // UnownedStringSlice profileName = sliceCount >= 1 ? slices[0] : UnownedTerminatedStringSlice(""); - SlangProfileID profileID = Slang::Profile::lookUp(profileName).raw; + SlangProfileID profileID = SlangProfileID(Slang::Profile::lookUp(profileName).raw); if( profileID == SLANG_PROFILE_UNKNOWN ) { sink->diagnose(operand.loc, Diagnostics::unknownProfile, profileName); @@ -1332,11 +1332,11 @@ struct OptionsParser } else if(argValue == "-matrix-layout-row-major") { - defaultMatrixLayoutMode = kMatrixLayoutMode_RowMajor; + defaultMatrixLayoutMode = SlangMatrixLayoutMode(kMatrixLayoutMode_RowMajor); } else if(argValue == "-matrix-layout-column-major") { - defaultMatrixLayoutMode = kMatrixLayoutMode_ColumnMajor; + defaultMatrixLayoutMode = SlangMatrixLayoutMode(kMatrixLayoutMode_ColumnMajor); } else if(argValue == "-line-directive-mode") { @@ -1993,7 +1993,7 @@ struct OptionsParser if( rawTarget.profileVersion != ProfileVersion::Unknown ) { - compileRequest->setTargetProfile(targetID, Profile(rawTarget.profileVersion).raw); + compileRequest->setTargetProfile(targetID, SlangProfileID(Profile(rawTarget.profileVersion).raw)); } for( auto atom : rawTarget.capabilityAtoms ) { -- cgit v1.2.3