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

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: Fix config setup 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 | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/gl/GrGLDefines.h » ('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 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 fConfigRenderSupport[kAlpha_half_GrPixelConfig][kNo_MSAA] = true;
482 if (kGL_GrGLStandard == standard) {
483 fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = true;
484 } else {
485 // for now we don't support float point MSAA on ES
486 fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = false;
487 }
488 }
489
475 // If we don't support MSAA then undo any places above where we set a config as renderable with 490 // If we don't support MSAA then undo any places above where we set a config as renderable with
476 // msaa. 491 // msaa.
477 if (kNone_MSFBOType == fMSFBOType) { 492 if (kNone_MSFBOType == fMSFBOType) {
478 for (int i = 0; i < kGrPixelConfigCnt; ++i) { 493 for (int i = 0; i < kGrPixelConfigCnt; ++i) {
479 fConfigRenderSupport[i][kYes_MSAA] = false; 494 fConfigRenderSupport[i][kYes_MSAA] = false;
480 } 495 }
481 } 496 }
482 } 497 }
483 498
484 void GrGLCaps::initConfigTexturableTable(const GrGLContextInfo& ctxInfo, const G rGLInterface* gli) { 499 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 615 // 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 616 // granular approach is possible. Coincidentally, floating point textures b ecame part of
602 // the standard in ES3.1 / OGL 3.1, hence the shorthand 617 // the standard in ES3.1 / OGL 3.1, hence the shorthand
603 bool hasFPTextures = version >= GR_GL_VER(3, 1); 618 bool hasFPTextures = version >= GR_GL_VER(3, 1);
604 if (!hasFPTextures) { 619 if (!hasFPTextures) {
605 hasFPTextures = ctxInfo.hasExtension("GL_ARB_texture_float") || 620 hasFPTextures = ctxInfo.hasExtension("GL_ARB_texture_float") ||
606 (ctxInfo.hasExtension("OES_texture_float_linear") && 621 (ctxInfo.hasExtension("OES_texture_float_linear") &&
607 ctxInfo.hasExtension("GL_OES_texture_float")); 622 ctxInfo.hasExtension("GL_OES_texture_float"));
608 } 623 }
609 fConfigTextureSupport[kRGBA_float_GrPixelConfig] = hasFPTextures; 624 fConfigTextureSupport[kRGBA_float_GrPixelConfig] = hasFPTextures;
625
626 // Check for fp16 texture support
627 // NOTE: We disallow floating point textures on ES devices if linear
628 // filtering modes are not supported. This is for simplicity, but a more
629 // granular approach is possible. Coincidentally, 16-bit floating point tex tures became part of
630 // the standard in ES3.1 / OGL 3.1, hence the shorthand
631 bool hasHalfFPTextures = version >= GR_GL_VER(3, 1);
632 if (!hasHalfFPTextures) {
633 hasHalfFPTextures = ctxInfo.hasExtension("GL_ARB_texture_float") ||
634 (ctxInfo.hasExtension("OES_texture_half_float_linear") &&
635 ctxInfo.hasExtension("GL_OES_texture_half_float"));
636 }
637 fConfigTextureSupport[kAlpha_half_GrPixelConfig] = hasHalfFPTextures && fTex tureRedSupport;
610 } 638 }
611 639
612 bool GrGLCaps::doReadPixelsSupported(const GrGLInterface* intf, 640 bool GrGLCaps::doReadPixelsSupported(const GrGLInterface* intf,
613 GrGLenum format, 641 GrGLenum format,
614 GrGLenum type) const { 642 GrGLenum type) const {
615 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) { 643 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) {
616 // ES 2 guarantees this format is supported 644 // ES 2 guarantees this format is supported
617 return true; 645 return true;
618 } 646 }
619 647
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); 897 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO"));
870 r.appendf("Fragment coord conventions support: %s\n", 898 r.appendf("Fragment coord conventions support: %s\n",
871 (fFragCoordsConventionSupport ? "YES": "NO")); 899 (fFragCoordsConventionSupport ? "YES": "NO"));
872 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO")); 900 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO"));
873 r.appendf("Use non-VBO for dynamic data: %s\n", 901 r.appendf("Use non-VBO for dynamic data: %s\n",
874 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); 902 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO"));
875 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO ")); 903 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")); 904 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO"));
877 return r; 905 return r;
878 } 906 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/gl/GrGLDefines.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698