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 |
11 #include "GrDrawTarget.h" | 11 #include "GrDrawTarget.h" |
12 #include "GrPathRendering.h" | 12 #include "GrPathRendering.h" |
13 #include "GrProgramDesc.h" | 13 #include "GrProgramDesc.h" |
14 #include "SkPath.h" | 14 #include "SkPath.h" |
15 | 15 |
16 class GrContext; | 16 class GrContext; |
17 class GrIndexBufferAllocPool; | 17 class GrIndexBufferAllocPool; |
18 class GrOptDrawState; | |
19 class GrPath; | 18 class GrPath; |
20 class GrPathRange; | 19 class GrPathRange; |
21 class GrPathRenderer; | 20 class GrPathRenderer; |
22 class GrPathRendererChain; | 21 class GrPathRendererChain; |
| 22 class GrPipeline; |
23 class GrPrimitiveProcessor; | 23 class GrPrimitiveProcessor; |
24 class GrStencilBuffer; | 24 class GrStencilBuffer; |
25 class GrVertexBufferAllocPool; | 25 class GrVertexBufferAllocPool; |
26 | 26 |
27 class GrGpu : public SkRefCnt { | 27 class GrGpu : public SkRefCnt { |
28 public: | 28 public: |
29 | 29 |
30 /** | 30 /** |
31 * Additional blend coefficients for dual source blending, not exposed | 31 * Additional blend coefficients for dual source blending, not exposed |
32 * through GrPaint/GrContext. | 32 * through GrPaint/GrContext. |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 static const ResetTimestamp kExpiredTimestamp = 0; | 299 static const ResetTimestamp kExpiredTimestamp = 0; |
300 // Returns a timestamp based on the number of times the context was reset. | 300 // Returns a timestamp based on the number of times the context was reset. |
301 // This timestamp can be used to lazily detect when cached 3D context state | 301 // This timestamp can be used to lazily detect when cached 3D context state |
302 // is dirty. | 302 // is dirty. |
303 ResetTimestamp getResetTimestamp() const { return fResetTimestamp; } | 303 ResetTimestamp getResetTimestamp() const { return fResetTimestamp; } |
304 | 304 |
305 GrContext::GPUStats* gpuStats() { return &fGPUStats; } | 305 GrContext::GPUStats* gpuStats() { return &fGPUStats; } |
306 | 306 |
307 virtual void buildProgramDesc(GrProgramDesc*, | 307 virtual void buildProgramDesc(GrProgramDesc*, |
308 const GrPrimitiveProcessor&, | 308 const GrPrimitiveProcessor&, |
309 const GrOptDrawState&, | 309 const GrPipeline&, |
310 const GrProgramDesc::DescInfo&, | 310 const GrProgramDesc::DescInfo&, |
311 const GrBatchTracker&) const = 0; | 311 const GrBatchTracker&) const = 0; |
312 | 312 |
313 /** | 313 /** |
314 * Called at start and end of gpu trace marking | 314 * Called at start and end of gpu trace marking |
315 * GR_CREATE_GPU_TRACE_MARKER(marker_str, target) will automatically call th
ese at the start | 315 * GR_CREATE_GPU_TRACE_MARKER(marker_str, target) will automatically call th
ese at the start |
316 * and end of a code block respectively | 316 * and end of a code block respectively |
317 */ | 317 */ |
318 void addGpuTraceMarker(const GrGpuTraceMarker* marker); | 318 void addGpuTraceMarker(const GrGpuTraceMarker* marker); |
319 void removeGpuTraceMarker(const GrGpuTraceMarker* marker); | 319 void removeGpuTraceMarker(const GrGpuTraceMarker* marker); |
(...skipping 24 matching lines...) Expand all Loading... |
344 // and point are pre-clipped. The src rect and implied dst rect are guarante
ed to be within the | 344 // and point are pre-clipped. The src rect and implied dst rect are guarante
ed to be within the |
345 // src/dst bounds and non-empty. | 345 // src/dst bounds and non-empty. |
346 virtual bool copySurface(GrSurface* dst, | 346 virtual bool copySurface(GrSurface* dst, |
347 GrSurface* src, | 347 GrSurface* src, |
348 const SkIRect& srcRect, | 348 const SkIRect& srcRect, |
349 const SkIPoint& dstPoint) = 0; | 349 const SkIPoint& dstPoint) = 0; |
350 | 350 |
351 struct DrawArgs { | 351 struct DrawArgs { |
352 typedef GrDrawTarget::DrawInfo DrawInfo; | 352 typedef GrDrawTarget::DrawInfo DrawInfo; |
353 DrawArgs(const GrPrimitiveProcessor* primProc, | 353 DrawArgs(const GrPrimitiveProcessor* primProc, |
354 const GrOptDrawState* optState, | 354 const GrPipeline* pipeline, |
355 const GrProgramDesc* desc, | 355 const GrProgramDesc* desc, |
356 const GrBatchTracker* batchTracker) | 356 const GrBatchTracker* batchTracker) |
357 : fPrimitiveProcessor(primProc) | 357 : fPrimitiveProcessor(primProc) |
358 , fOptState(optState) | 358 , fPipeline(pipeline) |
359 , fDesc(desc) | 359 , fDesc(desc) |
360 , fBatchTracker(batchTracker) { | 360 , fBatchTracker(batchTracker) { |
361 SkASSERT(primProc && optState && desc && batchTracker); | 361 SkASSERT(primProc && pipeline && desc && batchTracker); |
362 } | 362 } |
363 const GrPrimitiveProcessor* fPrimitiveProcessor; | 363 const GrPrimitiveProcessor* fPrimitiveProcessor; |
364 const GrOptDrawState* fOptState; | 364 const GrPipeline* fPipeline; |
365 const GrProgramDesc* fDesc; | 365 const GrProgramDesc* fDesc; |
366 const GrBatchTracker* fBatchTracker; | 366 const GrBatchTracker* fBatchTracker; |
367 }; | 367 }; |
368 | 368 |
369 void draw(const DrawArgs&, const GrDrawTarget::DrawInfo&); | 369 void draw(const DrawArgs&, const GrDrawTarget::DrawInfo&); |
370 | 370 |
371 /** None of these params are optional, pointers used just to avoid making co
pies. */ | 371 /** None of these params are optional, pointers used just to avoid making co
pies. */ |
372 struct StencilPathState { | 372 struct StencilPathState { |
373 bool fUseHWAA; | 373 bool fUseHWAA; |
374 GrRenderTarget* fRenderTarget; | 374 GrRenderTarget* fRenderTarget; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 int fGpuTrac
eMarkerCount; | 503 int fGpuTrac
eMarkerCount; |
504 GrTraceMarkerSet fActiveT
raceMarkers; | 504 GrTraceMarkerSet fActiveT
raceMarkers; |
505 GrTraceMarkerSet fStoredT
raceMarkers; | 505 GrTraceMarkerSet fStoredT
raceMarkers; |
506 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 506 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
507 GrContext* fContext
; | 507 GrContext* fContext
; |
508 | 508 |
509 typedef SkRefCnt INHERITED; | 509 typedef SkRefCnt INHERITED; |
510 }; | 510 }; |
511 | 511 |
512 #endif | 512 #endif |
OLD | NEW |