medfall

A super great game engine
Log | Files | Refs

commit 0f693ea29f192245376b54b2b50c920856d1aa01
parent 82b1a4aebdf03f84d54b7f3a66cf15d1a32a3314
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Thu Sep 14 23:37:42 +0300

TEXFMT_R_U16

Diffstat:
renderer.cc | 9+++++++++
renderer.h | 2++
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/renderer.cc b/renderer.cc @@ -325,6 +325,9 @@ static GLenum textureformat_to_glenum( TextureFormat format, bool srgb ) { case TEXFMT_R_U8NORM: ASSERT( !srgb ); return GL_R8_SNORM; + case TEXFMT_R_U16: + ASSERT( !srgb ); + return GL_R16; case TEXFMT_DEPTH: ASSERT( !srgb ); return GL_DEPTH_COMPONENT24; @@ -643,6 +646,8 @@ static u32 texture_byte_size( u32 width, u32 height, TextureFormat format, bool case TEXFMT_R_U8: case TEXFMT_R_U8NORM: return total_dim * 1 * sizeof( u8 ); + case TEXFMT_R_U16: + return total_dim * 1 * sizeof( u16 ); case TEXFMT_BC4: return total_dim / 2; default: @@ -699,6 +704,10 @@ Texture renderer_new_texture( TextureConfig config ) { channels = GL_RED; type = GL_UNSIGNED_BYTE; break; + case TEXFMT_R_U16: + channels = GL_RED; + type = GL_UNSIGNED_SHORT; + break; case TEXFMT_DEPTH: channels = GL_DEPTH_COMPONENT; type = GL_FLOAT; diff --git a/renderer.h b/renderer.h @@ -61,6 +61,7 @@ enum TextureFormat { TEXFMT_R_FLOAT, TEXFMT_R_U8, TEXFMT_R_U8NORM, + TEXFMT_R_U16, TEXFMT_DEPTH, @@ -182,6 +183,7 @@ struct TextureConfig { v4 border_colour; bool srgb = false; // TODO: this should be true by default. maybe needs enum TextureColorSpace too + // TODO: or it should be merged with TextureFormat since only some formats make sense with sRGB }; enum ClearColourBool { RENDERER_CLEAR_COLOUR_DONT, RENDERER_CLEAR_COLOUR_DO };