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 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 } | 92 } |
93 | 93 |
94 void buildProgramDesc(GrProgramDesc*, | 94 void buildProgramDesc(GrProgramDesc*, |
95 const GrPrimitiveProcessor&, | 95 const GrPrimitiveProcessor&, |
96 const GrPipeline&) const override; | 96 const GrPipeline&) const override; |
97 | 97 |
98 const GrGLContext* glContextForTesting() const override { | 98 const GrGLContext* glContextForTesting() const override { |
99 return &this->glContext(); | 99 return &this->glContext(); |
100 } | 100 } |
101 | 101 |
| 102 void clearStencil(GrRenderTarget*) override; |
| 103 |
| 104 void invalidateBoundRenderTarget() { |
| 105 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; |
| 106 } |
| 107 |
| 108 GrStencilAttachment* createStencilAttachmentForRenderTarget(const GrRenderTa
rget* rt, |
| 109 int width, |
| 110 int height) over
ride; |
| 111 |
102 GrBackendObject createTestingOnlyBackendTexture(void* pixels, int w, int h, | 112 GrBackendObject createTestingOnlyBackendTexture(void* pixels, int w, int h, |
103 GrPixelConfig config) const
override; | 113 GrPixelConfig config) const
override; |
104 bool isTestingOnlyBackendTexture(GrBackendObject id) const override; | 114 bool isTestingOnlyBackendTexture(GrBackendObject id) const override; |
105 void deleteTestingOnlyBackendTexture(GrBackendObject id) const override; | 115 void deleteTestingOnlyBackendTexture(GrBackendObject id) const override; |
106 | 116 |
107 private: | 117 private: |
108 GrGLGpu(GrGLContext* ctx, GrContext* context); | 118 GrGLGpu(GrGLContext* ctx, GrContext* context); |
109 | 119 |
110 // GrGpu overrides | 120 // GrGpu overrides |
111 void onResetContext(uint32_t resetBits) override; | 121 void onResetContext(uint32_t resetBits) override; |
112 | 122 |
113 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override; | 123 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override; |
114 | 124 |
115 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc
le lifeCycle, | 125 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc
le lifeCycle, |
116 const void* srcData, size_t rowBytes) override; | 126 const void* srcData, size_t rowBytes) override; |
117 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, | 127 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, |
118 GrGpuResource::LifeCycle lifeCycle, | 128 GrGpuResource::LifeCycle lifeCycle, |
119 const void* srcData) override; | 129 const void* srcData) override; |
120 GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) override; | 130 GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) override; |
121 GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) override; | 131 GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) override; |
122 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership
) override; | 132 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership
) override; |
123 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, | 133 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, |
124 GrWrapOwnership) override; | 134 GrWrapOwnership) override; |
125 bool createStencilAttachmentForRenderTarget(GrRenderTarget* rt, int width, i
nt height) override; | |
126 bool attachStencilAttachmentToRenderTarget(GrStencilAttachment* sb, | |
127 GrRenderTarget* rt) override; | |
128 // Given a GrPixelConfig return the index into the stencil format array on G
rGLCaps to a | 135 // Given a GrPixelConfig return the index into the stencil format array on G
rGLCaps to a |
129 // compatible stencil format. | 136 // compatible stencil format. |
130 int getCompatibleStencilIndex(GrPixelConfig config); | 137 int getCompatibleStencilIndex(GrPixelConfig config); |
131 | 138 |
132 void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) override; | 139 void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) override; |
133 | 140 |
134 void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool insideCli
p) override; | 141 void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool insideCli
p) override; |
135 | 142 |
136 bool onReadPixels(GrSurface*, | 143 bool onReadPixels(GrSurface*, |
137 int left, int top, | 144 int left, int top, |
138 int width, int height, | 145 int width, int height, |
139 GrPixelConfig, | 146 GrPixelConfig, |
140 void* buffer, | 147 void* buffer, |
141 size_t rowBytes) override; | 148 size_t rowBytes) override; |
142 | 149 |
143 bool onWritePixels(GrSurface*, | 150 bool onWritePixels(GrSurface*, |
144 int left, int top, int width, int height, | 151 int left, int top, int width, int height, |
145 GrPixelConfig config, const void* buffer, | 152 GrPixelConfig config, const void* buffer, |
146 size_t rowBytes) override; | 153 size_t rowBytes) override; |
147 | 154 |
148 void onResolveRenderTarget(GrRenderTarget* target) override; | 155 void onResolveRenderTarget(GrRenderTarget* target) override; |
149 | 156 |
150 void onDraw(const DrawArgs&, const GrNonInstancedVertices&) override; | 157 void onDraw(const DrawArgs&, const GrNonInstancedVertices&) override; |
151 | 158 |
152 bool onCopySurface(GrSurface* dst, | 159 bool onCopySurface(GrSurface* dst, |
153 GrSurface* src, | 160 GrSurface* src, |
154 const SkIRect& srcRect, | 161 const SkIRect& srcRect, |
155 const SkIPoint& dstPoint) override; | 162 const SkIPoint& dstPoint) override; |
156 | 163 |
157 void clearStencil(GrRenderTarget*) override; | |
158 | |
159 // binds texture unit in GL | 164 // binds texture unit in GL |
160 void setTextureUnit(int unitIdx); | 165 void setTextureUnit(int unitIdx); |
161 | 166 |
162 // Flushes state from GrPipeline to GL. Returns false if the state couldn't
be set. | 167 // Flushes state from GrPipeline to GL. Returns false if the state couldn't
be set. |
163 bool flushGLState(const DrawArgs&); | 168 bool flushGLState(const DrawArgs&); |
164 | 169 |
165 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt
es gives the offset | 170 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt
es gives the offset |
166 // an into the index buffer. It does not account for vertices.startIndex() b
ut rather the start | 171 // an into the index buffer. It does not account for vertices.startIndex() b
ut rather the start |
167 // index is relative to the returned offset. | 172 // index is relative to the returned offset. |
168 void setupGeometry(const GrPrimitiveProcessor&, | 173 void setupGeometry(const GrPrimitiveProcessor&, |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 | 498 |
494 // Mapping of pixel configs to known supported stencil formats to be used | 499 // Mapping of pixel configs to known supported stencil formats to be used |
495 // when adding a stencil buffer to a framebuffer. | 500 // when adding a stencil buffer to a framebuffer. |
496 int fPixelConfigToStencilIndex[kGrPixelConfigCnt]; | 501 int fPixelConfigToStencilIndex[kGrPixelConfigCnt]; |
497 | 502 |
498 typedef GrGpu INHERITED; | 503 typedef GrGpu INHERITED; |
499 friend class GrGLPathRendering; // For accessing setTextureUnit. | 504 friend class GrGLPathRendering; // For accessing setTextureUnit. |
500 }; | 505 }; |
501 | 506 |
502 #endif | 507 #endif |
OLD | NEW |