diff --git a/source/blender/python/gpu/gpu_py_shader.cc b/source/blender/python/gpu/gpu_py_shader.cc index dbdbb5bb0d3..28a1278f00d 100644 --- a/source/blender/python/gpu/gpu_py_shader.cc +++ b/source/blender/python/gpu/gpu_py_shader.cc @@ -13,6 +13,7 @@ #include "BLI_utildefines.h" +#include "GPU_context.hh" #include "GPU_shader.hh" #include "GPU_texture.hh" #include "GPU_uniform_buffer.hh" @@ -109,6 +110,20 @@ static PyObject *pygpu_shader__tp_new(PyTypeObject * /*type*/, PyObject *args, P { BPYGPU_IS_INIT_OR_ERROR_OBJ; + if (GPU_backend_get_type() == GPU_BACKEND_VULKAN) { + PyErr_SetString(PyExc_Exception, + "Direct shader creation is not supported on Vulkan. " + "Use gpu.shader.create_from_info(shader_info) instead."); + return nullptr; + } + + if (GPU_backend_get_type() == GPU_BACKEND_METAL) { + PyErr_SetString(PyExc_Exception, + "Direct shader creation is not supported on Metal. " + "Use gpu.shader.create_from_info(shader_info) instead."); + return nullptr; + } + PyErr_WarnEx(PyExc_DeprecationWarning, "Direct shader creation is deprecated. " "Use gpu.shader.create_from_info(shader_info) instead.",