Different processors provide different features and since Graphics32 should aways perform as fast as possible on any given processor it tries to use the processor optimizations that best fit the CPU of the host system. In order to do this it uses CPU feature detection; When the application starts, Graphics32 queries the CPU about what features it support and based on this selects among its available optimizations.
For example, all low-level blend functions have been implemented in at least 4 variants: A PUREPASCAL variant written entirely in Pascal with no use of assembler, an ASM variant written in regular x86 assembler, a MMX assembler variant optimized for the MMX SIMD instruction set, and a SSE or SSE2 variant optimized for the SSE or SSE2 SIMD instruction set. In addition, most of the assembler variants exists in both a 32-bit and a 64-bit version.
Generally you do not need to concern yourself about the CPU feature selection; It is completely automatic and transparent to the use of Graphics32. If you do need to control what CPU level features your application uses, you can do so with the following conditional symbols:
| Symbol | Meaning |
|---|---|
| PUREPASCAL | Disable all assembler implementations; Only regular Delphi Pascal code will be used. Can be used if the target platform doesn’t support x86 assembler (e.g. Android). |
| OMIT_MMX | Disable the MMX assembler optimizations. |
| OMIT_SSE2 | Disable the SSE2 assembler optimizations. Note that this also includes SSE, SSE4.1 and later version of SSE. |
| OMIT_MMX and OMIT_SSE2 | Use the x86 assembler optimizations. |
The chart below illustrates the effect of the various optimization levels. The data was generated by the Benchmark example.

CPU features
There are too many different CPU features to list here but the most common ones are declared in the GR32_System unit (via aliases):
- MMX
- ExMMX
- SSE
- SSE2
- SSE3
- SSSE3
- SSE41
- SSE42
- AVX
- AVX2
- AVX512
The complete list is defined in the GR32.CPUID unit.
To test for support of a certain CPU feature, use the InstructionSupport member of the global CPU variable (it’s a record):
uses
GR32.CPUID;
...
begin
// Test for SSE4.1 support
if (isSSE41 in CPU.InstructionSupport) then
begin
... SSE4.1 specific code here ...
end;
end;