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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
293 * @param offset offset from the start of the buffer | 293 * @param offset offset from the start of the buffer |
294 * @param rowBytes number of bytes between consecutive rows. Zero | 294 * @param rowBytes number of bytes between consecutive rows. Zero |
295 * means rows are tightly packed. | 295 * means rows are tightly packed. |
296 */ | 296 */ |
297 bool transferPixels(GrSurface* surface, | 297 bool transferPixels(GrSurface* surface, |
298 int left, int top, int width, int height, | 298 int left, int top, int width, int height, |
299 GrPixelConfig config, GrBuffer* transferBuffer, | 299 GrPixelConfig config, GrBuffer* transferBuffer, |
300 size_t offset, size_t rowBytes); | 300 size_t offset, size_t rowBytes); |
301 | 301 |
302 /** | 302 /** |
303 * Clear the passed in render target. Ignores the draw state and clip. | |
304 */ | |
305 void clear(const SkIRect& rect, GrColor color, GrRenderTarget* renderTarget) ; | |
306 | |
307 | |
308 void clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTarget* renderTarget); | |
309 | |
310 /** | |
311 * Discards the contents render target. nullptr indicates that the current r ender target should | |
312 * be discarded. | |
313 **/ | |
314 virtual void discard(GrRenderTarget* = nullptr) = 0; | |
315 | |
316 /** | |
317 * This is can be called before allocating a texture to be a dst for copySur face. It will | 303 * This is can be called before allocating a texture to be a dst for copySur face. It will |
318 * populate the origin, config, and flags fields of the desc such that copyS urface can | 304 * populate the origin, config, and flags fields of the desc such that copyS urface can |
319 * efficiently succeed. It should only succeed if it can allow copySurface t o perform a copy | 305 * efficiently succeed. It should only succeed if it can allow copySurface t o perform a copy |
320 * that would be more effecient than drawing the src to a dst render target. | 306 * that would be more effecient than drawing the src to a dst render target. |
321 */ | 307 */ |
322 virtual bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* des c) const = 0; | 308 virtual bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* des c) const = 0; |
323 | 309 |
324 // After the client interacts directly with the 3D context state the GrGpu | 310 // After the client interacts directly with the 3D context state the GrGpu |
325 // must resync its internal state and assumptions about 3D context state. | 311 // must resync its internal state and assumptions about 3D context state. |
326 // Each time this occurs the GrGpu bumps a timestamp. | 312 // Each time this occurs the GrGpu bumps a timestamp. |
(...skipping 29 matching lines...) Expand all Loading... | |
356 SkAutoTDeleteArray<const SkPoint> fSampleLocations; | 342 SkAutoTDeleteArray<const SkPoint> fSampleLocations; |
357 }; | 343 }; |
358 | 344 |
359 // Finds a render target's multisample specs. The stencil settings are only needed to flush the | 345 // Finds a render target's multisample specs. The stencil settings are only needed to flush the |
360 // draw state prior to querying multisample information; they should not hav e any effect on the | 346 // draw state prior to querying multisample information; they should not hav e any effect on the |
361 // multisample information itself. | 347 // multisample information itself. |
362 const MultisampleSpecs& getMultisampleSpecs(GrRenderTarget*, const GrStencil Settings&); | 348 const MultisampleSpecs& getMultisampleSpecs(GrRenderTarget*, const GrStencil Settings&); |
363 | 349 |
364 // Creates a GrGpuCommandBuffer in which the GrDrawTarget can send draw comm ands to instead of | 350 // Creates a GrGpuCommandBuffer in which the GrDrawTarget can send draw comm ands to instead of |
365 // directly to the Gpu object. | 351 // directly to the Gpu object. |
366 virtual GrGpuCommandBuffer* createCommandBuffer(const GrRenderTarget& target , | 352 virtual GrGpuCommandBuffer* createCommandBuffer(GrRenderTarget* target, |
367 GrGpuCommandBuffer::LoadAndS toreOp colorOp, | 353 GrGpuCommandBuffer::LoadAndS toreOp colorOp, |
368 GrColor colorClear, | 354 GrColor colorClear, |
369 GrGpuCommandBuffer::LoadAndS toreOp stencilOp, | 355 GrGpuCommandBuffer::LoadAndS toreOp stencilOp, |
370 GrColor stencilClear) = 0; | 356 GrColor stencilClear) = 0; |
371 | 357 |
372 // We pass in an array of meshCount GrMesh to the draw. The backend should l oop over each | |
373 // GrMesh object and emit a draw for it. Each draw will use the same GrPipel ine and | |
374 // GrPrimitiveProcessor. This may fail if the draw would exceed any resource limits (e.g. | |
375 // number of vertex attributes is too large). | |
376 bool draw(const GrPipeline&, | |
377 const GrPrimitiveProcessor&, | |
378 const GrMesh*, | |
379 int meshCount); | |
380 | |
381 // Called by drawtarget when flushing. | 358 // Called by drawtarget when flushing. |
382 // Provides a hook for post-flush actions (e.g. PLS reset and Vulkan command buffer submits). | 359 // Provides a hook for post-flush actions (e.g. PLS reset and Vulkan command buffer submits). |
383 virtual void finishDrawTarget() {} | 360 virtual void finishDrawTarget() {} |
384 | 361 |
385 /////////////////////////////////////////////////////////////////////////// | 362 /////////////////////////////////////////////////////////////////////////// |
386 // Debugging and Stats | 363 // Debugging and Stats |
387 | 364 |
388 class Stats { | 365 class Stats { |
389 public: | 366 public: |
390 #if GR_GPU_STATS | 367 #if GR_GPU_STATS |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
536 SkBudgeted budgeted, | 513 SkBudgeted budgeted, |
537 const SkTArray<GrMipLevel>& tex els) = 0; | 514 const SkTArray<GrMipLevel>& tex els) = 0; |
538 | 515 |
539 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapO wnership) = 0; | 516 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapO wnership) = 0; |
540 virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTarge tDesc&, | 517 virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTarge tDesc&, |
541 GrWrapOwnership) = 0; | 518 GrWrapOwnership) = 0; |
542 virtual GrRenderTarget* onWrapBackendTextureAsRenderTarget(const GrBackendTe xtureDesc&) = 0; | 519 virtual GrRenderTarget* onWrapBackendTextureAsRenderTarget(const GrBackendTe xtureDesc&) = 0; |
543 virtual GrBuffer* onCreateBuffer(size_t size, GrBufferType intendedType, GrA ccessPattern, | 520 virtual GrBuffer* onCreateBuffer(size_t size, GrBufferType intendedType, GrA ccessPattern, |
544 const void* data) = 0; | 521 const void* data) = 0; |
545 | 522 |
546 // overridden by backend-specific derived class to perform the clear. | |
547 virtual void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) = 0; | |
548 | |
549 // Overridden by backend specific classes to perform a clear of the stencil clip bits. This is | |
550 // ONLY used by the the clip target | |
551 virtual void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool i nsideClip) = 0; | |
552 | |
553 // overridden by backend-specific derived class to perform the draw call. | |
554 virtual void onDraw(const GrPipeline&, | |
555 const GrPrimitiveProcessor&, | |
556 const GrMesh*, | |
557 int meshCount) = 0; | |
558 | |
559 virtual bool onMakeCopyForTextureParams(GrTexture* texture, const GrTextureP arams&, | 523 virtual bool onMakeCopyForTextureParams(GrTexture* texture, const GrTextureP arams&, |
560 GrTextureProducer::CopyParams*) cons t { return false; } | 524 GrTextureProducer::CopyParams*) cons t { return false; } |
561 | 525 |
562 virtual bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int r eadHeight, | 526 virtual bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int r eadHeight, |
563 size_t rowBytes, GrPixelConfig readConfig, DrawPreference*, | 527 size_t rowBytes, GrPixelConfig readConfig, DrawPreference*, |
564 ReadPixelTempDrawInfo*) = 0; | 528 ReadPixelTempDrawInfo*) = 0; |
565 virtual bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int heig ht, | 529 virtual bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int heig ht, |
566 GrPixelConfig srcConfig, DrawPreference*, | 530 GrPixelConfig srcConfig, DrawPreference*, |
567 WritePixelTempDrawInfo*) = 0; | 531 WritePixelTempDrawInfo*) = 0; |
568 | 532 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
607 ++fResetTimestamp; | 571 ++fResetTimestamp; |
608 } | 572 } |
609 | 573 |
610 ResetTimestamp fResetTi mestamp; | 574 ResetTimestamp fResetTi mestamp; |
611 uint32_t fResetBi ts; | 575 uint32_t fResetBi ts; |
612 SkTArray<const MultisampleSpecs*, true> fMultisa mpleSpecsMap; | 576 SkTArray<const MultisampleSpecs*, true> fMultisa mpleSpecsMap; |
613 GrTAllocator<MultisampleSpecs> fMultisa mpleSpecsAllocator; | 577 GrTAllocator<MultisampleSpecs> fMultisa mpleSpecsAllocator; |
614 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 578 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
615 GrContext* fContext ; | 579 GrContext* fContext ; |
616 | 580 |
581 friend class GrGpuCommandBuffer; | |
bsalomon
2016/06/20 16:51:14
why does this need to be a friend?
egdaniel
2016/06/22 15:26:57
it is for the handleDirtyContext call on GrGpuComm
bsalomon
2016/06/22 15:41:15
I'd just make handleDirtyContext() public.
Should
egdaniel
2016/06/22 21:13:35
Made public. Previously we decided not to move it
| |
617 friend class GrPathRendering; | 582 friend class GrPathRendering; |
618 typedef SkRefCnt INHERITED; | 583 typedef SkRefCnt INHERITED; |
619 }; | 584 }; |
620 | 585 |
621 #endif | 586 #endif |
OLD | NEW |