MCPcopy Create free account
hub / github.com/baldurk/renderdoc / MakeGLFormat

Function MakeGLFormat

renderdoc/driver/gl/gl_common.cpp:2393–2719  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2391}
2392
2393GLenum MakeGLFormat(ResourceFormat fmt)
2394{
2395 GLenum ret = eGL_NONE;
2396
2397 if(fmt.Special())
2398 {
2399 switch(fmt.type)
2400 {
2401 case ResourceFormatType::BC1:
2402 {
2403 if(fmt.compCount == 3)
2404 ret = fmt.SRGBCorrected() ? eGL_COMPRESSED_SRGB_S3TC_DXT1_EXT
2405 : eGL_COMPRESSED_RGB_S3TC_DXT1_EXT;
2406 else
2407 ret = fmt.SRGBCorrected() ? eGL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
2408 : eGL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
2409 break;
2410 }
2411 case ResourceFormatType::BC2:
2412 ret = fmt.SRGBCorrected() ? eGL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
2413 : eGL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
2414 break;
2415 case ResourceFormatType::BC3:
2416 ret = fmt.SRGBCorrected() ? eGL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
2417 : eGL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
2418 break;
2419 case ResourceFormatType::BC4:
2420 ret = fmt.compType == CompType::SNorm ? eGL_COMPRESSED_SIGNED_RED_RGTC1
2421 : eGL_COMPRESSED_RED_RGTC1;
2422 break;
2423 case ResourceFormatType::BC5:
2424 ret = fmt.compType == CompType::SNorm ? eGL_COMPRESSED_SIGNED_RG_RGTC2
2425 : eGL_COMPRESSED_RG_RGTC2;
2426 break;
2427 case ResourceFormatType::BC6:
2428 ret = fmt.compType == CompType::SNorm ? eGL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB
2429 : eGL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB;
2430 break;
2431 case ResourceFormatType::BC7:
2432 ret = fmt.SRGBCorrected() ? eGL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB
2433 : eGL_COMPRESSED_RGBA_BPTC_UNORM_ARB;
2434 break;
2435 case ResourceFormatType::ETC2:
2436 {
2437 if(fmt.compCount == 3)
2438 ret = fmt.SRGBCorrected() ? eGL_COMPRESSED_SRGB8_ETC2 : eGL_COMPRESSED_RGB8_ETC2;
2439 else
2440 ret = fmt.SRGBCorrected() ? eGL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
2441 : eGL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;
2442 break;
2443 }
2444 case ResourceFormatType::EAC:
2445 {
2446 if(fmt.compCount == 1)
2447 ret = fmt.compType == CompType::SNorm ? eGL_COMPRESSED_SIGNED_R11_EAC
2448 : eGL_COMPRESSED_R11_EAC;
2449 else if(fmt.compCount == 2)
2450 ret = fmt.compType == CompType::SNorm ? eGL_COMPRESSED_SIGNED_RG11_EAC

Calls

no outgoing calls

Tested by

no test coverage detected