OLD | NEW |
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 "GrGLGpu.h" | 9 #include "GrGLGpu.h" |
10 #include "GrGLGLSL.h" | 10 #include "GrGLGLSL.h" |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 tempDrawInfo->fTempSurfaceDesc.fSampleCnt = 0; | 535 tempDrawInfo->fTempSurfaceDesc.fSampleCnt = 0; |
536 tempDrawInfo->fTempSurfaceDesc.fOrigin = kTopLeft_GrSurfaceOrigin; // no CPU
y-flip for TL. | 536 tempDrawInfo->fTempSurfaceDesc.fOrigin = kTopLeft_GrSurfaceOrigin; // no CPU
y-flip for TL. |
537 | 537 |
538 bool configsAreRBSwaps = GrPixelConfigSwapRAndB(srcConfig) == dstSurface->co
nfig(); | 538 bool configsAreRBSwaps = GrPixelConfigSwapRAndB(srcConfig) == dstSurface->co
nfig(); |
539 | 539 |
540 if (configsAreRBSwaps) { | 540 if (configsAreRBSwaps) { |
541 if (!this->caps()->isConfigTexturable(srcConfig)) { | 541 if (!this->caps()->isConfigTexturable(srcConfig)) { |
542 ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference); | 542 ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference); |
543 tempDrawInfo->fTempSurfaceDesc.fConfig = dstSurface->config(); | 543 tempDrawInfo->fTempSurfaceDesc.fConfig = dstSurface->config(); |
544 tempDrawInfo->fSwapRAndB = true; | 544 tempDrawInfo->fSwapRAndB = true; |
545 } else if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig ==
srcConfig) { | 545 } else if (this->glCaps().rgba8888PixelsOpsAreSlow() && |
| 546 kRGBA_8888_GrPixelConfig == srcConfig) { |
546 ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference
); | 547 ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference
); |
547 tempDrawInfo->fTempSurfaceDesc.fConfig = dstSurface->config(); | 548 tempDrawInfo->fTempSurfaceDesc.fConfig = dstSurface->config(); |
548 tempDrawInfo->fSwapRAndB = true; | 549 tempDrawInfo->fSwapRAndB = true; |
549 } else if (kGLES_GrGLStandard == this->glStandard() && | 550 } else if (kGLES_GrGLStandard == this->glStandard() && |
550 this->glCaps().bgraIsInternalFormat()) { | 551 this->glCaps().bgraIsInternalFormat()) { |
551 // The internal format and external formats must match texture uploa
ds so we can't | 552 // The internal format and external formats must match texture uploa
ds so we can't |
552 // swizzle while uploading when BGRA is a distinct internal format. | 553 // swizzle while uploading when BGRA is a distinct internal format. |
553 ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference); | 554 ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference); |
554 tempDrawInfo->fTempSurfaceDesc.fConfig = dstSurface->config(); | 555 tempDrawInfo->fTempSurfaceDesc.fConfig = dstSurface->config(); |
555 tempDrawInfo->fSwapRAndB = true; | 556 tempDrawInfo->fSwapRAndB = true; |
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1754 | 1755 |
1755 tempDrawInfo->fSwapRAndB = false; | 1756 tempDrawInfo->fSwapRAndB = false; |
1756 | 1757 |
1757 // These settings we will always want if a temp draw is performed. The confi
g is set below | 1758 // These settings we will always want if a temp draw is performed. The confi
g is set below |
1758 // depending on whether we want to do a R/B swap or not. | 1759 // depending on whether we want to do a R/B swap or not. |
1759 tempDrawInfo->fTempSurfaceDesc.fFlags = kRenderTarget_GrSurfaceFlag; | 1760 tempDrawInfo->fTempSurfaceDesc.fFlags = kRenderTarget_GrSurfaceFlag; |
1760 tempDrawInfo->fTempSurfaceDesc.fWidth = width; | 1761 tempDrawInfo->fTempSurfaceDesc.fWidth = width; |
1761 tempDrawInfo->fTempSurfaceDesc.fHeight = height; | 1762 tempDrawInfo->fTempSurfaceDesc.fHeight = height; |
1762 tempDrawInfo->fTempSurfaceDesc.fSampleCnt = 0; | 1763 tempDrawInfo->fTempSurfaceDesc.fSampleCnt = 0; |
1763 tempDrawInfo->fTempSurfaceDesc.fOrigin = kTopLeft_GrSurfaceOrigin; // no CPU
y-flip for TL. | 1764 tempDrawInfo->fTempSurfaceDesc.fOrigin = kTopLeft_GrSurfaceOrigin; // no CPU
y-flip for TL. |
1764 tempDrawInfo->fUseExactScratch = SkToBool(GR_GL_FULL_READPIXELS_FASTER_THAN_
PARTIAL) && | 1765 tempDrawInfo->fUseExactScratch = this->glCaps().partialFBOReadIsSlow() && |
1765 width >= this->caps()->minTextureSize() && | 1766 width >= this->caps()->minTextureSize() && |
1766 height >= this->caps()->minTextureSize(); | 1767 height >= this->caps()->minTextureSize(); |
1767 | 1768 |
1768 // Start off assuming that any temp draw should be to the readConfig, then c
heck if that will | 1769 // Start off assuming that any temp draw should be to the readConfig, then c
heck if that will |
1769 // be inefficient. | 1770 // be inefficient. |
1770 GrPixelConfig srcConfig = srcSurface->config(); | 1771 GrPixelConfig srcConfig = srcSurface->config(); |
1771 tempDrawInfo->fTempSurfaceDesc.fConfig = readConfig; | 1772 tempDrawInfo->fTempSurfaceDesc.fConfig = readConfig; |
1772 | 1773 |
1773 if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == readConfig
) { | 1774 if (this->glCaps().rgba8888PixelsOpsAreSlow() && kRGBA_8888_GrPixelConfig ==
readConfig) { |
1774 tempDrawInfo->fTempSurfaceDesc.fConfig = kBGRA_8888_GrPixelConfig; | 1775 tempDrawInfo->fTempSurfaceDesc.fConfig = kBGRA_8888_GrPixelConfig; |
1775 tempDrawInfo->fSwapRAndB = true; | 1776 tempDrawInfo->fSwapRAndB = true; |
1776 ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference); | 1777 ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference); |
1777 } else if (kMesa_GrGLDriver == this->glContext().driver() && | 1778 } else if (kMesa_GrGLDriver == this->glContext().driver() && |
1778 GrBytesPerPixel(readConfig) == 4 && | 1779 GrBytesPerPixel(readConfig) == 4 && |
1779 GrPixelConfigSwapRAndB(readConfig) == srcConfig) { | 1780 GrPixelConfigSwapRAndB(readConfig) == srcConfig) { |
1780 // Mesa 3D takes a slow path on when reading back BGRA from an RGBA sur
face and vice-versa. | 1781 // Mesa 3D takes a slow path on when reading back BGRA from an RGBA sur
face and vice-versa. |
1781 // Better to do a draw with a R/B swap and then read as the original con
fig. | 1782 // Better to do a draw with a R/B swap and then read as the original con
fig. |
1782 tempDrawInfo->fTempSurfaceDesc.fConfig = srcConfig; | 1783 tempDrawInfo->fTempSurfaceDesc.fConfig = srcConfig; |
1783 tempDrawInfo->fSwapRAndB = true; | 1784 tempDrawInfo->fSwapRAndB = true; |
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3212 this->setVertexArrayID(gpu, 0); | 3213 this->setVertexArrayID(gpu, 0); |
3213 } | 3214 } |
3214 int attrCount = gpu->glCaps().maxVertexAttributes(); | 3215 int attrCount = gpu->glCaps().maxVertexAttributes(); |
3215 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 3216 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
3216 fDefaultVertexArrayAttribState.resize(attrCount); | 3217 fDefaultVertexArrayAttribState.resize(attrCount); |
3217 } | 3218 } |
3218 attribState = &fDefaultVertexArrayAttribState; | 3219 attribState = &fDefaultVertexArrayAttribState; |
3219 } | 3220 } |
3220 return attribState; | 3221 return attribState; |
3221 } | 3222 } |
OLD | NEW |