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

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: Moving glTexStorage over to a separate CL. Created 4 years, 11 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 public: 270 public:
272 MockGpu(GrContext* context, const GrContextOptions& options) : INHERITED(con text) { 271 MockGpu(GrContext* context, const GrContextOptions& options) : INHERITED(con text) {
273 fCaps.reset(new MockCaps(options)); 272 fCaps.reset(new MockCaps(options));
274 } 273 }
275 ~MockGpu() override {} 274 ~MockGpu() override {}
276 275
277 bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeigh t, size_t rowBytes, 276 bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeigh t, size_t rowBytes,
278 GrPixelConfig readConfig, DrawPreference*, 277 GrPixelConfig readConfig, DrawPreference*,
279 ReadPixelTempDrawInfo*) override { return false; } 278 ReadPixelTempDrawInfo*) override { return false; }
280 279
281 bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, size _t rowBytes, 280 bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height,
282 GrPixelConfig srcConfig, DrawPreference*, 281 GrPixelConfig srcConfig, DrawPreference*,
283 WritePixelTempDrawInfo*) override { return false; } 282 WritePixelTempDrawInfo*) override { return false; }
284 283
285 void buildProgramDesc(GrProgramDesc*, const GrPrimitiveProcessor&, 284 void buildProgramDesc(GrProgramDesc*, const GrPrimitiveProcessor&,
286 const GrPipeline&) const override {} 285 const GrPipeline&) const override {}
287 286
288 void discard(GrRenderTarget*) override {} 287 void discard(GrRenderTarget*) override {}
289 288
290 bool onCopySurface(GrSurface* dst, 289 bool onCopySurface(GrSurface* dst,
291 GrSurface* src, 290 GrSurface* src,
292 const SkIRect& srcRect, 291 const SkIRect& srcRect,
293 const SkIPoint& dstPoint) override { return false; }; 292 const SkIPoint& dstPoint) override { return false; };
294 293
295 bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) const override { 294 bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) const override {
296 return false; 295 return false;
297 } 296 }
298 297
299 void drawDebugWireRect(GrRenderTarget*, const SkIRect&, GrColor) override {} ; 298 void drawDebugWireRect(GrRenderTarget*, const SkIRect&, GrColor) override {} ;
300 299
301 private: 300 private:
302 void onResetContext(uint32_t resetBits) override {} 301 void onResetContext(uint32_t resetBits) override {}
303 302
304 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override {} 303 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override {}
305 304
306 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc le lifeCycle, 305 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc le lifeCycle,
307 const void* srcData, size_t rowBytes) override { 306 const SkTArray<SkMipMapLevel>& texels) override {
308 return nullptr; 307 return nullptr;
309 } 308 }
310 309
311 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, GrGpuResourc e::LifeCycle, 310 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, GrGpuResourc e::LifeCycle,
312 const void* srcData) override { 311 const SkTArray<SkMipMapLevel>& texels) override {
313 return nullptr; 312 return nullptr;
314 } 313 }
315 314
316 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, 315 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&,
317 GrWrapOwnership) override { return nullptr; } 316 GrWrapOwnership) override { return nullptr; }
318 317
319 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, 318 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&,
320 GrWrapOwnership) override { 319 GrWrapOwnership) override {
321 return nullptr; 320 return nullptr;
322 } 321 }
(...skipping 13 matching lines...) Expand all
336 bool onReadPixels(GrSurface* surface, 335 bool onReadPixels(GrSurface* surface,
337 int left, int top, int width, int height, 336 int left, int top, int width, int height,
338 GrPixelConfig, 337 GrPixelConfig,
339 void* buffer, 338 void* buffer,
340 size_t rowBytes) override { 339 size_t rowBytes) override {
341 return false; 340 return false;
342 } 341 }
343 342
344 bool onWritePixels(GrSurface* surface, 343 bool onWritePixels(GrSurface* surface,
345 int left, int top, int width, int height, 344 int left, int top, int width, int height,
346 GrPixelConfig config, const void* buffer, 345 GrPixelConfig config, const SkTArray<SkMipMapLevel>& texe ls) override {
347 size_t rowBytes) override {
348 return false; 346 return false;
349 } 347 }
350 348
351 bool onTransferPixels(GrSurface* surface, 349 bool onTransferPixels(GrSurface* surface,
352 int left, int top, int width, int height, 350 int left, int top, int width, int height,
353 GrPixelConfig config, GrTransferBuffer* buffer, 351 GrPixelConfig config, GrTransferBuffer* buffer,
354 size_t offset, size_t rowBytes) override { 352 size_t offset, size_t rowBytes) override {
355 return false; 353 return false;
356 } 354 }
357 355
358 void onResolveRenderTarget(GrRenderTarget* target) override { return; } 356 void onResolveRenderTarget(GrRenderTarget* target) override { return; }
359 357
360 GrStencilAttachment* createStencilAttachmentForRenderTarget(const GrRenderTa rget*, 358 GrStencilAttachment* createStencilAttachmentForRenderTarget(const GrRenderTa rget*,
361 int width, 359 int width,
362 int height) over ride { 360 int height) over ride {
363 return nullptr; 361 return nullptr;
364 } 362 }
365 363
366 void clearStencil(GrRenderTarget* target) override {} 364 void clearStencil(GrRenderTarget* target) override {}
367 365
368 GrBackendObject createTestingOnlyBackendTexture(void* pixels, int w, int h, 366 GrBackendObject createTestingOnlyBackendTexture(void* pixels, int w, int h,
369 GrPixelConfig config) const override { 367 GrPixelConfig config) const override {
370 return 0; 368 return 0;
371 } 369 }
372 bool isTestingOnlyBackendTexture(GrBackendObject ) const override { return f alse; } 370 bool isTestingOnlyBackendTexture(GrBackendObject ) const override { return f alse; }
373 void deleteTestingOnlyBackendTexture(GrBackendObject, bool abandonTexture) c onst override {} 371 void deleteTestingOnlyBackendTexture(GrBackendObject, bool abandonTexture) c onst override {}
374 372
375 typedef GrGpu INHERITED; 373 typedef GrGpu INHERITED;
376 }; 374 };
377 375
378 GrContext* GrContext::CreateMockContext() { 376 GrContext* GrContext::CreateMockContext() {
379 GrContext* context = new GrContext; 377 GrContext* context = new GrContext;
380 378
381 context->initMockContext(); 379 context->initMockContext();
382 return context; 380 return context;
383 } 381 }
384 382
385 void GrContext::initMockContext() { 383 void GrContext::initMockContext() {
386 GrContextOptions options; 384 GrContextOptions options;
387 options.fGeometryBufferMapThreshold = 0; 385 options.fGeometryBufferMapThreshold = 0;
388 SkASSERT(nullptr == fGpu); 386 SkASSERT(nullptr == fGpu);
389 fGpu = new MockGpu(this, options); 387 fGpu = new MockGpu(this, options);
390 SkASSERT(fGpu); 388 SkASSERT(fGpu);
391 this->initCommon(options); 389 this->initCommon(options);
392 390
393 // We delete these because we want to test the cache starting with zero reso urces. Also, none of 391 // We delete these because we want to test the cache starting with zero reso urces. Also, none of
394 // these objects are required for any of tests that use this context. TODO: make stop allocating 392 // these objects are required for any of tests that use this context. TODO: make stop allocating
395 // resources in the buffer pools. 393 // resources in the buffer pools.
396 fDrawingManager->abandon(); 394 fDrawingManager->abandon();
397 } 395 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698