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

Side by Side Diff: src/gpu/GrGpu.h

Issue 737723003: drawinfo carries bufferinfo (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: feedback inc Created 6 years, 1 month 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
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrGpu.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 GrGpu_DEFINED 8 #ifndef GrGpu_DEFINED
9 #define GrGpu_DEFINED 9 #define GrGpu_DEFINED
10 10
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 367
368 // This method is called by copySurface The srcRect is guaranteed to be ent irely within the 368 // This method is called by copySurface The srcRect is guaranteed to be ent irely within the
369 // src bounds. Likewise, the dst rect implied by dstPoint and srcRect's widt h and height falls 369 // src bounds. Likewise, the dst rect implied by dstPoint and srcRect's widt h and height falls
370 // entirely within the dst. The default implementation will draw a rect from the src to the 370 // entirely within the dst. The default implementation will draw a rect from the src to the
371 // dst if the src is a texture and the dst is a render target and fail other wise. 371 // dst if the src is a texture and the dst is a render target and fail other wise.
372 virtual bool copySurface(GrSurface* dst, 372 virtual bool copySurface(GrSurface* dst,
373 GrSurface* src, 373 GrSurface* src,
374 const SkIRect& srcRect, 374 const SkIRect& srcRect,
375 const SkIPoint& dstPoint) = 0; 375 const SkIPoint& dstPoint) = 0;
376 376
377 /**
378 * Sets source of vertex data for the next draw. Data does not have to be
379 * in the buffer until drawIndexed, drawNonIndexed, or drawIndexedInstances.
380 *
381 * @param buffer vertex buffer containing vertex data. Must be
382 * unlocked before draw call. Vertex size is queried
383 * from current GrDrawState.
384 */
385 void setVertexSourceToBuffer(const GrVertexBuffer* buffer, size_t vertexStri de);
386
387 /**
388 * Sets source of index data for the next indexed draw. Data does not have
389 * to be in the buffer until drawIndexed.
390 *
391 * @param buffer index buffer containing indices. Must be unlocked
392 * before indexed draw call.
393 */
394 void setIndexSourceToBuffer(const GrIndexBuffer* buffer);
395
396 virtual void draw(const GrOptDrawState&, 377 virtual void draw(const GrOptDrawState&,
397 const GrDrawTarget::DrawInfo&, 378 const GrDrawTarget::DrawInfo&,
398 const GrClipMaskManager::ScissorState&); 379 const GrClipMaskManager::ScissorState&);
399 virtual void stencilPath(const GrOptDrawState&, 380 virtual void stencilPath(const GrOptDrawState&,
400 const GrPath*, 381 const GrPath*,
401 const GrClipMaskManager::ScissorState&, 382 const GrClipMaskManager::ScissorState&,
402 const GrStencilSettings&); 383 const GrStencilSettings&);
403 virtual void drawPath(const GrOptDrawState&, 384 virtual void drawPath(const GrOptDrawState&,
404 const GrPath*, 385 const GrPath*,
405 const GrClipMaskManager::ScissorState&, 386 const GrClipMaskManager::ScissorState&,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 // stencil funcs supported by GPUs. 418 // stencil funcs supported by GPUs.
438 static GrStencilFunc ConvertStencilFunc(bool stencilInClip, 419 static GrStencilFunc ConvertStencilFunc(bool stencilInClip,
439 GrStencilFunc func); 420 GrStencilFunc func);
440 static void ConvertStencilFuncAndMask(GrStencilFunc func, 421 static void ConvertStencilFuncAndMask(GrStencilFunc func,
441 bool clipInStencil, 422 bool clipInStencil,
442 unsigned int clipBit, 423 unsigned int clipBit,
443 unsigned int userBits, 424 unsigned int userBits,
444 unsigned int* ref, 425 unsigned int* ref,
445 unsigned int* mask); 426 unsigned int* mask);
446 427
447 struct GeometrySrcState {
448 GeometrySrcState() : fVertexBuffer(NULL), fIndexBuffer(NULL), fVertexSiz e(0) {}
449 const GrVertexBuffer* fVertexBuffer;
450 const GrIndexBuffer* fIndexBuffer;
451 size_t fVertexSize;
452 };
453
454 // accessors for derived classes
455 const GeometrySrcState& getGeomSrc() const { return fGeoSrcState; }
456
457 // it is preferable to call this rather than getGeomSrc()->fVertexSize becau se of the assert.
458 size_t getVertexSize() const {
459 // the vertex layout is only valid if a vertex source has been specified .
460 SkASSERT(this->getGeomSrc().fVertexBuffer);
461 return this->getGeomSrc().fVertexSize;
462 }
463
464 const GrTraceMarkerSet& getActiveTraceMarkers() { return fActiveTraceMarkers ; } 428 const GrTraceMarkerSet& getActiveTraceMarkers() { return fActiveTraceMarkers ; }
465 429
466 GrContext::GPUStats fGPUStats; 430 GrContext::GPUStats fGPUStats;
467 431
468 SkAutoTDelete<GrPathRendering> fPathRendering; 432 SkAutoTDelete<GrPathRendering> fPathRendering;
469 433
470 // Subclass must initialize this in its constructor. 434 // Subclass must initialize this in its constructor.
471 SkAutoTUnref<const GrDrawTargetCaps> fCaps; 435 SkAutoTUnref<const GrDrawTargetCaps> fCaps;
472 436
473 private: 437 private:
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 fResetBits = 0; 511 fResetBits = 0;
548 ++fResetTimestamp; 512 ++fResetTimestamp;
549 } 513 }
550 514
551 void handleDirtyContext() { 515 void handleDirtyContext() {
552 if (fResetBits) { 516 if (fResetBits) {
553 this->resetContext(); 517 this->resetContext();
554 } 518 }
555 } 519 }
556 520
557 GeometrySrcState fGeoSrcS tate;
558 ResetTimestamp fResetTi mestamp; 521 ResetTimestamp fResetTi mestamp;
559 uint32_t fResetBi ts; 522 uint32_t fResetBi ts;
560 // these are mutable so they can be created on-demand 523 // these are mutable so they can be created on-demand
561 mutable GrIndexBuffer* fQuadInd exBuffer; 524 mutable GrIndexBuffer* fQuadInd exBuffer;
562 // To keep track that we always have at least as many debug marker adds as r emoves 525 // To keep track that we always have at least as many debug marker adds as r emoves
563 int fGpuTrac eMarkerCount; 526 int fGpuTrac eMarkerCount;
564 GrTraceMarkerSet fActiveT raceMarkers; 527 GrTraceMarkerSet fActiveT raceMarkers;
565 GrTraceMarkerSet fStoredT raceMarkers; 528 GrTraceMarkerSet fStoredT raceMarkers;
566 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. 529 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu.
567 GrContext* fContext ; 530 GrContext* fContext ;
568 531
569 typedef SkRefCnt INHERITED; 532 typedef SkRefCnt INHERITED;
570 }; 533 };
571 534
572 #endif 535 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698