gpu.shaders: carry over instances from old shader/program objects when GLSL-SHADER: or GLSL-PROGRAM: forms get reparsed

db4
Joe Groff 2009-10-18 13:44:24 -05:00
parent 0653bae7ec
commit 09ceb7351e
1 changed files with 33 additions and 17 deletions

View File

@ -432,33 +432,49 @@ PRIVATE>
: <program-instance> ( program -- instance ) : <program-instance> ( program -- instance )
[ find-program-instance dup world get ] keep instances>> set-at ; [ find-program-instance dup world get ] keep instances>> set-at ;
<PRIVATE
: old-instances ( name -- instances )
dup constant? [
execute( -- s/p ) dup { [ shader? ] [ program? ] } 1||
[ instances>> ] [ drop H{ } clone ] if
] [ drop H{ } clone ] if ;
PRIVATE>
SYNTAX: GLSL-SHADER: SYNTAX: GLSL-SHADER:
CREATE-WORD dup CREATE dup
dup old-instances [
scan-word scan-word
f f
lexer get line>> lexer get line>>
parse-here parse-here
H{ } clone ] dip
shader boa shader boa
over reset-generic
define-constant ; define-constant ;
SYNTAX: GLSL-SHADER-FILE: SYNTAX: GLSL-SHADER-FILE:
CREATE-WORD dup CREATE dup
dup old-instances [
scan-word execute( -- kind ) scan-word execute( -- kind )
scan-object in-word's-path scan-object in-word's-path
0 0
over ascii file-contents over ascii file-contents
H{ } clone ] dip
shader boa shader boa
over reset-generic
define-constant ; define-constant ;
SYNTAX: GLSL-PROGRAM: SYNTAX: GLSL-PROGRAM:
CREATE-WORD dup CREATE dup
dup old-instances [
f f
lexer get line>> lexer get line>>
\ ; parse-until >array shaders-and-feedback-format \ ; parse-until >array shaders-and-feedback-format
H{ } clone ] dip
program boa program boa
over reset-generic
define-constant ; define-constant ;
M: shader-instance dispose M: shader-instance dispose