5 !handcode glXGetProcAddress
6 !handcode glXGetProcAddressARB
7 !handcode eglGetProcAddress
8 wl('%s APIENTRY %s(%s)', ret.ctype, func.name, ", ".join([p.ctype+" "+p.name for p in params]))
10 wl(' static %s (*orig)(%s) = NULL;', ret.ctype, ", ".join([p.ctype for p in params]))
13 wl(' %s ret;', ret.ctype)
15 wl(' orig = glsym("%s");', func.name)
16 wl(' pkt = packet_begin(FUNC_%s);', func.name.upper())
19 if p.direction=="out" and not head_sent:
20 wl(' packet_send_partial(pkt, get_out_fd());')
24 wl('orig(%s);', ", ".join([q.name for q in params]))
27 wl(' packet_write_%s(pkt, %s);', p.io[0].replace(' ', '_'), p.name)
28 elif p.kind=="array" and p.io and p.io[0]=="string":
29 wl(' packet_write_string_array(pkt, %s, %s);', p.name, p.csize)
31 wl(' packet_write_data(pkt, %s, %s);', p.name, p.csize)
33 wl(' packet_write_pointer(pkt, %s);', p.name)
36 wl(' packet_send_partial(pkt, get_out_fd());')
37 wl(' ret = orig(%s);', ", ".join([p.name for p in params]))
39 wl(' packet_write_%s(pkt, ret);', ret.io[0].replace(' ', '_'))
40 wl(' packet_send(pkt, get_out_fd());')
42 wl(' orig(%s);', ", ".join([p.name for p in params]))
43 if not func.name.startswith("glX"):
45 #wl(' receive_packet();')