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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 * @param buffer memory to read pixels from. | 282 * @param buffer memory to read pixels from. |
283 * @param rowBytes number of bytes between consecutive rows. Zero | 283 * @param rowBytes number of bytes between consecutive rows. Zero |
284 * means rows are tightly packed. | 284 * means rows are tightly packed. |
285 */ | 285 */ |
286 bool writePixels(GrSurface* surface, | 286 bool writePixels(GrSurface* surface, |
287 int left, int top, int width, int height, | 287 int left, int top, int width, int height, |
288 GrPixelConfig config, const void* buffer, | 288 GrPixelConfig config, const void* buffer, |
289 size_t rowBytes); | 289 size_t rowBytes); |
290 | 290 |
291 /** | 291 /** |
292 * Updates the pixels in a rectangle of a surface using a buffer | 292 * Updates the pixels in a rectangle of a texture using a buffer |
293 * | 293 * |
294 * @param surface The surface to write to. | 294 * @param textre The texture to write to. |
295 * @param left left edge of the rectangle to write (inclusive) | 295 * @param left left edge of the rectangle to write (inclusive) |
296 * @param top top edge of the rectangle to write (inclusive) | 296 * @param top top edge of the rectangle to write (inclusive) |
297 * @param width width of rectangle to write in pixels. | 297 * @param width width of rectangle to write in pixels. |
298 * @param height height of rectangle to write in pixels. | 298 * @param height height of rectangle to write in pixels. |
299 * @param config the pixel config of the source buffer | 299 * @param config the pixel config of the source buffer |
300 * @param transferBuffer GrBuffer to read pixels from (type must be "kCpuT
oGpu") | 300 * @param transferBuffer GrBuffer to read pixels from (type must be "kCpuT
oGpu") |
301 * @param offset offset from the start of the buffer | 301 * @param offset offset from the start of the buffer |
302 * @param rowBytes number of bytes between consecutive rows. Zero | 302 * @param rowBytes number of bytes between consecutive rows. Zero |
303 * means rows are tightly packed. | 303 * means rows are tightly packed. |
304 */ | 304 */ |
305 bool transferPixels(GrSurface* surface, | 305 bool transferPixels(GrTexture* texture, |
306 int left, int top, int width, int height, | 306 int left, int top, int width, int height, |
307 GrPixelConfig config, GrBuffer* transferBuffer, | 307 GrPixelConfig config, GrBuffer* transferBuffer, |
308 size_t offset, size_t rowBytes); | 308 size_t offset, size_t rowBytes, GrFence* fence); |
309 | 309 |
310 /** | 310 /** |
311 * This is can be called before allocating a texture to be a dst for copySur
face. This is only | 311 * This is can be called before allocating a texture to be a dst for copySur
face. This is only |
312 * used for doing dst copies needed in blends, thus the src is always a GrRe
nderTarget. It will | 312 * used for doing dst copies needed in blends, thus the src is always a GrRe
nderTarget. It will |
313 * populate the origin, config, and flags fields of the desc such that copyS
urface can | 313 * populate the origin, config, and flags fields of the desc such that copyS
urface can |
314 * efficiently succeed. | 314 * efficiently succeed. |
315 */ | 315 */ |
316 virtual bool initDescForDstCopy(const GrRenderTarget* src, GrSurfaceDesc* de
sc) const = 0; | 316 virtual bool initDescForDstCopy(const GrRenderTarget* src, GrSurfaceDesc* de
sc) const = 0; |
317 | 317 |
318 // After the client interacts directly with the 3D context state the GrGpu | 318 // After the client interacts directly with the 3D context state the GrGpu |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 // directly to the Gpu object. | 364 // directly to the Gpu object. |
365 virtual GrGpuCommandBuffer* createCommandBuffer( | 365 virtual GrGpuCommandBuffer* createCommandBuffer( |
366 GrRenderTarget* target, | 366 GrRenderTarget* target, |
367 const GrGpuCommandBuffer::LoadAndStoreInfo& colorInfo, | 367 const GrGpuCommandBuffer::LoadAndStoreInfo& colorInfo, |
368 const GrGpuCommandBuffer::LoadAndStoreInfo& stencilInfo) = 0; | 368 const GrGpuCommandBuffer::LoadAndStoreInfo& stencilInfo) = 0; |
369 | 369 |
370 // Called by drawtarget when flushing. | 370 // Called by drawtarget when flushing. |
371 // Provides a hook for post-flush actions (e.g. PLS reset and Vulkan command
buffer submits). | 371 // Provides a hook for post-flush actions (e.g. PLS reset and Vulkan command
buffer submits). |
372 virtual void finishDrawTarget() {} | 372 virtual void finishDrawTarget() {} |
373 | 373 |
| 374 virtual GrFence SK_WARN_UNUSED_RESULT insertFence() const = 0; |
| 375 virtual bool waitFence(GrFence) const = 0; |
| 376 virtual void deleteFence(GrFence) const = 0; |
| 377 |
374 /////////////////////////////////////////////////////////////////////////// | 378 /////////////////////////////////////////////////////////////////////////// |
375 // Debugging and Stats | 379 // Debugging and Stats |
376 | 380 |
377 class Stats { | 381 class Stats { |
378 public: | 382 public: |
379 #if GR_GPU_STATS | 383 #if GR_GPU_STATS |
380 Stats() { this->reset(); } | 384 Stats() { this->reset(); } |
381 | 385 |
382 void reset() { | 386 void reset() { |
383 fRenderTargetBinds = 0; | 387 fRenderTargetBinds = 0; |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 GrPixelConfig, | 558 GrPixelConfig, |
555 void* buffer, | 559 void* buffer, |
556 size_t rowBytes) = 0; | 560 size_t rowBytes) = 0; |
557 | 561 |
558 // overridden by backend-specific derived class to perform the surface write | 562 // overridden by backend-specific derived class to perform the surface write |
559 virtual bool onWritePixels(GrSurface*, | 563 virtual bool onWritePixels(GrSurface*, |
560 int left, int top, int width, int height, | 564 int left, int top, int width, int height, |
561 GrPixelConfig config, | 565 GrPixelConfig config, |
562 const SkTArray<GrMipLevel>& texels) = 0; | 566 const SkTArray<GrMipLevel>& texels) = 0; |
563 | 567 |
564 // overridden by backend-specific derived class to perform the surface write | 568 // overridden by backend-specific derived class to perform the texture trans
fer |
565 virtual bool onTransferPixels(GrSurface*, | 569 virtual bool onTransferPixels(GrTexture*, |
566 int left, int top, int width, int height, | 570 int left, int top, int width, int height, |
567 GrPixelConfig config, GrBuffer* transferBuffer
, | 571 GrPixelConfig config, GrBuffer* transferBuffer
, |
568 size_t offset, size_t rowBytes) = 0; | 572 size_t offset, size_t rowBytes) = 0; |
569 | 573 |
570 // overridden by backend-specific derived class to perform the resolve | 574 // overridden by backend-specific derived class to perform the resolve |
571 virtual void onResolveRenderTarget(GrRenderTarget* target) = 0; | 575 virtual void onResolveRenderTarget(GrRenderTarget* target) = 0; |
572 | 576 |
573 // overridden by backend specific derived class to perform the copy surface | 577 // overridden by backend specific derived class to perform the copy surface |
574 virtual bool onCopySurface(GrSurface* dst, | 578 virtual bool onCopySurface(GrSurface* dst, |
575 GrSurface* src, | 579 GrSurface* src, |
(...skipping 22 matching lines...) Expand all Loading... |
598 SkSTArray<1, MultisampleSpecs, true> fMultisampleSpecs; | 602 SkSTArray<1, MultisampleSpecs, true> fMultisampleSpecs; |
599 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 603 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
600 GrContext* fContext; | 604 GrContext* fContext; |
601 | 605 |
602 friend class GrPathRendering; | 606 friend class GrPathRendering; |
603 friend class gr_instanced::InstancedRendering; | 607 friend class gr_instanced::InstancedRendering; |
604 typedef SkRefCnt INHERITED; | 608 typedef SkRefCnt INHERITED; |
605 }; | 609 }; |
606 | 610 |
607 #endif | 611 #endif |
OLD | NEW |