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

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

Issue 805193003: Revert of Change desktop and ES 3.0 to always use sized internal texture formats. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | no next file » | 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 2011 Google Inc. 2 * Copyright 2011 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 "GrGpuGL.h" 9 #include "GrGpuGL.h"
10 #include "GrGLStencilBuffer.h" 10 #include "GrGLStencilBuffer.h"
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 // 565 we always use an unsized internal format to let the system pick 551 // 565 we always use an unsized internal format to let the system pick
552 // the best sized format to convert the 565 data to. Since TexStorage 552 // the best sized format to convert the 565 data to. Since TexStorage
553 // only allows sized internal formats we will instead use TexImage2D. 553 // only allows sized internal formats we will instead use TexImage2D.
554 useTexStorage = desc.fConfig != kRGB_565_GrPixelConfig; 554 useTexStorage = desc.fConfig != kRGB_565_GrPixelConfig;
555 } 555 }
556 556
557 GrGLenum internalFormat; 557 GrGLenum internalFormat;
558 GrGLenum externalFormat = 0x0; // suprress warning 558 GrGLenum externalFormat = 0x0; // suprress warning
559 GrGLenum externalType = 0x0;// suprress warning 559 GrGLenum externalType = 0x0;// suprress warning
560 560
561 // glTexStorage requires sized internal formats on both desktop and ES. 561 // glTexStorage requires sized internal formats on both desktop and ES. ES2 requires an unsized
562 // ES2 requires an unsized format for glTexImage. On ES3 and desktop we defa ult to sized. 562 // format for glTexImage, unlike ES3 and desktop. However, we allow the driv er to decide the
563 bool useSizedFormat = useTexStorage || kGL_GrGLStandard == this->glStandard( ) || 563 // size of the internal format whenever possible and so only use a sized int ernal format when
564 this->glVersion() >= GR_GL_VER(3, 0); 564 // using texture storage.
565 bool useSizedFormat = useTexStorage;
566 // Many versions of the ES3 drivers on various platforms will not accept GL_ RED in
567 // glTexImage2D for the internal format but will accept GL_R8.
568 if (kGLES_GrGLStandard == this->glStandard() && this->glVersion() >= GR_GL_V ER(3, 0) &&
569 kAlpha_8_GrPixelConfig == dataConfig) {
570 useSizedFormat = true;
571 }
565 if (!this->configToGLFormats(dataConfig, useSizedFormat, &internalFormat, 572 if (!this->configToGLFormats(dataConfig, useSizedFormat, &internalFormat,
566 &externalFormat, &externalType)) { 573 &externalFormat, &externalType)) {
567 return false; 574 return false;
568 } 575 }
569 576
570 /* 577 /*
571 * check whether to allocate a temporary buffer for flipping y or 578 * check whether to allocate a temporary buffer for flipping y or
572 * because our srcData has extra bytes past each row. If so, we need 579 * because our srcData has extra bytes past each row. If so, we need
573 * to trim those off here, since GL ES may not let us specify 580 * to trim those off here, since GL ES may not let us specify
574 * GL_UNPACK_ROW_LENGTH. 581 * GL_UNPACK_ROW_LENGTH.
(...skipping 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after
2582 this->setVertexArrayID(gpu, 0); 2589 this->setVertexArrayID(gpu, 0);
2583 } 2590 }
2584 int attrCount = gpu->glCaps().maxVertexAttributes(); 2591 int attrCount = gpu->glCaps().maxVertexAttributes();
2585 if (fDefaultVertexArrayAttribState.count() != attrCount) { 2592 if (fDefaultVertexArrayAttribState.count() != attrCount) {
2586 fDefaultVertexArrayAttribState.resize(attrCount); 2593 fDefaultVertexArrayAttribState.resize(attrCount);
2587 } 2594 }
2588 attribState = &fDefaultVertexArrayAttribState; 2595 attribState = &fDefaultVertexArrayAttribState;
2589 } 2596 }
2590 return attribState; 2597 return attribState;
2591 } 2598 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698