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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 GrGLStandard glStandard() const { return fGLContext->standard(); } | 47 GrGLStandard glStandard() const { return fGLContext->standard(); } |
48 GrGLVersion glVersion() const { return fGLContext->version(); } | 48 GrGLVersion glVersion() const { return fGLContext->version(); } |
49 GrGLSLGeneration glslGeneration() const { return fGLContext->glslGeneration(
); } | 49 GrGLSLGeneration glslGeneration() const { return fGLContext->glslGeneration(
); } |
50 const GrGLCaps& glCaps() const { return *fGLContext->caps(); } | 50 const GrGLCaps& glCaps() const { return *fGLContext->caps(); } |
51 | 51 |
52 GrGLPathRendering* glPathRendering() { | 52 GrGLPathRendering* glPathRendering() { |
53 SkASSERT(glCaps().shaderCaps()->pathRenderingSupport()); | 53 SkASSERT(glCaps().shaderCaps()->pathRenderingSupport()); |
54 return static_cast<GrGLPathRendering*>(pathRendering()); | 54 return static_cast<GrGLPathRendering*>(pathRendering()); |
55 } | 55 } |
56 | 56 |
57 void discard(GrRenderTarget*) override; | 57 void discard(GrRenderTarget*); |
58 | 58 |
59 // Used by GrGLProgram to configure OpenGL state. | 59 // Used by GrGLProgram to configure OpenGL state. |
60 void bindTexture(int unitIdx, const GrTextureParams& params, bool allowSRGBI
nputs, | 60 void bindTexture(int unitIdx, const GrTextureParams& params, bool allowSRGBI
nputs, |
61 GrGLTexture* texture); | 61 GrGLTexture* texture); |
62 | 62 |
63 void bindTexelBuffer(int unitIdx, GrPixelConfig, GrGLBuffer*); | 63 void bindTexelBuffer(int unitIdx, GrPixelConfig, GrGLBuffer*); |
64 | 64 |
65 void generateMipmaps(const GrTextureParams& params, bool allowSRGBInputs, Gr
GLTexture* texture); | 65 void generateMipmaps(const GrTextureParams& params, bool allowSRGBInputs, Gr
GLTexture* texture); |
66 | 66 |
67 bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeigh
t, size_t rowBytes, | 67 bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeigh
t, size_t rowBytes, |
(...skipping 20 matching lines...) Expand all Loading... |
88 | 88 |
89 // Binds a buffer to the GL target corresponding to 'type', updates internal
state tracking, and | 89 // Binds a buffer to the GL target corresponding to 'type', updates internal
state tracking, and |
90 // returns the GL target the buffer was bound to. | 90 // returns the GL target the buffer was bound to. |
91 // When 'type' is kIndex_GrBufferType, this function will also implicitly bi
nd the default VAO. | 91 // When 'type' is kIndex_GrBufferType, this function will also implicitly bi
nd the default VAO. |
92 // If the caller wishes to bind an index buffer to a specific VAO, it can ca
ll glBind directly. | 92 // If the caller wishes to bind an index buffer to a specific VAO, it can ca
ll glBind directly. |
93 GrGLenum bindBuffer(GrBufferType type, const GrGLBuffer*); | 93 GrGLenum bindBuffer(GrBufferType type, const GrGLBuffer*); |
94 | 94 |
95 // Called by GrGLBuffer after its buffer object has been destroyed. | 95 // Called by GrGLBuffer after its buffer object has been destroyed. |
96 void notifyBufferReleased(const GrGLBuffer*); | 96 void notifyBufferReleased(const GrGLBuffer*); |
97 | 97 |
| 98 // The GrGLGpuCommandBuffer does not buffer up draws before submitting them
to the gpu. |
| 99 // Thus this is the implementation of the draw call for the corresponding pa
ssthrough function |
| 100 // on GrGLGpuCommandBuffer. |
| 101 void draw(const GrPipeline&, |
| 102 const GrPrimitiveProcessor&, |
| 103 const GrMesh*, |
| 104 int meshCount); |
| 105 |
| 106 // The GrGLGpuCommandBuffer does not buffer up draws before submitting them
to the gpu. |
| 107 // Thus this is the implementation of the clear call for the corresponding p
assthrough function |
| 108 // on GrGLGpuCommandBuffer. |
| 109 void clear(const SkIRect& rect, GrColor color, GrRenderTarget* renderTarget)
; |
| 110 |
| 111 // The GrGLGpuCommandBuffer does not buffer up draws before submitting them
to the gpu. |
| 112 // Thus this is the implementation of the clearStencil call for the correspo
nding passthrough |
| 113 // function on GrGLGpuCommandBuffer. |
| 114 void clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTarget*
renderTarget); |
| 115 |
98 const GrGLContext* glContextForTesting() const override { | 116 const GrGLContext* glContextForTesting() const override { |
99 return &this->glContext(); | 117 return &this->glContext(); |
100 } | 118 } |
101 | 119 |
102 void clearStencil(GrRenderTarget*) override; | 120 void clearStencil(GrRenderTarget*) override; |
103 | 121 |
104 GrGpuCommandBuffer* createCommandBuffer(const GrRenderTarget& target, | 122 GrGpuCommandBuffer* createCommandBuffer(GrRenderTarget* target, |
105 GrGpuCommandBuffer::LoadAndStoreOp c
olorOp, | 123 GrGpuCommandBuffer::LoadAndStoreOp c
olorOp, |
106 GrColor colorClear, | 124 GrColor colorClear, |
107 GrGpuCommandBuffer::LoadAndStoreOp s
tencilOp, | 125 GrGpuCommandBuffer::LoadAndStoreOp s
tencilOp, |
108 GrColor stencilClear) override; | 126 GrColor stencilClear) override; |
109 | 127 |
110 void invalidateBoundRenderTarget() { | 128 void invalidateBoundRenderTarget() { |
111 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; | 129 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; |
112 } | 130 } |
113 | 131 |
114 GrStencilAttachment* createStencilAttachmentForRenderTarget(const GrRenderTa
rget* rt, | 132 GrStencilAttachment* createStencilAttachmentForRenderTarget(const GrRenderTa
rget* rt, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 170 |
153 | 171 |
154 // Returns whether the texture is successfully created. On success, the | 172 // Returns whether the texture is successfully created. On success, the |
155 // result is stored in |info|. | 173 // result is stored in |info|. |
156 // The texture is populated with |texels|, if it exists. | 174 // The texture is populated with |texels|, if it exists. |
157 // The texture parameters are cached in |initialTexParams|. | 175 // The texture parameters are cached in |initialTexParams|. |
158 bool createTextureImpl(const GrSurfaceDesc& desc, GrGLTextureInfo* info, | 176 bool createTextureImpl(const GrSurfaceDesc& desc, GrGLTextureInfo* info, |
159 bool renderTarget, GrGLTexture::TexParams* initialTex
Params, | 177 bool renderTarget, GrGLTexture::TexParams* initialTex
Params, |
160 const SkTArray<GrMipLevel>& texels); | 178 const SkTArray<GrMipLevel>& texels); |
161 | 179 |
162 void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) override; | |
163 | |
164 void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool insideCli
p) override; | |
165 | |
166 bool onMakeCopyForTextureParams(GrTexture*, const GrTextureParams&, | 180 bool onMakeCopyForTextureParams(GrTexture*, const GrTextureParams&, |
167 GrTextureProducer::CopyParams*) const overri
de; | 181 GrTextureProducer::CopyParams*) const overri
de; |
168 | 182 |
169 // Checks whether glReadPixels can be called to get pixel values in readConf
ig from the | 183 // Checks whether glReadPixels can be called to get pixel values in readConf
ig from the |
170 // render target. | 184 // render target. |
171 bool readPixelsSupported(GrRenderTarget* target, GrPixelConfig readConfig); | 185 bool readPixelsSupported(GrRenderTarget* target, GrPixelConfig readConfig); |
172 | 186 |
173 // Checks whether glReadPixels can be called to get pixel values in readConf
ig from a | 187 // Checks whether glReadPixels can be called to get pixel values in readConf
ig from a |
174 // render target that has renderTargetConfig. This may have to create a temp
orary | 188 // render target that has renderTargetConfig. This may have to create a temp
orary |
175 // render target and thus is less preferable than the variant that takes a r
ender target. | 189 // render target and thus is less preferable than the variant that takes a r
ender target. |
(...skipping 16 matching lines...) Expand all Loading... |
192 GrPixelConfig config, | 206 GrPixelConfig config, |
193 const SkTArray<GrMipLevel>& texels) override; | 207 const SkTArray<GrMipLevel>& texels) override; |
194 | 208 |
195 bool onTransferPixels(GrSurface*, | 209 bool onTransferPixels(GrSurface*, |
196 int left, int top, int width, int height, | 210 int left, int top, int width, int height, |
197 GrPixelConfig config, GrBuffer* transferBuffer, | 211 GrPixelConfig config, GrBuffer* transferBuffer, |
198 size_t offset, size_t rowBytes) override; | 212 size_t offset, size_t rowBytes) override; |
199 | 213 |
200 void onResolveRenderTarget(GrRenderTarget* target) override; | 214 void onResolveRenderTarget(GrRenderTarget* target) override; |
201 | 215 |
202 void onDraw(const GrPipeline&, | |
203 const GrPrimitiveProcessor&, | |
204 const GrMesh*, | |
205 int meshCount) override; | |
206 | |
207 bool onCopySurface(GrSurface* dst, | 216 bool onCopySurface(GrSurface* dst, |
208 GrSurface* src, | 217 GrSurface* src, |
209 const SkIRect& srcRect, | 218 const SkIRect& srcRect, |
210 const SkIPoint& dstPoint) override; | 219 const SkIPoint& dstPoint) override; |
211 | 220 |
212 void onGetMultisampleSpecs(GrRenderTarget*, | 221 void onGetMultisampleSpecs(GrRenderTarget*, |
213 const GrStencilSettings&, | 222 const GrStencilSettings&, |
214 int* effectiveSampleCnt, | 223 int* effectiveSampleCnt, |
215 SkAutoTDeleteArray<SkPoint>* sampleLocations) ove
rride; | 224 SkAutoTDeleteArray<SkPoint>* sampleLocations) ove
rride; |
216 | 225 |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 bool fHWPLSEnabled; | 595 bool fHWPLSEnabled; |
587 bool fPLSHasBeenUsed; | 596 bool fPLSHasBeenUsed; |
588 | 597 |
589 float fHWMinSampleShading; | 598 float fHWMinSampleShading; |
590 | 599 |
591 typedef GrGpu INHERITED; | 600 typedef GrGpu INHERITED; |
592 friend class GrGLPathRendering; // For accessing setTextureUnit. | 601 friend class GrGLPathRendering; // For accessing setTextureUnit. |
593 }; | 602 }; |
594 | 603 |
595 #endif | 604 #endif |
OLD | NEW |