mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-05 06:03:34 +00:00
Disabling inlining of counterSet checks
To help debug a suspect crash in these functions. Also, change some of the counter checks to use more Objective-C style checks instead of std::find. Bug: dawn:1102 Change-Id: I693d1f2489116200b2c0608ca60bc3eb8ddb8571 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71242 Reviewed-by: Jiawei Shao <jiawei.shao@intel.com> Reviewed-by: Hao Li <hao.x.li@intel.com> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
2f18b26c1d
commit
6e83e6284e
@ -64,6 +64,7 @@
|
|||||||
# if defined(NDEBUG)
|
# if defined(NDEBUG)
|
||||||
# define DAWN_FORCE_INLINE inline __attribute__((always_inline))
|
# define DAWN_FORCE_INLINE inline __attribute__((always_inline))
|
||||||
# endif
|
# endif
|
||||||
|
# define DAWN_NOINLINE __attribute__((noinline))
|
||||||
|
|
||||||
// MSVC
|
// MSVC
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
@ -83,6 +84,7 @@ extern void __cdecl __debugbreak(void);
|
|||||||
# if defined(NDEBUG)
|
# if defined(NDEBUG)
|
||||||
# define DAWN_FORCE_INLINE __forceinline
|
# define DAWN_FORCE_INLINE __forceinline
|
||||||
# endif
|
# endif
|
||||||
|
# define DAWN_NOINLINE __declspec(noinline)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
# error "Unsupported compiler"
|
# error "Unsupported compiler"
|
||||||
@ -106,6 +108,9 @@ extern void __cdecl __debugbreak(void);
|
|||||||
#if !defined(DAWN_FORCE_INLINE)
|
#if !defined(DAWN_FORCE_INLINE)
|
||||||
# define DAWN_FORCE_INLINE inline
|
# define DAWN_FORCE_INLINE inline
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(DAWN_NOINLINE)
|
||||||
|
# define DAWN_NOINLINE
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
# define DAWN_FALLTHROUGH [[clang::fallthrough]]
|
# define DAWN_FALLTHROUGH [[clang::fallthrough]]
|
||||||
|
@ -174,7 +174,7 @@ namespace dawn_native { namespace metal {
|
|||||||
# error "Unsupported Apple platform."
|
# error "Unsupported Apple platform."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool IsCounterSamplingBoundarySupport(id<MTLDevice> device)
|
DAWN_NOINLINE bool IsCounterSamplingBoundarySupport(id<MTLDevice> device)
|
||||||
API_AVAILABLE(macos(11.0), ios(14.0)) {
|
API_AVAILABLE(macos(11.0), ios(14.0)) {
|
||||||
bool isBlitBoundarySupported =
|
bool isBlitBoundarySupported =
|
||||||
[device supportsCounterSampling:MTLCounterSamplingPointAtBlitBoundary];
|
[device supportsCounterSampling:MTLCounterSamplingPointAtBlitBoundary];
|
||||||
@ -187,9 +187,9 @@ namespace dawn_native { namespace metal {
|
|||||||
isDrawBoundarySupported;
|
isDrawBoundarySupported;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsGPUCounterSupported(id<MTLDevice> device,
|
DAWN_NOINLINE bool IsGPUCounterSupported(id<MTLDevice> device,
|
||||||
MTLCommonCounterSet counterSetName,
|
MTLCommonCounterSet counterSetName,
|
||||||
std::vector<MTLCommonCounter> counters)
|
std::vector<MTLCommonCounter> counterNames)
|
||||||
API_AVAILABLE(macos(10.15), ios(14.0)) {
|
API_AVAILABLE(macos(10.15), ios(14.0)) {
|
||||||
// MTLDevice’s counterSets property declares which counter sets it supports. Check
|
// MTLDevice’s counterSets property declares which counter sets it supports. Check
|
||||||
// whether it's available on the device before requesting a counter set.
|
// whether it's available on the device before requesting a counter set.
|
||||||
@ -209,13 +209,15 @@ namespace dawn_native { namespace metal {
|
|||||||
// A GPU might support a counter set, but only support a subset of the counters in that
|
// A GPU might support a counter set, but only support a subset of the counters in that
|
||||||
// set, check if the counter set supports all specific counters we need. Return false
|
// set, check if the counter set supports all specific counters we need. Return false
|
||||||
// if there is a counter unsupported.
|
// if there is a counter unsupported.
|
||||||
std::vector<NSString*> supportedCounters;
|
for (MTLCommonCounter counterName : counterNames) {
|
||||||
for (id<MTLCounter> counter in counterSet.counters) {
|
bool found = false;
|
||||||
supportedCounters.push_back(counter.name);
|
for (id<MTLCounter> counter in counterSet.counters) {
|
||||||
}
|
if ([counter.name caseInsensitiveCompare:counterName] == NSOrderedSame) {
|
||||||
for (const auto& counterName : counters) {
|
found = true;
|
||||||
if (std::find(supportedCounters.begin(), supportedCounters.end(), counterName) ==
|
break;
|
||||||
supportedCounters.end()) {
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user