Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Resetting shaders  (Read 2057 times)
TecnoBacon
Customers
Community Member
*****
Posts: 305


WWW
« on: November 28, 2009, 11:06:21 AM »

I have tried '.shader.destroy' and creating new one but that destroys the mesh its attached to.

Replacing using createfrom but is that gonig to cause a mem leak or are you managing it.

We edit shaders in our editor directly and they get reloaded dynamically when changed so I need a solid way to reload shaders, am i doing it right or is/will there be a different way?

Eric
Logged

www.TecnoBacon.com - the other side of the Bacon family! 3D Development, Music and more.
jviper
Community Member
*
Posts: 2127

Discipline in training


« Reply #1 on: November 28, 2009, 03:13:45 PM »

Hmmm, well Destroying the Shader should not destroy the Mesh. Are you sure you are not callig Mesh.Destroy, or perhaps doing somthing that would make the mesh not visibe? The Mesh could be invisible because of a shader, and does not mean the mesh is destroyed.
Logged

JAbstract.....Don't just imagine, make it happen!
AriusEso
Customers
Community Member
*****
Posts: 940

Esoteric


« Reply #2 on: November 28, 2009, 03:28:41 PM »

Try doing SetShader(0) on the mesh before calling Destroy.
Logged

-...-

TecnoBacon
Customers
Community Member
*****
Posts: 305


WWW
« Reply #3 on: November 28, 2009, 10:18:27 PM »

not sure if the mesh itself is destroyed but I get an alloc error the next time I try to render the mesh, I'll try setshader(0)

Logged

www.TecnoBacon.com - the other side of the Bacon family! 3D Development, Music and more.
Shadowsong
Customers
Community Member
*****
Posts: 328


« Reply #4 on: December 04, 2009, 01:36:13 AM »

Well you get the alloc error because the mesh tries to render itself with the shader that doesn't exist anymore because you just destroyed it.
Still I guess this should be an error handled by TV, since they handle anything else, they could check if the shader exists before trying to use it.

So before destroying the shader, make sure to call SetShader(0) on every objects that used the shader before.
Logged
TecnoBacon
Customers
Community Member
*****
Posts: 305


WWW
« Reply #5 on: December 04, 2009, 10:58:17 AM »

Once I destroy the shader I create a new one and use setshader and it runs a few loops and then gets an alloc error, not right away. If I destroy the mesh and re-do it, it works fine.

If I just use createeffect to replace it without destroying the shader everything runs fine except that the memory from the last shader stays alloc'd for several loops of TV.

Another thing that happens is that if I call getlasterror when I know an error occurred it only gives me the text after the 2nd loop after the change, have to call getlasterror twice to get the error string.

I think that there is a sync problem in the TV code, maybe nothing can be done since TV has to rely on DX for the actual error response, possibly use blocking while waiting for the shader to load and compile (2 loops of TV)

Logged

www.TecnoBacon.com - the other side of the Bacon family! 3D Development, Music and more.
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks