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

Side by Side Diff: src/gpu/GrTest.cpp

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
2 /* 1 /*
3 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
4 * 3 *
5 * 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
6 * found in the LICENSE file. 5 * found in the LICENSE file.
7 */ 6 */
8 7
9 #include "GrTest.h" 8 #include "GrTest.h"
10 9
11 #include "GrBatchAtlas.h" 10 #include "GrBatchAtlas.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 public: 179 public:
181 MockGpu(GrContext* context, const GrContextOptions& options) : INHERITED(con text) { 180 MockGpu(GrContext* context, const GrContextOptions& options) : INHERITED(con text) {
182 fCaps.reset(new GrCaps(options)); 181 fCaps.reset(new GrCaps(options));
183 } 182 }
184 ~MockGpu() override {} 183 ~MockGpu() override {}
185 184
186 bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeigh t, size_t rowBytes, 185 bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeigh t, size_t rowBytes,
187 GrPixelConfig readConfig, DrawPreference*, 186 GrPixelConfig readConfig, DrawPreference*,
188 ReadPixelTempDrawInfo*) override { return false; } 187 ReadPixelTempDrawInfo*) override { return false; }
189 188
190 bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, size _t rowBytes, 189 bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height,
191 GrPixelConfig srcConfig, DrawPreference*, 190 GrPixelConfig srcConfig, DrawPreference*,
192 WritePixelTempDrawInfo*) override { return false; } 191 WritePixelTempDrawInfo*) override { return false; }
193 192
194 void buildProgramDesc(GrProgramDesc*, const GrPrimitiveProcessor&, 193 void buildProgramDesc(GrProgramDesc*, const GrPrimitiveProcessor&,
195 const GrPipeline&) const override {} 194 const GrPipeline&) const override {}
196 195
197 void discard(GrRenderTarget*) override {} 196 void discard(GrRenderTarget*) override {}
198 197
199 bool onCopySurface(GrSurface* dst, 198 bool onCopySurface(GrSurface* dst,
200 GrSurface* src, 199 GrSurface* src,
201 const SkIRect& srcRect, 200 const SkIRect& srcRect,
202 const SkIPoint& dstPoint) override { return false; }; 201 const SkIPoint& dstPoint) override { return false; };
203 202
204 bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) const override { 203 bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) const override {
205 return false; 204 return false;
206 } 205 }
207 206
208 private: 207 private:
209 void onResetContext(uint32_t resetBits) override {} 208 void onResetContext(uint32_t resetBits) override {}
210 209
211 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override {} 210 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override {}
212 211
213 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc le lifeCycle, 212 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc le lifeCycle,
214 const void* srcData, size_t rowBytes) override { 213 const SkTArray<SkMipMapLevel>& texels) override {
215 return nullptr; 214 return nullptr;
216 } 215 }
217 216
218 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, GrGpuResourc e::LifeCycle, 217 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, GrGpuResourc e::LifeCycle,
219 const void* srcData) override { 218 const SkTArray<SkMipMapLevel>& texels) override {
220 return nullptr; 219 return nullptr;
221 } 220 }
222 221
223 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, 222 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&,
224 GrWrapOwnership) override { return nullptr; } 223 GrWrapOwnership) override { return nullptr; }
225 224
226 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, 225 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&,
227 GrWrapOwnership) override { 226 GrWrapOwnership) override {
228 return nullptr; 227 return nullptr;
229 } 228 }
(...skipping 11 matching lines...) Expand all
241 bool onReadPixels(GrSurface* surface, 240 bool onReadPixels(GrSurface* surface,
242 int left, int top, int width, int height, 241 int left, int top, int width, int height,
243 GrPixelConfig, 242 GrPixelConfig,
244 void* buffer, 243 void* buffer,
245 size_t rowBytes) override { 244 size_t rowBytes) override {
246 return false; 245 return false;
247 } 246 }
248 247
249 bool onWritePixels(GrSurface* surface, 248 bool onWritePixels(GrSurface* surface,
250 int left, int top, int width, int height, 249 int left, int top, int width, int height,
251 GrPixelConfig config, const void* buffer, 250 GrPixelConfig config, const SkTArray<SkMipMapLevel>& texe ls) override {
252 size_t rowBytes) override {
253 return false; 251 return false;
254 } 252 }
255 253
256 void onResolveRenderTarget(GrRenderTarget* target) override { return; } 254 void onResolveRenderTarget(GrRenderTarget* target) override { return; }
257 255
258 GrStencilAttachment* createStencilAttachmentForRenderTarget(const GrRenderTa rget*, 256 GrStencilAttachment* createStencilAttachmentForRenderTarget(const GrRenderTa rget*,
259 int width, 257 int width,
260 int height) over ride { 258 int height) over ride {
261 return nullptr; 259 return nullptr;
262 } 260 }
263 261
264 void clearStencil(GrRenderTarget* target) override {} 262 void clearStencil(GrRenderTarget* target) override {}
265 263
266 GrBackendObject createTestingOnlyBackendTexture(void* pixels, int w, int h, 264 GrBackendObject createTestingOnlyBackendTexture(void* pixels, int w, int h,
267 GrPixelConfig config) const override { 265 GrPixelConfig config) const override {
268 return 0; 266 return 0;
269 } 267 }
270 bool isTestingOnlyBackendTexture(GrBackendObject id) const override { return false; } 268 bool isTestingOnlyBackendTexture(GrBackendObject id) const override { return false; }
271 void deleteTestingOnlyBackendTexture(GrBackendObject id) const override {} 269 void deleteTestingOnlyBackendTexture(GrBackendObject id) const override {}
272 270
273 typedef GrGpu INHERITED; 271 typedef GrGpu INHERITED;
274 }; 272 };
275 273
276 GrContext* GrContext::CreateMockContext() { 274 GrContext* GrContext::CreateMockContext() {
277 GrContext* context = new GrContext; 275 GrContext* context = new GrContext;
278 276
279 context->initMockContext(); 277 context->initMockContext();
280 return context; 278 return context;
281 } 279 }
282 280
283 void GrContext::initMockContext() { 281 void GrContext::initMockContext() {
284 GrContextOptions options; 282 GrContextOptions options;
285 options.fGeometryBufferMapThreshold = 0; 283 options.fGeometryBufferMapThreshold = 0;
286 SkASSERT(nullptr == fGpu); 284 SkASSERT(nullptr == fGpu);
287 fGpu = new MockGpu(this, options); 285 fGpu = new MockGpu(this, options);
288 SkASSERT(fGpu); 286 SkASSERT(fGpu);
289 this->initCommon(); 287 this->initCommon();
290 288
291 // We delete these because we want to test the cache starting with zero reso urces. Also, none of 289 // We delete these because we want to test the cache starting with zero reso urces. Also, none of
292 // these objects are required for any of tests that use this context. TODO: make stop allocating 290 // these objects are required for any of tests that use this context. TODO: make stop allocating
293 // resources in the buffer pools. 291 // resources in the buffer pools.
294 fDrawingMgr.abandon(); 292 fDrawingMgr.abandon();
295 } 293 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698