Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Side by Side Diff: src/gpu/gl/GrGLGpu.cpp

Issue 1541903002: added support for PLS path rendering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 8
9 #include "GrGLGpu.h" 9 #include "GrGLGpu.h"
10 #include "GrGLGLSL.h" 10 #include "GrGLGLSL.h"
11 #include "GrGLStencilAttachment.h" 11 #include "GrGLStencilAttachment.h"
12 #include "GrGLTextureRenderTarget.h" 12 #include "GrGLTextureRenderTarget.h"
13 #include "GrGpuResourcePriv.h" 13 #include "GrGpuResourcePriv.h"
14 #include "GrPipeline.h" 14 #include "GrPipeline.h"
15 #include "GrPLSGeometryProcessor.h"
15 #include "GrRenderTargetPriv.h" 16 #include "GrRenderTargetPriv.h"
16 #include "GrSurfacePriv.h" 17 #include "GrSurfacePriv.h"
17 #include "GrTexturePriv.h" 18 #include "GrTexturePriv.h"
18 #include "GrTypes.h" 19 #include "GrTypes.h"
19 #include "GrVertices.h" 20 #include "GrVertices.h"
20 #include "builders/GrGLShaderStringBuilder.h" 21 #include "builders/GrGLShaderStringBuilder.h"
21 #include "glsl/GrGLSL.h" 22 #include "glsl/GrGLSL.h"
22 #include "glsl/GrGLSLCaps.h" 23 #include "glsl/GrGLSLCaps.h"
23 #include "SkStrokeRec.h" 24 #include "SkStrokeRec.h"
24 #include "SkTemplates.h" 25 #include "SkTemplates.h"
25 26
26 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) 27 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X)
27 #define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glInterface(), RET, X) 28 #define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glInterface(), RET, X)
28 29
29 #define SKIP_CACHE_CHECK true 30 #define SKIP_CACHE_CHECK true
30 31
31 #if GR_GL_CHECK_ALLOC_WITH_GET_ERROR 32 #if GR_GL_CHECK_ALLOC_WITH_GET_ERROR
32 #define CLEAR_ERROR_BEFORE_ALLOC(iface) GrGLClearErr(iface) 33 #define CLEAR_ERROR_BEFORE_ALLOC(iface) GrGLClearErr(iface)
33 #define GL_ALLOC_CALL(iface, call) GR_GL_CALL_NOERRCHECK(iface, call) 34 #define GL_ALLOC_CALL(iface, call) GR_GL_CALL_NOERRCHECK(iface, call)
34 #define CHECK_ALLOC_ERROR(iface) GR_GL_GET_ERROR(iface) 35 #define CHECK_ALLOC_ERROR(iface) GR_GL_GET_ERROR(iface)
35 #else 36 #else
36 #define CLEAR_ERROR_BEFORE_ALLOC(iface) 37 #define CLEAR_ERROR_BEFORE_ALLOC(iface)
37 #define GL_ALLOC_CALL(iface, call) GR_GL_CALL(iface, call) 38 #define GL_ALLOC_CALL(iface, call) GR_GL_CALL(iface, call)
38 #define CHECK_ALLOC_ERROR(iface) GR_GL_NO_ERROR 39 #define CHECK_ALLOC_ERROR(iface) GR_GL_NO_ERROR
39 #endif 40 #endif
40 41
42 #define GL_SHADER_PIXEL_LOCAL_STORAGE_EXT 0x8F64
43
41 44
42 /////////////////////////////////////////////////////////////////////////////// 45 ///////////////////////////////////////////////////////////////////////////////
43 46
44 47
45 static const GrGLenum gXfermodeEquation2Blend[] = { 48 static const GrGLenum gXfermodeEquation2Blend[] = {
46 // Basic OpenGL blend equations. 49 // Basic OpenGL blend equations.
47 GR_GL_FUNC_ADD, 50 GR_GL_FUNC_ADD,
48 GR_GL_FUNC_SUBTRACT, 51 GR_GL_FUNC_SUBTRACT,
49 GR_GL_FUNC_REVERSE_SUBTRACT, 52 GR_GL_FUNC_REVERSE_SUBTRACT,
50 53
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 fTempSrcFBOID = 0; 220 fTempSrcFBOID = 0;
218 fTempDstFBOID = 0; 221 fTempDstFBOID = 0;
219 fStencilClearFBOID = 0; 222 fStencilClearFBOID = 0;
220 223
221 if (this->glCaps().shaderCaps()->pathRenderingSupport()) { 224 if (this->glCaps().shaderCaps()->pathRenderingSupport()) {
222 fPathRendering.reset(new GrGLPathRendering(this)); 225 fPathRendering.reset(new GrGLPathRendering(this));
223 } 226 }
224 this->createCopyPrograms(); 227 this->createCopyPrograms();
225 fWireRectProgram.fProgram = 0; 228 fWireRectProgram.fProgram = 0;
226 fWireRectArrayBuffer = 0; 229 fWireRectArrayBuffer = 0;
230 #ifdef ENABLE_PLS
231 if (this->glCaps().shaderCaps()->pixelLocalStorageSize() > 0) {
232 this->createPLSSetupProgram();
233 }
234 else {
235 memset(&fPLSSetupProgram, 0, sizeof(fPLSSetupProgram));
236 }
237 fHWPLSEnabled = false;
238 #endif
227 } 239 }
228 240
229 GrGLGpu::~GrGLGpu() { 241 GrGLGpu::~GrGLGpu() {
230 if (0 != fHWProgramID) { 242 if (0 != fHWProgramID) {
231 // detach the current program so there is no confusion on OpenGL's part 243 // detach the current program so there is no confusion on OpenGL's part
232 // that we want it to be deleted 244 // that we want it to be deleted
233 GL_CALL(UseProgram(0)); 245 GL_CALL(UseProgram(0));
234 } 246 }
235 247
236 if (0 != fTempSrcFBOID) { 248 if (0 != fTempSrcFBOID) {
(...skipping 17 matching lines...) Expand all
254 } 266 }
255 267
256 if (0 != fWireRectProgram.fProgram) { 268 if (0 != fWireRectProgram.fProgram) {
257 GL_CALL(DeleteProgram(fWireRectProgram.fProgram)); 269 GL_CALL(DeleteProgram(fWireRectProgram.fProgram));
258 } 270 }
259 271
260 if (0 != fWireRectArrayBuffer) { 272 if (0 != fWireRectArrayBuffer) {
261 GL_CALL(DeleteBuffers(1, &fWireRectArrayBuffer)); 273 GL_CALL(DeleteBuffers(1, &fWireRectArrayBuffer));
262 } 274 }
263 275
276 #ifdef ENABLE_PLS
277 if (0 != fPLSSetupProgram.fArrayBuffer) {
278 GL_CALL(DeleteBuffers(1, &fPLSSetupProgram.fArrayBuffer));
279 }
280
281 if (0 != fPLSSetupProgram.fProgram) {
282 GL_CALL(DeleteProgram(fPLSSetupProgram.fProgram));
283 }
284 #endif
285
264 delete fProgramCache; 286 delete fProgramCache;
265 } 287 }
266 288
289 #ifdef ENABLE_PLS
290 void GrGLGpu::createPLSSetupProgram() {
291 const char* version = this->glCaps().glslCaps()->versionDeclString();
292
293 GrGLSLShaderVar aVertex("a_vertex", kVec2f_GrSLType, GrShaderVar::kAttribute _TypeModifier);
294 GrGLSLShaderVar uTexCoordXform("u_texCoordXform", kVec4f_GrSLType,
295 GrShaderVar::kUniform_TypeModifier);
296 GrGLSLShaderVar uPosXform("u_posXform", kVec4f_GrSLType, GrShaderVar::kUnifo rm_TypeModifier);
297 GrGLSLShaderVar uTexture("u_texture", kSampler2D_GrSLType, GrShaderVar::kUni form_TypeModifier);
298 GrGLSLShaderVar vTexCoord("v_texCoord", kVec2f_GrSLType, GrShaderVar::kVaryi ngOut_TypeModifier);
299
300 SkString vshaderTxt(version);
301 aVertex.appendDecl(this->glCaps().glslCaps(), &vshaderTxt);
302 vshaderTxt.append(";");
303 uTexCoordXform.appendDecl(this->glCaps().glslCaps(), &vshaderTxt);
304 vshaderTxt.append(";");
305 uPosXform.appendDecl(this->glCaps().glslCaps(), &vshaderTxt);
306 vshaderTxt.append(";");
307 vTexCoord.appendDecl(this->glCaps().glslCaps(), &vshaderTxt);
308 vshaderTxt.append(";");
309
310 vshaderTxt.append(
311 "// PLS Setup Program VS\n"
312 "void main() {"
313 " gl_Position.xy = a_vertex * u_posXform.xy + u_posXform.zw;"
314 " gl_Position.zw = vec2(0, 1);"
315 "}"
316 );
317
318 SkString fshaderTxt(version);
319 fshaderTxt.append("#extension GL_ARM_shader_framebuffer_fetch : require\n");
320 fshaderTxt.append("#extension GL_EXT_shader_pixel_local_storage : require\n" );
321 GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision,
322 *this->glCaps().glslCaps(),
323 &fshaderTxt);
324 vTexCoord.setTypeModifier(GrShaderVar::kVaryingIn_TypeModifier);
325 vTexCoord.appendDecl(this->glCaps().glslCaps(), &fshaderTxt);
326 fshaderTxt.append(";");
327 uTexture.appendDecl(this->glCaps().glslCaps(), &fshaderTxt);
328 fshaderTxt.append(";");
329
330 fshaderTxt.appendf(
331 "// PLS Setup Program FS\n"
332 PLS_DATA_DECL
333 "void main() {\n"
334 " pls.dstColor = gl_LastFragColorARM;\n"
335 " pls.windings = ivec4(0, 0, 0, 0);\n"
336 "}"
337 );
338 GL_CALL_RET(fPLSSetupProgram.fProgram, CreateProgram());
339 const char* str;
340 GrGLint length;
341
342 str = vshaderTxt.c_str();
343 length = SkToInt(vshaderTxt.size());
344 GrGLuint vshader = GrGLCompileAndAttachShader(*fGLContext, fPLSSetupProgram. fProgram,
345 GR_GL_VERTEX_SHADER, &str, &le ngth, 1, &fStats);
346
347 str = fshaderTxt.c_str();
348 length = SkToInt(fshaderTxt.size());
349 GrGLuint fshader = GrGLCompileAndAttachShader(*fGLContext, fPLSSetupProgram. fProgram,
350 GR_GL_FRAGMENT_SHADER, &str, & length, 1, &fStats);
351
352 GL_CALL(LinkProgram(fPLSSetupProgram.fProgram));
353
354 GL_CALL_RET(fPLSSetupProgram.fPosXformUniform, GetUniformLocation(fPLSSetupP rogram.fProgram,
355 "u_posXform")) ;
356
357 GL_CALL(BindAttribLocation(fPLSSetupProgram.fProgram, 0, "a_vertex"));
358
359 GL_CALL(DeleteShader(vshader));
360 GL_CALL(DeleteShader(fshader));
361
362 GL_CALL(GenBuffers(1, &fPLSSetupProgram.fArrayBuffer));
363 fHWGeometryState.setVertexBufferID(this, fPLSSetupProgram.fArrayBuffer);
364 static const GrGLfloat vdata[] = {
365 0, 0,
366 0, 1,
367 1, 0,
368 1, 1
369 };
370 GL_ALLOC_CALL(this->glInterface(),
371 BufferData(GR_GL_ARRAY_BUFFER,
372 (GrGLsizeiptr) sizeof(vdata),
373 vdata, // data ptr
374 GR_GL_STATIC_DRAW));
375 }
376 #endif
377
267 void GrGLGpu::contextAbandoned() { 378 void GrGLGpu::contextAbandoned() {
268 INHERITED::contextAbandoned(); 379 INHERITED::contextAbandoned();
269 fProgramCache->abandon(); 380 fProgramCache->abandon();
270 fHWProgramID = 0; 381 fHWProgramID = 0;
271 fTempSrcFBOID = 0; 382 fTempSrcFBOID = 0;
272 fTempDstFBOID = 0; 383 fTempDstFBOID = 0;
273 fStencilClearFBOID = 0; 384 fStencilClearFBOID = 0;
274 fCopyProgramArrayBuffer = 0; 385 fCopyProgramArrayBuffer = 0;
275 for (size_t i = 0; i < SK_ARRAY_COUNT(fCopyPrograms); ++i) { 386 for (size_t i = 0; i < SK_ARRAY_COUNT(fCopyPrograms); ++i) {
276 fCopyPrograms[i].fProgram = 0; 387 fCopyPrograms[i].fProgram = 0;
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 if (!flipY) { 2171 if (!flipY) {
2061 dst += rowBytes; 2172 dst += rowBytes;
2062 } else { 2173 } else {
2063 dst -= rowBytes; 2174 dst -= rowBytes;
2064 } 2175 }
2065 } 2176 }
2066 } 2177 }
2067 return true; 2178 return true;
2068 } 2179 }
2069 2180
2181 void GrGLGpu::performFlushWorkaround() {
2182 #ifdef ENABLE_PLS
2183 if (this->glCaps().shaderCaps()->pixelLocalStorageSize() > 0) {
2184 /* There is an ARM driver bug where if we use PLS, and then draw a f rame which does not
2185 * use PLS, it leaves garbage all over the place. As a workaround, w e use PLS in a
2186 * trivial way every frame.
2187 */
2188 if (kYes_TriState == fHWScissorSettings.fEnabled) {
2189 GL_CALL(Disable(GR_GL_SCISSOR_TEST));
2190 }
2191 GL_CALL(Enable(GL_SHADER_PIXEL_LOCAL_STORAGE_EXT));
2192 this->stampRectUsingProgram(fPLSSetupProgram.fProgram,
2193 SkRect::MakeXYWH(-100.0f, -100.0f, 0.01f , 0.01f),
2194 fPLSSetupProgram.fPosXformUniform,
2195 fPLSSetupProgram.fArrayBuffer);
2196 GL_CALL(Disable(GL_SHADER_PIXEL_LOCAL_STORAGE_EXT));
2197 if (kYes_TriState == fHWScissorSettings.fEnabled) {
2198 GL_CALL(Enable(GR_GL_SCISSOR_TEST));
2199 }
2200 }
2201 #endif
2202 }
2203
2070 void GrGLGpu::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bound) { 2204 void GrGLGpu::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bound) {
2071
2072 SkASSERT(target); 2205 SkASSERT(target);
2073 2206
2074 uint32_t rtID = target->getUniqueID(); 2207 uint32_t rtID = target->getUniqueID();
2075 if (fHWBoundRenderTargetUniqueID != rtID) { 2208 if (fHWBoundRenderTargetUniqueID != rtID) {
2076 fStats.incRenderTargetBinds(); 2209 fStats.incRenderTargetBinds();
2077 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, target->renderFBOID())); 2210 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, target->renderFBOID()));
2078 #ifdef SK_DEBUG 2211 #ifdef SK_DEBUG
2079 // don't do this check in Chromium -- this is causing 2212 // don't do this check in Chromium -- this is causing
2080 // lots of repeated command buffer flushes when the compositor is 2213 // lots of repeated command buffer flushes when the compositor is
2081 // rendering with Ganesh, which is really slow; even too slow for 2214 // rendering with Ganesh, which is really slow; even too slow for
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
2144 } 2277 }
2145 } 2278 }
2146 #endif 2279 #endif
2147 #endif 2280 #endif
2148 2281
2149 void GrGLGpu::onDraw(const DrawArgs& args, const GrNonInstancedVertices& vertice s) { 2282 void GrGLGpu::onDraw(const DrawArgs& args, const GrNonInstancedVertices& vertice s) {
2150 if (!this->flushGLState(args)) { 2283 if (!this->flushGLState(args)) {
2151 return; 2284 return;
2152 } 2285 }
2153 2286
2287 #ifdef ENABLE_PLS
2288 GrPixelLocalStorageState plsState = args.fPrimitiveProcessor->getPixelLo calStorageState();
2289 if (!fHWPLSEnabled && plsState != GrPixelLocalStorageState::kDisabled_St ate) {
2290 GL_CALL(Enable(GL_SHADER_PIXEL_LOCAL_STORAGE_EXT));
2291 this->setupPixelLocalStorage(args);
2292 fHWPLSEnabled = true;
2293 }
2294 if (plsState == GrPixelLocalStorageState::kFinish_State) {
2295 GrStencilSettings stencil;
2296 stencil.setDisabled();
2297 this->flushStencil(stencil);
2298 }
2299 #endif
2300
2154 size_t indexOffsetInBytes = 0; 2301 size_t indexOffsetInBytes = 0;
2155 this->setupGeometry(*args.fPrimitiveProcessor, vertices, &indexOffsetInBytes ); 2302 this->setupGeometry(*args.fPrimitiveProcessor, vertices, &indexOffsetInBytes );
2156 2303
2157 SkASSERT((size_t)vertices.primitiveType() < SK_ARRAY_COUNT(gPrimitiveType2GL Mode)); 2304 SkASSERT((size_t)vertices.primitiveType() < SK_ARRAY_COUNT(gPrimitiveType2GL Mode));
2158 2305
2159 if (vertices.isIndexed()) { 2306 if (vertices.isIndexed()) {
2160 GrGLvoid* indices = 2307 GrGLvoid* indices =
2161 reinterpret_cast<GrGLvoid*>(indexOffsetInBytes + sizeof(uint16_t) * 2308 reinterpret_cast<GrGLvoid*>(indexOffsetInBytes + sizeof(uint16_t) *
2162 vertices.startIndex()); 2309 vertices.startIndex());
2163 // info.startVertex() was accounted for by setupGeometry. 2310 // info.startVertex() was accounted for by setupGeometry.
2164 GL_CALL(DrawElements(gPrimitiveType2GLMode[vertices.primitiveType()], 2311 GL_CALL(DrawElements(gPrimitiveType2GLMode[vertices.primitiveType()],
2165 vertices.indexCount(), 2312 vertices.indexCount(),
2166 GR_GL_UNSIGNED_SHORT, 2313 GR_GL_UNSIGNED_SHORT,
2167 indices)); 2314 indices));
2168 } else { 2315 } else {
2169 // Pass 0 for parameter first. We have to adjust glVertexAttribPointer() to account for 2316 // Pass 0 for parameter first. We have to adjust glVertexAttribPointer() to account for
2170 // startVertex in the DrawElements case. So we always rely on setupGeome try to have 2317 // startVertex in the DrawElements case. So we always rely on setupGeome try to have
2171 // accounted for startVertex. 2318 // accounted for startVertex.
2172 GL_CALL(DrawArrays(gPrimitiveType2GLMode[vertices.primitiveType()], 0, 2319 GL_CALL(DrawArrays(gPrimitiveType2GLMode[vertices.primitiveType()], 0,
2173 vertices.vertexCount())); 2320 vertices.vertexCount()));
2174 } 2321 }
2322
2323 #ifdef ENABLE_PLS
2324 if (fHWPLSEnabled && plsState == GrPixelLocalStorageState::kFinish_State ) {
2325 // PLS draws always involve multiple draws, finishing up with a non- PLS
2326 // draw that writes to the color buffer. That draw ends up here; we wait
2327 // until after it is complete to actually disable PLS.
2328 GL_CALL(Disable(GL_SHADER_PIXEL_LOCAL_STORAGE_EXT));
2329 fHWPLSEnabled = false;
2330 this->disableScissor();
2331 }
2332 #endif
2333
2175 #if SWAP_PER_DRAW 2334 #if SWAP_PER_DRAW
2176 glFlush(); 2335 glFlush();
2177 #if defined(SK_BUILD_FOR_MAC) 2336 #if defined(SK_BUILD_FOR_MAC)
2178 aglSwapBuffers(aglGetCurrentContext()); 2337 aglSwapBuffers(aglGetCurrentContext());
2179 int set_a_break_pt_here = 9; 2338 int set_a_break_pt_here = 9;
2180 aglSwapBuffers(aglGetCurrentContext()); 2339 aglSwapBuffers(aglGetCurrentContext());
2181 #elif defined(SK_BUILD_FOR_WIN32) 2340 #elif defined(SK_BUILD_FOR_WIN32)
2182 SwapBuf(); 2341 SwapBuf();
2183 int set_a_break_pt_here = 9; 2342 int set_a_break_pt_here = 9;
2184 SwapBuf(); 2343 SwapBuf();
2185 #endif 2344 #endif
2186 #endif 2345 #endif
2187 } 2346 }
2188 2347
2348 void GrGLGpu::stampRectUsingProgram(GrGLuint program, const SkRect& bounds, GrGL int posXformUniform,
2349 GrGLuint arrayBuffer) {
2350 GL_CALL(UseProgram(program));
2351 this->fHWGeometryState.setVertexArrayID(this, 0);
2352
2353 GrGLAttribArrayState* attribs =
2354 this->fHWGeometryState.bindArrayAndBufferToDraw(this, arrayBuffer);
2355 attribs->set(this, 0, arrayBuffer, 2, GR_GL_FLOAT, false, 2 * sizeof(GrGLflo at), 0);
2356 attribs->disableUnusedArrays(this, 0x1);
2357
2358 GL_CALL(Uniform4f(posXformUniform, bounds.width(), bounds.height(), bounds.l eft(),
2359 bounds.top()));
2360
2361 GrXferProcessor::BlendInfo blendInfo;
2362 blendInfo.reset();
2363 this->flushBlend(blendInfo);
2364 this->flushColorWrite(true);
2365 this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
2366 if (!fHWStencilSettings.isDisabled()) {
2367 GL_CALL(Disable(GR_GL_STENCIL_TEST));
2368 }
2369 GL_CALL(DrawArrays(GR_GL_TRIANGLE_STRIP, 0, 4));
2370 GL_CALL(UseProgram(fHWProgramID));
2371 if (!fHWStencilSettings.isDisabled()) {
2372 GL_CALL(Enable(GR_GL_STENCIL_TEST));
2373 }
2374 }
2375
2376 #ifdef ENABLE_PLS
2377 void GrGLGpu::setupPixelLocalStorage(const DrawArgs& args) {
2378 const SkRect& bounds =
2379 static_cast<const GrPLSGeometryProcessor*>(args.fPrimitiveProcessor) ->fBounds;
2380 // setup pixel local storage -- this means capturing and storing the current framebuffer color
2381 // and initializing the winding counts to zero
2382 GrRenderTarget* rt = args.fPipeline->getRenderTarget();
2383 SkScalar width = rt->width();
2384 SkScalar height = rt->height();
2385 // dst rect edges in NDC (-1 to 1)
2386 // having some issues with rounding, just expand the bounds by 1 and trust t he scissor to keep
2387 // it contained properly
2388 GrGLfloat dx0 = 2.0f * (bounds.left() - 1) / width - 1.0f;
2389 GrGLfloat dx1 = 2.0f * (bounds.right() + 1) / width - 1.0f;
2390 GrGLfloat dy0 = -2.0f * (bounds.top() - 1) / height + 1.0f;
2391 GrGLfloat dy1 = -2.0f * (bounds.bottom() + 1) / height + 1.0f;
2392 SkRect deviceBounds = SkRect::MakeXYWH(dx0, dy0, dx1 - dx0, dy1 - dy0);
2393
2394 GL_CALL(Enable(GR_GL_FETCH_PER_SAMPLE_ARM));
2395 this->stampRectUsingProgram(fPLSSetupProgram.fProgram, deviceBounds,
2396 fPLSSetupProgram.fPosXformUniform, fPLSSetupProg ram.fArrayBuffer);
2397 }
2398 #endif
2399
2189 void GrGLGpu::onResolveRenderTarget(GrRenderTarget* target) { 2400 void GrGLGpu::onResolveRenderTarget(GrRenderTarget* target) {
2190 GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(target); 2401 GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(target);
2191 if (rt->needsResolve()) { 2402 if (rt->needsResolve()) {
2192 // Some extensions automatically resolves the texture when it is read. 2403 // Some extensions automatically resolves the texture when it is read.
2193 if (this->glCaps().usesMSAARenderBuffers()) { 2404 if (this->glCaps().usesMSAARenderBuffers()) {
2194 SkASSERT(rt->textureFBOID() != rt->renderFBOID()); 2405 SkASSERT(rt->textureFBOID() != rt->renderFBOID());
2195 fStats.incRenderTargetBinds(); 2406 fStats.incRenderTargetBinds();
2196 fStats.incRenderTargetBinds(); 2407 fStats.incRenderTargetBinds();
2197 GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER, rt->renderFBOID())); 2408 GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER, rt->renderFBOID()));
2198 GL_CALL(BindFramebuffer(GR_GL_DRAW_FRAMEBUFFER, rt->textureFBOID())) ; 2409 GL_CALL(BindFramebuffer(GR_GL_DRAW_FRAMEBUFFER, rt->textureFBOID())) ;
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
3372 this->setVertexArrayID(gpu, 0); 3583 this->setVertexArrayID(gpu, 0);
3373 } 3584 }
3374 int attrCount = gpu->glCaps().maxVertexAttributes(); 3585 int attrCount = gpu->glCaps().maxVertexAttributes();
3375 if (fDefaultVertexArrayAttribState.count() != attrCount) { 3586 if (fDefaultVertexArrayAttribState.count() != attrCount) {
3376 fDefaultVertexArrayAttribState.resize(attrCount); 3587 fDefaultVertexArrayAttribState.resize(attrCount);
3377 } 3588 }
3378 attribState = &fDefaultVertexArrayAttribState; 3589 attribState = &fDefaultVertexArrayAttribState;
3379 } 3590 }
3380 return attribState; 3591 return attribState;
3381 } 3592 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698