GPU Extension: Add OS defines
authorClément Foucault <foucault.clem@gmail.com>
Sat, 9 Mar 2019 15:42:44 +0000 (16:42 +0100)
committerClément Foucault <foucault.clem@gmail.com>
Sat, 9 Mar 2019 15:43:05 +0000 (16:43 +0100)
This makes possible to have os specific workaround inside the shaders.

source/blender/gpu/intern/gpu_shader.c

index e9ca3257a8ff72b56344244972b5d8f98d586f22..55b696e5ba2f5eb55905cebcb5d9c6441d724bcb 100644 (file)
@@ -271,6 +271,14 @@ static void gpu_shader_standard_defines(char defines[MAX_DEFINE_LENGTH])
        else if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_ANY, GPU_DRIVER_ANY))
                strcat(defines, "#define GPU_INTEL\n");
 
+       /* some useful defines to detect OS type */
+       if (GPU_type_matches(GPU_DEVICE_ANY, GPU_OS_WIN, GPU_DRIVER_ANY))
+               strcat(defines, "#define OS_WIN\n");
+       else if (GPU_type_matches(GPU_DEVICE_ANY, GPU_OS_MAC, GPU_DRIVER_ANY))
+               strcat(defines, "#define OS_MAC\n");
+       else if (GPU_type_matches(GPU_DEVICE_ANY, GPU_OS_UNIX, GPU_DRIVER_ANY))
+               strcat(defines, "#define OS_UNIX\n");
+
        return;
 }