-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathworkflow0.txt
57 lines (49 loc) · 1.54 KB
/
workflow0.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# I thought someone might like
# to see one possible workflow
# for a project like this. So I
# provide intermediate steps.
# file: example.py
# I'm usually not a fan of test
# driven design. But now the
# outcome and goals are very
# explicit and allows it.
import vks
# Lets start with the simple one
vks.InstanceCreateInfo(dict(
enabledExtensionNames = ["VK_KHR_surface", "VK_KHR_xcb_surface"],
))
# file: vks.py
# Ultimately the goal is to have
# everything generated from vk.xml
# But before you can generate
# things it's better you know the
# format you need things in.
# Too early abstraction is evil.
# Also we want a theory about how
# this kind of library would work.
def InstanceCreateInfo(struct):
pool = {}
obj = "+InstanceCreateInfo"
print obj
for key, item in struct.iteritems():
act = table[key]
act(obj, item)
return pool
def enabledExtensionNames(base, item):
print "{}.enabledExtensionCount = {}".format(base, len(item))
print "{}.pEnabledExtensionNames = +char_pp".format(base)
for i, name in enumerate(item):
print "+char_pp[{}] = {!r}".format(i, name)
table = {}
table["enabledExtensionNames"] = enabledExtensionNames
# output: python example.py
# Here we can see that the program
# is generating the pool contents
# we need. So I have obtained a
# theory about the function of the
# tool I'm designing.
+InstanceCreateInfo
+InstanceCreateInfo.enabledExtensionCount = 2
+InstanceCreateInfo.pEnabledExtensionNames = +char_pp
+char_pp[0] = 'VK_KHR_surface'
+char_pp[1] = 'VK_KHR_xcb_surface'