Index: trunk/src/gl/gl_context.cc
===================================================================
--- trunk/src/gl/gl_context.cc	(revision 499)
+++ trunk/src/gl/gl_context.cc	(revision 500)
@@ -132,5 +132,5 @@
 }
 
-void nv::gl_context::attach( framebuffer f, output_slot slot, texture t )
+void nv::gl_context::attach( framebuffer f, output_slot slot, texture t, int layer /* = -1*/ )
 {
 	// TODO: framebuffer variable, so no re-binding?
@@ -143,14 +143,13 @@
 		glBindFramebuffer( GL_FRAMEBUFFER, info->glid );
 		unsigned gl_type = texture_type_to_enum( tinfo->type );
-
-		if ( tinfo )
-		{
-			//		if ( tinfo->size.y == 0 )
-				//			glFramebufferTexture1D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+(unsigned)slot, GL_TEXTURE_1D, tinfo->glid, 0 );
-			glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+unsigned( slot ), gl_type, tinfo->glid, 0 );
+		unsigned tglid = tinfo ? tinfo->glid : 0;
+
+		if ( layer >= 0 )
+		{
+			glFramebufferTextureLayer( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + unsigned( slot ), tglid, 0, layer );
 		}
 		else
 		{
-			glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+unsigned( slot ), gl_type, 0, 0 );
+			glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + unsigned( slot ), gl_type, tglid, 0 );
 		}
 
@@ -171,5 +170,5 @@
 		if ( layer >= 0 )
 		{
-			glFramebufferTextureLayer( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, tinfo->glid, 0, layer );
+			glFramebufferTextureLayer( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, glid, 0, layer );
 		}
 		else
Index: trunk/src/gl/gl_enum.cc
===================================================================
--- trunk/src/gl/gl_enum.cc	(revision 499)
+++ trunk/src/gl/gl_enum.cc	(revision 500)
@@ -202,4 +202,10 @@
 	case R32I    : return GL_RED_INTEGER;
 	case R32UI   : return GL_RED_INTEGER;
+	case RGBA8I  : return GL_RGBA;
+	case RGBA8UI : return GL_RGBA;
+	case RGBA16I : return GL_RGBA;
+	case RGBA16UI: return GL_RGBA;
+	case RGBA32I : return GL_RGBA;
+	case RGBA32UI: return GL_RGBA;
 	NV_RETURN_COVERED_DEFAULT( 0 );
 	}
@@ -230,4 +236,11 @@
 	case R32I    : return GL_R32I;
 	case R32UI   : return GL_R32UI;
+	case RGBA8I  : return GL_RGBA8I;
+	case RGBA8UI : return GL_RGBA8UI;
+	case RGBA16I : return GL_RGBA16I;
+	case RGBA16UI: return GL_RGBA16UI;
+	case RGBA32I : return GL_RGBA32I;
+	case RGBA32UI: return GL_RGBA32UI;
+
 	NV_RETURN_COVERED_DEFAULT( 0 );
 	}
