Index: trunk/src/gl/gl_context.cc
===================================================================
--- trunk/src/gl/gl_context.cc	(revision 534)
+++ trunk/src/gl/gl_context.cc	(revision 535)
@@ -126,12 +126,12 @@
 }
 
-nv::image_data* nv::gl_context::dump_image( image_format f, image_data* reuse )
-{
-	NV_ASSERT_ALWAYS( f.type   == nv::UBYTE, "Bad format passed to dump" );
-	NV_ASSERT_ALWAYS( f.format == nv::RGB || f.format == nv::RGBA, "Bad format passed to dump" );
+nv::image_data* nv::gl_context::dump_image( pixel_format format, image_data* reuse )
+{
+	NV_ASSERT_ALWAYS( format == nv::RGB8 || format == nv::RGBA8, "Bad format passed to dump" );
 	glPixelStorei( GL_PACK_ALIGNMENT, 1 );
 	image_data* result = reuse;
-	if ( !result ) result = new image_data( f, ivec2( m_viewport.z, m_viewport.w ) );
-	glReadPixels( 0, 0, m_viewport.z, m_viewport.w, f.format == nv::RGB ? GL_RGB : GL_RGBA, datatype_to_gl_enum( f.type ), const_cast< uint8* >( result->get_data() ) );
+	datatype type = get_pixel_format_info( format ).type;
+	if ( !result ) result = new image_data( format, ivec2( m_viewport.z, m_viewport.w ) );
+	glReadPixels( 0, 0, m_viewport.z, m_viewport.w, format == nv::RGB8 ? GL_RGB : GL_RGBA, datatype_to_gl_enum( type ), const_cast< uint8* >( result->get_data() ) );
 	return result;
 }
@@ -307,5 +307,5 @@
 		NV_ASSERT_ALWAYS( binfo->type == TEXTURE_BUFFER && tinfo->type == TEXTURE_1D_BUFFER, "bad texture or buffer type!" );
 		bind( t, TEXTURE_0 );
-		glTexBuffer( GL_TEXTURE_BUFFER, image_format_to_internal_enum( tinfo->format.format ), binfo->glid );
+		glTexBuffer( GL_TEXTURE_BUFFER, image_format_to_internal_enum( tinfo->format ), binfo->glid );
 	}
 }
@@ -451,5 +451,6 @@
 	if ( info )
 	{
-		image_format format  = info->format;
+		pixel_format format  = info->format;
+		datatype     type    = get_pixel_format_info( format ).type;
 		ivec3        size    = info->size;
 		unsigned     gl_type = texture_type_to_enum( info->type );
@@ -457,9 +458,9 @@
 		bind( t, texture_slot::TEXTURE_0 );
 		if ( info->type == TEXTURE_3D || info->type == TEXTURE_2D_ARRAY )
-//			glTexImage3D( gl_type, 0, static_cast<GLint>( nv::image_format_to_internal_enum( format.format ) ), size.x, size.y, size.z, 0, nv::image_format_to_enum( format.format ), nv::datatype_to_gl_enum( format.type ), data );
-			glTexSubImage3D( gl_type, 0, 0, 0, 0, size.x, size.y, size.z, nv::image_format_to_enum( format.format ), nv::datatype_to_gl_enum( format.type ), data );
+//			glTexImage3D( gl_type, 0, static_cast<GLint>( nv::image_format_to_internal_enum( format ) ), size.x, size.y, size.z, 0, nv::image_format_to_enum( format ), nv::datatype_to_gl_enum( type ), data );
+			glTexSubImage3D( gl_type, 0, 0, 0, 0, size.x, size.y, size.z, nv::image_format_to_enum( format ), nv::datatype_to_gl_enum( type ), data );
 		else
-//			glTexImage2D( gl_type, 0, static_cast<GLint>( nv::image_format_to_internal_enum(format.format) ), size.x, size.y, 0, nv::image_format_to_enum(format.format), nv::datatype_to_gl_enum(format.type), data );
-			glTexSubImage2D( gl_type, 0, 0, 0, size.x, size.y, nv::image_format_to_enum( format.format ), nv::datatype_to_gl_enum( format.type ), data );
+//			glTexImage2D( gl_type, 0, static_cast<GLint>( nv::image_format_to_internal_enum(format) ), size.x, size.y, 0, nv::image_format_to_enum(format), nv::datatype_to_gl_enum(type), data );
+			glTexSubImage2D( gl_type, 0, 0, 0, size.x, size.y, nv::image_format_to_enum( format ), nv::datatype_to_gl_enum( type ), data );
 	}
 }
@@ -898,15 +899,15 @@
 }
 
-nv::texture nv::gl_context::create_texture( texture_type type, ivec2 size, image_format aformat, sampler asampler, const void* data /*= nullptr */ )
-{
-	texture result = create_texture( type, aformat.format );
+nv::texture nv::gl_context::create_texture( texture_type type, ivec2 size, pixel_format aformat, sampler asampler, const void* data /*= nullptr */ )
+{
+	texture result = create_texture( type, aformat );
 	gl_texture_info* info = static_cast<gl_device*>( m_device )->get_full_texture_info( result );
 	bind( result, texture_slot::TEXTURE_0 );
 	unsigned glid = info->glid;
 	unsigned gl_type = texture_type_to_enum( type );
-	GLenum gl_internal = GLenum( image_format_to_internal_enum( aformat.format ) );
-	unsigned gl_enum = image_format_to_enum( aformat.format );
-
-	bool is_depth = aformat.format == DEPTH16 || aformat.format == DEPTH24 || aformat.format == DEPTH32;
+	GLenum gl_internal = GLenum( image_format_to_internal_enum( aformat ) );
+	unsigned gl_enum = image_format_to_enum( aformat );
+
+	bool is_depth = aformat == DEPTH16 || aformat == DEPTH24 || aformat == DEPTH32;
 
 	// Detect if mipmapping was requested
@@ -953,5 +954,5 @@
 
 	if ( gl_type != GL_TEXTURE_2D_MULTISAMPLE )
-		glTexImage2D( gl_type, 0, gl_internal, size.x, size.y, 0, gl_enum, nv::datatype_to_gl_enum( aformat.type ), data );
+		glTexImage2D( gl_type, 0, gl_internal, size.x, size.y, 0, gl_enum, nv::datatype_to_gl_enum( get_pixel_format_info( aformat ).type ), data );
 	else
 		glTexImage2DMultisample( gl_type, 4, gl_internal, size.x, size.y, 1 );
@@ -974,7 +975,7 @@
 }
 
-nv::texture nv::gl_context::create_texture( texture_type type, ivec3 size, image_format aformat, sampler asampler, const void* data /*= nullptr */ )
-{
-	texture result = create_texture( type, aformat.format );
+nv::texture nv::gl_context::create_texture( texture_type type, ivec3 size, pixel_format aformat, sampler asampler, const void* data /*= nullptr */ )
+{
+	texture result = create_texture( type, aformat );
 	gl_texture_info* info = static_cast<gl_device*>( m_device )->get_full_texture_info( result );
 	bind( result, texture_slot::TEXTURE_0 );
@@ -983,5 +984,5 @@
 	unsigned gl_type = texture_type_to_enum( type );
 
-	bool is_depth = aformat.format == DEPTH16 || aformat.format == DEPTH24 || aformat.format == DEPTH32;
+	bool is_depth = aformat == DEPTH16 || aformat == DEPTH24 || aformat == DEPTH32;
 
 	if ( asampler.filter_max != sampler::NEAREST )
@@ -1007,5 +1008,5 @@
 
 	//glTexStorage3D( GL_TEXTURE_2D_ARRAY, mipLevelCount, GL_RGBA8, width, height, layerCount );
-	glTexImage3D( gl_type, 0, GLint( nv::image_format_to_internal_enum( aformat.format ) ), size.x, size.y, size.z, 0, nv::image_format_to_enum( aformat.format ), nv::datatype_to_gl_enum( aformat.type ), data );
+	glTexImage3D( gl_type, 0, GLint( nv::image_format_to_internal_enum( aformat ) ), size.x, size.y, size.z, 0, nv::image_format_to_enum( aformat ), nv::datatype_to_gl_enum( get_pixel_format_info( aformat ).type ), data );
 
 	bind( texture(), texture_slot::TEXTURE_0 );
Index: trunk/src/gl/gl_device.cc
===================================================================
--- trunk/src/gl/gl_device.cc	(revision 534)
+++ trunk/src/gl/gl_device.cc	(revision 535)
@@ -36,14 +36,13 @@
 	}
 	// TODO: BGR vs RGB, single channel
-	pixel_format pformat = RGBA;
+	pixel_format pformat = RGBA8;
 	switch ( image->format->BytesPerPixel )
 	{
-	case 4: pformat = RGBA; break;
-	case 3: pformat = RGB; break;
-	case 1: pformat = RED; break;
+	case 4: pformat = RGBA8; break;
+	case 3: pformat = RGB8; break;
+	case 1: pformat = R8; break;
 	default: NV_ASSERT( false, "BytesPerPixel != 4,3 or 1!" );
 	}
-	image_format format( pformat, UBYTE );
-	image_data* data = new image_data( format, ivec2( image->w, image->h ), static_cast<nv::uint8*>( image->pixels ) );
+	image_data* data = new image_data( pformat, ivec2( image->w, image->h ), static_cast<nv::uint8*>( image->pixels ) );
 	return data;
 }
@@ -62,5 +61,5 @@
 	// TODO: BGR vs RGB, single channel
 	NV_ASSERT( image->format->BytesPerPixel > 2, "bytes per pixel > 2!" );
-	image_format format( image->format->BytesPerPixel == 3 ? RGB : RGBA, UBYTE );
+	pixel_format format( image->format->BytesPerPixel == 3 ? RGB8 : RGBA8 );
 	image_data* idata = new image_data( format, ivec2( image->w, image->h ), static_cast<nv::uint8*>( image->pixels ) );
 	return idata;
Index: trunk/src/gl/gl_enum.cc
===================================================================
--- trunk/src/gl/gl_enum.cc	(revision 534)
+++ trunk/src/gl/gl_enum.cc	(revision 535)
@@ -182,13 +182,13 @@
 	switch( format )
 	{
-	case RGB     : return GL_RGB;
-	case RGBA    : return GL_RGBA;
+	case RGB8    : return GL_RGB;
+	case RGBA8   : return GL_RGBA;
+	case R8      : return GL_RED;
 	case RGB32F  : return GL_RGB;
 	case RGBA32F : return GL_RGBA;
 	case RGB16F  : return GL_RGB;
 	case RGBA16F : return GL_RGBA;
-	case BGR     : return GL_BGR;
-	case BGRA    : return GL_BGRA;
-	case RED     : return GL_RED;
+	case BGR8    : return GL_BGR;
+	case BGRA8   : return GL_BGRA;
 	case R16F    : return GL_RED;
 	case R32F    : return GL_RED;
@@ -202,10 +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;
+	case RGBA8I  : return GL_RGBA_INTEGER;
+	case RGBA8UI : return GL_RGBA_INTEGER;
+	case RGBA16I : return GL_RGBA_INTEGER;
+	case RGBA16UI: return GL_RGBA_INTEGER;
+	case RGBA32I : return GL_RGBA_INTEGER;
+	case RGBA32UI: return GL_RGBA_INTEGER;
 	NV_RETURN_COVERED_DEFAULT( 0 );
 	}
@@ -216,18 +216,18 @@
 	switch( format )
 	{
-	case RGB     : return GL_RGB8;
-	case RGBA    : return GL_RGBA8;
+	case RGB8    : return GL_RGB8;
+	case RGBA8   : return GL_RGBA8;
+	case R8      : return GL_R8;
 	case RGB32F  : return GL_RGB32F;
 	case RGBA32F : return GL_RGBA32F;
 	case RGB16F  : return GL_RGBA16F;
 	case RGBA16F : return GL_RGBA16F;
-	case BGR     : return GL_RGB8;
-	case BGRA    : return GL_RGBA8;
-	case RED     : return GL_R8;
+	case BGR8    : return GL_RGB8;
+	case BGRA8   : return GL_RGBA8;
 	case R16F    : return GL_R16F;
 	case R32F    : return GL_R32F;
 	case DEPTH16 : return GL_DEPTH_COMPONENT16;
 	case DEPTH24 : return GL_DEPTH_COMPONENT24;
-	case DEPTH32:  return GL_DEPTH_COMPONENT32;
+	case DEPTH32 :  return GL_DEPTH_COMPONENT32;
 	case R8I     : return GL_R8I;
 	case R8UI    : return GL_R8UI;
