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

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

Issue 1249543003: Creating functions for uploading a mipmapped texture. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Removing the concept of a dirty mipmap. It is expected that the texture upload provides the mipmaps. Created 5 years, 3 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
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 #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 "SkMipMapLevel.h"
22 #include "GrPipelineBuilder.h" 23 #include "GrPipelineBuilder.h"
24 #include "SkTArray.h"
23 #include "GrXferProcessor.h" 25 #include "GrXferProcessor.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
(...skipping 22 matching lines...) Expand all
55 void discard(GrRenderTarget*) override; 57 void discard(GrRenderTarget*) override;
56 58
57 // Used by GrGLProgram to configure OpenGL state. 59 // Used by GrGLProgram to configure OpenGL state.
58 void bindTexture(int unitIdx, const GrTextureParams& params, GrGLTexture* te xture); 60 void bindTexture(int unitIdx, const GrTextureParams& params, GrGLTexture* te xture);
59 61
60 bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeigh t, size_t rowBytes, 62 bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeigh t, size_t rowBytes,
61 GrPixelConfig readConfig, DrawPreference*, 63 GrPixelConfig readConfig, DrawPreference*,
62 ReadPixelTempDrawInfo*) override; 64 ReadPixelTempDrawInfo*) override;
63 65
64 bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, 66 bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height,
65 size_t rowBytes, GrPixelConfig srcConfig, DrawPref erence*, 67 GrPixelConfig srcConfig, DrawPreference*,
66 WritePixelTempDrawInfo*) override; 68 WritePixelTempDrawInfo*) override;
67 69
68 bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) const override; 70 bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) const override;
69 71
70 // These functions should be used to bind GL objects. They track the GL stat e and skip redundant 72 // These functions should be used to bind GL objects. They track the GL stat e and skip redundant
71 // bindings. Making the equivalent glBind calls directly will confuse the st ate tracking. 73 // bindings. Making the equivalent glBind calls directly will confuse the st ate tracking.
72 void bindVertexArray(GrGLuint id) { 74 void bindVertexArray(GrGLuint id) {
73 fHWGeometryState.setVertexArrayID(this, id); 75 fHWGeometryState.setVertexArrayID(this, id);
74 } 76 }
75 void bindIndexBufferAndDefaultVertexArray(GrGLuint id) { 77 void bindIndexBufferAndDefaultVertexArray(GrGLuint id) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 118
117 private: 119 private:
118 GrGLGpu(GrGLContext* ctx, GrContext* context); 120 GrGLGpu(GrGLContext* ctx, GrContext* context);
119 121
120 // GrGpu overrides 122 // GrGpu overrides
121 void onResetContext(uint32_t resetBits) override; 123 void onResetContext(uint32_t resetBits) override;
122 124
123 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override; 125 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override;
124 126
125 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc le lifeCycle, 127 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc le lifeCycle,
126 const void* srcData, size_t rowBytes) override; 128 const SkTArray<SkMipMapLevel>& texels) override;
127 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, 129 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc,
128 GrGpuResource::LifeCycle lifeCycle, 130 GrGpuResource::LifeCycle lifeCycle,
129 const void* srcData) override; 131 const SkTArray<SkMipMapLevel>& texels) override;
132
130 GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) override; 133 GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) override;
131 GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) override; 134 GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) override;
132 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership ) override; 135 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership ) override;
133 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, 136 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&,
134 GrWrapOwnership) override; 137 GrWrapOwnership) override;
135 // Given a GrPixelConfig return the index into the stencil format array on G rGLCaps to a 138 // Given a GrPixelConfig return the index into the stencil format array on G rGLCaps to a
136 // compatible stencil format. 139 // compatible stencil format.
137 int getCompatibleStencilIndex(GrPixelConfig config); 140 int getCompatibleStencilIndex(GrPixelConfig config);
138 141
139 void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) override; 142 void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) override;
140 143
141 void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool insideCli p) override; 144 void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool insideCli p) override;
142 145
143 bool onReadPixels(GrSurface*, 146 bool onReadPixels(GrSurface*,
144 int left, int top, 147 int left, int top,
145 int width, int height, 148 int width, int height,
146 GrPixelConfig, 149 GrPixelConfig,
147 void* buffer, 150 void* buffer,
148 size_t rowBytes) override; 151 size_t rowBytes) override;
149 152
150 bool onWritePixels(GrSurface*, 153 bool onWritePixels(GrSurface*,
151 int left, int top, int width, int height, 154 int left, int top, int width, int height,
152 GrPixelConfig config, const void* buffer, 155 GrPixelConfig config,
153 size_t rowBytes) override; 156 const SkTArray<SkMipMapLevel>& texels) override;
154 157
155 void onResolveRenderTarget(GrRenderTarget* target) override; 158 void onResolveRenderTarget(GrRenderTarget* target) override;
156 159
157 void onDraw(const DrawArgs&, const GrNonInstancedVertices&) override; 160 void onDraw(const DrawArgs&, const GrNonInstancedVertices&) override;
158 161
159 bool onCopySurface(GrSurface* dst, 162 bool onCopySurface(GrSurface* dst,
160 GrSurface* src, 163 GrSurface* src,
161 const SkIRect& srcRect, 164 const SkIRect& srcRect,
162 const SkIPoint& dstPoint) override; 165 const SkIPoint& dstPoint) override;
163 166
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 bool configToGLFormats(GrPixelConfig config, 269 bool configToGLFormats(GrPixelConfig config,
267 bool getSizedInternal, 270 bool getSizedInternal,
268 GrGLenum* internalFormat, 271 GrGLenum* internalFormat,
269 GrGLenum* externalFormat, 272 GrGLenum* externalFormat,
270 GrGLenum* externalType) const; 273 GrGLenum* externalType) const;
271 // helper for onCreateTexture and writeTexturePixels 274 // helper for onCreateTexture and writeTexturePixels
272 bool uploadTexData(const GrSurfaceDesc& desc, 275 bool uploadTexData(const GrSurfaceDesc& desc,
273 bool isNewTexture, 276 bool isNewTexture,
274 int left, int top, int width, int height, 277 int left, int top, int width, int height,
275 GrPixelConfig dataConfig, 278 GrPixelConfig dataConfig,
276 const void* data, 279 const SkTArray<SkMipMapLevel>& texels);
277 size_t rowBytes);
278 280
279 // helper for onCreateCompressedTexture. If width and height are 281 // helper for onCreateCompressedTexture. If width and height are
280 // set to -1, then this function will use desc.fWidth and desc.fHeight 282 // set to -1, then this function will use desc.fWidth and desc.fHeight
281 // for the size of the data. The isNewTexture flag should be set to true 283 // for the size of the data. The isNewTexture flag should be set to true
282 // whenever a new texture needs to be created. Otherwise, we assume that 284 // whenever a new texture needs to be created. Otherwise, we assume that
283 // the texture is already in GPU memory and that it's going to be updated 285 // the texture is already in GPU memory and that it's going to be updated
284 // with new data. 286 // with new data.
285 bool uploadCompressedTexData(const GrSurfaceDesc& desc, 287 bool uploadCompressedTexData(const GrSurfaceDesc& desc,
286 const void* data, 288 const SkTArray<SkMipMapLevel>& texels,
287 bool isNewTexture = true, 289 bool isNewTexture = true,
288 int left = 0, int top = 0, 290 int left = 0, int top = 0,
289 int width = -1, int height = -1); 291 int width = -1, int height = -1);
290 292
291 bool createRenderTargetObjects(const GrSurfaceDesc&, GrGpuResource::LifeCycl e lifeCycle, 293 bool createRenderTargetObjects(const GrSurfaceDesc&, GrGpuResource::LifeCycl e lifeCycle,
292 GrGLuint texID, GrGLRenderTarget::IDDesc*); 294 GrGLuint texID, GrGLRenderTarget::IDDesc*);
293 295
294 enum TempFBOTarget { 296 enum TempFBOTarget {
295 kSrc_TempFBOTarget, 297 kSrc_TempFBOTarget,
296 kDst_TempFBOTarget 298 kDst_TempFBOTarget
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 500
499 // Mapping of pixel configs to known supported stencil formats to be used 501 // Mapping of pixel configs to known supported stencil formats to be used
500 // when adding a stencil buffer to a framebuffer. 502 // when adding a stencil buffer to a framebuffer.
501 int fPixelConfigToStencilIndex[kGrPixelConfigCnt]; 503 int fPixelConfigToStencilIndex[kGrPixelConfigCnt];
502 504
503 typedef GrGpu INHERITED; 505 typedef GrGpu INHERITED;
504 friend class GrGLPathRendering; // For accessing setTextureUnit. 506 friend class GrGLPathRendering; // For accessing setTextureUnit.
505 }; 507 };
506 508
507 #endif 509 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698