Skip to content

Commit

Permalink
codegen: Update 'create' criteria
Browse files Browse the repository at this point in the history
Determine whether or not a command is expected to return a result in a
pointer based on parameter type rather than a hard-coded list of command
names.

Closes KhronosGroup#4136.
  • Loading branch information
ncesario-lunarg committed May 19, 2022
1 parent c935ec7 commit 7a9afe1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
14 changes: 6 additions & 8 deletions layers/generated/layer_chassis_dispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9335,11 +9335,10 @@ VkResult DispatchGetDrmDisplayEXT(
{
auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map);
if (!wrap_handles) return layer_data->instance_dispatch_table.GetDrmDisplayEXT(physicalDevice, drmFd, connectorId, display);
{
display = layer_data->Unwrap(display);
}
VkResult result = layer_data->instance_dispatch_table.GetDrmDisplayEXT(physicalDevice, drmFd, connectorId, display);

if (VK_SUCCESS == result) {
*display = layer_data->WrapNew(*display);
}
return result;
}

Expand Down Expand Up @@ -9431,11 +9430,10 @@ VkResult DispatchGetWinrtDisplayNV(
{
auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map);
if (!wrap_handles) return layer_data->instance_dispatch_table.GetWinrtDisplayNV(physicalDevice, deviceRelativeId, pDisplay);
{
pDisplay = layer_data->Unwrap(pDisplay);
}
VkResult result = layer_data->instance_dispatch_table.GetWinrtDisplayNV(physicalDevice, deviceRelativeId, pDisplay);

if (VK_SUCCESS == result) {
*pDisplay = layer_data->WrapNew(*pDisplay);
}
return result;
}
#endif // VK_USE_PLATFORM_WIN32_KHR
Expand Down
4 changes: 2 additions & 2 deletions scripts/layer_chassis_dispatch_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2011,7 +2011,7 @@ def generate_wrapping_code(self, cmd):
cmd_member_dict = dict(self.cmdMembers)
cmd_info = cmd_member_dict[proto.text]
# Handle ndo create/allocate operations
if cmd_info[0].iscreate:
if cmd_info[-1].iscreate:
create_ndo_code = self.generate_create_ndo_code(indent, proto, params, cmd_info)
else:
create_ndo_code = ''
Expand Down Expand Up @@ -2074,7 +2074,7 @@ def genCmd(self, cmdinfo, cmdname, alias):
if self.struct_contains_ndo(type) == True:
islocal = True
isdestroy = True if True in [destroy_txt in cmdname for destroy_txt in ['Destroy', 'Free', 'ReleasePerformanceConfigurationINTEL']] else False
iscreate = True if True in [create_txt in cmdname for create_txt in ['Create', 'Allocate', 'GetRandROutputDisplayEXT', 'RegisterDeviceEvent', 'RegisterDisplayEvent', 'AcquirePerformanceConfigurationINTEL']] else False
iscreate = (not isconst) and ispointer
extstructs = self.registry.validextensionstructs[type] if name == 'pNext' else None
membersInfo.append(self.CommandParam(type=type,
name=name,
Expand Down

0 comments on commit 7a9afe1

Please sign in to comment.