Page 1 of 1

How do I clean memory from a shader?

Posted: Wed Feb 23, 2011 1:28 pm
by sylpheed
I have this in my app for creating a shader:

Code: Select all

id_material = gpu->addHighLevelShaderMaterial(
							vs_code.c_str (), vs_main_name.c_str (), vsType,
							ps_code.c_str (), ps_main_name.c_str (), psType,
							callback, (E_MATERIAL_TYPE)material_type);
I use this shader for a time to render a object, later I don't need it so I would like to free memory for this shader. How do I clean the material with "id_material" from the scene?

Thanks and sorry for my English

Posted: Fri Feb 25, 2011 12:22 pm
by REDDemon
nice question. :) have googled and not found anything. Have you really so many shaders in your game that this can become an issue?

Posted: Fri Feb 25, 2011 1:59 pm
by hybrid
I guess it wasn't added to the API in the past because we do not grab the material renderers from the materials that use them. So it's kind of hard to make sure that your material is not used anymore. So right now it's probably only possible by dropping the device.