Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan codegen refactor tranche 4 #1950

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c7fa9de
codegen: Update ref resource consumer
MarkY-LunarG Nov 7, 2024
daeac7c
codegen: Update cmd buffer util header
MarkY-LunarG Nov 7, 2024
155f192
codegen: Remove unused code in CPP consumer
MarkY-LunarG Nov 7, 2024
5b26f29
codegen: Update cmd buf util body generation
MarkY-LunarG Nov 7, 2024
c8e4665
codegen: Update api call endcoders
MarkY-LunarG Nov 7, 2024
989b193
codegen: Rename global_structs_with_handle*
MarkY-LunarG Nov 7, 2024
6425bb7
codegen: Move wrapper prefix usage to use ApiData
MarkY-LunarG Nov 7, 2024
d3ad04f
codegen: Move API Prefix to use APIData
MarkY-LunarG Nov 8, 2024
5a32cf6
codegen: Modify struct handle wrapper header
MarkY-LunarG Nov 8, 2024
63f6d1b
codegen: Modify how handles, atoms and opaques are handled
MarkY-LunarG Nov 8, 2024
093a23a
codegen: Use "isHandleLike" instead of separate checks
MarkY-LunarG Nov 8, 2024
eee90ea
codegen: Move struct handle wrap body to Khronos
MarkY-LunarG Nov 8, 2024
ce06f24
codegen: Rename Khronos struct handle mapper files
MarkY-LunarG Nov 8, 2024
75e587c
codegen: Rename Khronos base_decoder_body generator
MarkY-LunarG Nov 8, 2024
fade468
codegen: Move Khronos Base Replay name to remove Base
MarkY-LunarG Nov 8, 2024
13549b0
codegen: Rename Khronos Base Struct Decoder to remove "Base"
MarkY-LunarG Nov 8, 2024
31008cc
codegen: Move JSON body to support other handle-like types
MarkY-LunarG Nov 8, 2024
6354614
codegen: Migrate struct encoder header to Khronos
MarkY-LunarG Nov 8, 2024
d1034ae
codegen: Migrate struct encoder body to Khronos
MarkY-LunarG Nov 8, 2024
cd55f62
codegen: Move more from struct decoder body to Khronos
MarkY-LunarG Nov 8, 2024
9f12fd0
codegen: Move decoder header generation into Khronos
MarkY-LunarG Nov 8, 2024
bde3b84
codegen: Fix 64-bit flag detection in khronos
MarkY-LunarG Nov 12, 2024
0481acd
codegen: Fix flag types/enum conversion
MarkY-LunarG Nov 12, 2024
f7b150b
codegen: Remove unnecessary methods
MarkY-LunarG Nov 12, 2024
20eaf3c
codegen: Remove unnecessary lists in enum->string
MarkY-LunarG Nov 12, 2024
487f951
codegen: enum->json header use Khronos types
MarkY-LunarG Nov 12, 2024
ec242c3
codegen: Add ability to go backwards enum->flags
MarkY-LunarG Nov 12, 2024
33808e6
codegen: Update enum->json body to use Khronos types
MarkY-LunarG Nov 12, 2024
3410216
codegen: Move enum->json header into Khronos
MarkY-LunarG Nov 12, 2024
f9640f0
codegen: Move enum->json body to Khronos files
MarkY-LunarG Nov 12, 2024
f84b8c1
codegen: Move enum->string header code to Khronos
MarkY-LunarG Nov 12, 2024
f6f044f
codegen: Move enum->string body code to Khronos
MarkY-LunarG Nov 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions framework/generated/generated_vulkan_enum_to_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3591,7 +3591,7 @@ template <> std::string ToString<VkPhysicalDeviceLayeredApiKHR>(const VkPhysical
return "Unhandled VkPhysicalDeviceLayeredApiKHR";
}

template <> std::string ToString<VkPhysicalDeviceSchedulingControlsFlagBitsARM>(const VkPhysicalDeviceSchedulingControlsFlagBitsARM& value, ToStringFlags, uint32_t, uint32_t)
std::string VkPhysicalDeviceSchedulingControlsFlagBitsARMToString(const VkPhysicalDeviceSchedulingControlsFlagBitsARM value)
{
switch (value) {
case VK_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_SHADER_CORE_COUNT_ARM: return "VK_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_SHADER_CORE_COUNT_ARM";
Expand All @@ -3600,9 +3600,28 @@ template <> std::string ToString<VkPhysicalDeviceSchedulingControlsFlagBitsARM>(
return "Unhandled VkPhysicalDeviceSchedulingControlsFlagBitsARM";
}

template <> std::string ToString<VkPhysicalDeviceSchedulingControlsFlagBitsARM>(VkFlags vkFlags, ToStringFlags, uint32_t, uint32_t)
std::string VkPhysicalDeviceSchedulingControlsFlagsARMToString(VkFlags64 vkFlags)
{
return BitmaskToString<VkPhysicalDeviceSchedulingControlsFlagBitsARM>(vkFlags);
std::string str;
VkFlags64 index = 0U;
while (vkFlags)
{
if (vkFlags & 1U)
{
if (!str.empty())
{
str += '|';
}
str.append(VkPhysicalDeviceSchedulingControlsFlagBitsARMToString(static_cast<VkPhysicalDeviceSchedulingControlsFlagBitsARM>(1U) << index));
}
++index;
vkFlags >>= 1U;
}
if (str.empty())
{
str.append(VkPhysicalDeviceSchedulingControlsFlagBitsARMToString(0U));
}
return str;
}

template <> std::string ToString<VkPhysicalDeviceType>(const VkPhysicalDeviceType& value, ToStringFlags, uint32_t, uint32_t)
Expand Down
4 changes: 2 additions & 2 deletions framework/generated/generated_vulkan_enum_to_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ template <> std::string ToString<VkPerformanceOverrideTypeINTEL>(const VkPerform
template <> std::string ToString<VkPerformanceParameterTypeINTEL>(const VkPerformanceParameterTypeINTEL& value, ToStringFlags toStringFlags, uint32_t tabCount, uint32_t tabSize);
template <> std::string ToString<VkPerformanceValueTypeINTEL>(const VkPerformanceValueTypeINTEL& value, ToStringFlags toStringFlags, uint32_t tabCount, uint32_t tabSize);
template <> std::string ToString<VkPhysicalDeviceLayeredApiKHR>(const VkPhysicalDeviceLayeredApiKHR& value, ToStringFlags toStringFlags, uint32_t tabCount, uint32_t tabSize);
template <> std::string ToString<VkPhysicalDeviceSchedulingControlsFlagBitsARM>(const VkPhysicalDeviceSchedulingControlsFlagBitsARM& value, ToStringFlags toStringFlags, uint32_t tabCount, uint32_t tabSize);
template <> std::string ToString<VkPhysicalDeviceSchedulingControlsFlagBitsARM>(VkFlags vkFlags, ToStringFlags toStringFlags, uint32_t tabCount, uint32_t tabSize);
std::string VkPhysicalDeviceSchedulingControlsFlagBitsARMToString(const VkPhysicalDeviceSchedulingControlsFlagBitsARM value);
std::string VkPhysicalDeviceSchedulingControlsFlagsARMToString(VkFlags64 vkFlags);
template <> std::string ToString<VkPhysicalDeviceType>(const VkPhysicalDeviceType& value, ToStringFlags toStringFlags, uint32_t tabCount, uint32_t tabSize);
template <> std::string ToString<VkPipelineBindPoint>(const VkPipelineBindPoint& value, ToStringFlags toStringFlags, uint32_t tabCount, uint32_t tabSize);
template <> std::string ToString<VkPipelineCacheCreateFlagBits>(const VkPipelineCacheCreateFlagBits& value, ToStringFlags toStringFlags, uint32_t tabCount, uint32_t tabSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,6 @@ void VulkanReferencedResourceConsumer::Process_vkCmdBindDescriptorSets2(
if (!pBindDescriptorSetsInfo->IsNull() && (pBindDescriptorSetsInfo->HasData()))
{
auto pBindDescriptorSetsInfo_ptr = pBindDescriptorSetsInfo->GetMetaStructPointer();

if (!pBindDescriptorSetsInfo_ptr->pDescriptorSets.IsNull() && (pBindDescriptorSetsInfo_ptr->pDescriptorSets.HasData()))
{
auto pDescriptorSets_ptr = pBindDescriptorSetsInfo_ptr->pDescriptorSets.GetPointer();
Expand All @@ -962,19 +961,6 @@ void VulkanReferencedResourceConsumer::Process_vkCmdBindDescriptorSets2(
}
}

void VulkanReferencedResourceConsumer::Process_vkCmdPushConstants2(
const ApiCallInfo& call_info,
format::HandleId commandBuffer,
StructPointerDecoder<Decoded_VkPushConstantsInfo>* pPushConstantsInfo)
{
assert(pPushConstantsInfo != nullptr);

if (!pPushConstantsInfo->IsNull() && (pPushConstantsInfo->HasData()))
{
auto pPushConstantsInfo_ptr = pPushConstantsInfo->GetMetaStructPointer();
}
}

void VulkanReferencedResourceConsumer::Process_vkCmdPushDescriptorSet2(
const ApiCallInfo& call_info,
format::HandleId commandBuffer,
Expand All @@ -985,7 +971,6 @@ void VulkanReferencedResourceConsumer::Process_vkCmdPushDescriptorSet2(
if (!pPushDescriptorSetInfo->IsNull() && (pPushDescriptorSetInfo->HasData()))
{
auto pPushDescriptorSetInfo_ptr = pPushDescriptorSetInfo->GetMetaStructPointer();

if (!pPushDescriptorSetInfo_ptr->pDescriptorWrites->IsNull() && (pPushDescriptorSetInfo_ptr->pDescriptorWrites->HasData()))
{
auto pDescriptorWrites_ptr = pPushDescriptorSetInfo_ptr->pDescriptorWrites->GetMetaStructPointer();
Expand Down Expand Up @@ -1571,7 +1556,6 @@ void VulkanReferencedResourceConsumer::Process_vkCmdBindDescriptorSets2KHR(
if (!pBindDescriptorSetsInfo->IsNull() && (pBindDescriptorSetsInfo->HasData()))
{
auto pBindDescriptorSetsInfo_ptr = pBindDescriptorSetsInfo->GetMetaStructPointer();

if (!pBindDescriptorSetsInfo_ptr->pDescriptorSets.IsNull() && (pBindDescriptorSetsInfo_ptr->pDescriptorSets.HasData()))
{
auto pDescriptorSets_ptr = pBindDescriptorSetsInfo_ptr->pDescriptorSets.GetPointer();
Expand All @@ -1584,19 +1568,6 @@ void VulkanReferencedResourceConsumer::Process_vkCmdBindDescriptorSets2KHR(
}
}

void VulkanReferencedResourceConsumer::Process_vkCmdPushConstants2KHR(
const ApiCallInfo& call_info,
format::HandleId commandBuffer,
StructPointerDecoder<Decoded_VkPushConstantsInfo>* pPushConstantsInfo)
{
assert(pPushConstantsInfo != nullptr);

if (!pPushConstantsInfo->IsNull() && (pPushConstantsInfo->HasData()))
{
auto pPushConstantsInfo_ptr = pPushConstantsInfo->GetMetaStructPointer();
}
}

void VulkanReferencedResourceConsumer::Process_vkCmdPushDescriptorSet2KHR(
const ApiCallInfo& call_info,
format::HandleId commandBuffer,
Expand All @@ -1607,7 +1578,6 @@ void VulkanReferencedResourceConsumer::Process_vkCmdPushDescriptorSet2KHR(
if (!pPushDescriptorSetInfo->IsNull() && (pPushDescriptorSetInfo->HasData()))
{
auto pPushDescriptorSetInfo_ptr = pPushDescriptorSetInfo->GetMetaStructPointer();

if (!pPushDescriptorSetInfo_ptr->pDescriptorWrites->IsNull() && (pPushDescriptorSetInfo_ptr->pDescriptorWrites->HasData()))
{
auto pDescriptorWrites_ptr = pPushDescriptorSetInfo_ptr->pDescriptorWrites->GetMetaStructPointer();
Expand Down Expand Up @@ -1665,32 +1635,6 @@ void VulkanReferencedResourceConsumer::Process_vkCmdPushDescriptorSet2KHR(
}
}

void VulkanReferencedResourceConsumer::Process_vkCmdSetDescriptorBufferOffsets2EXT(
const ApiCallInfo& call_info,
format::HandleId commandBuffer,
StructPointerDecoder<Decoded_VkSetDescriptorBufferOffsetsInfoEXT>* pSetDescriptorBufferOffsetsInfo)
{
assert(pSetDescriptorBufferOffsetsInfo != nullptr);

if (!pSetDescriptorBufferOffsetsInfo->IsNull() && (pSetDescriptorBufferOffsetsInfo->HasData()))
{
auto pSetDescriptorBufferOffsetsInfo_ptr = pSetDescriptorBufferOffsetsInfo->GetMetaStructPointer();
}
}

void VulkanReferencedResourceConsumer::Process_vkCmdBindDescriptorBufferEmbeddedSamplers2EXT(
const ApiCallInfo& call_info,
format::HandleId commandBuffer,
StructPointerDecoder<Decoded_VkBindDescriptorBufferEmbeddedSamplersInfoEXT>* pBindDescriptorBufferEmbeddedSamplersInfo)
{
assert(pBindDescriptorBufferEmbeddedSamplersInfo != nullptr);

if (!pBindDescriptorBufferEmbeddedSamplersInfo->IsNull() && (pBindDescriptorBufferEmbeddedSamplersInfo->HasData()))
{
auto pBindDescriptorBufferEmbeddedSamplersInfo_ptr = pBindDescriptorBufferEmbeddedSamplersInfo->GetMetaStructPointer();
}
}

void VulkanReferencedResourceConsumer::Process_vkCmdBindTransformFeedbackBuffersEXT(
const ApiCallInfo& call_info,
format::HandleId commandBuffer,
Expand Down Expand Up @@ -2099,31 +2043,11 @@ void VulkanReferencedResourceConsumer::Process_vkCmdPreprocessGeneratedCommandsE
StructPointerDecoder<Decoded_VkGeneratedCommandsInfoEXT>* pGeneratedCommandsInfo,
format::HandleId stateCommandBuffer)
{
assert(pGeneratedCommandsInfo != nullptr);
GFXRECON_UNREFERENCED_PARAMETER(pGeneratedCommandsInfo);

if (!pGeneratedCommandsInfo->IsNull() && (pGeneratedCommandsInfo->HasData()))
{
auto pGeneratedCommandsInfo_ptr = pGeneratedCommandsInfo->GetMetaStructPointer();
}
GetTable().AddUserToUser(commandBuffer, stateCommandBuffer);
}

void VulkanReferencedResourceConsumer::Process_vkCmdExecuteGeneratedCommandsEXT(
const ApiCallInfo& call_info,
format::HandleId commandBuffer,
VkBool32 isPreprocessed,
StructPointerDecoder<Decoded_VkGeneratedCommandsInfoEXT>* pGeneratedCommandsInfo)
{
GFXRECON_UNREFERENCED_PARAMETER(isPreprocessed);

assert(pGeneratedCommandsInfo != nullptr);

if (!pGeneratedCommandsInfo->IsNull() && (pGeneratedCommandsInfo->HasData()))
{
auto pGeneratedCommandsInfo_ptr = pGeneratedCommandsInfo->GetMetaStructPointer();
}
}

void VulkanReferencedResourceConsumer::Process_vkCmdBuildAccelerationStructuresKHR(
const ApiCallInfo& call_info,
format::HandleId commandBuffer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,6 @@ class VulkanReferencedResourceConsumer : public VulkanReferencedResourceConsumer
format::HandleId commandBuffer,
StructPointerDecoder<Decoded_VkBindDescriptorSetsInfo>* pBindDescriptorSetsInfo) override;

virtual void Process_vkCmdPushConstants2(
const ApiCallInfo& call_info,
format::HandleId commandBuffer,
StructPointerDecoder<Decoded_VkPushConstantsInfo>* pPushConstantsInfo) override;

virtual void Process_vkCmdPushDescriptorSet2(
const ApiCallInfo& call_info,
format::HandleId commandBuffer,
Expand Down Expand Up @@ -484,26 +479,11 @@ class VulkanReferencedResourceConsumer : public VulkanReferencedResourceConsumer
format::HandleId commandBuffer,
StructPointerDecoder<Decoded_VkBindDescriptorSetsInfo>* pBindDescriptorSetsInfo) override;

virtual void Process_vkCmdPushConstants2KHR(
const ApiCallInfo& call_info,
format::HandleId commandBuffer,
StructPointerDecoder<Decoded_VkPushConstantsInfo>* pPushConstantsInfo) override;

virtual void Process_vkCmdPushDescriptorSet2KHR(
const ApiCallInfo& call_info,
format::HandleId commandBuffer,
StructPointerDecoder<Decoded_VkPushDescriptorSetInfo>* pPushDescriptorSetInfo) override;

virtual void Process_vkCmdSetDescriptorBufferOffsets2EXT(
const ApiCallInfo& call_info,
format::HandleId commandBuffer,
StructPointerDecoder<Decoded_VkSetDescriptorBufferOffsetsInfoEXT>* pSetDescriptorBufferOffsetsInfo) override;

virtual void Process_vkCmdBindDescriptorBufferEmbeddedSamplers2EXT(
const ApiCallInfo& call_info,
format::HandleId commandBuffer,
StructPointerDecoder<Decoded_VkBindDescriptorBufferEmbeddedSamplersInfoEXT>* pBindDescriptorBufferEmbeddedSamplersInfo) override;

virtual void Process_vkCmdBindTransformFeedbackBuffersEXT(
const ApiCallInfo& call_info,
format::HandleId commandBuffer,
Expand Down Expand Up @@ -673,12 +653,6 @@ class VulkanReferencedResourceConsumer : public VulkanReferencedResourceConsumer
StructPointerDecoder<Decoded_VkGeneratedCommandsInfoEXT>* pGeneratedCommandsInfo,
format::HandleId stateCommandBuffer) override;

virtual void Process_vkCmdExecuteGeneratedCommandsEXT(
const ApiCallInfo& call_info,
format::HandleId commandBuffer,
VkBool32 isPreprocessed,
StructPointerDecoder<Decoded_VkGeneratedCommandsInfoEXT>* pGeneratedCommandsInfo) override;

virtual void Process_vkCmdBuildAccelerationStructuresKHR(
const ApiCallInfo& call_info,
format::HandleId commandBuffer,
Expand Down
60 changes: 41 additions & 19 deletions framework/generated/generated_vulkan_struct_handle_wrappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,34 @@ VkBaseInStructure* CopyPNextStruct(const VkBaseInStructure* base, HandleUnwrapMe

const void* UnwrapPNextStructHandles(const void* value, HandleUnwrapMemory* unwrap_memory);

template <typename ParentWrapper, typename CoParentWrapper, typename T>
void CreateWrappedStructArrayHandles(typename ParentWrapper::HandleType parent, typename CoParentWrapper::HandleType co_parent, T* value, size_t len, PFN_GetHandleId get_id);

template <typename T>
T* MakeUnwrapStructs(const T* values, size_t len, HandleUnwrapMemory* unwrap_memory)
{
assert((values != nullptr) && (len > 0) && (unwrap_memory != nullptr));

const uint8_t* bytes = reinterpret_cast<const uint8_t*>(values);
size_t num_bytes = len * sizeof(T);

return reinterpret_cast<T*>(unwrap_memory->GetFilledBuffer(bytes, num_bytes));
}

template <typename T>
const T* UnwrapStructPtrHandles(const T* value, HandleUnwrapMemory* unwrap_memory)
{
T* unwrapped_struct = nullptr;

if (value != nullptr)
{
unwrapped_struct = MakeUnwrapStructs(value, 1, unwrap_memory);
UnwrapStructHandles(unwrapped_struct, unwrap_memory);
}

return unwrapped_struct;
}

template <typename ParentWrapper, typename CoParentWrapper>
void CreateWrappedStructHandles(typename ParentWrapper::HandleType parent, typename CoParentWrapper::HandleType co_parent, VkPhysicalDeviceGroupProperties* value, PFN_GetHandleId get_id)
{
Expand Down Expand Up @@ -502,40 +530,34 @@ void CreateWrappedStructArrayHandles(typename ParentWrapper::HandleType parent,
}

template <typename T>
T* MakeUnwrapStructs(const T* values, size_t len, HandleUnwrapMemory* unwrap_memory)
const T* UnwrapStructArrayHandles(const T* values, size_t len, HandleUnwrapMemory* unwrap_memory)
{
assert((values != nullptr) && (len > 0) && (unwrap_memory != nullptr));

const uint8_t* bytes = reinterpret_cast<const uint8_t*>(values);
size_t num_bytes = len * sizeof(T);

return reinterpret_cast<T*>(unwrap_memory->GetFilledBuffer(bytes, num_bytes));
}
if ((values != nullptr) && (len > 0))
{
auto unwrapped_structs = MakeUnwrapStructs(values, len, unwrap_memory);

template <typename T>
const T* UnwrapStructPtrHandles(const T* value, HandleUnwrapMemory* unwrap_memory)
{
T* unwrapped_struct = nullptr;
for (size_t i = 0; i < len; ++i)
{
UnwrapStructHandles(&unwrapped_structs[i], unwrap_memory);
}

if (value != nullptr)
{
unwrapped_struct = MakeUnwrapStructs(value, 1, unwrap_memory);
UnwrapStructHandles(unwrapped_struct, unwrap_memory);
return unwrapped_structs;
}

return unwrapped_struct;
// Leave the original memory in place when the pointer is not null, but size is zero.
return values;
}

template <typename T>
const T* UnwrapStructArrayHandles(const T* values, size_t len, HandleUnwrapMemory* unwrap_memory)
T* UnwrapStructPtrArrayHandles(T* values, size_t len, HandleUnwrapMemory* unwrap_memory)
{
if ((values != nullptr) && (len > 0))
{
auto unwrapped_structs = MakeUnwrapStructs(values, len, unwrap_memory);

for (size_t i = 0; i < len; ++i)
{
UnwrapStructHandles(&unwrapped_structs[i], unwrap_memory);
UnwrapStructHandles(unwrapped_structs[i], unwrap_memory);
}

return unwrapped_structs;
Expand Down
Loading