| 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 GrGLGpu_DEFINED | 8 #ifndef GrGLGpu_DEFINED |
| 9 #define GrGLGpu_DEFINED | 9 #define GrGLGpu_DEFINED |
| 10 | 10 |
| 11 #include "GrGLContext.h" | 11 #include "GrGLContext.h" |
| 12 #include "GrGLIRect.h" | 12 #include "GrGLIRect.h" |
| 13 #include "GrGLIndexBuffer.h" | 13 #include "GrGLIndexBuffer.h" |
| 14 #include "GrGLPathRendering.h" | 14 #include "GrGLPathRendering.h" |
| 15 #include "GrGLProgram.h" | 15 #include "GrGLProgram.h" |
| 16 #include "GrGLRenderTarget.h" | 16 #include "GrGLRenderTarget.h" |
| 17 #include "GrGLStencilAttachment.h" | 17 #include "GrGLStencilAttachment.h" |
| 18 #include "GrGLTexture.h" | 18 #include "GrGLTexture.h" |
| 19 #include "GrGLVertexArray.h" | 19 #include "GrGLVertexArray.h" |
| 20 #include "GrGLVertexBuffer.h" | 20 #include "GrGLVertexBuffer.h" |
| 21 #include "GrGpu.h" | 21 #include "GrGpu.h" |
| 22 #include "GrPipelineBuilder.h" | 22 #include "GrPipelineBuilder.h" |
| 23 #include "GrXferProcessor.h" | 23 #include "GrXferProcessor.h" |
| 24 #include "SkTypes.h" | 24 #include "SkTypes.h" |
| 25 | 25 |
| 26 class GrPipeline; | 26 class GrPipeline; |
| 27 class GrVertices; | 27 class GrNonInstancedVertices; |
| 28 | 28 |
| 29 #ifdef SK_DEVELOPER | 29 #ifdef SK_DEVELOPER |
| 30 #define PROGRAM_CACHE_STATS | 30 #define PROGRAM_CACHE_STATS |
| 31 #endif | 31 #endif |
| 32 | 32 |
| 33 class GrGLGpu : public GrGpu { | 33 class GrGLGpu : public GrGpu { |
| 34 public: | 34 public: |
| 35 GrGLGpu(const GrGLContext& ctx, GrContext* context); | 35 GrGLGpu(const GrGLContext& ctx, GrContext* context); |
| 36 ~GrGLGpu() override; | 36 ~GrGLGpu() override; |
| 37 | 37 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 void* buffer, | 142 void* buffer, |
| 143 size_t rowBytes) override; | 143 size_t rowBytes) override; |
| 144 | 144 |
| 145 bool onWriteTexturePixels(GrTexture* texture, | 145 bool onWriteTexturePixels(GrTexture* texture, |
| 146 int left, int top, int width, int height, | 146 int left, int top, int width, int height, |
| 147 GrPixelConfig config, const void* buffer, | 147 GrPixelConfig config, const void* buffer, |
| 148 size_t rowBytes) override; | 148 size_t rowBytes) override; |
| 149 | 149 |
| 150 void onResolveRenderTarget(GrRenderTarget* target) override; | 150 void onResolveRenderTarget(GrRenderTarget* target) override; |
| 151 | 151 |
| 152 void onDraw(const DrawArgs&, const GrVertices&) override; | 152 void onDraw(const DrawArgs&, const GrNonInstancedVertices&) override; |
| 153 void onStencilPath(const GrPath*, const StencilPathState&) override; | 153 void onStencilPath(const GrPath*, const StencilPathState&) override; |
| 154 void onDrawPath(const DrawArgs&, const GrPath*, const GrStencilSettings&) ov
erride; | 154 void onDrawPath(const DrawArgs&, const GrPath*, const GrStencilSettings&) ov
erride; |
| 155 void onDrawPaths(const DrawArgs&, | 155 void onDrawPaths(const DrawArgs&, |
| 156 const GrPathRange*, | 156 const GrPathRange*, |
| 157 const void* indices, | 157 const void* indices, |
| 158 GrDrawTarget::PathIndexType, | 158 GrDrawTarget::PathIndexType, |
| 159 const float transformValues[], | 159 const float transformValues[], |
| 160 GrDrawTarget::PathTransformType, | 160 GrDrawTarget::PathTransformType, |
| 161 int count, | 161 int count, |
| 162 const GrStencilSettings&) override; | 162 const GrStencilSettings&) override; |
| 163 | 163 |
| 164 void clearStencil(GrRenderTarget*) override; | 164 void clearStencil(GrRenderTarget*) override; |
| 165 | 165 |
| 166 // GrDrawTarget overrides | 166 // GrDrawTarget overrides |
| 167 void didAddGpuTraceMarker() override; | 167 void didAddGpuTraceMarker() override; |
| 168 void didRemoveGpuTraceMarker() override; | 168 void didRemoveGpuTraceMarker() override; |
| 169 | 169 |
| 170 // binds texture unit in GL | 170 // binds texture unit in GL |
| 171 void setTextureUnit(int unitIdx); | 171 void setTextureUnit(int unitIdx); |
| 172 | 172 |
| 173 // Flushes state from GrPipeline to GL. Returns false if the state couldn't
be set. | 173 // Flushes state from GrPipeline to GL. Returns false if the state couldn't
be set. |
| 174 bool flushGLState(const DrawArgs&); | 174 bool flushGLState(const DrawArgs&); |
| 175 | 175 |
| 176 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt
es gives the offset | 176 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt
es gives the offset |
| 177 // an into the index buffer. It does not account for vertices.startIndex() b
ut rather the start | 177 // an into the index buffer. It does not account for vertices.startIndex() b
ut rather the start |
| 178 // index is relative to the returned offset. | 178 // index is relative to the returned offset. |
| 179 void setupGeometry(const GrPrimitiveProcessor&, | 179 void setupGeometry(const GrPrimitiveProcessor&, |
| 180 const GrVertices& vertices, | 180 const GrNonInstancedVertices& vertices, |
| 181 size_t* indexOffsetInBytes); | 181 size_t* indexOffsetInBytes); |
| 182 | 182 |
| 183 // Subclasses should call this to flush the blend state. | 183 // Subclasses should call this to flush the blend state. |
| 184 void flushBlend(const GrXferProcessor::BlendInfo& blendInfo); | 184 void flushBlend(const GrXferProcessor::BlendInfo& blendInfo); |
| 185 | 185 |
| 186 bool hasExtension(const char* ext) const { return fGLContext.hasExtension(ex
t); } | 186 bool hasExtension(const char* ext) const { return fGLContext.hasExtension(ex
t); } |
| 187 | 187 |
| 188 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); | 188 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); |
| 189 | 189 |
| 190 class ProgramCache : public ::SkNoncopyable { | 190 class ProgramCache : public ::SkNoncopyable { |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 | 470 |
| 471 // we record what stencil format worked last time to hopefully exit early | 471 // we record what stencil format worked last time to hopefully exit early |
| 472 // from our loop that tries stencil formats and calls check fb status. | 472 // from our loop that tries stencil formats and calls check fb status. |
| 473 int fLastSuccessfulStencilFmtIdx; | 473 int fLastSuccessfulStencilFmtIdx; |
| 474 | 474 |
| 475 typedef GrGpu INHERITED; | 475 typedef GrGpu INHERITED; |
| 476 friend class GrGLPathRendering; // For accessing setTextureUnit. | 476 friend class GrGLPathRendering; // For accessing setTextureUnit. |
| 477 }; | 477 }; |
| 478 | 478 |
| 479 #endif | 479 #endif |
| OLD | NEW |