pyGPU: Deprecate Shader.program getter

This is getting in the way of making the
GPUShader API more threadsafe.

This getter already doesn't work for vulkan
and Metal, and has very limited usage.

Keeping the python function to avoid errors
and display a deprecation warning.

Pull Request: https://projects.blender.org/blender/blender/pulls/136983
This commit is contained in:
Clément Foucault
2025-04-04 14:23:09 +02:00
committed by Clément Foucault
parent 0dc46773e0
commit 3562433ae7
9 changed files with 5 additions and 48 deletions

View File

@@ -865,11 +865,14 @@ PyDoc_STRVAR(
/* Wrap. */
pygpu_shader_program_doc,
"The name of the program object for use by the OpenGL API (read-only).\n"
"This is deprecated and will always return -1.\n"
"\n"
":type: int");
static PyObject *pygpu_shader_program_get(BPyGPUShader *self, void * /*closure*/)
static PyObject *pygpu_shader_program_get(BPyGPUShader * /*self*/, void * /*closure*/)
{
return PyLong_FromLong(GPU_shader_get_program(self->shader));
PyErr_WarnEx(
PyExc_DeprecationWarning, "'program' is deprecated. No valid handle will be returned.", 1);
return PyLong_FromLong(-1);
}
static PyGetSetDef pygpu_shader__tp_getseters[] = {