Files
test2/source/blender/gpu/intern/gpu_platform_private.hh
Omar Emara 56b0b709ea Compositor: Support GPU OIDN denoising
This patch supports GPU OIDN denoising in the compositor. A new
compositor performance option was added to allow choosing between CPU,
GPU, and Auto device selection. Auto will use whatever the compositor is
using for execution.

The code is two folds, first, denoising code was adapted to use buffers
as opposed to passing in pointers to filters directly, this is needed to
support GPU devices. Second, device creation is now a bit more involved,
it tries to choose the device is being used by the compositor for
execution.

Matching GPU devices is done by choosing the OIDN device that matches
the UUID or LUID of the active GPU platform. We need both UUID and LUID
because not all platforms support both. UUID is supported on all
platforms except MacOS Metal, while LUID is only supported on Window and
MacOS metal.

If there is no active GPU device or matching is unsuccessful, we let
OIDN choose the best device, which is typically the fastest.

To support this case, UUID and LUID identifiers were added to the
GPUPlatformGlobal and are initialized by the GPU backend if supported.
OpenGL now requires GL_EXT_memory_object and GL_EXT_memory_object_win32
to support this use case, but it should function without it.

Pull Request: https://projects.blender.org/blender/blender/pulls/136660
2025-04-04 11:17:08 +02:00

60 lines
1.5 KiB
C++

/* SPDX-FileCopyrightText: 2020 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#pragma once
#include <cstdint>
#include "BLI_array.hh"
#include "BLI_vector.hh"
#include "GPU_platform.hh"
namespace blender::gpu {
class GPUPlatformGlobal {
public:
bool initialized = false;
eGPUDeviceType device;
eGPUOSType os;
eGPUDriverType driver;
eGPUSupportLevel support_level;
char *vendor = nullptr;
char *renderer = nullptr;
char *version = nullptr;
char *support_key = nullptr;
char *gpu_name = nullptr;
eGPUBackendType backend = GPU_BACKEND_NONE;
GPUArchitectureType architecture_type = GPU_ARCHITECTURE_IMR;
Vector<GPUDevice> devices;
/* The UUID of the device. Can be an empty array, since it is not supported on all platforms. */
Array<uint8_t, 16> device_uuid;
/* The LUID of the device. Can be an empty array, since it is not supported on all platforms. */
Array<uint8_t, 8> device_luid;
/* A bit field with the nth bit active identifying the nth device with the same LUID. Only
* matters if device_luid is defined. */
uint32_t device_luid_node_mask;
void init(eGPUDeviceType gpu_device,
eGPUOSType os_type,
eGPUDriverType driver_type,
eGPUSupportLevel gpu_support_level,
eGPUBackendType backend,
const char *vendor_str,
const char *renderer_str,
const char *version_str,
GPUArchitectureType arch_type);
void clear();
};
extern GPUPlatformGlobal GPG;
} // namespace blender::gpu