| 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 |
| 11 #include "GrGLContext.h" | 11 #include "GrGLContext.h" |
| 12 #include "GrGLIRect.h" | 12 #include "GrGLIRect.h" |
| 13 #include "GrGLIndexBuffer.h" | 13 #include "GrGLIndexBuffer.h" |
| 14 #include "GrGLPathRendering.h" | 14 #include "GrGLPathRendering.h" |
| 15 #include "GrGLProgram.h" | 15 #include "GrGLProgram.h" |
| 16 #include "GrGLRenderTarget.h" | 16 #include "GrGLRenderTarget.h" |
| 17 #include "GrGLStencilAttachment.h" | 17 #include "GrGLStencilAttachment.h" |
| 18 #include "GrGLTexture.h" | 18 #include "GrGLTexture.h" |
| 19 #include "GrGLVertexArray.h" | 19 #include "GrGLVertexArray.h" |
| 20 #include "GrGLVertexBuffer.h" | 20 #include "GrGLVertexBuffer.h" |
| 21 #include "GrGpu.h" | 21 #include "GrGpu.h" |
| 22 #include "GrPipelineBuilder.h" | 22 #include "GrPipelineBuilder.h" |
| 23 #include "GrXferProcessor.h" | 23 #include "GrXferProcessor.h" |
| 24 #include "SkMipMapLevel.h" |
| 25 #include "SkTArray.h" |
| 24 #include "SkTypes.h" | 26 #include "SkTypes.h" |
| 25 | 27 |
| 26 class GrPipeline; | 28 class GrPipeline; |
| 27 class GrNonInstancedVertices; | 29 class GrNonInstancedVertices; |
| 28 | 30 |
| 29 #ifdef SK_DEVELOPER | 31 #ifdef SK_DEVELOPER |
| 30 #define PROGRAM_CACHE_STATS | 32 #define PROGRAM_CACHE_STATS |
| 31 #endif | 33 #endif |
| 32 | 34 |
| 33 class GrGLGpu : public GrGpu { | 35 class GrGLGpu : public GrGpu { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 bool isTestingOnlyBackendTexture(GrBackendObject id) const override; | 119 bool isTestingOnlyBackendTexture(GrBackendObject id) const override; |
| 118 void deleteTestingOnlyBackendTexture(GrBackendObject id) const override; | 120 void deleteTestingOnlyBackendTexture(GrBackendObject id) const override; |
| 119 | 121 |
| 120 private: | 122 private: |
| 121 GrGLGpu(GrGLContext* ctx, GrContext* context); | 123 GrGLGpu(GrGLContext* ctx, GrContext* context); |
| 122 | 124 |
| 123 // GrGpu overrides | 125 // GrGpu overrides |
| 124 void onResetContext(uint32_t resetBits) override; | 126 void onResetContext(uint32_t resetBits) override; |
| 125 | 127 |
| 126 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc
le lifeCycle, | 128 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc
le lifeCycle, |
| 127 const void* srcData, size_t rowBytes) override; | 129 SkTArray<SkMipMapLevel>& texels) override; |
| 128 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, | 130 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, |
| 129 GrGpuResource::LifeCycle lifeCycle, | 131 GrGpuResource::LifeCycle lifeCycle, |
| 130 const void* srcData) override; | 132 SkTArray<SkMipMapLevel>& texels) overri
de; |
| 133 |
| 131 GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) override; | 134 GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) override; |
| 132 GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) override; | 135 GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) override; |
| 133 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership
) override; | 136 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership
) override; |
| 134 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, | 137 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, |
| 135 GrWrapOwnership) override; | 138 GrWrapOwnership) override; |
| 136 bool createStencilAttachmentForRenderTarget(GrRenderTarget* rt, int width, i
nt height) override; | 139 bool createStencilAttachmentForRenderTarget(GrRenderTarget* rt, int width, i
nt height) override; |
| 137 bool attachStencilAttachmentToRenderTarget(GrStencilAttachment* sb, | 140 bool attachStencilAttachmentToRenderTarget(GrStencilAttachment* sb, |
| 138 GrRenderTarget* rt) override; | 141 GrRenderTarget* rt) override; |
| 139 | 142 |
| 140 void onClear(GrRenderTarget*, const SkIRect* rect, GrColor color, | 143 void onClear(GrRenderTarget*, const SkIRect* rect, GrColor color, |
| 141 bool canIgnoreRect) override; | 144 bool canIgnoreRect) override; |
| 142 | 145 |
| 143 void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool insideCli
p) override; | 146 void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool insideCli
p) override; |
| 144 | 147 |
| 145 bool onReadPixels(GrRenderTarget* target, | 148 bool onReadPixels(GrRenderTarget* target, |
| 146 int left, int top, | 149 int left, int top, |
| 147 int width, int height, | 150 int width, int height, |
| 148 GrPixelConfig, | 151 GrPixelConfig, |
| 149 void* buffer, | 152 void* buffer, |
| 150 size_t rowBytes) override; | 153 size_t rowBytes) override; |
| 151 | 154 |
| 152 bool onWriteTexturePixels(GrTexture* texture, | 155 bool onWriteTexturePixels(GrTexture* texture, |
| 153 int left, int top, int width, int height, | 156 int left, int top, int width, int height, |
| 154 GrPixelConfig config, const void* buffer, | 157 GrPixelConfig config, |
| 155 size_t rowBytes) override; | 158 SkTArray<SkMipMapLevel>& texels) override; |
| 156 | 159 |
| 157 void onResolveRenderTarget(GrRenderTarget* target) override; | 160 void onResolveRenderTarget(GrRenderTarget* target) override; |
| 158 | 161 |
| 159 void onDraw(const DrawArgs&, const GrNonInstancedVertices&) override; | 162 void onDraw(const DrawArgs&, const GrNonInstancedVertices&) override; |
| 160 | 163 |
| 161 void clearStencil(GrRenderTarget*) override; | 164 void clearStencil(GrRenderTarget*) override; |
| 162 | 165 |
| 163 // GrDrawTarget overrides | 166 // GrDrawTarget overrides |
| 164 void didAddGpuTraceMarker() override; | 167 void didAddGpuTraceMarker() override; |
| 165 void didRemoveGpuTraceMarker() override; | 168 void didRemoveGpuTraceMarker() override; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 bool configToGLFormats(GrPixelConfig config, | 272 bool configToGLFormats(GrPixelConfig config, |
| 270 bool getSizedInternal, | 273 bool getSizedInternal, |
| 271 GrGLenum* internalFormat, | 274 GrGLenum* internalFormat, |
| 272 GrGLenum* externalFormat, | 275 GrGLenum* externalFormat, |
| 273 GrGLenum* externalType) const; | 276 GrGLenum* externalType) const; |
| 274 // helper for onCreateTexture and writeTexturePixels | 277 // helper for onCreateTexture and writeTexturePixels |
| 275 bool uploadTexData(const GrSurfaceDesc& desc, | 278 bool uploadTexData(const GrSurfaceDesc& desc, |
| 276 bool isNewTexture, | 279 bool isNewTexture, |
| 277 int left, int top, int width, int height, | 280 int left, int top, int width, int height, |
| 278 GrPixelConfig dataConfig, | 281 GrPixelConfig dataConfig, |
| 279 const void* data, | 282 SkTArray<SkMipMapLevel>& texels); |
| 280 size_t rowBytes); | |
| 281 | 283 |
| 282 // helper for onCreateCompressedTexture. If width and height are | 284 // helper for onCreateCompressedTexture. If width and height are |
| 283 // set to -1, then this function will use desc.fWidth and desc.fHeight | 285 // 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 | 286 // 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 | 287 // 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 | 288 // the texture is already in GPU memory and that it's going to be updated |
| 287 // with new data. | 289 // with new data. |
| 288 bool uploadCompressedTexData(const GrSurfaceDesc& desc, | 290 bool uploadCompressedTexData(const GrSurfaceDesc& desc, |
| 289 const void* data, | 291 const SkTArray<SkMipMapLevel>& texels, |
| 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 GrGLuint texID, GrGLRenderTarget::IDDesc*); |
| 296 | 298 |
| 297 enum TempFBOTarget { | 299 enum TempFBOTarget { |
| 298 kSrc_TempFBOTarget, | 300 kSrc_TempFBOTarget, |
| 299 kDst_TempFBOTarget | 301 kDst_TempFBOTarget |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 | 502 |
| 501 // we record what stencil format worked last time to hopefully exit early | 503 // we record what stencil format worked last time to hopefully exit early |
| 502 // from our loop that tries stencil formats and calls check fb status. | 504 // from our loop that tries stencil formats and calls check fb status. |
| 503 int fLastSuccessfulStencilFmtIdx; | 505 int fLastSuccessfulStencilFmtIdx; |
| 504 | 506 |
| 505 typedef GrGpu INHERITED; | 507 typedef GrGpu INHERITED; |
| 506 friend class GrGLPathRendering; // For accessing setTextureUnit. | 508 friend class GrGLPathRendering; // For accessing setTextureUnit. |
| 507 }; | 509 }; |
| 508 | 510 |
| 509 #endif | 511 #endif |
| OLD | NEW |