Merge branch 'blender-v5.0-release'

This commit is contained in:
Jeroen Bakker
2025-10-10 09:00:14 +02:00
7 changed files with 85 additions and 6 deletions

View File

@@ -81,7 +81,7 @@ bool VKBuffer::create(size_t size_in_bytes,
vma_create_info.priority = priority;
vma_create_info.requiredFlags = required_flags;
vma_create_info.preferredFlags = preferred_flags;
vma_create_info.usage = VMA_MEMORY_USAGE_AUTO;
vma_create_info.usage = VMA_MEMORY_USAGE_UNKNOWN;
if (export_memory) {
create_info.pNext = &external_memory_create_info;

View File

@@ -45,7 +45,7 @@ void VKMemoryPools::init_external_memory_image(VKDevice &device)
VK_IMAGE_LAYOUT_UNDEFINED};
VmaAllocationCreateInfo allocation_create_info = {};
allocation_create_info.flags = VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT;
allocation_create_info.usage = VMA_MEMORY_USAGE_AUTO;
allocation_create_info.usage = VMA_MEMORY_USAGE_UNKNOWN;
uint32_t memory_type_index;
vmaFindMemoryTypeIndexForImageInfo(
device.mem_allocator_get(), &image_create_info, &allocation_create_info, &memory_type_index);
@@ -75,7 +75,7 @@ void VKMemoryPools::init_external_memory_pixel_buffer(VKDevice &device)
nullptr};
VmaAllocationCreateInfo allocation_create_info = {};
allocation_create_info.flags = VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT;
allocation_create_info.usage = VMA_MEMORY_USAGE_AUTO;
allocation_create_info.usage = VMA_MEMORY_USAGE_UNKNOWN;
uint32_t memory_type_index;
vmaFindMemoryTypeIndexForBufferInfo(device.mem_allocator_get(),
&buffer_create_info,

View File

@@ -699,7 +699,7 @@ bool VKTexture::allocate()
VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO, nullptr, 0};
VmaAllocationCreateInfo allocCreateInfo = {};
allocCreateInfo.usage = VMA_MEMORY_USAGE_AUTO;
allocCreateInfo.usage = VMA_MEMORY_USAGE_UNKNOWN;
allocCreateInfo.priority = memory_priority(texture_usage);
if (bool(texture_usage & GPU_TEXTURE_USAGE_MEMORY_EXPORT)) {

View File

@@ -20,6 +20,7 @@ set(SRC
imbuf_py_api.cc
py_capi_rna.cc
py_capi_utils.cc
python_compat.cc
bl_math_py_api.hh
blf_py_api.hh
@@ -28,9 +29,9 @@ set(SRC
imbuf_py_api.hh
py_capi_rna.hh
py_capi_utils.hh
python_compat.hh
# header-only
python_compat.hh
python_utildefines.hh
)

View File

@@ -0,0 +1,76 @@
/* SPDX-FileCopyrightText: 2025 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup pygen
*
* Functions relating to compatibility across Python versions.
*/
#include <Python.h> /* IWYU pragma: keep. */
#include "BLI_utildefines.h" /* IWYU pragma: keep. */
#include "python_compat.hh" /* IWYU pragma: keep. */
#if PY_VERSION_HEX >= 0x030e0000 /* >=3.14 */
/* Removed in Python 3.14. */
int _PyArg_CheckPositional(const char *name, Py_ssize_t nargs, Py_ssize_t min, Py_ssize_t max)
{
BLI_assert(min >= 0);
BLI_assert(min <= max);
if (nargs < min) {
if (name != nullptr) {
PyErr_Format(PyExc_TypeError,
"%.200s expected %s%zd argument%s, got %zd",
name,
(min == max ? "" : "at least "),
min,
min == 1 ? "" : "s",
nargs);
}
else {
PyErr_Format(PyExc_TypeError,
"unpacked tuple should have %s%zd element%s,"
" but has %zd",
(min == max ? "" : "at least "),
min,
min == 1 ? "" : "s",
nargs);
}
return 0;
}
if (nargs == 0) {
return 1;
}
if (nargs > max) {
if (name != nullptr) {
PyErr_Format(PyExc_TypeError,
"%.200s expected %s%zd argument%s, got %zd",
name,
(min == max ? "" : "at most "),
max,
max == 1 ? "" : "s",
nargs);
}
else {
PyErr_Format(PyExc_TypeError,
"unpacked tuple should have %s%zd element%s,"
" but has %zd",
(min == max ? "" : "at most "),
max,
max == 1 ? "" : "s",
nargs);
}
return 0;
}
return 1;
}
#endif

View File

@@ -48,6 +48,7 @@
#if PY_VERSION_HEX < 0x030e0000
# define Py_HashPointer _Py_HashPointer
# define PyThreadState_GetUnchecked _PyThreadState_UncheckedGet
/* TODO: Support: `PyDict_Pop`, it has different arguments. */
#else /* >= 3.14 */
int _PyArg_CheckPositional(const char *name, Py_ssize_t nargs, Py_ssize_t min, Py_ssize_t max);
#endif

View File

@@ -29,6 +29,7 @@
#include "BLI_utildefines.h"
#include "../generic/py_capi_utils.hh"
#include "../generic/python_compat.hh" /* IWYU pragma: keep. */
#include "../generic/python_utildefines.hh"
/* ---------------------------------INTERSECTION FUNCTIONS-------------------- */