| 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 #ifndef GrGLGpu_DEFINED | 8 #ifndef GrGLGpu_DEFINED |
| 9 #define GrGLGpu_DEFINED | 9 #define GrGLGpu_DEFINED |
| 10 | 10 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 void flushStencil(const GrStencilSettings&); | 266 void flushStencil(const GrStencilSettings&); |
| 267 void flushHWAAState(GrRenderTarget* rt, bool useHWAA, bool stencilEnabled); | 267 void flushHWAAState(GrRenderTarget* rt, bool useHWAA, bool stencilEnabled); |
| 268 | 268 |
| 269 bool configToGLFormats(GrPixelConfig config, | 269 bool configToGLFormats(GrPixelConfig config, |
| 270 bool getSizedInternal, | 270 bool getSizedInternal, |
| 271 GrGLenum* internalFormat, | 271 GrGLenum* internalFormat, |
| 272 GrGLenum* externalFormat, | 272 GrGLenum* externalFormat, |
| 273 GrGLenum* externalType) const; | 273 GrGLenum* externalType) const; |
| 274 // helper for onCreateTexture and writeTexturePixels | 274 // helper for onCreateTexture and writeTexturePixels |
| 275 bool uploadTexData(const GrSurfaceDesc& desc, | 275 bool uploadTexData(const GrSurfaceDesc& desc, |
| 276 GrGLenum target, |
| 276 bool isNewTexture, | 277 bool isNewTexture, |
| 277 int left, int top, int width, int height, | 278 int left, int top, int width, int height, |
| 278 GrPixelConfig dataConfig, | 279 GrPixelConfig dataConfig, |
| 279 const void* data, | 280 const void* data, |
| 280 size_t rowBytes); | 281 size_t rowBytes); |
| 281 | 282 |
| 282 // helper for onCreateCompressedTexture. If width and height are | 283 // helper for onCreateCompressedTexture. If width and height are |
| 283 // set to -1, then this function will use desc.fWidth and desc.fHeight | 284 // set to -1, then this function will use desc.fWidth and desc.fHeight |
| 284 // for the size of the data. The isNewTexture flag should be set to true | 285 // for the size of the data. The isNewTexture flag should be set to true |
| 285 // whenever a new texture needs to be created. Otherwise, we assume that | 286 // whenever a new texture needs to be created. Otherwise, we assume that |
| 286 // the texture is already in GPU memory and that it's going to be updated | 287 // the texture is already in GPU memory and that it's going to be updated |
| 287 // with new data. | 288 // with new data. |
| 288 bool uploadCompressedTexData(const GrSurfaceDesc& desc, | 289 bool uploadCompressedTexData(const GrSurfaceDesc& desc, |
| 290 GrGLenum target, |
| 289 const void* data, | 291 const void* data, |
| 290 bool isNewTexture = true, | 292 bool isNewTexture = true, |
| 291 int left = 0, int top = 0, | 293 int left = 0, int top = 0, |
| 292 int width = -1, int height = -1); | 294 int width = -1, int height = -1); |
| 293 | 295 |
| 294 bool createRenderTargetObjects(const GrSurfaceDesc&, GrGpuResource::LifeCycl
e lifeCycle, | 296 bool createRenderTargetObjects(const GrSurfaceDesc&, GrGpuResource::LifeCycl
e lifeCycle, |
| 295 GrGLuint texID, GrGLRenderTarget::IDDesc*); | 297 GrGLenum textureTarget, GrGLuint texID, |
| 298 GrGLRenderTarget::IDDesc*); |
| 296 | 299 |
| 297 enum TempFBOTarget { | 300 enum TempFBOTarget { |
| 298 kSrc_TempFBOTarget, | 301 kSrc_TempFBOTarget, |
| 299 kDst_TempFBOTarget | 302 kDst_TempFBOTarget |
| 300 }; | 303 }; |
| 301 | 304 |
| 302 GrGLuint bindSurfaceAsFBO(GrSurface* surface, GrGLenum fboTarget, GrGLIRect*
viewport, | 305 // Binds a surface as a FBO for a copy operation. If the surface already own
s an FBO ID then |
| 306 // that ID is bound. If not the surface is temporarily bound to a FBO and th
at FBO is bound. |
| 307 // This must be paired with a call to unbindSurfaceFBOForCopy(). |
| 308 void bindSurfaceFBOForCopy(GrSurface* surface, GrGLenum fboTarget, GrGLIRect
* viewport, |
| 303 TempFBOTarget tempFBOTarget); | 309 TempFBOTarget tempFBOTarget); |
| 304 | 310 |
| 305 void unbindTextureFromFBO(GrGLenum fboTarget); | 311 // Must be called if bindSurfaceFBOForCopy was used to bind a surface for co
pying. |
| 312 void unbindTextureFBOForCopy(GrGLenum fboTarget, GrSurface* surface); |
| 306 | 313 |
| 307 SkAutoTUnref<GrGLContext> fGLContext; | 314 SkAutoTUnref<GrGLContext> fGLContext; |
| 308 | 315 |
| 309 void createCopyProgram(); | 316 void createCopyProgram(); |
| 310 | 317 |
| 311 // GL program-related state | 318 // GL program-related state |
| 312 ProgramCache* fProgramCache; | 319 ProgramCache* fProgramCache; |
| 313 | 320 |
| 314 /////////////////////////////////////////////////////////////////////////// | 321 /////////////////////////////////////////////////////////////////////////// |
| 315 ///@name Caching of GL State | 322 ///@name Caching of GL State |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 | 507 |
| 501 // Mapping of pixel configs to known supported stencil formats to be used | 508 // Mapping of pixel configs to known supported stencil formats to be used |
| 502 // when adding a stencil buffer to a framebuffer. | 509 // when adding a stencil buffer to a framebuffer. |
| 503 int fPixelConfigToStencilIndex[kGrPixelConfigCnt]; | 510 int fPixelConfigToStencilIndex[kGrPixelConfigCnt]; |
| 504 | 511 |
| 505 typedef GrGpu INHERITED; | 512 typedef GrGpu INHERITED; |
| 506 friend class GrGLPathRendering; // For accessing setTextureUnit. | 513 friend class GrGLPathRendering; // For accessing setTextureUnit. |
| 507 }; | 514 }; |
| 508 | 515 |
| 509 #endif | 516 #endif |
| OLD | NEW |