@@ -242,13 +242,17 @@ public static GLImageFormat[][] getFormatsForCaps(EnumSet<Caps> caps) {
242
242
// But for render buffers it's OK.
243
243
format (formatToGL , Format .Depth16 , GL .GL_DEPTH_COMPONENT16 , GL .GL_DEPTH_COMPONENT , GL .GL_UNSIGNED_SHORT );
244
244
245
- // NOTE: OpenGL ES 2.0 does not support DEPTH_COMPONENT as internal format -- fallback to 16-bit depth.
246
- if (caps .contains (Caps .OpenGLES20 )) {
245
+
246
+ if (caps .contains (Caps .WebGL )) {
247
+ // NOTE: fallback to 24-bit depth as workaround for firefox bug in WebGL 2 where DEPTH_COMPONENT16 is not handled properly
248
+ format (formatToGL , Format .Depth , GL2 .GL_DEPTH_COMPONENT24 , GL .GL_DEPTH_COMPONENT , GL .GL_UNSIGNED_INT );
249
+ } else if (caps .contains (Caps .OpenGLES20 )) {
250
+ // NOTE: OpenGL ES 2.0 does not support DEPTH_COMPONENT as internal format -- fallback to 16-bit depth.
247
251
format (formatToGL , Format .Depth , GL .GL_DEPTH_COMPONENT16 , GL .GL_DEPTH_COMPONENT , GL .GL_UNSIGNED_SHORT );
248
252
} else {
249
253
format (formatToGL , Format .Depth , GL .GL_DEPTH_COMPONENT , GL .GL_DEPTH_COMPONENT , GL .GL_UNSIGNED_BYTE );
250
254
}
251
- if (caps .contains (Caps .OpenGL20 ) || caps .contains (Caps .Depth24 )) {
255
+ if (caps .contains (Caps .OpenGLES30 ) || caps . contains ( Caps . OpenGL20 ) || caps .contains (Caps .Depth24 )) {
252
256
format (formatToGL , Format .Depth24 , GL2 .GL_DEPTH_COMPONENT24 , GL .GL_DEPTH_COMPONENT , GL .GL_UNSIGNED_INT );
253
257
}
254
258
if (caps .contains (Caps .FloatDepthBuffer )) {
@@ -274,11 +278,20 @@ public static GLImageFormat[][] getFormatsForCaps(EnumSet<Caps> caps) {
274
278
}
275
279
276
280
if (caps .contains (Caps .TextureCompressionETC2 )) {
281
+ formatComp (formatToGL , Format .ETC2 , GLExt .GL_COMPRESSED_RGBA8_ETC2_EAC , GL .GL_RGBA , GL .GL_UNSIGNED_BYTE );
282
+ formatComp (formatToGL , Format .ETC2_ALPHA1 , GLExt .GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 , GL .GL_RGBA , GL .GL_UNSIGNED_BYTE );
277
283
formatComp (formatToGL , Format .ETC1 , GLExt .GL_COMPRESSED_RGB8_ETC2 , GL .GL_RGB , GL .GL_UNSIGNED_BYTE );
284
+ if (caps .contains (Caps .Srgb )) {
285
+ formatCompSrgb (formatToGL , Format .ETC2 , GLExt .GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC , GL .GL_RGBA , GL .GL_UNSIGNED_BYTE );
286
+ formatCompSrgb (formatToGL , Format .ETC2_ALPHA1 , GLExt .GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 , GL .GL_RGBA , GL .GL_UNSIGNED_BYTE );
287
+ formatCompSrgb (formatToGL , Format .ETC1 , GLExt .GL_COMPRESSED_SRGB8_ETC2 , GL .GL_RGB , GL .GL_UNSIGNED_BYTE );
288
+ }
278
289
} else if (caps .contains (Caps .TextureCompressionETC1 )) {
279
- formatComp (formatToGL , Format .ETC1 , GLExt .GL_ETC1_RGB8_OES , GL .GL_RGB , GL .GL_UNSIGNED_BYTE );
290
+ formatComp (formatToGL , Format .ETC1 , GLExt .GL_ETC1_RGB8_OES , GL .GL_RGB , GL .GL_UNSIGNED_BYTE );
280
291
}
281
292
293
+
294
+
282
295
if (caps .contains (Caps .OpenGL42 ) || caps .contains (Caps .TextureCompressionBPTC )) {
283
296
formatComp (formatToGL , Format .BC6H_SF16 , GLExt .GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT , GL .GL_RGB , GL .GL_UNSIGNED_BYTE );
284
297
formatComp (formatToGL , Format .BC6H_UF16 , GLExt .GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT , GL .GL_RGB , GL .GL_UNSIGNED_BYTE );
0 commit comments