1 # -*- Mode:text; tab-width:4; electric-indent-mode: nil; indent-line-function:insert-tab; -*-
6 struct <default> rename=s/_T$// {
10 func:vkGetInstanceProcAddr raw:result$ instance:0;
12 # be nice if findMatches() took the name of the target then it could handle pattern matching struct // automatically
13 # todo: check this works for extension functions
14 func:<match-function> instance:0 {{
15 # another way perhaps? func:<match-function> match:0=u64:${VkInstance_T};
18 return $s->{type} eq 'func' && defined($s->{items}->[0]) && $s->{items}->[0]->{deref} eq 'u64:${VkInstance_T}';
22 # another version for extension functions - uses a dynamic func resolution
23 #func:<match-function> instance:0 func:template=code:vulkan-method=invoke-dynamic {{
33 MethodHandle {name}$FH;
34 public {java-result} {rename}({java-arguments}) {
35 {native-output-define}
36 {native-result-define}
38 if ({name}$FH == null)
39 {name}$FH = Memory.downcall("{name}", vkGetInstanceProcAddr("{name}"), {function-descriptor}, scope());
42 {native-result-assign}{name}$FH.invokeExact({native-call});
49 } catch (Throwable t) {
50 throw new RuntimeException(t);