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

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: fix for ASAN failure Created 4 years, 10 months 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
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | src/gpu/gl/GrGLProgram.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
24 #include "glsl/GrGLSLPLSPathRendering.h"
23 #include "SkStrokeRec.h" 25 #include "SkStrokeRec.h"
24 #include "SkTemplates.h" 26 #include "SkTemplates.h"
25 27
26 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) 28 #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) 29 #define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glInterface(), RET, X)
28 30
29 #define SKIP_CACHE_CHECK true 31 #define SKIP_CACHE_CHECK true
30 32
31 #if GR_GL_CHECK_ALLOC_WITH_GET_ERROR 33 #if GR_GL_CHECK_ALLOC_WITH_GET_ERROR
32 #define CLEAR_ERROR_BEFORE_ALLOC(iface) GrGLClearErr(iface) 34 #define CLEAR_ERROR_BEFORE_ALLOC(iface) GrGLClearErr(iface)
33 #define GL_ALLOC_CALL(iface, call) GR_GL_CALL_NOERRCHECK(iface, call) 35 #define GL_ALLOC_CALL(iface, call) GR_GL_CALL_NOERRCHECK(iface, call)
34 #define CHECK_ALLOC_ERROR(iface) GR_GL_GET_ERROR(iface) 36 #define CHECK_ALLOC_ERROR(iface) GR_GL_GET_ERROR(iface)
35 #else 37 #else
36 #define CLEAR_ERROR_BEFORE_ALLOC(iface) 38 #define CLEAR_ERROR_BEFORE_ALLOC(iface)
37 #define GL_ALLOC_CALL(iface, call) GR_GL_CALL(iface, call) 39 #define GL_ALLOC_CALL(iface, call) GR_GL_CALL(iface, call)
38 #define CHECK_ALLOC_ERROR(iface) GR_GL_NO_ERROR 40 #define CHECK_ALLOC_ERROR(iface) GR_GL_NO_ERROR
39 #endif 41 #endif
40 42
41
42 /////////////////////////////////////////////////////////////////////////////// 43 ///////////////////////////////////////////////////////////////////////////////
43 44
44 45
45 static const GrGLenum gXfermodeEquation2Blend[] = { 46 static const GrGLenum gXfermodeEquation2Blend[] = {
46 // Basic OpenGL blend equations. 47 // Basic OpenGL blend equations.
47 GR_GL_FUNC_ADD, 48 GR_GL_FUNC_ADD,
48 GR_GL_FUNC_SUBTRACT, 49 GR_GL_FUNC_SUBTRACT,
49 GR_GL_FUNC_REVERSE_SUBTRACT, 50 GR_GL_FUNC_REVERSE_SUBTRACT,
50 51
51 // GL_KHR_blend_equation_advanced. 52 // GL_KHR_blend_equation_advanced.
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 fTempSrcFBOID = 0; 218 fTempSrcFBOID = 0;
218 fTempDstFBOID = 0; 219 fTempDstFBOID = 0;
219 fStencilClearFBOID = 0; 220 fStencilClearFBOID = 0;
220 221
221 if (this->glCaps().shaderCaps()->pathRenderingSupport()) { 222 if (this->glCaps().shaderCaps()->pathRenderingSupport()) {
222 fPathRendering.reset(new GrGLPathRendering(this)); 223 fPathRendering.reset(new GrGLPathRendering(this));
223 } 224 }
224 this->createCopyPrograms(); 225 this->createCopyPrograms();
225 fWireRectProgram.fProgram = 0; 226 fWireRectProgram.fProgram = 0;
226 fWireRectArrayBuffer = 0; 227 fWireRectArrayBuffer = 0;
228 if (this->glCaps().shaderCaps()->plsPathRenderingSupport()) {
229 this->createPLSSetupProgram();
230 }
231 else {
232 memset(&fPLSSetupProgram, 0, sizeof(fPLSSetupProgram));
233 }
234 fHWPLSEnabled = false;
235 fPLSHasBeenUsed = false;
227 } 236 }
228 237
229 GrGLGpu::~GrGLGpu() { 238 GrGLGpu::~GrGLGpu() {
230 // Delete the path rendering explicitly, since it will need working gpu obje ct to release the 239 // Delete the path rendering explicitly, since it will need working gpu obje ct to release the
231 // resources the object itself holds. 240 // resources the object itself holds.
232 fPathRendering.reset(); 241 fPathRendering.reset();
233 242
234 if (0 != fHWProgramID) { 243 if (0 != fHWProgramID) {
235 // detach the current program so there is no confusion on OpenGL's part 244 // detach the current program so there is no confusion on OpenGL's part
236 // that we want it to be deleted 245 // that we want it to be deleted
(...skipping 21 matching lines...) Expand all
258 } 267 }
259 268
260 if (0 != fWireRectProgram.fProgram) { 269 if (0 != fWireRectProgram.fProgram) {
261 GL_CALL(DeleteProgram(fWireRectProgram.fProgram)); 270 GL_CALL(DeleteProgram(fWireRectProgram.fProgram));
262 } 271 }
263 272
264 if (0 != fWireRectArrayBuffer) { 273 if (0 != fWireRectArrayBuffer) {
265 GL_CALL(DeleteBuffers(1, &fWireRectArrayBuffer)); 274 GL_CALL(DeleteBuffers(1, &fWireRectArrayBuffer));
266 } 275 }
267 276
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
268 delete fProgramCache; 285 delete fProgramCache;
269 } 286 }
270 287
288 void GrGLGpu::createPLSSetupProgram() {
289 const char* version = this->glCaps().glslCaps()->versionDeclString();
290
291 GrGLSLShaderVar aVertex("a_vertex", kVec2f_GrSLType, GrShaderVar::kAttribute _TypeModifier);
292 GrGLSLShaderVar uTexCoordXform("u_texCoordXform", kVec4f_GrSLType,
293 GrShaderVar::kUniform_TypeModifier);
294 GrGLSLShaderVar uPosXform("u_posXform", kVec4f_GrSLType, GrShaderVar::kUnifo rm_TypeModifier);
295 GrGLSLShaderVar uTexture("u_texture", kSampler2D_GrSLType, GrShaderVar::kUni form_TypeModifier);
296 GrGLSLShaderVar vTexCoord("v_texCoord", kVec2f_GrSLType, GrShaderVar::kVaryi ngOut_TypeModifier);
297
298 SkString vshaderTxt(version);
299 aVertex.appendDecl(this->glCaps().glslCaps(), &vshaderTxt);
300 vshaderTxt.append(";");
301 uTexCoordXform.appendDecl(this->glCaps().glslCaps(), &vshaderTxt);
302 vshaderTxt.append(";");
303 uPosXform.appendDecl(this->glCaps().glslCaps(), &vshaderTxt);
304 vshaderTxt.append(";");
305 vTexCoord.appendDecl(this->glCaps().glslCaps(), &vshaderTxt);
306 vshaderTxt.append(";");
307
308 vshaderTxt.append(
309 "// PLS Setup Program VS\n"
310 "void main() {"
311 " gl_Position.xy = a_vertex * u_posXform.xy + u_posXform.zw;"
312 " gl_Position.zw = vec2(0, 1);"
313 "}"
314 );
315
316 SkString fshaderTxt(version);
317 fshaderTxt.append("#extension ");
318 fshaderTxt.append(this->glCaps().glslCaps()->fbFetchExtensionString());
319 fshaderTxt.append(" : 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 GR_GL_PLS_PATH_DATA_DECL
333 "void main() {\n"
334 " " GR_GL_PLS_DSTCOLOR_NAME " = 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
271 void GrGLGpu::contextAbandoned() { 377 void GrGLGpu::contextAbandoned() {
272 INHERITED::contextAbandoned(); 378 INHERITED::contextAbandoned();
273 fProgramCache->abandon(); 379 fProgramCache->abandon();
274 fHWProgramID = 0; 380 fHWProgramID = 0;
275 fTempSrcFBOID = 0; 381 fTempSrcFBOID = 0;
276 fTempDstFBOID = 0; 382 fTempDstFBOID = 0;
277 fStencilClearFBOID = 0; 383 fStencilClearFBOID = 0;
278 fCopyProgramArrayBuffer = 0; 384 fCopyProgramArrayBuffer = 0;
279 for (size_t i = 0; i < SK_ARRAY_COUNT(fCopyPrograms); ++i) { 385 for (size_t i = 0; i < SK_ARRAY_COUNT(fCopyPrograms); ++i) {
280 fCopyPrograms[i].fProgram = 0; 386 fCopyPrograms[i].fProgram = 0;
(...skipping 1980 matching lines...) Expand 10 before | Expand all | Expand 10 after
2261 if (!flipY) { 2367 if (!flipY) {
2262 dst += rowBytes; 2368 dst += rowBytes;
2263 } else { 2369 } else {
2264 dst -= rowBytes; 2370 dst -= rowBytes;
2265 } 2371 }
2266 } 2372 }
2267 } 2373 }
2268 return true; 2374 return true;
2269 } 2375 }
2270 2376
2377 void GrGLGpu::performFlushWorkaround() {
2378 if (fPLSHasBeenUsed) {
2379 /* There is an ARM driver bug where if we use PLS, and then draw a frame which does not
2380 * use PLS, it leaves garbage all over the place. As a workaround, we us e PLS in a
2381 * trivial way every frame. And since we use it every frame, there's nev er a point at which
2382 * it becomes safe to stop using this workaround once we start.
2383 */
2384 this->disableScissor();
2385 // using PLS in the presence of MSAA results in GL_INVALID_OPERATION
2386 this->flushHWAAState(nullptr, false);
2387 SkASSERT(!fHWPLSEnabled);
2388 SkASSERT(fMSAAEnabled != kYes_TriState);
2389 GL_CALL(Enable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE));
2390 this->stampRectUsingProgram(fPLSSetupProgram.fProgram,
2391 SkRect::MakeXYWH(-100.0f, -100.0f, 0.01f, 0. 01f),
2392 fPLSSetupProgram.fPosXformUniform,
2393 fPLSSetupProgram.fArrayBuffer);
2394 GL_CALL(Disable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE));
2395 }
2396 }
2397
2271 void GrGLGpu::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bound) { 2398 void GrGLGpu::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bound) {
2272
2273 SkASSERT(target); 2399 SkASSERT(target);
2274 2400
2275 uint32_t rtID = target->getUniqueID(); 2401 uint32_t rtID = target->getUniqueID();
2276 if (fHWBoundRenderTargetUniqueID != rtID) { 2402 if (fHWBoundRenderTargetUniqueID != rtID) {
2277 fStats.incRenderTargetBinds(); 2403 fStats.incRenderTargetBinds();
2278 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, target->renderFBOID())); 2404 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, target->renderFBOID()));
2279 #ifdef SK_DEBUG 2405 #ifdef SK_DEBUG
2280 // don't do this check in Chromium -- this is causing 2406 // don't do this check in Chromium -- this is causing
2281 // lots of repeated command buffer flushes when the compositor is 2407 // lots of repeated command buffer flushes when the compositor is
2282 // rendering with Ganesh, which is really slow; even too slow for 2408 // rendering with Ganesh, which is really slow; even too slow for
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
2345 } 2471 }
2346 } 2472 }
2347 #endif 2473 #endif
2348 #endif 2474 #endif
2349 2475
2350 void GrGLGpu::onDraw(const DrawArgs& args, const GrNonInstancedVertices& vertice s) { 2476 void GrGLGpu::onDraw(const DrawArgs& args, const GrNonInstancedVertices& vertice s) {
2351 if (!this->flushGLState(args)) { 2477 if (!this->flushGLState(args)) {
2352 return; 2478 return;
2353 } 2479 }
2354 2480
2481 GrPixelLocalStorageState plsState = args.fPrimitiveProcessor->getPixelLocalS torageState();
2482 if (!fHWPLSEnabled && plsState !=
2483 GrPixelLocalStorageState::kDisabled_GrPixelLocalStorageState) {
2484 GL_CALL(Enable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE));
2485 this->setupPixelLocalStorage(args);
2486 fHWPLSEnabled = true;
2487 }
2488 if (plsState == GrPixelLocalStorageState::kFinish_GrPixelLocalStorageState) {
2489 GrStencilSettings stencil;
2490 stencil.setDisabled();
2491 this->flushStencil(stencil);
2492 }
2493
2355 size_t indexOffsetInBytes = 0; 2494 size_t indexOffsetInBytes = 0;
2356 this->setupGeometry(*args.fPrimitiveProcessor, vertices, &indexOffsetInBytes ); 2495 this->setupGeometry(*args.fPrimitiveProcessor, vertices, &indexOffsetInBytes );
2357 2496
2358 SkASSERT((size_t)vertices.primitiveType() < SK_ARRAY_COUNT(gPrimitiveType2GL Mode)); 2497 SkASSERT((size_t)vertices.primitiveType() < SK_ARRAY_COUNT(gPrimitiveType2GL Mode));
2359 2498
2360 if (vertices.isIndexed()) { 2499 if (vertices.isIndexed()) {
2361 GrGLvoid* indices = 2500 GrGLvoid* indices =
2362 reinterpret_cast<GrGLvoid*>(indexOffsetInBytes + sizeof(uint16_t) * 2501 reinterpret_cast<GrGLvoid*>(indexOffsetInBytes + sizeof(uint16_t) *
2363 vertices.startIndex()); 2502 vertices.startIndex());
2364 // info.startVertex() was accounted for by setupGeometry. 2503 // info.startVertex() was accounted for by setupGeometry.
2365 GL_CALL(DrawElements(gPrimitiveType2GLMode[vertices.primitiveType()], 2504 GL_CALL(DrawElements(gPrimitiveType2GLMode[vertices.primitiveType()],
2366 vertices.indexCount(), 2505 vertices.indexCount(),
2367 GR_GL_UNSIGNED_SHORT, 2506 GR_GL_UNSIGNED_SHORT,
2368 indices)); 2507 indices));
2369 } else { 2508 } else {
2370 // Pass 0 for parameter first. We have to adjust glVertexAttribPointer() to account for 2509 // Pass 0 for parameter first. We have to adjust glVertexAttribPointer() to account for
2371 // startVertex in the DrawElements case. So we always rely on setupGeome try to have 2510 // startVertex in the DrawElements case. So we always rely on setupGeome try to have
2372 // accounted for startVertex. 2511 // accounted for startVertex.
2373 GL_CALL(DrawArrays(gPrimitiveType2GLMode[vertices.primitiveType()], 0, 2512 GL_CALL(DrawArrays(gPrimitiveType2GLMode[vertices.primitiveType()], 0,
2374 vertices.vertexCount())); 2513 vertices.vertexCount()));
2375 } 2514 }
2515
2516 if (fHWPLSEnabled && plsState == GrPixelLocalStorageState::kFinish_GrPixelLo calStorageState) {
2517 // PLS draws always involve multiple draws, finishing up with a non-PLS
2518 // draw that writes to the color buffer. That draw ends up here; we wait
2519 // until after it is complete to actually disable PLS.
2520 GL_CALL(Disable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE));
2521 fHWPLSEnabled = false;
2522 this->disableScissor();
2523 }
2524
2376 #if SWAP_PER_DRAW 2525 #if SWAP_PER_DRAW
2377 glFlush(); 2526 glFlush();
2378 #if defined(SK_BUILD_FOR_MAC) 2527 #if defined(SK_BUILD_FOR_MAC)
2379 aglSwapBuffers(aglGetCurrentContext()); 2528 aglSwapBuffers(aglGetCurrentContext());
2380 int set_a_break_pt_here = 9; 2529 int set_a_break_pt_here = 9;
2381 aglSwapBuffers(aglGetCurrentContext()); 2530 aglSwapBuffers(aglGetCurrentContext());
2382 #elif defined(SK_BUILD_FOR_WIN32) 2531 #elif defined(SK_BUILD_FOR_WIN32)
2383 SwapBuf(); 2532 SwapBuf();
2384 int set_a_break_pt_here = 9; 2533 int set_a_break_pt_here = 9;
2385 SwapBuf(); 2534 SwapBuf();
2386 #endif 2535 #endif
2387 #endif 2536 #endif
2388 } 2537 }
2389 2538
2539 void GrGLGpu::stampRectUsingProgram(GrGLuint program, const SkRect& bounds, GrGL int posXformUniform,
2540 GrGLuint arrayBuffer) {
2541 GL_CALL(UseProgram(program));
2542 this->fHWGeometryState.setVertexArrayID(this, 0);
2543
2544 GrGLAttribArrayState* attribs =
2545 this->fHWGeometryState.bindArrayAndBufferToDraw(this, arrayBuffer);
2546 attribs->set(this, 0, arrayBuffer, 2, GR_GL_FLOAT, false, 2 * sizeof(GrGLflo at), 0);
2547 attribs->disableUnusedArrays(this, 0x1);
2548
2549 GL_CALL(Uniform4f(posXformUniform, bounds.width(), bounds.height(), bounds.l eft(),
2550 bounds.top()));
2551
2552 GrXferProcessor::BlendInfo blendInfo;
2553 blendInfo.reset();
2554 this->flushBlend(blendInfo, GrSwizzle());
2555 this->flushColorWrite(true);
2556 this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
2557 if (!fHWStencilSettings.isDisabled()) {
2558 GL_CALL(Disable(GR_GL_STENCIL_TEST));
2559 }
2560 GL_CALL(DrawArrays(GR_GL_TRIANGLE_STRIP, 0, 4));
2561 GL_CALL(UseProgram(fHWProgramID));
2562 if (!fHWStencilSettings.isDisabled()) {
2563 GL_CALL(Enable(GR_GL_STENCIL_TEST));
2564 }
2565 }
2566
2567 void GrGLGpu::setupPixelLocalStorage(const DrawArgs& args) {
2568 fPLSHasBeenUsed = true;
2569 const SkRect& bounds =
2570 static_cast<const GrPLSGeometryProcessor*>(args.fPrimitiveProcessor) ->getBounds();
2571 // setup pixel local storage -- this means capturing and storing the current framebuffer color
2572 // and initializing the winding counts to zero
2573 GrRenderTarget* rt = args.fPipeline->getRenderTarget();
2574 SkScalar width = SkIntToScalar(rt->width());
2575 SkScalar height = SkIntToScalar(rt->height());
2576 // dst rect edges in NDC (-1 to 1)
2577 // having some issues with rounding, just expand the bounds by 1 and trust t he scissor to keep
2578 // it contained properly
2579 GrGLfloat dx0 = 2.0f * (bounds.left() - 1) / width - 1.0f;
2580 GrGLfloat dx1 = 2.0f * (bounds.right() + 1) / width - 1.0f;
2581 GrGLfloat dy0 = -2.0f * (bounds.top() - 1) / height + 1.0f;
2582 GrGLfloat dy1 = -2.0f * (bounds.bottom() + 1) / height + 1.0f;
2583 SkRect deviceBounds = SkRect::MakeXYWH(dx0, dy0, dx1 - dx0, dy1 - dy0);
2584
2585 GL_CALL(Enable(GR_GL_FETCH_PER_SAMPLE_ARM));
2586 this->stampRectUsingProgram(fPLSSetupProgram.fProgram, deviceBounds,
2587 fPLSSetupProgram.fPosXformUniform, fPLSSetupProg ram.fArrayBuffer);
2588 }
2589
2390 void GrGLGpu::onResolveRenderTarget(GrRenderTarget* target) { 2590 void GrGLGpu::onResolveRenderTarget(GrRenderTarget* target) {
2391 GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(target); 2591 GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(target);
2392 if (rt->needsResolve()) { 2592 if (rt->needsResolve()) {
2393 // Some extensions automatically resolves the texture when it is read. 2593 // Some extensions automatically resolves the texture when it is read.
2394 if (this->glCaps().usesMSAARenderBuffers()) { 2594 if (this->glCaps().usesMSAARenderBuffers()) {
2395 SkASSERT(rt->textureFBOID() != rt->renderFBOID()); 2595 SkASSERT(rt->textureFBOID() != rt->renderFBOID());
2396 fStats.incRenderTargetBinds(); 2596 fStats.incRenderTargetBinds();
2397 fStats.incRenderTargetBinds(); 2597 fStats.incRenderTargetBinds();
2398 GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER, rt->renderFBOID())); 2598 GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER, rt->renderFBOID()));
2399 GL_CALL(BindFramebuffer(GR_GL_DRAW_FRAMEBUFFER, rt->textureFBOID())) ; 2599 GL_CALL(BindFramebuffer(GR_GL_DRAW_FRAMEBUFFER, rt->textureFBOID())) ;
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after
3623 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || 3823 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() ||
3624 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { 3824 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) {
3625 copyParams->fFilter = GrTextureParams::kNone_FilterMode; 3825 copyParams->fFilter = GrTextureParams::kNone_FilterMode;
3626 copyParams->fWidth = texture->width(); 3826 copyParams->fWidth = texture->width();
3627 copyParams->fHeight = texture->height(); 3827 copyParams->fHeight = texture->height();
3628 return true; 3828 return true;
3629 } 3829 }
3630 } 3830 }
3631 return false; 3831 return false;
3632 } 3832 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | src/gpu/gl/GrGLProgram.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698