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

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

Issue 1430643002: Remove min texture size support (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Delete even more! Created 5 years, 1 month 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/GrGLCaps.cpp ('k') | src/image/SkImage_Gpu.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 "GrGLGpu.h" 9 #include "GrGLGpu.h"
10 #include "GrGLGLSL.h" 10 #include "GrGLGLSL.h"
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 (GrGLint*)&format->fTotalBits); 1177 (GrGLint*)&format->fTotalBits);
1178 format->fTotalBits += format->fStencilBits; 1178 format->fTotalBits += format->fStencilBits;
1179 } else { 1179 } else {
1180 format->fTotalBits = format->fStencilBits; 1180 format->fTotalBits = format->fStencilBits;
1181 } 1181 }
1182 } 1182 }
1183 } 1183 }
1184 } 1184 }
1185 1185
1186 int GrGLGpu::getCompatibleStencilIndex(GrPixelConfig config) { 1186 int GrGLGpu::getCompatibleStencilIndex(GrPixelConfig config) {
1187 int size = this->caps()->minTextureSize(); 1187 static const int kSize = 16;
1188 if (kUnknownStencilIndex == fPixelConfigToStencilIndex[config]) { 1188 if (kUnknownStencilIndex == fPixelConfigToStencilIndex[config]) {
1189 // Default to unsupported 1189 // Default to unsupported
1190 fPixelConfigToStencilIndex[config] = kUnsupportedStencilIndex; 1190 fPixelConfigToStencilIndex[config] = kUnsupportedStencilIndex;
1191 // Create color texture 1191 // Create color texture
1192 GrGLuint colorID; 1192 GrGLuint colorID;
1193 GL_CALL(GenTextures(1, &colorID)); 1193 GL_CALL(GenTextures(1, &colorID));
1194 this->setScratchTextureUnit(); 1194 this->setScratchTextureUnit();
1195 GL_CALL(BindTexture(GR_GL_TEXTURE_2D, colorID)); 1195 GL_CALL(BindTexture(GR_GL_TEXTURE_2D, colorID));
1196 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, 1196 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D,
1197 GR_GL_TEXTURE_MAG_FILTER, 1197 GR_GL_TEXTURE_MAG_FILTER,
(...skipping 21 matching lines...) Expand all
1219 if (!this->configToGLFormats(config, useSizedFormat, &internalFormat, 1219 if (!this->configToGLFormats(config, useSizedFormat, &internalFormat,
1220 &externalFormat, &externalType)) { 1220 &externalFormat, &externalType)) {
1221 GL_CALL(DeleteTextures(1, &colorID)); 1221 GL_CALL(DeleteTextures(1, &colorID));
1222 fPixelConfigToStencilIndex[config] = kUnsupportedStencilIndex; 1222 fPixelConfigToStencilIndex[config] = kUnsupportedStencilIndex;
1223 return kUnsupportedStencilIndex; 1223 return kUnsupportedStencilIndex;
1224 } 1224 }
1225 1225
1226 CLEAR_ERROR_BEFORE_ALLOC(this->glInterface()); 1226 CLEAR_ERROR_BEFORE_ALLOC(this->glInterface());
1227 GL_ALLOC_CALL(this->glInterface(), TexImage2D(GR_GL_TEXTURE_2D, 1227 GL_ALLOC_CALL(this->glInterface(), TexImage2D(GR_GL_TEXTURE_2D,
1228 0, internalFormat, 1228 0, internalFormat,
1229 size, 1229 kSize,
1230 size, 1230 kSize,
1231 0, 1231 0,
1232 externalFormat, 1232 externalFormat,
1233 externalType, 1233 externalType,
1234 NULL)); 1234 NULL));
1235 if (GR_GL_NO_ERROR != GR_GL_GET_ERROR(this->glInterface())) { 1235 if (GR_GL_NO_ERROR != GR_GL_GET_ERROR(this->glInterface())) {
1236 GL_CALL(DeleteTextures(1, &colorID)); 1236 GL_CALL(DeleteTextures(1, &colorID));
1237 fPixelConfigToStencilIndex[config] = kUnsupportedStencilIndex; 1237 fPixelConfigToStencilIndex[config] = kUnsupportedStencilIndex;
1238 return kUnsupportedStencilIndex; 1238 return kUnsupportedStencilIndex;
1239 } 1239 }
1240 1240
(...skipping 18 matching lines...) Expand all
1259 const GrGLCaps::StencilFormat& sFmt = this->glCaps().stencilFormats( )[i]; 1259 const GrGLCaps::StencilFormat& sFmt = this->glCaps().stencilFormats( )[i];
1260 1260
1261 GL_CALL(GenRenderbuffers(1, &sbRBID)); 1261 GL_CALL(GenRenderbuffers(1, &sbRBID));
1262 if (!sbRBID) { 1262 if (!sbRBID) {
1263 break; 1263 break;
1264 } 1264 }
1265 GL_CALL(BindRenderbuffer(GR_GL_RENDERBUFFER, sbRBID)); 1265 GL_CALL(BindRenderbuffer(GR_GL_RENDERBUFFER, sbRBID));
1266 CLEAR_ERROR_BEFORE_ALLOC(this->glInterface()); 1266 CLEAR_ERROR_BEFORE_ALLOC(this->glInterface());
1267 GL_ALLOC_CALL(this->glInterface(), RenderbufferStorage(GR_GL_RENDERB UFFER, 1267 GL_ALLOC_CALL(this->glInterface(), RenderbufferStorage(GR_GL_RENDERB UFFER,
1268 sFmt.fInterna lFormat, 1268 sFmt.fInterna lFormat,
1269 size, size)); 1269 kSize, kSize) );
1270 if (GR_GL_NO_ERROR == GR_GL_GET_ERROR(this->glInterface())) { 1270 if (GR_GL_NO_ERROR == GR_GL_GET_ERROR(this->glInterface())) {
1271 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, 1271 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER,
1272 GR_GL_STENCIL_ATTACHMENT, 1272 GR_GL_STENCIL_ATTACHMENT,
1273 GR_GL_RENDERBUFFER, sbRBID)); 1273 GR_GL_RENDERBUFFER, sbRBID));
1274 if (sFmt.fPacked) { 1274 if (sFmt.fPacked) {
1275 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, 1275 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER,
1276 GR_GL_DEPTH_ATTACHMENT, 1276 GR_GL_DEPTH_ATTACHMENT,
1277 GR_GL_RENDERBUFFER, sbRBID)) ; 1277 GR_GL_RENDERBUFFER, sbRBID)) ;
1278 } else { 1278 } else {
1279 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, 1279 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER,
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1811 1811
1812 static bool read_pixels_pays_for_y_flip(GrRenderTarget* renderTarget, const GrGL Caps& caps, 1812 static bool read_pixels_pays_for_y_flip(GrRenderTarget* renderTarget, const GrGL Caps& caps,
1813 int width, int height, GrPixelConfig co nfig, 1813 int width, int height, GrPixelConfig co nfig,
1814 size_t rowBytes) { 1814 size_t rowBytes) {
1815 // If this render target is already TopLeft, we don't need to flip. 1815 // If this render target is already TopLeft, we don't need to flip.
1816 if (kTopLeft_GrSurfaceOrigin == renderTarget->origin()) { 1816 if (kTopLeft_GrSurfaceOrigin == renderTarget->origin()) {
1817 return false; 1817 return false;
1818 } 1818 }
1819 1819
1820 // If the read is really small or smaller than the min texture size, don't f orce a draw. 1820 // If the read is really small or smaller than the min texture size, don't f orce a draw.
1821 int minSize = SkTMax(32, caps.minTextureSize()); 1821 static const int kMinSize = 32;
1822 if (width < minSize || height < minSize) { 1822 if (width < kMinSize || height < kMinSize) {
1823 return false; 1823 return false;
1824 } 1824 }
1825 1825
1826 // if GL can do the flip then we'll never pay for it. 1826 // if GL can do the flip then we'll never pay for it.
1827 if (caps.packFlipYSupport()) { 1827 if (caps.packFlipYSupport()) {
1828 return false; 1828 return false;
1829 } 1829 }
1830 1830
1831 // If we have to do memcpy to handle non-trim rowBytes then we 1831 // If we have to do memcpy to handle non-trim rowBytes then we
1832 // get the flip for free. Otherwise it costs. 1832 // get the flip for free. Otherwise it costs.
(...skipping 17 matching lines...) Expand all
1850 1850
1851 tempDrawInfo->fSwapRAndB = false; 1851 tempDrawInfo->fSwapRAndB = false;
1852 1852
1853 // These settings we will always want if a temp draw is performed. The confi g is set below 1853 // These settings we will always want if a temp draw is performed. The confi g is set below
1854 // depending on whether we want to do a R/B swap or not. 1854 // depending on whether we want to do a R/B swap or not.
1855 tempDrawInfo->fTempSurfaceDesc.fFlags = kRenderTarget_GrSurfaceFlag; 1855 tempDrawInfo->fTempSurfaceDesc.fFlags = kRenderTarget_GrSurfaceFlag;
1856 tempDrawInfo->fTempSurfaceDesc.fWidth = width; 1856 tempDrawInfo->fTempSurfaceDesc.fWidth = width;
1857 tempDrawInfo->fTempSurfaceDesc.fHeight = height; 1857 tempDrawInfo->fTempSurfaceDesc.fHeight = height;
1858 tempDrawInfo->fTempSurfaceDesc.fSampleCnt = 0; 1858 tempDrawInfo->fTempSurfaceDesc.fSampleCnt = 0;
1859 tempDrawInfo->fTempSurfaceDesc.fOrigin = kTopLeft_GrSurfaceOrigin; // no CPU y-flip for TL. 1859 tempDrawInfo->fTempSurfaceDesc.fOrigin = kTopLeft_GrSurfaceOrigin; // no CPU y-flip for TL.
1860 tempDrawInfo->fUseExactScratch = this->glCaps().partialFBOReadIsSlow() && 1860 tempDrawInfo->fUseExactScratch = this->glCaps().partialFBOReadIsSlow();
1861 width >= this->caps()->minTextureSize() &&
1862 height >= this->caps()->minTextureSize();
1863 1861
1864 // Start off assuming that any temp draw should be to the readConfig, then c heck if that will 1862 // Start off assuming that any temp draw should be to the readConfig, then c heck if that will
1865 // be inefficient. 1863 // be inefficient.
1866 GrPixelConfig srcConfig = srcSurface->config(); 1864 GrPixelConfig srcConfig = srcSurface->config();
1867 tempDrawInfo->fTempSurfaceDesc.fConfig = readConfig; 1865 tempDrawInfo->fTempSurfaceDesc.fConfig = readConfig;
1868 1866
1869 if (this->glCaps().rgba8888PixelsOpsAreSlow() && kRGBA_8888_GrPixelConfig == readConfig) { 1867 if (this->glCaps().rgba8888PixelsOpsAreSlow() && kRGBA_8888_GrPixelConfig == readConfig) {
1870 tempDrawInfo->fTempSurfaceDesc.fConfig = kBGRA_8888_GrPixelConfig; 1868 tempDrawInfo->fTempSurfaceDesc.fConfig = kBGRA_8888_GrPixelConfig;
1871 tempDrawInfo->fSwapRAndB = true; 1869 tempDrawInfo->fSwapRAndB = true;
1872 ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference); 1870 ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference);
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after
3297 this->setVertexArrayID(gpu, 0); 3295 this->setVertexArrayID(gpu, 0);
3298 } 3296 }
3299 int attrCount = gpu->glCaps().maxVertexAttributes(); 3297 int attrCount = gpu->glCaps().maxVertexAttributes();
3300 if (fDefaultVertexArrayAttribState.count() != attrCount) { 3298 if (fDefaultVertexArrayAttribState.count() != attrCount) {
3301 fDefaultVertexArrayAttribState.resize(attrCount); 3299 fDefaultVertexArrayAttribState.resize(attrCount);
3302 } 3300 }
3303 attribState = &fDefaultVertexArrayAttribState; 3301 attribState = &fDefaultVertexArrayAttribState;
3304 } 3302 }
3305 return attribState; 3303 return attribState;
3306 } 3304 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLCaps.cpp ('k') | src/image/SkImage_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698