|
|
@ -286,18 +286,125 @@ namespace SceneUtil
|
|
|
|
mOperationQueue->add(operation);
|
|
|
|
mOperationQueue->add(operation);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool isRedGreenPixelFormat(GLenum format)
|
|
|
|
GLenum computeUnsizedPixelFormat(GLenum format)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
switch (format)
|
|
|
|
switch (format)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case GL_RG:
|
|
|
|
// Try compressed formats first, they're more likely to be used
|
|
|
|
case GL_RG_INTEGER:
|
|
|
|
|
|
|
|
|
|
|
|
// Generic
|
|
|
|
|
|
|
|
case GL_COMPRESSED_ALPHA_ARB:
|
|
|
|
|
|
|
|
return GL_ALPHA;
|
|
|
|
|
|
|
|
case GL_COMPRESSED_INTENSITY_ARB:
|
|
|
|
|
|
|
|
return GL_INTENSITY;
|
|
|
|
|
|
|
|
case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
|
|
|
|
|
|
|
|
return GL_LUMINANCE_ALPHA;
|
|
|
|
|
|
|
|
case GL_COMPRESSED_LUMINANCE_ARB:
|
|
|
|
|
|
|
|
return GL_LUMINANCE;
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGB_ARB:
|
|
|
|
|
|
|
|
return GL_RGB;
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGBA_ARB:
|
|
|
|
|
|
|
|
return GL_RGBA;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// S3TC
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
|
|
|
|
|
|
|
|
return GL_RGB;
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
|
|
|
|
|
|
|
|
return GL_RGBA;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// RGTC
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RED_RGTC1_EXT:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SIGNED_RED_RGTC1_EXT:
|
|
|
|
|
|
|
|
return GL_RED;
|
|
|
|
case GL_COMPRESSED_RED_GREEN_RGTC2_EXT:
|
|
|
|
case GL_COMPRESSED_RED_GREEN_RGTC2_EXT:
|
|
|
|
case GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:
|
|
|
|
case GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:
|
|
|
|
return true;
|
|
|
|
return GL_RG;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// PVRTC
|
|
|
|
return false;
|
|
|
|
case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG:
|
|
|
|
|
|
|
|
return GL_RGB;
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:
|
|
|
|
|
|
|
|
return GL_RGBA;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ETC
|
|
|
|
|
|
|
|
case GL_COMPRESSED_R11_EAC:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SIGNED_R11_EAC:
|
|
|
|
|
|
|
|
return GL_RED;
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RG11_EAC:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SIGNED_RG11_EAC:
|
|
|
|
|
|
|
|
return GL_RG;
|
|
|
|
|
|
|
|
case GL_ETC1_RGB8_OES:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGB8_ETC2:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SRGB8_ETC2:
|
|
|
|
|
|
|
|
return GL_RGB;
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGBA8_ETC2_EAC:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
|
|
|
|
|
|
|
|
return GL_RGBA;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ASTC
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGBA_ASTC_4x4_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGBA_ASTC_5x4_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGBA_ASTC_5x5_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGBA_ASTC_6x5_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGBA_ASTC_6x6_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGBA_ASTC_8x5_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGBA_ASTC_8x6_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGBA_ASTC_8x8_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGBA_ASTC_10x5_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGBA_ASTC_10x6_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGBA_ASTC_10x8_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGBA_ASTC_10x10_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGBA_ASTC_12x10_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_RGBA_ASTC_12x12_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
|
|
|
|
|
|
|
|
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
|
|
|
|
|
|
|
|
return GL_RGBA;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Plug in some holes computePixelFormat has, you never know when these could come in handy
|
|
|
|
|
|
|
|
case GL_INTENSITY4:
|
|
|
|
|
|
|
|
case GL_INTENSITY8:
|
|
|
|
|
|
|
|
case GL_INTENSITY12:
|
|
|
|
|
|
|
|
case GL_INTENSITY16:
|
|
|
|
|
|
|
|
return GL_INTENSITY;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case GL_LUMINANCE4:
|
|
|
|
|
|
|
|
case GL_LUMINANCE8:
|
|
|
|
|
|
|
|
case GL_LUMINANCE12:
|
|
|
|
|
|
|
|
case GL_LUMINANCE16:
|
|
|
|
|
|
|
|
return GL_LUMINANCE;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case GL_LUMINANCE4_ALPHA4:
|
|
|
|
|
|
|
|
case GL_LUMINANCE6_ALPHA2:
|
|
|
|
|
|
|
|
case GL_LUMINANCE8_ALPHA8:
|
|
|
|
|
|
|
|
case GL_LUMINANCE12_ALPHA4:
|
|
|
|
|
|
|
|
case GL_LUMINANCE12_ALPHA12:
|
|
|
|
|
|
|
|
case GL_LUMINANCE16_ALPHA16:
|
|
|
|
|
|
|
|
return GL_LUMINANCE_ALPHA;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return osg::Image::computePixelFormat(format);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|