On 04/06/06, Ivan Gyurdiev <[EMAIL PROTECTED]> wrote:
Well, it seems to store a bit more than that. If I create pshaders A,B,
and vshaders C,D, and do:
set_pixel(A); set_vertex(C);
draw_stuff();
set_pixel(B); set_vertex(D);
draw_stuff();
set_pixel(NULL), set_vertex(NULL)

Won't this create...5 different programs, all kept in memory for the
entire lifetime of the program, while we only need 2 [1 active]?
(A, NULL), (A,C), (B,C), (B,D), (NULL, D)
I think it should be possible to change the code in such a way that
the programs are only created once they're actually used.

Also, is it necessary to store link pair info in both shaders - isn't
this redundant somehow?
Well, yes. When a shader is released, the programs it's linked to
should be destroyed.
However, it's probably not neccesary to point to the other shader. We
could probably just link to a program struct that contains the program
id and a list of linked shaders. It doubt it will make much of a
difference wrt amount of memory used though, at least not as long as
there are only two shaders involved. On the other hand, for d3d10
we'll also need geometry / primitive shaders.


Reply via email to