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

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

Issue 398183002: Fix alpha textures in NV ES3 contexts on Windows (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: suppress warning Created 6 years, 5 months 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/gl/GrGLUtil.cpp ('k') | tests/DeferredCanvasTest.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 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 "GrGLNameAllocator.h" 10 #include "GrGLNameAllocator.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 const GrGLubyte* version; 130 const GrGLubyte* version;
131 GL_CALL_RET(vendor, GetString(GR_GL_VENDOR)); 131 GL_CALL_RET(vendor, GetString(GR_GL_VENDOR));
132 GL_CALL_RET(renderer, GetString(GR_GL_RENDERER)); 132 GL_CALL_RET(renderer, GetString(GR_GL_RENDERER));
133 GL_CALL_RET(version, GetString(GR_GL_VERSION)); 133 GL_CALL_RET(version, GetString(GR_GL_VERSION));
134 GrPrintf("------------------------- create GrGpuGL %p --------------\n", 134 GrPrintf("------------------------- create GrGpuGL %p --------------\n",
135 this); 135 this);
136 GrPrintf("------ VENDOR %s\n", vendor); 136 GrPrintf("------ VENDOR %s\n", vendor);
137 GrPrintf("------ RENDERER %s\n", renderer); 137 GrPrintf("------ RENDERER %s\n", renderer);
138 GrPrintf("------ VERSION %s\n", version); 138 GrPrintf("------ VERSION %s\n", version);
139 GrPrintf("------ EXTENSIONS\n"); 139 GrPrintf("------ EXTENSIONS\n");
140 #if 0 // TODO: Reenable this after GrGLInterface's extensions can be accessed s afely. 140 ctx.extensions().print();
141 ctx.extensions().print();
142 #endif
143 GrPrintf("\n"); 141 GrPrintf("\n");
144 GrPrintf(this->glCaps().dump().c_str()); 142 GrPrintf(this->glCaps().dump().c_str());
145 } 143 }
146 144
147 fProgramCache = SkNEW_ARGS(ProgramCache, (this)); 145 fProgramCache = SkNEW_ARGS(ProgramCache, (this));
148 146
149 SkASSERT(this->glCaps().maxVertexAttributes() >= GrDrawState::kMaxVertexAttr ibCnt); 147 SkASSERT(this->glCaps().maxVertexAttributes() >= GrDrawState::kMaxVertexAttr ibCnt);
150 148
151 fLastSuccessfulStencilFmtIdx = 0; 149 fLastSuccessfulStencilFmtIdx = 0;
152 fHWProgramID = 0; 150 fHWProgramID = 0;
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 565
568 if (useTexStorage && kGL_GrGLStandard == this->glStandard()) { 566 if (useTexStorage && kGL_GrGLStandard == this->glStandard()) {
569 // 565 is not a sized internal format on desktop GL. So on desktop with 567 // 565 is not a sized internal format on desktop GL. So on desktop with
570 // 565 we always use an unsized internal format to let the system pick 568 // 565 we always use an unsized internal format to let the system pick
571 // the best sized format to convert the 565 data to. Since TexStorage 569 // the best sized format to convert the 565 data to. Since TexStorage
572 // only allows sized internal formats we will instead use TexImage2D. 570 // only allows sized internal formats we will instead use TexImage2D.
573 useTexStorage = desc.fConfig != kRGB_565_GrPixelConfig; 571 useTexStorage = desc.fConfig != kRGB_565_GrPixelConfig;
574 } 572 }
575 573
576 GrGLenum internalFormat; 574 GrGLenum internalFormat;
577 GrGLenum externalFormat; 575 GrGLenum externalFormat = 0x0; // suprress warning
578 GrGLenum externalType; 576 GrGLenum externalType = 0x0;// suprress warning
577
579 // glTexStorage requires sized internal formats on both desktop and ES. ES2 requires an unsized 578 // glTexStorage requires sized internal formats on both desktop and ES. ES2 requires an unsized
580 // format for glTexImage, unlike ES3 and desktop. However, we allow the driv er to decide the 579 // format for glTexImage, unlike ES3 and desktop. However, we allow the driv er to decide the
581 // size of the internal format whenever possible and so only use a sized int ernal format when 580 // size of the internal format whenever possible and so only use a sized int ernal format when
582 // using texture storage. 581 // using texture storage.
583 if (!this->configToGLFormats(dataConfig, useTexStorage, &internalFormat, 582 bool useSizedFormat = useTexStorage;
583 // At least some versions of the desktop ES3 drivers for NVIDIA won't accept GL_RED in
584 // glTexImage2D for the internal format but will accept GL_R8.
585 if (!useSizedFormat && kNVIDIA_GrGLVendor == this->glContext().vendor() &&
586 kGLES_GrGLStandard == this->glStandard() && this->glVersion() >= GR_GL_V ER(3, 0)) {
587 useSizedFormat = true;
588 }
589 if (!this->configToGLFormats(dataConfig, useSizedFormat, &internalFormat,
584 &externalFormat, &externalType)) { 590 &externalFormat, &externalType)) {
585 return false; 591 return false;
586 } 592 }
587 593
588 if (!isNewTexture && GR_GL_PALETTE8_RGBA8 == internalFormat) { 594 if (!isNewTexture && GR_GL_PALETTE8_RGBA8 == internalFormat) {
589 // paletted textures cannot be updated 595 // paletted textures cannot be updated
590 return false; 596 return false;
591 } 597 }
592 598
593 /* 599 /*
(...skipping 2421 matching lines...) Expand 10 before | Expand all | Expand 10 after
3015 this->setVertexArrayID(gpu, 0); 3021 this->setVertexArrayID(gpu, 0);
3016 } 3022 }
3017 int attrCount = gpu->glCaps().maxVertexAttributes(); 3023 int attrCount = gpu->glCaps().maxVertexAttributes();
3018 if (fDefaultVertexArrayAttribState.count() != attrCount) { 3024 if (fDefaultVertexArrayAttribState.count() != attrCount) {
3019 fDefaultVertexArrayAttribState.resize(attrCount); 3025 fDefaultVertexArrayAttribState.resize(attrCount);
3020 } 3026 }
3021 attribState = &fDefaultVertexArrayAttribState; 3027 attribState = &fDefaultVertexArrayAttribState;
3022 } 3028 }
3023 return attribState; 3029 return attribState;
3024 } 3030 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLUtil.cpp ('k') | tests/DeferredCanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698