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

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

Issue 23185004: Rename kES2_GrGLBinding to kES_GrGLBinding. Step 0 for supporting ES3. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/gl/GrGLUtil.cpp ('k') | src/gpu/gl/SkGLContextHelper.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 "GrGLStencilBuffer.h" 10 #include "GrGLStencilBuffer.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 return kBGRA_8888_GrPixelConfig; 256 return kBGRA_8888_GrPixelConfig;
257 } else { 257 } else {
258 return writeConfig; 258 return writeConfig;
259 } 259 }
260 } 260 }
261 261
262 bool GrGpuGL::canWriteTexturePixels(const GrTexture* texture, GrPixelConfig srcC onfig) const { 262 bool GrGpuGL::canWriteTexturePixels(const GrTexture* texture, GrPixelConfig srcC onfig) const {
263 if (kIndex_8_GrPixelConfig == srcConfig || kIndex_8_GrPixelConfig == texture ->config()) { 263 if (kIndex_8_GrPixelConfig == srcConfig || kIndex_8_GrPixelConfig == texture ->config()) {
264 return false; 264 return false;
265 } 265 }
266 if (srcConfig != texture->config() && kES2_GrGLBinding == this->glBinding()) { 266 if (srcConfig != texture->config() && kES_GrGLBinding == this->glBinding()) {
267 // In general ES2 requires the internal format of the texture and the fo rmat of the src 267 // In general ES2 requires the internal format of the texture and the fo rmat of the src
268 // pixels to match. However, It may or may not be possible to upload BGR A data to a RGBA 268 // pixels to match. However, It may or may not be possible to upload BGR A data to a RGBA
269 // texture. It depends upon which extension added BGRA. The Apple extens ion allows it 269 // texture. It depends upon which extension added BGRA. The Apple extens ion allows it
270 // (BGRA's internal format is RGBA) while the EXT extension does not (BG RA is its own 270 // (BGRA's internal format is RGBA) while the EXT extension does not (BG RA is its own
271 // internal format). 271 // internal format).
272 if (this->glCaps().bgraFormatSupport() && 272 if (this->glCaps().bgraFormatSupport() &&
273 !this->glCaps().bgraIsInternalFormat() && 273 !this->glCaps().bgraIsInternalFormat() &&
274 kBGRA_8888_GrPixelConfig == srcConfig && 274 kBGRA_8888_GrPixelConfig == srcConfig &&
275 kRGBA_8888_GrPixelConfig == texture->config()) { 275 kRGBA_8888_GrPixelConfig == texture->config()) {
276 return true; 276 return true;
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 // the texture bound to the other. The exception is the IMG multisample exte nsion. With this 803 // the texture bound to the other. The exception is the IMG multisample exte nsion. With this
804 // extension the texture is multisampled when rendered to and then auto-reso lves it when it is 804 // extension the texture is multisampled when rendered to and then auto-reso lves it when it is
805 // rendered from. 805 // rendered from.
806 if (desc->fSampleCnt > 0 && this->glCaps().usesMSAARenderBuffers()) { 806 if (desc->fSampleCnt > 0 && this->glCaps().usesMSAARenderBuffers()) {
807 GL_CALL(GenFramebuffers(1, &desc->fRTFBOID)); 807 GL_CALL(GenFramebuffers(1, &desc->fRTFBOID));
808 GL_CALL(GenRenderbuffers(1, &desc->fMSColorRenderbufferID)); 808 GL_CALL(GenRenderbuffers(1, &desc->fMSColorRenderbufferID));
809 if (!desc->fRTFBOID || 809 if (!desc->fRTFBOID ||
810 !desc->fMSColorRenderbufferID || 810 !desc->fMSColorRenderbufferID ||
811 !this->configToGLFormats(desc->fConfig, 811 !this->configToGLFormats(desc->fConfig,
812 // GLES requires sized internal formats 812 // GLES requires sized internal formats
813 kES2_GrGLBinding == this->glBinding(), 813 kES_GrGLBinding == this->glBinding(),
814 &msColorFormat, 814 &msColorFormat,
815 NULL, 815 NULL,
816 NULL)) { 816 NULL)) {
817 goto FAILED; 817 goto FAILED;
818 } 818 }
819 } else { 819 } else {
820 desc->fRTFBOID = desc->fTexFBOID; 820 desc->fRTFBOID = desc->fTexFBOID;
821 } 821 }
822 822
823 // below here we may bind the FBO 823 // below here we may bind the FBO
(...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after
2296 } 2296 }
2297 } 2297 }
2298 2298
2299 inline bool can_copy_texsubimage(const GrSurface* dst, 2299 inline bool can_copy_texsubimage(const GrSurface* dst,
2300 const GrSurface* src, 2300 const GrSurface* src,
2301 const GrGpuGL* gpu, 2301 const GrGpuGL* gpu,
2302 bool* wouldNeedTempFBO = NULL) { 2302 bool* wouldNeedTempFBO = NULL) {
2303 // Table 3.9 of the ES2 spec indicates the supported formats with CopyTexSub Image 2303 // Table 3.9 of the ES2 spec indicates the supported formats with CopyTexSub Image
2304 // and BGRA isn't in the spec. There doesn't appear to be any extension that adds it. Perhaps 2304 // and BGRA isn't in the spec. There doesn't appear to be any extension that adds it. Perhaps
2305 // many drivers would allow it to work, but ANGLE does not. 2305 // many drivers would allow it to work, but ANGLE does not.
2306 if (kES2_GrGLBinding == gpu->glBinding() && gpu->glCaps().bgraIsInternalForm at() && 2306 if (kES_GrGLBinding == gpu->glBinding() && gpu->glCaps().bgraIsInternalForma t() &&
2307 (kBGRA_8888_GrPixelConfig == dst->config() || kBGRA_8888_GrPixelConfig = = src->config())) { 2307 (kBGRA_8888_GrPixelConfig == dst->config() || kBGRA_8888_GrPixelConfig = = src->config())) {
2308 return false; 2308 return false;
2309 } 2309 }
2310 const GrGLRenderTarget* dstRT = static_cast<const GrGLRenderTarget*>(dst->as RenderTarget()); 2310 const GrGLRenderTarget* dstRT = static_cast<const GrGLRenderTarget*>(dst->as RenderTarget());
2311 // If dst is multisampled (and uses an extension where there is a separate M SAA renderbuffer) 2311 // If dst is multisampled (and uses an extension where there is a separate M SAA renderbuffer)
2312 // then we don't want to copy to the texture but to the MSAA buffer. 2312 // then we don't want to copy to the texture but to the MSAA buffer.
2313 if (NULL != dstRT && dstRT->renderFBOID() != dstRT->textureFBOID()) { 2313 if (NULL != dstRT && dstRT->renderFBOID() != dstRT->textureFBOID()) {
2314 return false; 2314 return false;
2315 } 2315 }
2316 const GrGLRenderTarget* srcRT = static_cast<const GrGLRenderTarget*>(src->as RenderTarget()); 2316 const GrGLRenderTarget* srcRT = static_cast<const GrGLRenderTarget*>(src->as RenderTarget());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2357 GR_GL_CALL(gl, BindFramebuffer(fboTarget, rt->renderFBOID())); 2357 GR_GL_CALL(gl, BindFramebuffer(fboTarget, rt->renderFBOID()));
2358 *viewport = rt->getViewport(); 2358 *viewport = rt->getViewport();
2359 } 2359 }
2360 return tempFBOID; 2360 return tempFBOID;
2361 } 2361 }
2362 2362
2363 } 2363 }
2364 2364
2365 void GrGpuGL::initCopySurfaceDstDesc(const GrSurface* src, GrTextureDesc* desc) { 2365 void GrGpuGL::initCopySurfaceDstDesc(const GrSurface* src, GrTextureDesc* desc) {
2366 // Check for format issues with glCopyTexSubImage2D 2366 // Check for format issues with glCopyTexSubImage2D
2367 if (kES2_GrGLBinding == this->glBinding() && this->glCaps().bgraIsInternalFo rmat() && 2367 if (kES_GrGLBinding == this->glBinding() && this->glCaps().bgraIsInternalFor mat() &&
2368 kBGRA_8888_GrPixelConfig == src->config()) { 2368 kBGRA_8888_GrPixelConfig == src->config()) {
2369 // glCopyTexSubImage2D doesn't work with this config. We'll want to make it a render target 2369 // glCopyTexSubImage2D doesn't work with this config. We'll want to make it a render target
2370 // in order to call glBlitFramebuffer or to copy to it by rendering. 2370 // in order to call glBlitFramebuffer or to copy to it by rendering.
2371 INHERITED::initCopySurfaceDstDesc(src, desc); 2371 INHERITED::initCopySurfaceDstDesc(src, desc);
2372 return; 2372 return;
2373 } else if (NULL == src->asRenderTarget()) { 2373 } else if (NULL == src->asRenderTarget()) {
2374 // We don't want to have to create an FBO just to use glCopyTexSubImage2 D. Let the base 2374 // We don't want to have to create an FBO just to use glCopyTexSubImage2 D. Let the base
2375 // class handle it by rendering. 2375 // class handle it by rendering.
2376 INHERITED::initCopySurfaceDstDesc(src, desc); 2376 INHERITED::initCopySurfaceDstDesc(src, desc);
2377 return; 2377 return;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
2552 this->setVertexArrayID(gpu, 0); 2552 this->setVertexArrayID(gpu, 0);
2553 } 2553 }
2554 int attrCount = gpu->glCaps().maxVertexAttributes(); 2554 int attrCount = gpu->glCaps().maxVertexAttributes();
2555 if (fDefaultVertexArrayAttribState.count() != attrCount) { 2555 if (fDefaultVertexArrayAttribState.count() != attrCount) {
2556 fDefaultVertexArrayAttribState.resize(attrCount); 2556 fDefaultVertexArrayAttribState.resize(attrCount);
2557 } 2557 }
2558 attribState = &fDefaultVertexArrayAttribState; 2558 attribState = &fDefaultVertexArrayAttribState;
2559 } 2559 }
2560 return attribState; 2560 return attribState;
2561 } 2561 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLUtil.cpp ('k') | src/gpu/gl/SkGLContextHelper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698