Issue Overview
Push constants have a minimum guarantee of pushing data transfers quickly up to 128 bytes to the GPU. Currently, there is an existing bug.
vk::pipeline::push_constant does not guarantee the data being pushed is 128 bytes or less. This should have some static_assert to ensure this is known to the user at compile-time.
What does the fix for this look like?
I am proposing this to be changed to using a template. Where we use a static_assert to determine the data being pushed does not exceed the minimum guarantee amount of bytes of data over to the GPU.
Example Implementation
An example implementation, I could see being done to the implementation of the function would be done similar to the following.
template<typename T>
void pipeline::push_constant(const VkCommandBuffer& p_current,
shader_stage p_stage,
const T& p_data,
uint32_t p_offset=0) {
vkCmdPushConstants(p_current,
m_pipeline_layout,
static_cast<VkShaderStageFlags>(p_stage),
p_offset,
sizeof(T), // size of bytes of data being pushed
&p_data // pointer to the data pushed
);
}
Issue Overview
Push constants have a minimum guarantee of pushing data transfers quickly up to 128 bytes to the GPU. Currently, there is an existing bug.
vk::pipeline::push_constantdoes not guarantee the data being pushed is 128 bytes or less. This should have somestatic_assertto ensure this is known to the user at compile-time.What does the fix for this look like?
I am proposing this to be changed to using a template. Where we use a
static_assertto determine the data being pushed does not exceed the minimum guarantee amount of bytes of data over to the GPU.Example Implementation
An example implementation, I could see being done to the implementation of the function would be done similar to the following.