Merge pull request #96 from asuessenbach/singular_fix

changed enhanced version of CommandBuffer::pushConstants to be templa…
This commit is contained in:
Markus Tavenrath 2016-04-11 15:57:35 +02:00
commit 757d3b7aed
2 changed files with 7 additions and 5 deletions

View File

@ -603,7 +603,7 @@ size_t findTemplateIndex(CommandData const& commandData, std::map<size_t, size_t
{ {
for (size_t i = 0; i < commandData.arguments.size(); i++) for (size_t i = 0; i < commandData.arguments.size(); i++)
{ {
if (commandData.arguments[i].name == "pData") if ((commandData.arguments[i].name == "pData") || (commandData.arguments[i].name == "pValues"))
{ {
assert(vectorParameters.find(i) != vectorParameters.end()); assert(vectorParameters.find(i) != vectorParameters.end());
return i; return i;

View File

@ -18231,14 +18231,16 @@ namespace vk
} }
#ifdef VKCPP_ENHANCED_MODE #ifdef VKCPP_ENHANCED_MODE
void pushConstants( PipelineLayout layout, ShaderStageFlags stageFlags, uint32_t offset, std::vector<uint8_t> const & values ) const template <typename T>
void pushConstants( PipelineLayout layout, ShaderStageFlags stageFlags, uint32_t offset, std::vector<T> const & values ) const
{ {
vkCmdPushConstants( m_commandBuffer, static_cast<VkPipelineLayout>( layout ), static_cast<VkShaderStageFlags>( stageFlags ), offset, static_cast<uint32_t>( values.size() ), values.data() ); vkCmdPushConstants( m_commandBuffer, static_cast<VkPipelineLayout>( layout ), static_cast<VkShaderStageFlags>( stageFlags ), offset, static_cast<uint32_t>( values.size() * sizeof( T ) ), reinterpret_cast<const void*>( values.data() ) );
} }
void pushConstant( PipelineLayout layout, ShaderStageFlags stageFlags, uint32_t offset, std::vector<uint8_t> const & value ) const template <typename T>
void pushConstant( PipelineLayout layout, ShaderStageFlags stageFlags, uint32_t offset, T const & value ) const
{ {
vkCmdPushConstants( m_commandBuffer, static_cast<VkPipelineLayout>( layout ), static_cast<VkShaderStageFlags>( stageFlags ), offset, 1, &value ); vkCmdPushConstants( m_commandBuffer, static_cast<VkPipelineLayout>( layout ), static_cast<VkShaderStageFlags>( stageFlags ), offset, static_cast<uint32_t>( sizeof( T ) ), reinterpret_cast<const void*>( &value ) );
} }
#endif /*VKCPP_ENHANCED_MODE*/ #endif /*VKCPP_ENHANCED_MODE*/