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

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

Issue 806943002: 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. ES2 requires an unsized 561 // glTexStorage requires sized internal formats on both desktop and ES.
562 // format for glTexImage, unlike ES3 and desktop. However, we allow the driv er to decide the
563 // size of the internal format whenever possible and so only use a sized int ernal format when
564 // using texture storage.
565 bool useSizedFormat = useTexStorage; 562 bool useSizedFormat = useTexStorage;
bsalomon 2014/12/15 22:20:00 maybe just change to usf = useTexStorage || glstd
566 // Many versions of the ES3 drivers on various platforms will not accept GL_ RED in 563 // ES2 requires an unsized format for glTexImage. On ES3 and desktop we defa ult to sized.
567 // glTexImage2D for the internal format but will accept GL_R8. 564 if (kGL_GrGLStandard == this->glStandard() || this->glVersion() >= GR_GL_VER (3, 0)) {
568 if (kGLES_GrGLStandard == this->glStandard() && this->glVersion() >= GR_GL_V ER(3, 0) &&
569 kAlpha_8_GrPixelConfig == dataConfig) {
570 useSizedFormat = true; 565 useSizedFormat = true;
571 } 566 }
572 if (!this->configToGLFormats(dataConfig, useSizedFormat, &internalFormat, 567 if (!this->configToGLFormats(dataConfig, useSizedFormat, &internalFormat,
573 &externalFormat, &externalType)) { 568 &externalFormat, &externalType)) {
574 return false; 569 return false;
575 } 570 }
576 571
577 /* 572 /*
578 * check whether to allocate a temporary buffer for flipping y or 573 * check whether to allocate a temporary buffer for flipping y or
579 * because our srcData has extra bytes past each row. If so, we need 574 * because our srcData has extra bytes past each row. If so, we need
(...skipping 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after
2589 this->setVertexArrayID(gpu, 0); 2584 this->setVertexArrayID(gpu, 0);
2590 } 2585 }
2591 int attrCount = gpu->glCaps().maxVertexAttributes(); 2586 int attrCount = gpu->glCaps().maxVertexAttributes();
2592 if (fDefaultVertexArrayAttribState.count() != attrCount) { 2587 if (fDefaultVertexArrayAttribState.count() != attrCount) {
2593 fDefaultVertexArrayAttribState.resize(attrCount); 2588 fDefaultVertexArrayAttribState.resize(attrCount);
2594 } 2589 }
2595 attribState = &fDefaultVertexArrayAttribState; 2590 attribState = &fDefaultVertexArrayAttribState;
2596 } 2591 }
2597 return attribState; 2592 return attribState;
2598 } 2593 }
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