IAkProcessorFeatures.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*******************************************************************************
  2. The content of this file includes portions of the AUDIOKINETIC Wwise Technology
  3. released in source code form as part of the SDK installer package.
  4. Commercial License Usage
  5. Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology
  6. may use this file in accordance with the end user license agreement provided
  7. with the software or, alternatively, in accordance with the terms contained in a
  8. written agreement between you and Audiokinetic Inc.
  9. Apache License Usage
  10. Alternatively, this file may be used under the Apache License, Version 2.0 (the
  11. "Apache License"); you may not use this file except in compliance with the
  12. Apache License. You may obtain a copy of the Apache License at
  13. http://www.apache.org/licenses/LICENSE-2.0.
  14. Unless required by applicable law or agreed to in writing, software distributed
  15. under the Apache License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
  16. OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License for
  17. the specific language governing permissions and limitations under the License.
  18. Copyright (c) 2023 Audiokinetic Inc.
  19. *******************************************************************************/
  20. /// \file
  21. /// Runtime processor supported features detection interface.
  22. #pragma once
  23. #include <AK/SoundEngine/Common/AkTypes.h>
  24. namespace AK
  25. {
  26. /// SIMD instruction sets.
  27. enum AkSIMDProcessorSupport
  28. {
  29. #if (defined(AK_CPU_X86_64) || defined(AK_CPU_X86) || defined(AK_CPU_WASM))
  30. AK_SIMD_SSE = 1<<0, ///< SSE support.
  31. AK_SIMD_SSE2 = 1<<1, ///< SSE2 support.
  32. AK_SIMD_SSE3 = 1<<2, ///< SSE3 support.
  33. AK_SIMD_SSSE3 = 1<<3, ///< SSSE3 support.
  34. AK_SIMD_SSE41 = 1<<4, ///< SSE 4.1 support.
  35. AK_SIMD_AVX = 1<<5, ///< AVX support.
  36. AK_SIMD_F16C = 1<<6, ///< F16C support.
  37. AK_SIMD_AVX2 = 1<<7 ///< AVX2 support.
  38. #endif
  39. };
  40. /// Runtime processor supported features detection interface. Allows to query specific processor features
  41. /// to chose optimal implementation.
  42. /// \akwarning
  43. /// The functions in this interface are not thread-safe, unless stated otherwise.
  44. /// \endakwarning
  45. class IAkProcessorFeatures
  46. {
  47. protected:
  48. /// Virtual destructor on interface to avoid warnings.
  49. virtual ~IAkProcessorFeatures(){}
  50. public:
  51. /// Query for specific SIMD instruction set support. See AkSIMDProcessorSupport for options.
  52. virtual bool GetSIMDSupport(AkSIMDProcessorSupport in_eSIMD) = 0;
  53. /// Query L2 cache size to optimize prefetching techniques where necessary.
  54. virtual AkUInt32 GetCacheSize() = 0;
  55. /// Query cache line size to optimize prefetching techniques where necessary.
  56. virtual AkUInt32 GetCacheLineSize() = 0;
  57. };
  58. }