Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_shader.cc
| Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| delete interface; | delete interface; | ||||
| } | } | ||||
| static void standard_defines(Vector<const char *> &sources) | static void standard_defines(Vector<const char *> &sources) | ||||
| { | { | ||||
| BLI_assert(sources.size() == 0); | BLI_assert(sources.size() == 0); | ||||
| /* Version needs to be first. Exact values will be added by implementation. */ | /* Version needs to be first. Exact values will be added by implementation. */ | ||||
| sources.append("version"); | sources.append("version"); | ||||
| /* Define to identify code usage in shading language. */ | /* Define to identify code usage in shading language. */ | ||||
fclem: This is supposed to be replace by whatever the backend wants. So I would not make it backend… | |||||
Not Done Inline ActionsAh right, will update. MichaelPW: Ah right, will update. | |||||
| sources.append("#define GPU_SHADER\n"); | sources.append("#define GPU_SHADER\n"); | ||||
| /* some useful defines to detect GPU type */ | /* some useful defines to detect GPU type */ | ||||
| if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY)) { | if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY)) { | ||||
| sources.append("#define GPU_ATI\n"); | sources.append("#define GPU_ATI\n"); | ||||
| } | } | ||||
| else if (GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_ANY, GPU_DRIVER_ANY)) { | else if (GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_ANY, GPU_DRIVER_ANY)) { | ||||
| sources.append("#define GPU_NVIDIA\n"); | sources.append("#define GPU_NVIDIA\n"); | ||||
| } | } | ||||
| Show All 11 Lines | else if (GPU_type_matches(GPU_DEVICE_ANY, GPU_OS_UNIX, GPU_DRIVER_ANY)) { | ||||
| sources.append("#define OS_UNIX\n"); | sources.append("#define OS_UNIX\n"); | ||||
| } | } | ||||
| /* API Definition */ | /* API Definition */ | ||||
| eGPUBackendType backend = GPU_backend_get_type(); | eGPUBackendType backend = GPU_backend_get_type(); | ||||
| switch (backend) { | switch (backend) { | ||||
| case GPU_BACKEND_OPENGL: | case GPU_BACKEND_OPENGL: | ||||
| sources.append("#define GPU_OPENGL\n"); | sources.append("#define GPU_OPENGL\n"); | ||||
| break; | break; | ||||
| case GPU_BACKEND_METAL: | |||||
| sources.append("#define GPU_METAL\n"); | |||||
| break; | |||||
| default: | default: | ||||
| BLI_assert(false && "Invalid GPU Backend Type"); | BLI_assert(false && "Invalid GPU Backend Type"); | ||||
| break; | break; | ||||
| } | } | ||||
| if (GPU_crappy_amd_driver()) { | if (GPU_crappy_amd_driver()) { | ||||
| sources.append("#define GPU_DEPRECATED_AMD_DRIVER\n"); | sources.append("#define GPU_DEPRECATED_AMD_DRIVER\n"); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 701 Lines • Show Last 20 Lines | |||||
This is supposed to be replace by whatever the backend wants. So I would not make it backend dependent here. If metal does not need any first line header, it should just replace this sources[0] by an empty string.