diff options
author | Dan Gudmundsson <[email protected]> | 2016-11-22 09:57:09 +0100 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2016-11-22 09:57:09 +0100 |
commit | 9cacf4faa47f87a063af6baa52a017ea9a4989e3 (patch) | |
tree | e14bc5803c8cef0d1a6a97c11e1fc35ec5d3159f /lib/wx/api_gen/gl_gen_erl.erl | |
parent | 4b6b406a75116f651213a307f6873940d35b5199 (diff) | |
download | otp-9cacf4faa47f87a063af6baa52a017ea9a4989e3.tar.gz otp-9cacf4faa47f87a063af6baa52a017ea9a4989e3.tar.bz2 otp-9cacf4faa47f87a063af6baa52a017ea9a4989e3.zip |
Add option to send prebuilt binaries to multiDrawArrays
Diffstat (limited to 'lib/wx/api_gen/gl_gen_erl.erl')
-rw-r--r-- | lib/wx/api_gen/gl_gen_erl.erl | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/wx/api_gen/gl_gen_erl.erl b/lib/wx/api_gen/gl_gen_erl.erl index 1f9407525d..4bb80662e1 100644 --- a/lib/wx/api_gen/gl_gen_erl.erl +++ b/lib/wx/api_gen/gl_gen_erl.erl @@ -496,6 +496,8 @@ doc_arg_type2(#type{base=string, single=list}) -> "iolist()"; doc_arg_type2(T=#type{single={tuple,Sz}}) -> "{" ++ args(fun doc_arg_type3/1, ",", lists:duplicate(Sz,T)) ++ "}"; +doc_arg_type2(#type{base=guard_int, single=list}) -> + "[integer()]|mem()"; doc_arg_type2(T=#type{single=list}) -> "[" ++ doc_arg_type3(T) ++ "]"; doc_arg_type2(T=#type{single={list, _Max}}) -> @@ -516,7 +518,9 @@ doc_arg_type3(#type{base=binary}) -> "binary()"; doc_arg_type3(#type{base=memory}) -> "mem()". guard_test(As) -> - Str = args(fun(#arg{name=N,type=#type{base=guard_int}}) -> + Str = args(fun(#arg{name=N,type=#type{base=guard_int, single=list}}) -> + " is_list("++erl_arg_name(N)++")"; + (#arg{name=N,type=#type{base=guard_int}}) -> " is_integer("++erl_arg_name(N)++")"; (_) -> skip @@ -526,6 +530,13 @@ guard_test(As) -> Other -> " when " ++ Other end. +pre_marshal([#arg{name=N,in=true, type=#type{base=binary, single=list}=T, alt=list_binary}=A|R]) -> + w(" send_bin(~s),~n", [erl_arg_name(N)]), + w(" ~sLen = byte_size(if is_binary(~s) -> ~s; is_tuple(~s) -> element(2, ~s) end) div 4,~n", + [erl_arg_name(N),erl_arg_name(N), erl_arg_name(N), erl_arg_name(N), erl_arg_name(N)]), + Type = T#type{base=int, by_val=true, single=true, ref=undefined}, + Arg=A#arg{name=N++"Len", where=both, type=Type}, + [Arg|pre_marshal(R)]; pre_marshal([#arg{name=N,in=true,type=#type{base=binary}}|R]) -> w(" send_bin(~s),~n", [erl_arg_name(N)]), pre_marshal(R); @@ -587,7 +598,7 @@ marshal_arg(#type{size=BSz,name=Type,single={tuple,matrix12}},Name,A0) -> align(BSz,16,A0,All); marshal_arg(#type{size=Sz,name=Type,base=Base,single=list},Name,A0) - when Base =:= float; Base =:= int -> + when Base =:= float; Base =:= int; Base =:= guard_int -> KeepA = case Sz of 8 -> "0:32,"; _ -> "" end, Str0 = "(length("++Name++")):?GLuint,"++KeepA++"\n" " (<< <<C:?"++Type++">> || C <- "++Name++">>)/binary", |