OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #include "GrGLCaps.h" | 9 #include "GrGLCaps.h" |
10 #include "GrGLContext.h" | 10 #include "GrGLContext.h" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 ctxInfo.glslGeneration() >= k150_GrGLSLGenerati
on; | 327 ctxInfo.glslGeneration() >= k150_GrGLSLGenerati
on; |
328 } else { | 328 } else { |
329 fShaderDerivativeSupport = ctxInfo.hasExtension("GL_OES_standard_derivat
ives"); | 329 fShaderDerivativeSupport = ctxInfo.hasExtension("GL_OES_standard_derivat
ives"); |
330 } | 330 } |
331 | 331 |
332 if (GrGLCaps::kES_IMG_MsToTexture_MSFBOType == fMSFBOType) { | 332 if (GrGLCaps::kES_IMG_MsToTexture_MSFBOType == fMSFBOType) { |
333 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES_IMG, &fMaxSampleCount); | 333 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES_IMG, &fMaxSampleCount); |
334 } else if (GrGLCaps::kNone_MSFBOType != fMSFBOType) { | 334 } else if (GrGLCaps::kNone_MSFBOType != fMSFBOType) { |
335 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &fMaxSampleCount); | 335 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &fMaxSampleCount); |
336 } | 336 } |
| 337 |
| 338 this->initConfigRenderableTable(ctxInfo); |
| 339 } |
| 340 |
| 341 void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo) { |
| 342 |
| 343 // OpenGL < 3.0 |
| 344 // no support for render targets unless the GL_ARB_framebuffer_object |
| 345 // extension is supported (in which case we get ALPHA, RED, RG, RGB, |
| 346 // RGBA (ALPHA8, RGBA4, RGBA8) for OpenGL > 1.1). Note that we |
| 347 // probably don't get R8 in this case. |
| 348 |
| 349 // OpenGL 3.0 |
| 350 // base color renderable: ALPHA, RED, RG, RGB, and RGBA |
| 351 // sized derivatives: ALPHA8, R8, RGBA4, RGBA8 |
| 352 |
| 353 // >= OpenGL 3.1 |
| 354 // base color renderable: RED, RG, RGB, and RGBA |
| 355 // sized derivatives: R8, RGBA4, RGBA8 |
| 356 // if the GL_ARB_compatibility extension is supported then we get back |
| 357 // support for GL_ALPHA and ALPHA8 |
| 358 |
| 359 // GL_EXT_bgra adds BGRA render targets to any version |
| 360 |
| 361 // ES 2.0 |
| 362 // color renderable: RGBA4, RGB5_A1, RGB565 |
| 363 // GL_EXT_texture_rg adds support for R8 as a color render target |
| 364 // GL_OES_rgb8_rgba8 and/or GL_ARM_rgba8 adds support for RGBA8 |
| 365 // GL_EXT_texture_format_BGRA8888 and/or GL_APPLE_texture_format_BGRA8888 a
dded BGRA support |
| 366 |
| 367 // ES 3.0 |
| 368 // Same as ES 2.0 except R8 and RGBA8 are supported without extensions (the
functions called |
| 369 // below already account for this). |
| 370 |
| 371 if (kDesktop_GrGLBinding == ctxInfo.binding()) { |
| 372 // Post 3.0 we will get R8 |
| 373 // Prior to 3.0 we will get ALPHA8 (with GL_ARB_framebuffer_object) |
| 374 if (ctxInfo.version() >= GR_GL_VER(3,0) || |
| 375 ctxInfo.hasExtension("GL_ARB_framebuffer_object")) { |
| 376 fConfigRenderSupport[kAlpha_8_GrPixelConfig] = true; |
| 377 } |
| 378 } else { |
| 379 // On ES we can only hope for R8 |
| 380 fConfigRenderSupport[kAlpha_8_GrPixelConfig] = fTextureRedSupport; |
| 381 } |
| 382 |
| 383 if (kDesktop_GrGLBinding != ctxInfo.binding()) { |
| 384 // only available in ES |
| 385 fConfigRenderSupport[kRGB_565_GrPixelConfig] = true; |
| 386 } |
| 387 |
| 388 // we no longer support 444 as a render target |
| 389 fConfigRenderSupport[kRGBA_4444_GrPixelConfig] = false; |
| 390 |
| 391 if (this->fRGBA8RenderbufferSupport) { |
| 392 fConfigRenderSupport[kRGBA_8888_GrPixelConfig] = true; |
| 393 } |
| 394 |
| 395 if (this->fBGRAFormatSupport) { |
| 396 fConfigRenderSupport[kBGRA_8888_GrPixelConfig] = true; |
| 397 } |
337 } | 398 } |
338 | 399 |
339 bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf, | 400 bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf, |
340 GrGLenum format, | 401 GrGLenum format, |
341 GrGLenum type) const { | 402 GrGLenum type) const { |
342 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) { | 403 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) { |
343 // ES 2 guarantees this format is supported | 404 // ES 2 guarantees this format is supported |
344 return true; | 405 return true; |
345 } | 406 } |
346 | 407 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 GrPrintf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); | 624 GrPrintf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); |
564 GrPrintf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); | 625 GrPrintf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); |
565 GrPrintf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); | 626 GrPrintf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); |
566 GrPrintf("Fragment coord conventions support: %s\n", | 627 GrPrintf("Fragment coord conventions support: %s\n", |
567 (fFragCoordsConventionSupport ? "YES": "NO")); | 628 (fFragCoordsConventionSupport ? "YES": "NO")); |
568 GrPrintf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "
YES": "NO")); | 629 GrPrintf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "
YES": "NO")); |
569 GrPrintf("Use non-VBO for dynamic data: %s\n", | 630 GrPrintf("Use non-VBO for dynamic data: %s\n", |
570 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); | 631 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); |
571 GrPrintf("Discard FrameBuffer support: %s\n", (fDiscardFBSupport ? "YES" : "
NO")); | 632 GrPrintf("Discard FrameBuffer support: %s\n", (fDiscardFBSupport ? "YES" : "
NO")); |
572 } | 633 } |
OLD | NEW |