msl: Explicity validate against MSL 1.2
Fixed: tint:1327 Change-Id: I7d2e182f60c42894410500f393a1235d37efe5e1 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71680 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: James Price <jrprice@google.com> Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
parent
05eedd81b0
commit
9c7b39f365
|
@ -38,10 +38,15 @@ Result Msl(const std::string& xcrun_path, const std::string& source) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// On Windows, we should actually be running metal.exe from the Metal
|
// On Windows, we should actually be running metal.exe from the Metal
|
||||||
// Developer Tools for Windows
|
// Developer Tools for Windows
|
||||||
auto res = xcrun("-x", "metal", "-c", "-o", "NUL", file.Path());
|
auto res = xcrun("-x", "metal", //
|
||||||
|
"-o", "NUL", //
|
||||||
|
"-std=osx-metal1.2", //
|
||||||
|
"-c", file.Path());
|
||||||
#else
|
#else
|
||||||
auto res =
|
auto res = xcrun("-sdk", "macosx", "metal", //
|
||||||
xcrun("-sdk", "macosx", "metal", "-o", "/dev/null", "-c", file.Path());
|
"-o", "/dev/null", //
|
||||||
|
"-std=osx-metal1.2", //
|
||||||
|
"-c", file.Path());
|
||||||
#endif
|
#endif
|
||||||
if (!res.out.empty()) {
|
if (!res.out.empty()) {
|
||||||
if (!result.output.empty()) {
|
if (!result.output.empty()) {
|
||||||
|
|
|
@ -40,8 +40,11 @@ Result MslUsingMetalAPI(const std::string& src) {
|
||||||
NSString* source = [NSString stringWithCString:src.c_str()
|
NSString* source = [NSString stringWithCString:src.c_str()
|
||||||
encoding:NSUTF8StringEncoding];
|
encoding:NSUTF8StringEncoding];
|
||||||
|
|
||||||
|
MTLCompileOptions* compileOptions = [MTLCompileOptions new];
|
||||||
|
compileOptions.languageVersion = MTLLanguageVersion1_2;
|
||||||
|
|
||||||
id<MTLLibrary> library = [device newLibraryWithSource:source
|
id<MTLLibrary> library = [device newLibraryWithSource:source
|
||||||
options:nil
|
options:compileOptions
|
||||||
error:&error];
|
error:&error];
|
||||||
if (!library) {
|
if (!library) {
|
||||||
NSString* output = [error localizedDescription];
|
NSString* output = [error localizedDescription];
|
||||||
|
|
|
@ -38,8 +38,11 @@ CompileResult CompileMslUsingMetalAPI(const std::string& src) {
|
||||||
NSString* source = [NSString stringWithCString:src.c_str()
|
NSString* source = [NSString stringWithCString:src.c_str()
|
||||||
encoding:NSUTF8StringEncoding];
|
encoding:NSUTF8StringEncoding];
|
||||||
|
|
||||||
|
MTLCompileOptions* compileOptions = [MTLCompileOptions new];
|
||||||
|
compileOptions.languageVersion = MTLLanguageVersion1_2;
|
||||||
|
|
||||||
id<MTLLibrary> library = [device newLibraryWithSource:source
|
id<MTLLibrary> library = [device newLibraryWithSource:source
|
||||||
options:nil
|
options:compileOptions
|
||||||
error:&error];
|
error:&error];
|
||||||
if (!library) {
|
if (!library) {
|
||||||
NSString* output = [error localizedDescription];
|
NSString* output = [error localizedDescription];
|
||||||
|
|
Loading…
Reference in New Issue