From 5185e2f901704ca367b5c0c6fa867c1b146eb748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Wed, 4 Mar 2015 22:08:54 -0800 Subject: [PATCH] GL: Fixing texture formats for GL and GLES31. --- src/renderer_gl.cpp | 18 ++++++++++++------ src/renderer_gl.h | 8 ++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 4f901aef..d01f41b0 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -1168,12 +1168,7 @@ namespace bgfx { setTextureFormat(TextureFormat::D32, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT); - if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) ) - { - setTextureFormat(TextureFormat::R16, GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT); - setTextureFormat(TextureFormat::RGBA16, GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT); - } - else + if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES < 30) ) { setTextureFormat(TextureFormat::RGBA16F, GL_RGBA, GL_RGBA, GL_HALF_FLOAT); @@ -1185,6 +1180,17 @@ namespace bgfx } } + if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) + || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) ) + { + setTextureFormat(TextureFormat::R16, GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT); + setTextureFormat(TextureFormat::RG16, GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT); + setTextureFormat(TextureFormat::RGBA16, GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT); + setTextureFormat(TextureFormat::R32, GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT); + setTextureFormat(TextureFormat::RG32, GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT); + setTextureFormat(TextureFormat::RGBA32, GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT); + } + if (s_extension[Extension::EXT_texture_format_BGRA8888 ].m_supported || s_extension[Extension::EXT_bgra ].m_supported || s_extension[Extension::IMG_texture_format_BGRA8888 ].m_supported diff --git a/src/renderer_gl.h b/src/renderer_gl.h index 626b8534..b65a8499 100644 --- a/src/renderer_gl.h +++ b/src/renderer_gl.h @@ -143,6 +143,10 @@ typedef uint64_t GLuint64; # define GL_RG16 0x822C #endif // GL_RG16 +#ifndef GL_RG16UI +# define GL_RG16UI 0x823A +#endif // GL_RG16UI + #ifndef GL_RG16F # define GL_RG16F 0x822F #endif // GL_RG16F @@ -183,6 +187,10 @@ typedef uint64_t GLuint64; # define GL_RG 0x8227 #endif // GL_RG +#ifndef GL_RG_INTEGER +# define GL_RG_INTEGER 0x8228 +#endif // GL_RG_INTEGER + #ifndef GL_GREEN # define GL_GREEN 0x1904 #endif // GL_GREEN