Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: src/gpu/gl/GrGLCaps.cpp

Issue 799593002: Fix float and half float support on mobile. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rearrange format setup to get around GCC 4.8 Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/gpu/gl/GrGpuGL.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 // Chromium may have an extension to allow BGRA renderbuffers to work on desktop platforms. 463 // Chromium may have an extension to allow BGRA renderbuffers to work on desktop platforms.
464 if (ctxInfo.hasExtension("GL_CHROMIUM_renderbuffer_format_BGRA8888")) { 464 if (ctxInfo.hasExtension("GL_CHROMIUM_renderbuffer_format_BGRA8888")) {
465 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] = true; 465 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] = true;
466 } else { 466 } else {
467 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] = 467 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] =
468 !fBGRAIsInternalFormat || !this->usesMSAARenderBuffers(); 468 !fBGRAIsInternalFormat || !this->usesMSAARenderBuffers();
469 } 469 }
470 } 470 }
471 471
472 if (this->isConfigTexturable(kRGBA_float_GrPixelConfig)) { 472 if (this->isConfigTexturable(kRGBA_float_GrPixelConfig)) {
473 fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = true;
474 if (kGL_GrGLStandard == standard) { 473 if (kGL_GrGLStandard == standard) {
474 fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = true;
475 fConfigRenderSupport[kRGBA_float_GrPixelConfig][kYes_MSAA] = true; 475 fConfigRenderSupport[kRGBA_float_GrPixelConfig][kYes_MSAA] = true;
476 } else { 476 } else {
477 // for now we don't support float point MSAA on ES 477 if (ctxInfo.hasExtension("GL_EXT_color_buffer_float")) {
478 fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = true ;
479 } else {
480 fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = fals e;
481 }
482 // for now we don't support floating point MSAA on ES
478 fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = false; 483 fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = false;
479 } 484 }
480 } 485 }
481 486
482 if (this->isConfigTexturable(kAlpha_half_GrPixelConfig)) { 487 if (this->isConfigTexturable(kAlpha_half_GrPixelConfig)) {
483 fConfigRenderSupport[kAlpha_half_GrPixelConfig][kNo_MSAA] = true;
484 if (kGL_GrGLStandard == standard) { 488 if (kGL_GrGLStandard == standard) {
489 fConfigRenderSupport[kAlpha_half_GrPixelConfig][kNo_MSAA] = true;
485 fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = true; 490 fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = true;
486 } else { 491 } else {
487 // for now we don't support float point MSAA on ES 492 // in theory, check for "GL_EXT_color_buffer_half_float"
493 // for now we don't support half float alpha render target on ES
494 fConfigRenderSupport[kAlpha_half_GrPixelConfig][kNo_MSAA] = false;
488 fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = false; 495 fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = false;
489 } 496 }
490 } 497 }
491 498
492 // If we don't support MSAA then undo any places above where we set a config as renderable with 499 // If we don't support MSAA then undo any places above where we set a config as renderable with
493 // msaa. 500 // msaa.
494 if (kNone_MSFBOType == fMSFBOType) { 501 if (kNone_MSFBOType == fMSFBOType) {
495 for (int i = 0; i < kGrPixelConfigCnt; ++i) { 502 for (int i = 0; i < kGrPixelConfigCnt; ++i) {
496 fConfigRenderSupport[i][kYes_MSAA] = false; 503 fConfigRenderSupport[i][kYes_MSAA] = false;
497 } 504 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 ctxInfo.hasExtension("GL_OES_texture_compression_astc"); 620 ctxInfo.hasExtension("GL_OES_texture_compression_astc");
614 621
615 // Check for floating point texture support 622 // Check for floating point texture support
616 // NOTE: We disallow floating point textures on ES devices if linear 623 // NOTE: We disallow floating point textures on ES devices if linear
617 // filtering modes are not supported. This is for simplicity, but a more 624 // filtering modes are not supported. This is for simplicity, but a more
618 // granular approach is possible. Coincidentally, floating point textures b ecame part of 625 // granular approach is possible. Coincidentally, floating point textures b ecame part of
619 // the standard in ES3.1 / OGL 3.1, hence the shorthand 626 // the standard in ES3.1 / OGL 3.1, hence the shorthand
620 bool hasFPTextures = version >= GR_GL_VER(3, 1); 627 bool hasFPTextures = version >= GR_GL_VER(3, 1);
621 if (!hasFPTextures) { 628 if (!hasFPTextures) {
622 hasFPTextures = ctxInfo.hasExtension("GL_ARB_texture_float") || 629 hasFPTextures = ctxInfo.hasExtension("GL_ARB_texture_float") ||
623 (ctxInfo.hasExtension("OES_texture_float_linear") && 630 (ctxInfo.hasExtension("GL_OES_texture_float_linear") &&
624 ctxInfo.hasExtension("GL_OES_texture_float")); 631 ctxInfo.hasExtension("GL_OES_texture_float"));
625 } 632 }
626 fConfigTextureSupport[kRGBA_float_GrPixelConfig] = hasFPTextures; 633 fConfigTextureSupport[kRGBA_float_GrPixelConfig] = hasFPTextures;
627 634
628 // Check for fp16 texture support 635 // Check for fp16 texture support
629 // NOTE: We disallow floating point textures on ES devices if linear 636 // NOTE: We disallow floating point textures on ES devices if linear
630 // filtering modes are not supported. This is for simplicity, but a more 637 // filtering modes are not supported. This is for simplicity, but a more
631 // granular approach is possible. Coincidentally, 16-bit floating point tex tures became part of 638 // granular approach is possible. Coincidentally, 16-bit floating point tex tures became part of
632 // the standard in ES3.1 / OGL 3.1, hence the shorthand 639 // the standard in ES3.1 / OGL 3.1, hence the shorthand
633 bool hasHalfFPTextures = version >= GR_GL_VER(3, 1); 640 bool hasHalfFPTextures = version >= GR_GL_VER(3, 1);
634 if (!hasHalfFPTextures) { 641 if (!hasHalfFPTextures) {
635 hasHalfFPTextures = ctxInfo.hasExtension("GL_ARB_texture_float") || 642 hasHalfFPTextures = ctxInfo.hasExtension("GL_ARB_texture_float") ||
636 (ctxInfo.hasExtension("OES_texture_half_float_linear") && 643 (ctxInfo.hasExtension("GL_OES_texture_half_float_linear") &&
637 ctxInfo.hasExtension("GL_OES_texture_half_float")); 644 ctxInfo.hasExtension("GL_OES_texture_half_float"));
638 } 645 }
639 fConfigTextureSupport[kAlpha_half_GrPixelConfig] = hasHalfFPTextures && fTex tureRedSupport; 646 fConfigTextureSupport[kAlpha_half_GrPixelConfig] = hasHalfFPTextures && fTex tureRedSupport;
640 } 647 }
641 648
642 bool GrGLCaps::doReadPixelsSupported(const GrGLInterface* intf, 649 bool GrGLCaps::doReadPixelsSupported(const GrGLInterface* intf,
643 GrGLenum format, 650 GrGLenum format,
644 GrGLenum type) const { 651 GrGLenum type) const {
645 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) { 652 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) {
646 // ES 2 guarantees this format is supported 653 // ES 2 guarantees this format is supported
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); 985 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO"));
979 r.appendf("Fragment coord conventions support: %s\n", 986 r.appendf("Fragment coord conventions support: %s\n",
980 (fFragCoordsConventionSupport ? "YES": "NO")); 987 (fFragCoordsConventionSupport ? "YES": "NO"));
981 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO")); 988 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO"));
982 r.appendf("Use non-VBO for dynamic data: %s\n", 989 r.appendf("Use non-VBO for dynamic data: %s\n",
983 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); 990 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO"));
984 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO ")); 991 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO "));
985 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO")); 992 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO"));
986 return r; 993 return r;
987 } 994 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/gl/GrGpuGL.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698