0 vreg-counter set-global
[ build-tree optimize-tree ] keep build-cfg ;
-: test-optimizer ( quot -- cfgs )
- test-builder [ [ optimize-cfg ] with-cfg ] map ;
-
: test-ssa ( quot -- cfgs )
test-builder [
[
: >decoder< ( decoder -- stream encoding )
[ stream>> ] [ code>> ] bi ; inline
-: fix-read1 ( stream char -- char )
- over cr>> [
- over cr-
- dup CHAR: \n = [
- drop dup stream-read1
- ] when
- ] when nip ; inline
-
M: decoder stream-element-type
drop +character+ ; inline
: optimized-cfg ( quot -- cfgs )
{
{ [ dup cfg? ] [ 1array ] }
- { [ dup quotation? ] [ test-optimizer ] }
- { [ dup word? ] [ test-optimizer ] }
+ { [ dup quotation? ] [ test-ssa ] }
+ { [ dup word? ] [ test-ssa ] }
[ ]
} cond ;
{ $values { "string" string } { "number-seq" sequence } }
{ $description "Splits a string on whitespace and converts the elements to a number sequence." } ;
-HELP: string>floats ( string -- float-seq )
-{ $values { "string" string } { "float-seq" sequence } }
-{ $description "Splits a string on whitespace and converts the elements to a float sequence." } ;
-
HELP: x-up { $class-description "Right-handed 3D coordinate system where X is up." } ;
HELP: y-up { $class-description "Right-handed 3D coordinate system where Y is up." } ;
HELP: z-up { $class-description "Right-handed 3D coordinate system where Z is up." } ;
: string>numbers ( string -- number-seq )
" \t\n" split harvest [ string>number ] map ;
-: string>floats ( string -- float-seq )
- " \t\n" split harvest [ string>number ] map ;
-
: x/ ( tag child-name -- child-tag )
[ tag-named ]
[ rot dup [ drop missing-child ] unless 2nip ]
: source>seq ( source-tag up-axis scale -- sequence )
rot
- [ "float_array" x/ xt string>floats [ * ] with map ]
+ [ "float_array" x/ xt string>numbers [ * ] with map ]
[ nip "technique_common" x/ "accessor" x/ "stride" x@ string>number ] 2bi
group
[ swap over length 2 > [ >y-up-axis! ] [ drop ] if ] with map ;
: triangles>model ( sources vertices triangles-tag -- model )
[ "input" tags-named collect-sources ] keep swap
-
+
[
largest-offset+1 swap
[ "count" x@ string>number ] [ triangles>numbers ] bi