The goal is to solve confusion of the "All rights reserved" for licensing
code under an open-source license.
The phrase "All rights reserved" comes from a historical convention that
required this phrase for the copyright protection to apply. This convention
is no longer relevant.
However, even though the phrase has no meaning in establishing the copyright
it has not lost meaning in terms of licensing.
This change makes it so code under the Blender Foundation copyright does
not use "all rights reserved". This is also how the GPL license itself
states how to apply it to the source code:
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software ...
This change does not change copyright notice in cases when the copyright
is dual (BF and an author), or just an author of the code. It also does
mot change copyright which is inherited from NaN Holding BV as it needs
some further investigation about what is the proper way to handle it.
114 lines
2.5 KiB
C++
114 lines
2.5 KiB
C++
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
* Copyright 2022 Blender Foundation */
|
|
|
|
/** \file
|
|
* \ingroup gpu
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "gpu_context_private.hh"
|
|
|
|
#include "vk_command_buffer.hh"
|
|
#include "vk_descriptor_pools.hh"
|
|
|
|
namespace blender::gpu {
|
|
class VKFrameBuffer;
|
|
|
|
class VKContext : public Context {
|
|
private:
|
|
/** Copies of the handles owned by the GHOST context. */
|
|
VkInstance vk_instance_ = VK_NULL_HANDLE;
|
|
VkPhysicalDevice vk_physical_device_ = VK_NULL_HANDLE;
|
|
VkDevice vk_device_ = VK_NULL_HANDLE;
|
|
VKCommandBuffer command_buffer_;
|
|
uint32_t vk_queue_family_ = 0;
|
|
VkQueue vk_queue_ = VK_NULL_HANDLE;
|
|
|
|
/** Allocator used for texture and buffers and other resources. */
|
|
VmaAllocator mem_allocator_ = VK_NULL_HANDLE;
|
|
VKDescriptorPools descriptor_pools_;
|
|
|
|
/** Limits of the device linked to this context. */
|
|
VkPhysicalDeviceLimits vk_physical_device_limits_;
|
|
|
|
void *ghost_context_;
|
|
|
|
public:
|
|
VKContext(void *ghost_window, void *ghost_context);
|
|
virtual ~VKContext();
|
|
|
|
void activate() override;
|
|
void deactivate() override;
|
|
void begin_frame() override;
|
|
void end_frame() override;
|
|
|
|
void flush() override;
|
|
void finish() override;
|
|
|
|
void memory_statistics_get(int *total_mem, int *free_mem) override;
|
|
|
|
void debug_group_begin(const char *, int) override;
|
|
void debug_group_end() override;
|
|
bool debug_capture_begin() override;
|
|
void debug_capture_end() override;
|
|
void *debug_capture_scope_create(const char *name) override;
|
|
bool debug_capture_scope_begin(void *scope) override;
|
|
void debug_capture_scope_end(void *scope) override;
|
|
|
|
void activate_framebuffer(VKFrameBuffer &framebuffer);
|
|
void deactivate_framebuffer();
|
|
|
|
static VKContext *get(void)
|
|
{
|
|
return static_cast<VKContext *>(Context::get());
|
|
}
|
|
|
|
VkPhysicalDevice physical_device_get() const
|
|
{
|
|
return vk_physical_device_;
|
|
}
|
|
|
|
const VkPhysicalDeviceLimits &physical_device_limits_get() const
|
|
{
|
|
return vk_physical_device_limits_;
|
|
}
|
|
|
|
VkDevice device_get() const
|
|
{
|
|
return vk_device_;
|
|
}
|
|
|
|
VKCommandBuffer &command_buffer_get()
|
|
{
|
|
return command_buffer_;
|
|
}
|
|
|
|
VkQueue queue_get() const
|
|
{
|
|
return vk_queue_;
|
|
}
|
|
|
|
const uint32_t *queue_family_ptr_get() const
|
|
{
|
|
return &vk_queue_family_;
|
|
}
|
|
|
|
VKDescriptorPools &descriptor_pools_get()
|
|
{
|
|
return descriptor_pools_;
|
|
}
|
|
|
|
VmaAllocator mem_allocator_get() const
|
|
{
|
|
return mem_allocator_;
|
|
}
|
|
|
|
private:
|
|
void init_physical_device_limits();
|
|
|
|
bool has_active_framebuffer() const;
|
|
};
|
|
|
|
} // namespace blender::gpu
|