GPUOpen-Archive / Anvil

Anvil is a cross-platform framework for Vulkan
MIT License
594 stars 62 forks source link

Why does PipelineCache::get_data take a void** parameter for data? #105

Closed Silverlan closed 5 years ago

Silverlan commented 6 years ago

_PipelineCache::getdata takes a void** for the output data, which is then implicitly cast to a void* in the vkGetPipelineCacheData-call, that doesn't seem right to me:

bool Anvil::PipelineCache::get_data(size_t*      out_n_data_bytes_ptr,
                                    const void** out_data_ptr)
{
    VkResult result_vk;

    result_vk = vkGetPipelineCacheData(m_device_ptr->get_device_vk(),
                                       m_pipeline_cache,
                                       out_n_data_bytes_ptr,
                                       out_data_ptr);

    anvil_assert(result_vk);

    return is_vk_call_successful(result_vk);
}

I'm not sure if this is a bug, or if there's some logic behind it I don't understand.

Silverlan commented 6 years ago

Something else related I just noticed: Both _PipelineCache::getdata and PipelineCache::merge use _anvilassert to check the VkResult, I believe that should either be _anvil_assert_vk_callsucceeded, or the assert should be removed altogether, since in both cases the result is checked again just below the assert:

    anvil_assert(result_vk);
    return is_vk_call_successful(result_vk);
DominikWitczakAMD commented 5 years ago

Agreed, this is a shameful piece of nonsensical code :-) I've fixed this internally; will be including the change in the update, hopefully coming tomorrow.