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

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

Issue 762923003: Add support for half float alpha textures. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments 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
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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 fUseDrawInsteadOfClear = true; 383 fUseDrawInsteadOfClear = true;
384 } 384 }
385 385
386 this->initConfigTexturableTable(ctxInfo, gli); 386 this->initConfigTexturableTable(ctxInfo, gli);
387 this->initConfigRenderableTable(ctxInfo); 387 this->initConfigRenderableTable(ctxInfo);
388 388
389 return true; 389 return true;
390 } 390 }
391 391
392 void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo) { 392 void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo) {
393
394 // OpenGL < 3.0 393 // OpenGL < 3.0
395 // no support for render targets unless the GL_ARB_framebuffer_object 394 // no support for render targets unless the GL_ARB_framebuffer_object
396 // extension is supported (in which case we get ALPHA, RED, RG, RGB, 395 // extension is supported (in which case we get ALPHA, RED, RG, RGB,
397 // RGBA (ALPHA8, RGBA4, RGBA8) for OpenGL > 1.1). Note that we 396 // RGBA (ALPHA8, RGBA4, RGBA8) for OpenGL > 1.1). Note that we
398 // probably don't get R8 in this case. 397 // probably don't get R8 in this case.
399 398
400 // OpenGL 3.0 399 // OpenGL 3.0
401 // base color renderable: ALPHA, RED, RG, RGB, and RGBA 400 // base color renderable: ALPHA, RED, RG, RGB, and RGBA
402 // sized derivatives: ALPHA8, R8, RGBA4, RGBA8 401 // sized derivatives: ALPHA8, R8, RGBA4, RGBA8
403 402
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 if (ctxInfo.hasExtension("GL_CHROMIUM_renderbuffer_format_BGRA8888")) { 462 if (ctxInfo.hasExtension("GL_CHROMIUM_renderbuffer_format_BGRA8888")) {
464 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] = true; 463 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] = true;
465 } else { 464 } else {
466 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] = 465 fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] =
467 !fBGRAIsInternalFormat || !this->usesMSAARenderBuffers(); 466 !fBGRAIsInternalFormat || !this->usesMSAARenderBuffers();
468 } 467 }
469 } 468 }
470 469
471 if (this->isConfigTexturable(kRGBA_float_GrPixelConfig)) { 470 if (this->isConfigTexturable(kRGBA_float_GrPixelConfig)) {
472 fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = true; 471 fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = true;
472 if (kGL_GrGLStandard == standard) {
473 fConfigRenderSupport[kRGBA_float_GrPixelConfig][kYes_MSAA] = true;
474 } else {
475 // for now we don't support float point MSAA on ES
476 fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = false;
477 }
473 } 478 }
474 479
480 if (this->isConfigTexturable(kAlpha_half_GrPixelConfig)) {
481 if (kGL_GrGLStandard == standard) {
482 fConfigRenderSupport[kAlpha_half_GrPixelConfig][kNo_MSAA] = true;
483 fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = true;
484 } else {
485 fConfigRenderSupport[kAlpha_half_GrPixelConfig][kNo_MSAA] = fTexture RedSupport;
bsalomon 2014/12/05 20:21:27 is fTextureREdSupport not already checked in isCon
jvanverth1 2014/12/05 20:31:41 Whoop, right. I was thinking isConfigTexturable wa
486 // for now we don't support float point MSAA on ES
487 fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = false;
488 }
489 }
490
475 // If we don't support MSAA then undo any places above where we set a config as renderable with 491 // If we don't support MSAA then undo any places above where we set a config as renderable with
476 // msaa. 492 // msaa.
477 if (kNone_MSFBOType == fMSFBOType) { 493 if (kNone_MSFBOType == fMSFBOType) {
478 for (int i = 0; i < kGrPixelConfigCnt; ++i) { 494 for (int i = 0; i < kGrPixelConfigCnt; ++i) {
479 fConfigRenderSupport[i][kYes_MSAA] = false; 495 fConfigRenderSupport[i][kYes_MSAA] = false;
480 } 496 }
481 } 497 }
482 } 498 }
483 499
484 void GrGLCaps::initConfigTexturableTable(const GrGLContextInfo& ctxInfo, const G rGLInterface* gli) { 500 void GrGLCaps::initConfigTexturableTable(const GrGLContextInfo& ctxInfo, const G rGLInterface* gli) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 // filtering modes are not supported. This is for simplicity, but a more 616 // filtering modes are not supported. This is for simplicity, but a more
601 // granular approach is possible. Coincidentally, floating point textures b ecame part of 617 // granular approach is possible. Coincidentally, floating point textures b ecame part of
602 // the standard in ES3.1 / OGL 3.1, hence the shorthand 618 // the standard in ES3.1 / OGL 3.1, hence the shorthand
603 bool hasFPTextures = version >= GR_GL_VER(3, 1); 619 bool hasFPTextures = version >= GR_GL_VER(3, 1);
604 if (!hasFPTextures) { 620 if (!hasFPTextures) {
605 hasFPTextures = ctxInfo.hasExtension("GL_ARB_texture_float") || 621 hasFPTextures = ctxInfo.hasExtension("GL_ARB_texture_float") ||
606 (ctxInfo.hasExtension("OES_texture_float_linear") && 622 (ctxInfo.hasExtension("OES_texture_float_linear") &&
607 ctxInfo.hasExtension("GL_OES_texture_float")); 623 ctxInfo.hasExtension("GL_OES_texture_float"));
608 } 624 }
609 fConfigTextureSupport[kRGBA_float_GrPixelConfig] = hasFPTextures; 625 fConfigTextureSupport[kRGBA_float_GrPixelConfig] = hasFPTextures;
626
627 // Check for fp16 texture support
628 // NOTE: We disallow floating point textures on ES devices if linear
629 // filtering modes are not supported. This is for simplicity, but a more
630 // granular approach is possible. Coincidentally, 16-bit floating point tex tures became part of
631 // the standard in ES3.1 / OGL 3.1, hence the shorthand
632 bool hasHalfFPTextures = version >= GR_GL_VER(3, 1);
633 if (!hasHalfFPTextures) {
634 hasHalfFPTextures = ctxInfo.hasExtension("GL_ARB_texture_float") ||
635 (ctxInfo.hasExtension("OES_texture_half_float_linear") &&
636 ctxInfo.hasExtension("GL_OES_texture_half_float"));
637 }
638 fConfigTextureSupport[kAlpha_half_GrPixelConfig] = hasHalfFPTextures;
bsalomon 2014/12/05 20:21:27 hasHPT && fTextureRedSupport?
jvanverth1 2014/12/05 20:31:41 Done.
610 } 639 }
611 640
612 bool GrGLCaps::doReadPixelsSupported(const GrGLInterface* intf, 641 bool GrGLCaps::doReadPixelsSupported(const GrGLInterface* intf,
613 GrGLenum format, 642 GrGLenum format,
614 GrGLenum type) const { 643 GrGLenum type) const {
615 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) { 644 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) {
616 // ES 2 guarantees this format is supported 645 // ES 2 guarantees this format is supported
617 return true; 646 return true;
618 } 647 }
619 648
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); 898 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO"));
870 r.appendf("Fragment coord conventions support: %s\n", 899 r.appendf("Fragment coord conventions support: %s\n",
871 (fFragCoordsConventionSupport ? "YES": "NO")); 900 (fFragCoordsConventionSupport ? "YES": "NO"));
872 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO")); 901 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO"));
873 r.appendf("Use non-VBO for dynamic data: %s\n", 902 r.appendf("Use non-VBO for dynamic data: %s\n",
874 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); 903 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO"));
875 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO ")); 904 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO "));
876 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO")); 905 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO"));
877 return r; 906 return r;
878 } 907 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/gl/GrGLDefines.h » ('j') | src/gpu/gl/GrGLDefines.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698