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.
66 lines
2.0 KiB
C++
66 lines
2.0 KiB
C++
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
* Copyright 2023 Blender Foundation */
|
|
|
|
/** \file
|
|
* \ingroup gpu
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "BLI_array.hh"
|
|
|
|
#include "gpu_shader_create_info.hh"
|
|
#include "gpu_shader_interface.hh"
|
|
|
|
#include "BLI_array.hh"
|
|
|
|
#include "vk_push_constants.hh"
|
|
|
|
namespace blender::gpu {
|
|
class VKShaderInterface : public ShaderInterface {
|
|
private:
|
|
/**
|
|
* Offset when searching for a shader input based on a binding number.
|
|
*
|
|
* When shaders combine images and samplers, the images have to be offset to find the correct
|
|
* shader input. Both textures and images are stored in the uniform list and their ID can be
|
|
* overlapping.
|
|
*/
|
|
uint32_t image_offset_ = 0;
|
|
Array<VKDescriptorSet::Location> descriptor_set_locations_;
|
|
|
|
VKPushConstants::Layout push_constants_layout_;
|
|
|
|
public:
|
|
VKShaderInterface() = default;
|
|
|
|
void init(const shader::ShaderCreateInfo &info);
|
|
|
|
const VKDescriptorSet::Location descriptor_set_location(
|
|
const shader::ShaderCreateInfo::Resource &resource) const;
|
|
const VKDescriptorSet::Location descriptor_set_location(
|
|
const shader::ShaderCreateInfo::Resource::BindType &bind_type, int binding) const;
|
|
|
|
/** Get the Layout of the shader. */
|
|
const VKPushConstants::Layout &push_constants_layout_get() const
|
|
{
|
|
return push_constants_layout_;
|
|
}
|
|
|
|
private:
|
|
/**
|
|
* Retrieve the shader input for the given resource.
|
|
*
|
|
* nullptr is returned when resource could not be found.
|
|
* Should only happen when still developing the Vulkan shader.
|
|
*/
|
|
const ShaderInput *shader_input_get(const shader::ShaderCreateInfo::Resource &resource) const;
|
|
const ShaderInput *shader_input_get(
|
|
const shader::ShaderCreateInfo::Resource::BindType &bind_type, int binding) const;
|
|
const VKDescriptorSet::Location descriptor_set_location(const ShaderInput *shader_input) const;
|
|
void descriptor_set_location_update(const ShaderInput *shader_input,
|
|
const VKDescriptorSet::Location location);
|
|
};
|
|
|
|
} // namespace blender::gpu
|