gpu.shaders: simplified in-word's-path

factor-shell
Björn Lindqvist 2018-01-28 03:43:01 +01:00
parent a9ebc772df
commit d95d9e0ec8
2 changed files with 11 additions and 2 deletions

View File

@ -1,6 +1,6 @@
! Copyright (C) 2009 Joe Groff.
! See http://factorcode.org/license.txt for BSD license.
USING: multiline gpu.shaders gpu.shaders.private tools.test ;
USING: gpu.shaders gpu.shaders.private io.pathnames tools.test ;
IN: gpu.shaders.tests
{ "ERROR: foo.factor:20: Bad command or filename
@ -10,3 +10,9 @@ NOT:A:LOG:LINE" }
"ERROR: 0:1: Bad command or filename
INFO: 0:11: The operation completed successfully
NOT:A:LOG:LINE" replace-log-line-numbers ] unit-test
SYMBOL: a-test-symbol
{ "shaders" } [
a-test-symbol word-directory file-name
] unit-test

View File

@ -494,8 +494,11 @@ DEFER: <shader-instance>
: link-program ( program -- program-instance )
dup shaders>> [ <shader-instance> ] map (link-program) ;
: word-directory ( word -- directory )
where first parent-directory ;
: in-word's-path ( word kind filename -- word kind filename' )
[ over ] dip [ where first parent-directory ] dip append-path ;
pick word-directory prepend-path ;
: become-shader-instance ( shader-instance new-shader-instance -- )
handle>> [ swap delete-gl-shader ] curry change-handle drop ;