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 GrGpu_DEFINED | 8 #ifndef GrGpu_DEFINED |
9 #define GrGpu_DEFINED | 9 #define GrGpu_DEFINED |
10 | 10 |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
346 // a billion years. | 346 // a billion years. |
347 typedef uint64_t ResetTimestamp; | 347 typedef uint64_t ResetTimestamp; |
348 | 348 |
349 // This timestamp is always older than the current timestamp | 349 // This timestamp is always older than the current timestamp |
350 static const ResetTimestamp kExpiredTimestamp = 0; | 350 static const ResetTimestamp kExpiredTimestamp = 0; |
351 // Returns a timestamp based on the number of times the context was reset. | 351 // Returns a timestamp based on the number of times the context was reset. |
352 // This timestamp can be used to lazily detect when cached 3D context state | 352 // This timestamp can be used to lazily detect when cached 3D context state |
353 // is dirty. | 353 // is dirty. |
354 ResetTimestamp getResetTimestamp() const { return fResetTimestamp; } | 354 ResetTimestamp getResetTimestamp() const { return fResetTimestamp; } |
355 | 355 |
356 virtual void buildProgramDesc(GrProgramDesc*, | |
357 const GrPrimitiveProcessor&, | |
358 const GrPipeline&) const = 0; | |
359 | |
360 // Called to perform a surface to surface copy. Fallbacks to issuing a draw from the src to dst | 356 // Called to perform a surface to surface copy. Fallbacks to issuing a draw from the src to dst |
361 // take place at the GrDrawTarget level and this function implement faster c opy paths. The rect | 357 // take place at the GrDrawTarget level and this function implement faster c opy paths. The rect |
362 // and point are pre-clipped. The src rect and implied dst rect are guarante ed to be within the | 358 // and point are pre-clipped. The src rect and implied dst rect are guarante ed to be within the |
363 // src/dst bounds and non-empty. | 359 // src/dst bounds and non-empty. |
364 bool copySurface(GrSurface* dst, | 360 bool copySurface(GrSurface* dst, |
365 GrSurface* src, | 361 GrSurface* src, |
366 const SkIRect& srcRect, | 362 const SkIRect& srcRect, |
367 const SkIPoint& dstPoint); | 363 const SkIPoint& dstPoint); |
368 | 364 |
369 struct MultisampleSpecs { | 365 struct MultisampleSpecs { |
370 // Nonzero ID that uniquely identifies these multisample specs. | 366 // Nonzero ID that uniquely identifies these multisample specs. |
371 uint8_t fUniqueID; | 367 uint8_t fUniqueID; |
372 // The actual number of samples the GPU will run. NOTE: this value can b e greater than the | 368 // The actual number of samples the GPU will run. NOTE: this value can b e greater than the |
373 // the render target's sample count. | 369 // the render target's sample count. |
374 int fEffectiveSampleCnt; | 370 int fEffectiveSampleCnt; |
375 // If sample locations are supported, contains the subpixel locations at which the GPU will | 371 // If sample locations are supported, contains the subpixel locations at which the GPU will |
376 // sample. Pixel center is at (.5, .5) and (0, 0) indicates the top left corner. | 372 // sample. Pixel center is at (.5, .5) and (0, 0) indicates the top left corner. |
377 SkAutoTDeleteArray<const SkPoint> fSampleLocations; | 373 SkAutoTDeleteArray<const SkPoint> fSampleLocations; |
378 }; | 374 }; |
379 | 375 |
380 // Finds a render target's multisample specs. The stencil settings are only needed to flush the | 376 // Finds a render target's multisample specs. The stencil settings are only needed to flush the |
381 // draw state prior to querying multisample information; they should not hav e any effect on the | 377 // draw state prior to querying multisample information; they should not hav e any effect on the |
382 // multisample information itself. | 378 // multisample information itself. |
383 const MultisampleSpecs& getMultisampleSpecs(GrRenderTarget*, const GrStencil Settings&); | 379 const MultisampleSpecs& getMultisampleSpecs(GrRenderTarget*, const GrStencil Settings&); |
384 | 380 |
385 struct DrawArgs { | 381 struct DrawArgs { |
bsalomon
2016/03/16 20:07:22
Delete this?
egdaniel
2016/03/17 15:09:36
Done.
| |
386 DrawArgs(const GrPrimitiveProcessor* primProc, | 382 DrawArgs(const GrPrimitiveProcessor* primProc, |
387 const GrPipeline* pipeline, | 383 const GrPipeline* pipeline, |
388 const GrProgramDesc* desc) | 384 const GrProgramDesc* desc) |
389 : fPrimitiveProcessor(primProc) | 385 : fPrimitiveProcessor(primProc) |
390 , fPipeline(pipeline) | 386 , fPipeline(pipeline) |
391 , fDesc(desc) { | 387 , fDesc(desc) { |
392 SkASSERT(primProc && pipeline && desc); | 388 SkASSERT(primProc && pipeline && desc); |
393 } | 389 } |
394 const GrPrimitiveProcessor* fPrimitiveProcessor; | 390 const GrPrimitiveProcessor* fPrimitiveProcessor; |
395 const GrPipeline* fPipeline; | 391 const GrPipeline* fPipeline; |
396 const GrProgramDesc* fDesc; | 392 const GrProgramDesc* fDesc; |
397 }; | 393 }; |
398 | 394 |
399 void draw(const DrawArgs&, const GrVertices&); | 395 // We pass in an array of drawCount GrVertices to the draw. The backend shou ld loop over each |
396 // GrVertices object and emit a draw for it. Each draw will use the same GrP ipeline and | |
397 // GrPrimitiveProcessor. | |
398 void draw(const GrPipeline&, | |
399 const GrPrimitiveProcessor&, | |
400 GrPrimitiveType primitiveType, | |
401 const GrVertices*, | |
402 int drawCount); | |
bsalomon
2016/03/16 20:07:22
verticesCnt? Had to think for a bit to remember th
egdaniel
2016/03/17 15:09:36
changed to meshCount
| |
400 | 403 |
401 // Called by drawtarget when flushing. | 404 // Called by drawtarget when flushing. |
402 // Provides a hook for post-flush actions (e.g. PLS reset and Vulkan command buffer submits). | 405 // Provides a hook for post-flush actions (e.g. PLS reset and Vulkan command buffer submits). |
403 virtual void finishDrawTarget() {} | 406 virtual void finishDrawTarget() {} |
404 | 407 |
405 /////////////////////////////////////////////////////////////////////////// | 408 /////////////////////////////////////////////////////////////////////////// |
406 // Debugging and Stats | 409 // Debugging and Stats |
407 | 410 |
408 class Stats { | 411 class Stats { |
409 public: | 412 public: |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
570 | 573 |
571 // overridden by backend-specific derived class to perform the clear. | 574 // overridden by backend-specific derived class to perform the clear. |
572 virtual void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) = 0; | 575 virtual void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) = 0; |
573 | 576 |
574 | 577 |
575 // Overridden by backend specific classes to perform a clear of the stencil clip bits. This is | 578 // Overridden by backend specific classes to perform a clear of the stencil clip bits. This is |
576 // ONLY used by the the clip target | 579 // ONLY used by the the clip target |
577 virtual void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool i nsideClip) = 0; | 580 virtual void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool i nsideClip) = 0; |
578 | 581 |
579 // overridden by backend-specific derived class to perform the draw call. | 582 // overridden by backend-specific derived class to perform the draw call. |
580 virtual void onDraw(const DrawArgs&, const GrNonInstancedVertices&) = 0; | 583 virtual void onDraw(const GrPipeline&, |
584 const GrPrimitiveProcessor&, | |
585 GrPrimitiveType primitiveType, | |
586 const GrVertices*, | |
587 int drawCount) = 0; | |
581 | 588 |
582 virtual bool onMakeCopyForTextureParams(GrTexture* texture, const GrTextureP arams&, | 589 virtual bool onMakeCopyForTextureParams(GrTexture* texture, const GrTextureP arams&, |
583 GrTextureProducer::CopyParams*) cons t { return false; } | 590 GrTextureProducer::CopyParams*) cons t { return false; } |
584 | 591 |
585 virtual bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int r eadHeight, | 592 virtual bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int r eadHeight, |
586 size_t rowBytes, GrPixelConfig readConfig, DrawPreference*, | 593 size_t rowBytes, GrPixelConfig readConfig, DrawPreference*, |
587 ReadPixelTempDrawInfo*) = 0; | 594 ReadPixelTempDrawInfo*) = 0; |
588 virtual bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int heig ht, | 595 virtual bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int heig ht, |
589 GrPixelConfig srcConfig, DrawPreference*, | 596 GrPixelConfig srcConfig, DrawPreference*, |
590 WritePixelTempDrawInfo*) = 0; | 597 WritePixelTempDrawInfo*) = 0; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
635 SkTArray<const MultisampleSpecs*, true> fMultisa mpleSpecsMap; | 642 SkTArray<const MultisampleSpecs*, true> fMultisa mpleSpecsMap; |
636 GrTAllocator<MultisampleSpecs> fMultisa mpleSpecsAllocator; | 643 GrTAllocator<MultisampleSpecs> fMultisa mpleSpecsAllocator; |
637 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 644 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
638 GrContext* fContext ; | 645 GrContext* fContext ; |
639 | 646 |
640 friend class GrPathRendering; | 647 friend class GrPathRendering; |
641 typedef SkRefCnt INHERITED; | 648 typedef SkRefCnt INHERITED; |
642 }; | 649 }; |
643 | 650 |
644 #endif | 651 #endif |
OLD | NEW |