|
Blender V4.3
|
#include <vk_push_constants.hh>
Inherits blender::gpu::VKResourceTracker< VKUniformBuffer >.
Classes | |
| struct | Layout |
Public Types | |
| enum class | StorageType { NONE , PUSH_CONSTANTS , UNIFORM_BUFFER } |
Public Member Functions | |
| VKPushConstants () | |
| VKPushConstants (const Layout *layout) | |
| VKPushConstants (VKPushConstants &&other) | |
| virtual | ~VKPushConstants () |
| VKPushConstants & | operator= (VKPushConstants &&other) |
| size_t | offset () const |
| const Layout & | layout_get () const |
| std::unique_ptr< VKUniformBuffer > | create_resource (VKContext &context) override |
| const void * | data () const |
| template<typename T > | |
| void | push_constant_set (int32_t location, int32_t comp_len, int32_t array_size, const T *input_data) |
| void | update_uniform_buffer () |
| std::unique_ptr< VKUniformBuffer > & | uniform_buffer_get () |
Friends | |
| class | VKContext |
Container to store push constants in a buffer.
Can handle buffers with different memory layouts (std140/std430) Which memory layout is used is based on the storage type.
VKPushConstantsLayout only describes the buffer, an instance of this class can handle setting/modifying/duplicating push constants.
It should also keep track of the submissions in order to reuse the allocated data.
Definition at line 48 of file vk_push_constants.hh.
|
strong |
Different methods to store push constants.
| Enumerator | |
|---|---|
| NONE | Push constants aren't in use. |
| PUSH_CONSTANTS | Store push constants as regular vulkan push constants. |
| UNIFORM_BUFFER | Fallback when push constants doesn't meet the device requirements. |
Definition at line 53 of file vk_push_constants.hh.
|
default |
| blender::gpu::VKPushConstants::VKPushConstants | ( | const Layout * | layout | ) |
Definition at line 119 of file vk_push_constants.cc.
References MEM_mallocN, and blender::gpu::VKPushConstants::Layout::size_in_bytes().
| blender::gpu::VKPushConstants::VKPushConstants | ( | VKPushConstants && | other | ) |
Definition at line 124 of file vk_push_constants.cc.
|
virtual |
Definition at line 130 of file vk_push_constants.cc.
References MEM_freeN().
|
overridevirtual |
Part of Resource Tracking API is called when new resource is needed.
Implements blender::gpu::VKResourceTracker< VKUniformBuffer >.
Definition at line 164 of file vk_push_constants.cc.
References blender::gpu::VKPushConstants::Layout::size_in_bytes().
|
inline |
Get the reference to the active data.
Data can get inactive when push constants are modified, after being added to the command queue. We still keep track of the old data for reuse and make sure we don't overwrite data that is still not on the GPU.
Definition at line 192 of file vk_push_constants.hh.
|
inline |
Definition at line 175 of file vk_push_constants.hh.
|
inline |
Definition at line 170 of file vk_push_constants.hh.
| VKPushConstants & blender::gpu::VKPushConstants::operator= | ( | VKPushConstants && | other | ) |
Definition at line 138 of file vk_push_constants.cc.
|
inline |
Modify a push constant.
location: ShaderInput.location of the push constant to update. comp_len: number of components has the data type that is being updated. array_size: number of elements when an array to update. (0=no array) input_data: packed source data to use.
Definition at line 206 of file vk_push_constants.hh.
References blender::gpu::VKPushConstants::Layout::PushConstant::array_size, BLI_assert, BLI_assert_msg, blender::gpu::VKPushConstants::Layout::PushConstant::inner_row_padding, max_ii(), blender::gpu::VKPushConstants::Layout::PushConstant::offset, PUSH_CONSTANTS, T, and UNUSED_VARS.
Referenced by blender::gpu::VKShader::uniform_float(), and blender::gpu::VKShader::uniform_int().
| std::unique_ptr< VKUniformBuffer > & blender::gpu::VKPushConstants::uniform_buffer_get | ( | ) |
Get a reference to the uniform buffer.
Only valid when storage type = StorageType::UNIFORM_BUFFER.
Definition at line 158 of file vk_push_constants.cc.
References blender::gpu::VKResourceTracker< VKUniformBuffer >::active_resource(), BLI_assert, blender::gpu::VKPushConstants::Layout::storage_type_get(), and UNIFORM_BUFFER.
| void blender::gpu::VKPushConstants::update_uniform_buffer | ( | ) |
When storage type = StorageType::UNIFORM_BUFFER use this method to update the uniform buffer.
It must be called just before adding a draw/compute command to the command queue.
Definition at line 148 of file vk_push_constants.cc.
References BLI_assert, blender::gpu::VKContext::get(), blender::gpu::VKPushConstants::Layout::storage_type_get(), blender::gpu::VKResourceTracker< VKUniformBuffer >::tracked_resource_for(), and UNIFORM_BUFFER.
|
friend |
Definition at line 49 of file vk_push_constants.hh.