GPU: Deprecate GPU_DATA_UINT_24_8

GPU_DATA_UINT_24_8 isn't used anymore. We cannot phase out the data type
as it can still be used by add-ons. This PR will deprecate
`GPU_DATA_UINT_24_8`. When used in an add-on a deprecation message will
be shown.

Pull Request: https://projects.blender.org/blender/blender/pulls/140715
This commit is contained in:
Jeroen Bakker
2025-06-20 12:17:20 +02:00
parent 2e3d19ca4f
commit 03caffe540
17 changed files with 44 additions and 30 deletions

View File

@@ -550,6 +550,7 @@ PyDoc_STRVAR(
" :type slot: int\n"
" :arg format: The format that describes the content of a single channel.\n"
" Possible values are `FLOAT`, `INT`, `UINT`, `UBYTE`, `UINT_24_8` and `10_11_11_REV`.\n"
" `UINT_24_8` is deprecated, use `FLOAT` instead.\n"
" :type format: str\n"
" :arg data: Optional Buffer object to fill with the pixels values.\n"
" :type data: :class:`gpu.types.Buffer`\n"
@@ -599,6 +600,10 @@ static PyObject *pygpu_framebuffer_read_color(BPyGPUFrameBuffer *self,
return nullptr;
}
if (pygpu_dataformat.value_found == GPU_DATA_UINT_24_8_DEPRECATED) {
PyErr_WarnEx(PyExc_DeprecationWarning, "`UINT_24_8` is deprecated, use `FLOAT` instead", 1);
}
if (!IN_RANGE_INCL(channels, 1, 4)) {
PyErr_SetString(PyExc_AttributeError, "Color channels must be 1, 2, 3 or 4");
return nullptr;