mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-10 11:51:52 +00:00
BACKENDS: BaseBackend detects NEON on aarch64
This commit is contained in:
parent
bdc6d72e0b
commit
c3554dd7f0
@ -64,6 +64,7 @@ void BaseBackend::initBackend() {
|
||||
if (!_audiocdManager)
|
||||
_audiocdManager = new DefaultAudioCDManager();
|
||||
#endif
|
||||
_cpuFeatures = kCpuNoFeatures;
|
||||
#if defined(__x86_64__) || defined(__i686__)
|
||||
uint32 ext_edx1 = 0, ext_ebx7 = 0;
|
||||
# ifdef __GNUC__
|
||||
@ -87,17 +88,19 @@ void BaseBackend::initBackend() {
|
||||
mov ext_ebx7,ebx
|
||||
}
|
||||
# endif // __GNUC__ and _MSC_VER
|
||||
_x86features = (ext_edx1 & (1 << 26)) ? kX86FeatureSSE2 : kX86NoFeatures;
|
||||
_x86features |= (ext_ebx7 & (1 << 5)) ? kX86FeatureAVX2 : kX86NoFeatures;
|
||||
#else
|
||||
_x86features = kX86NotX86;
|
||||
_cpuFeatures |= (ext_edx1 & (1 << 26)) ? kCpuFeatureSSE2 : kCpuNoFeatures;
|
||||
_cpuFeatures |= (ext_ebx7 & (1 << 5)) ? kCpuFeatureAVX2 : kCpuNoFeatures;
|
||||
#endif // __x86_64__ and __i686__
|
||||
#if defined(__ARM_NEON) || defined(__ARM_NEON__)
|
||||
_cpuFeatures |= kCpuFeatureNEON;
|
||||
#endif
|
||||
OSystem::initBackend();
|
||||
}
|
||||
|
||||
bool BaseBackend::hasFeature(Feature f) {
|
||||
if (f == kFeatureSSE2) return (_x86features & kX86FeatureSSE2) == kX86FeatureSSE2;
|
||||
if (f == kFeatureAVX2) return (_x86features & kX86FeatureAVX2) == kX86FeatureAVX2;
|
||||
if (f == kFeatureSSE2) return _cpuFeatures & kCpuFeatureSSE2;
|
||||
if (f == kFeatureAVX2) return _cpuFeatures & kCpuFeatureAVX2;
|
||||
if (f == kFeatureNEON) return _cpuFeatures & kCpuFeatureNEON;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -31,11 +31,15 @@
|
||||
*/
|
||||
class BaseBackend : public OSystem {
|
||||
public:
|
||||
enum x86FeatureFlags {
|
||||
kX86NoFeatures = 0x00,
|
||||
kX86NotX86 = 0x00,
|
||||
kX86FeatureSSE2 = 0x01,
|
||||
kX86FeatureAVX2 = 0x02,
|
||||
enum CpuFeatureFlags {
|
||||
kCpuNoFeatures = 0x00, // Completely detected by BaseBackend
|
||||
kCpuFeatureSSE2 = 0x01, // Completely detected by BaseBackend
|
||||
kCpuFeatureAVX2 = 0x02, // Completely detected by BaseBackend
|
||||
// Detected either by BaseBackend (if platform ONLY supports ARMv8+) or
|
||||
// platform specific Backends if ARM is optional or not on all versions
|
||||
// of the platform.
|
||||
kCpuFeatureNEON = 0x04,
|
||||
kCpuFeatureAlitvec = 0x08, // Platform specific
|
||||
};
|
||||
|
||||
void initBackend() override;
|
||||
@ -49,7 +53,7 @@ public:
|
||||
void fillScreen(const Common::Rect &r, uint32 col) override;
|
||||
|
||||
private:
|
||||
uint32 _x86features;
|
||||
uint32 _cpuFeatures;
|
||||
};
|
||||
|
||||
class EventsBaseBackend : virtual public BaseBackend, Common::EventSource {
|
||||
|
Loading…
Reference in New Issue
Block a user