Index: trunk/src/gfx/debug_draw.cc
===================================================================
--- trunk/src/gfx/debug_draw.cc	(revision 302)
+++ trunk/src/gfx/debug_draw.cc	(revision 303)
@@ -29,5 +29,5 @@
 
 nv::debug_data::debug_data( device* a_device )
-	: m_device( a_device ), m_program( nullptr ), m_va()
+	: m_device( a_device ), m_program(), m_va()
 {
 	m_program = m_device->create_program( nv_debug_draw_vertex_shader, nv_debug_draw_fragment_shader );
@@ -76,4 +76,4 @@
 {
 	m_device->release( m_va );
-	delete m_program;
+	m_device->release( m_program );
 }
Index: trunk/src/gfx/keyframed_mesh.cc
===================================================================
--- trunk/src/gfx/keyframed_mesh.cc	(revision 302)
+++ trunk/src/gfx/keyframed_mesh.cc	(revision 303)
@@ -98,7 +98,7 @@
 
 
-void nv::keyframed_mesh::update( program* a_program )
-{
-	a_program->set_opt_uniform( "nv_interpolate", m_interpolation );
+void nv::keyframed_mesh::update( program a_program )
+{
+	m_context->get_device()->set_opt_uniform( a_program, "nv_interpolate", m_interpolation );
 }
 
@@ -165,14 +165,14 @@
 }
 
-void nv::keyframed_mesh_gpu::update( program* a_program )
+void nv::keyframed_mesh_gpu::update( program a_program )
 {
 	if ( m_loc_next_position == -1 )
 	{
-		m_loc_next_position = a_program->get_attribute( "nv_next_position" )->get_location();
-		m_loc_next_normal   = a_program->get_attribute( "nv_next_normal" )->get_location();
+		device* dev = m_context->get_device();
+		m_loc_next_position = dev->get_attribute_location( a_program, "nv_next_position" );
+		m_loc_next_normal   = dev->get_attribute_location( a_program, "nv_next_normal" );
 		if ( m_has_tangent )
-			m_loc_next_tangent  = a_program->get_attribute( "nv_next_tangent" )->get_location();
-
-		device* dev = m_context->get_device();
+			m_loc_next_tangent  = dev->get_attribute_location( a_program, "nv_next_tangent" );
+
 		dev->add_vertex_buffer( m_va, (slot)m_loc_next_position, m_pbuffer, FLOAT, 3, 0, m_vsize, false );
 		dev->add_vertex_buffer( m_va, (slot)m_loc_next_normal,   m_pbuffer, FLOAT, 3, sizeof( vec3 ), m_vsize, false );
Index: trunk/src/gfx/skeletal_mesh.cc
===================================================================
--- trunk/src/gfx/skeletal_mesh.cc	(revision 302)
+++ trunk/src/gfx/skeletal_mesh.cc	(revision 303)
@@ -213,8 +213,8 @@
 }
 
-void nv::skeletal_mesh_gpu::update( program* a_program )
+void nv::skeletal_mesh_gpu::update( program a_program )
 {
 	if ( m_bone_data )
-		a_program->set_opt_uniform_array( "nv_m_bones", m_transform, m_bone_data->get_count() );
+		m_context->get_device()->set_opt_uniform_array( a_program, "nv_m_bones", m_transform, m_bone_data->get_count() );
 }
 
