Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2019-03-09 18:42:44 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-03-09 18:43:05 +0300
commit9c4352001022440f0cffbc64061cd67f28d687b3 (patch)
tree9ffbaf5eb7e23b455a2e235c67f8b0d8069e4434 /source/blender/gpu
parent7e5d1a9560a5d926381f4aa864623845cdb8f1b2 (diff)
GPU Extension: Add OS defines
This makes possible to have os specific workaround inside the shaders.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/intern/gpu_shader.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c
index e9ca3257a8f..55b696e5ba2 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -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;
}