blender/intern/cycles/device/dummy/device.cpp
Sergey Sharybin a70b34065d Refactor: Cycles: Make kernel_features 64bit
This change adds 32 more bit to store kernel features.

While for a short term it might be possible to make a space for one or
two extra bits, it seems going 64bit is inevitable.

Expanding the field to 64bit might introduce some slowdown due to less
optimal cache, but so is consolidation of existing flags could also
lead to performance drop in certain configurations.

The main tricky part of the change is Metal where function constants
are used to store kernel_features, and 64bit constants are only
available on macOS 12. There is a runtime check for it. On older macOS
versions the flags are stored as a pair of 32bit values. It is slower,
but there are unlikely to be many Cycles users on macOS 11.

Ref #159470

Pull Request: https://projects.blender.org/blender/blender/pulls/162737
2026-08-18 10:41:27 +02:00

54 lines
1.5 KiB
C++

/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
*
* SPDX-License-Identifier: Apache-2.0 */
#include "device/dummy/device.h"
#include "device/device.h"
#include "device/queue.h"
CCL_NAMESPACE_BEGIN
/* Dummy device for when creating an appropriate rendering device fails. */
class DummyDevice : public Device {
public:
DummyDevice(const DeviceInfo &info_, Stats &stats_, Profiler &profiler_, bool headless_)
: Device(info_, stats_, profiler_, headless_)
{
error_msg = info.error_msg;
}
~DummyDevice() override = default;
BVHLayoutMask get_bvh_layout_mask(const uint64_t /*kernel_features*/) const override
{
return 0;
}
void mem_alloc(device_memory & /*mem*/) override {}
void mem_copy_to(device_memory & /*mem*/) override {}
void mem_move_to_host(device_memory & /*mem*/) override {}
void mem_copy_from(
device_memory & /*mem*/, size_t /*y*/, size_t /*w*/, size_t /*h*/, size_t /*elem*/) override
{
}
void mem_zero(device_memory & /*mem*/) override {}
void mem_free(device_memory & /*mem*/) override {}
void const_copy_to(const char * /*name*/, void * /*host*/, size_t /*size*/) override {}
};
unique_ptr<Device> device_dummy_create(const DeviceInfo &info,
Stats &stats,
Profiler &profiler,
bool headless)
{
return make_unique<DummyDevice>(info, stats, profiler, headless);
}
CCL_NAMESPACE_END