Parcourir la source

GL: Fixing texture formats for GL and GLES31.

Branimir Karadžić il y a 10 ans
Parent
commit
5185e2f901
2 fichiers modifiés avec 20 ajouts et 6 suppressions
  1. 12 6
      src/renderer_gl.cpp
  2. 8 0
      src/renderer_gl.h

+ 12 - 6
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

+ 8 - 0
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