gpu.shaders: carry over instances from old shader/program objects when GLSL-SHADER: or GLSL-PROGRAM: forms get reparsed
parent
0653bae7ec
commit
09ceb7351e
|
@ -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
|
||||||
scan-word
|
dup old-instances [
|
||||||
f
|
scan-word
|
||||||
lexer get line>>
|
f
|
||||||
parse-here
|
lexer get line>>
|
||||||
H{ } clone
|
parse-here
|
||||||
|
] 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
|
||||||
scan-word execute( -- kind )
|
dup old-instances [
|
||||||
scan-object in-word's-path
|
scan-word execute( -- kind )
|
||||||
0
|
scan-object in-word's-path
|
||||||
over ascii file-contents
|
0
|
||||||
H{ } clone
|
over ascii file-contents
|
||||||
|
] dip
|
||||||
shader boa
|
shader boa
|
||||||
|
over reset-generic
|
||||||
define-constant ;
|
define-constant ;
|
||||||
|
|
||||||
SYNTAX: GLSL-PROGRAM:
|
SYNTAX: GLSL-PROGRAM:
|
||||||
CREATE-WORD dup
|
CREATE dup
|
||||||
f
|
dup old-instances [
|
||||||
lexer get line>>
|
f
|
||||||
\ ; parse-until >array shaders-and-feedback-format
|
lexer get line>>
|
||||||
H{ } clone
|
\ ; parse-until >array shaders-and-feedback-format
|
||||||
|
] dip
|
||||||
program boa
|
program boa
|
||||||
|
over reset-generic
|
||||||
define-constant ;
|
define-constant ;
|
||||||
|
|
||||||
M: shader-instance dispose
|
M: shader-instance dispose
|
||||||
|
|
Loading…
Reference in New Issue