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

Implement instance table API #154

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 12 additions & 6 deletions generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def cdepends(key):

spec = parse_xml(specpath)

block_keys = ('DEVICE_TABLE', 'PROTOTYPES_H', 'PROTOTYPES_C', 'LOAD_LOADER', 'LOAD_INSTANCE', 'LOAD_DEVICE', 'LOAD_DEVICE_TABLE')
block_keys = ('INSTANCE_TABLE', 'DEVICE_TABLE', 'PROTOTYPES_H', 'PROTOTYPES_C', 'LOAD_LOADER', 'LOAD_INSTANCE', 'LOAD_INSTANCE_TABLE', 'LOAD_DEVICE', 'LOAD_DEVICE_TABLE')

blocks = {}

Expand Down Expand Up @@ -169,14 +169,20 @@ def cdepends(key):
if name == 'vkGetDeviceProcAddr':
type = 'VkInstance'

load_fn = '\t' + name + ' = (PFN_' + name + ')load(context, "' + name + '");\n'
def_table = '\tPFN_' + name + ' ' + name + ';\n'
load_table = '\ttable->' + name + ' = (PFN_' + name + ')load(context, "' + name + '");\n'

if is_descendant_type(types, type, 'VkDevice') and name not in instance_commands:
blocks['LOAD_DEVICE'] += '\t' + name + ' = (PFN_' + name + ')load(context, "' + name + '");\n'
blocks['DEVICE_TABLE'] += '\tPFN_' + name + ' ' + name + ';\n'
blocks['LOAD_DEVICE_TABLE'] += '\ttable->' + name + ' = (PFN_' + name + ')load(context, "' + name + '");\n'
blocks['LOAD_DEVICE'] += load_fn
blocks['DEVICE_TABLE'] += def_table
blocks['LOAD_DEVICE_TABLE'] += load_table
elif is_descendant_type(types, type, 'VkInstance'):
blocks['LOAD_INSTANCE'] += '\t' + name + ' = (PFN_' + name + ')load(context, "' + name + '");\n'
blocks['LOAD_INSTANCE'] += load_fn
blocks['INSTANCE_TABLE'] += def_table
blocks['LOAD_INSTANCE_TABLE'] += load_table
elif type != '':
blocks['LOAD_LOADER'] += '\t' + name + ' = (PFN_' + name + ')load(context, "' + name + '");\n'
blocks['LOAD_LOADER'] += load_fn

blocks['PROTOTYPES_H'] += 'extern PFN_' + name + ' ' + name + ';\n'
blocks['PROTOTYPES_C'] += 'PFN_' + name + ' ' + name + ';\n'
Expand Down
Loading