Add new debug macro UNSUPPORTED().
Plumb this into regres.
Bug: b/131243109
Change-Id: Ie82cab71aca0e6b1648852dad8f4a0acd0856e70
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/29928
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Vulkan/VkDebug.hpp b/src/Vulkan/VkDebug.hpp
index 3133932..7798de1 100644
--- a/src/Vulkan/VkDebug.hpp
+++ b/src/Vulkan/VkDebug.hpp
@@ -89,11 +89,22 @@
DABORT("ASSERT(%s)\n", #expression); \
} } while(0)
-// A macro to indicate unimplemented functionality.
+// A macro to indicate functionality currently unimplemented for a feature
+// advertised as supported. For unsupported features not advertised as supported
+// use UNSUPPORTED().
#undef UNIMPLEMENTED
#define UNIMPLEMENTED(format, ...) DABORT("UNIMPLEMENTED: " format, ##__VA_ARGS__)
-// A macro for code which is not expected to be reached under valid assumptions.
+// A macro to indicate unsupported functionality.
+// This should be called when a Vulkan / SPIR-V feature is attempted to be used,
+// but is not currently implemented by SwiftShader.
+// Note that in a well-behaved application these should not be reached as the
+// application should be respecting the advertised features / limits.
+#undef UNSUPPORTED
+#define UNSUPPORTED(format, ...) DABORT("UNSUPPORTED: " format, ##__VA_ARGS__)
+
+// A macro for code which should never be reached, even with misbehaving
+// applications.
#undef UNREACHABLE
#define UNREACHABLE(format, ...) DABORT("UNREACHABLE: " format, ##__VA_ARGS__)
diff --git a/tests/regres/main.go b/tests/regres/main.go
index ddae932..867b881 100644
--- a/tests/regres/main.go
+++ b/tests/regres/main.go
@@ -1035,6 +1035,7 @@
{" Fail", testlist.Fail},
{" Timeout", testlist.Timeout},
{" UNIMPLEMENTED()", testlist.Unimplemented},
+ {" UNSUPPORTED()", testlist.Unsupported},
{" UNREACHABLE()", testlist.Unreachable},
{" ASSERT()", testlist.Assert},
{" ABORT()", testlist.Abort},
@@ -1118,6 +1119,8 @@
deqpRE = regexp.MustCompile(`(Fail|Pass|NotSupported|CompatibilityWarning|QualityWarning) \(([^\)]*)\)`)
// Regular expression to parse a test that failed due to UNIMPLEMENTED()
unimplementedRE = regexp.MustCompile(`[^\n]*UNIMPLEMENTED:[^\n]*`)
+ // Regular expression to parse a test that failed due to UNSUPPORTED()
+ unsupportedRE = regexp.MustCompile(`[^\n]*UNSUPPORTED\([^\)]*\):[^\n]*`)
// Regular expression to parse a test that failed due to UNREACHABLE()
unreachableRE = regexp.MustCompile(`[^\n]*UNREACHABLE:[^\n]*`)
// Regular expression to parse a test that failed due to ASSERT()
@@ -1159,6 +1162,7 @@
s testlist.Status
}{
{unimplementedRE, testlist.Unimplemented},
+ {unsupportedRE, testlist.Unsupported},
{unreachableRE, testlist.Unreachable},
{assertRE, testlist.Assert},
{abortRE, testlist.Abort},
diff --git a/tests/regres/testlist/testlist.go b/tests/regres/testlist/testlist.go
index b79120c..1378c24 100644
--- a/tests/regres/testlist/testlist.go
+++ b/tests/regres/testlist/testlist.go
@@ -161,6 +161,8 @@
Crash = Status("CRASH")
// Unimplemented is the status of a test that failed with UNIMPLEMENTED().
Unimplemented = Status("UNIMPLEMENTED")
+ // Unsupported is the status of a test that failed with UNSUPPORTED().
+ Unsupported = Status("UNSUPPORTED")
// Unreachable is the status of a test that failed with UNREACHABLE().
Unreachable = Status("UNREACHABLE")
// Assert is the status of a test that failed with ASSERT() or ASSERT_MSG().
@@ -182,6 +184,7 @@
Timeout,
Crash,
Unimplemented,
+ Unsupported,
Unreachable,
Assert,
Abort,
@@ -195,6 +198,11 @@
switch s {
case Fail, Timeout, Crash, Unimplemented, Unreachable, Assert:
return true
+ case Unsupported:
+ // This may seem surprising that this should be a failure, however these
+ // should not be reached, as dEQP should not be using features that are
+ // not advertised.
+ return true
default:
return false
}