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

Side by Side Diff: Source/core/html/canvas/WebGLRenderingContext.cpp

Issue 127493002: Removed most calls to GraphicsContext3D from DrawingBuffer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 size_t WebGLRenderingContext::oldestContextIndex() 120 size_t WebGLRenderingContext::oldestContextIndex()
121 { 121 {
122 if (!activeContexts().size()) 122 if (!activeContexts().size())
123 return maxGLActiveContexts; 123 return maxGLActiveContexts;
124 124
125 WebGLRenderingContext* candidate = activeContexts().first(); 125 WebGLRenderingContext* candidate = activeContexts().first();
126 size_t candidateID = 0; 126 size_t candidateID = 0;
127 for (size_t ii = 1; ii < activeContexts().size(); ++ii) { 127 for (size_t ii = 1; ii < activeContexts().size(); ++ii) {
128 WebGLRenderingContext* context = activeContexts()[ii]; 128 WebGLRenderingContext* context = activeContexts()[ii];
129 if (context->graphicsContext3D() && candidate->graphicsContext3D() && co ntext->graphicsContext3D()->lastFlushID() < candidate->graphicsContext3D()->last FlushID()) { 129 if (context->webGraphicsContext3D() && candidate->webGraphicsContext3D() && context->webGraphicsContext3D()->lastFlushID() < candidate->webGraphicsConte xt3D()->lastFlushID()) {
130 candidate = context; 130 candidate = context;
131 candidateID = ii; 131 candidateID = ii;
132 } 132 }
133 } 133 }
134 134
135 return candidateID; 135 return candidateID;
136 } 136 }
137 137
138 IntSize WebGLRenderingContext::oldestContextSize() 138 IntSize WebGLRenderingContext::oldestContextSize()
139 { 139 {
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 m_contextGroup = WebGLContextGroup::create(); 570 m_contextGroup = WebGLContextGroup::create();
571 m_contextGroup->addContext(this); 571 m_contextGroup->addContext(this);
572 572
573 m_maxViewportDims[0] = m_maxViewportDims[1] = 0; 573 m_maxViewportDims[0] = m_maxViewportDims[1] = 0;
574 m_context->getIntegerv(GL_MAX_VIEWPORT_DIMS, m_maxViewportDims); 574 m_context->getIntegerv(GL_MAX_VIEWPORT_DIMS, m_maxViewportDims);
575 575
576 RefPtr<WebGLRenderingContextEvictionManager> contextEvictionManager = adoptR ef(new WebGLRenderingContextEvictionManager()); 576 RefPtr<WebGLRenderingContextEvictionManager> contextEvictionManager = adoptR ef(new WebGLRenderingContextEvictionManager());
577 577
578 // Create the DrawingBuffer and initialize the platform layer. 578 // Create the DrawingBuffer and initialize the platform layer.
579 DrawingBuffer::PreserveDrawingBuffer preserve = preserveDrawingBuffer ? Draw ingBuffer::Preserve : DrawingBuffer::Discard; 579 DrawingBuffer::PreserveDrawingBuffer preserve = preserveDrawingBuffer ? Draw ingBuffer::Preserve : DrawingBuffer::Discard;
580 m_drawingBuffer = DrawingBuffer::create(m_contextSupport.get(), clampedCanva sSize(), preserve, contextEvictionManager.release()); 580 m_drawingBuffer = DrawingBuffer::create(m_context.get(), clampedCanvasSize() , preserve, contextEvictionManager.release());
581 581
582 if (!m_drawingBuffer->isZeroSized()) { 582 if (!m_drawingBuffer->isZeroSized()) {
583 m_drawingBuffer->bind(); 583 m_drawingBuffer->bind();
584 setupFlags(); 584 setupFlags();
585 initializeNewContext(); 585 initializeNewContext();
586 } 586 }
587 587
588 // Register extensions. 588 // Register extensions.
589 static const char* const webkitPrefix[] = { "WEBKIT_", 0, }; 589 static const char* const webkitPrefix[] = { "WEBKIT_", 0, };
590 static const char* const bothPrefixes[] = { "", "WEBKIT_", 0, }; 590 static const char* const bothPrefixes[] = { "", "WEBKIT_", 0, };
(...skipping 4834 matching lines...) Expand 10 before | Expand all | Expand 10 after
5425 synthesizeGLError(GL_INVALID_OPERATION, "", "error restoring context "); 5425 synthesizeGLError(GL_INVALID_OPERATION, "", "error restoring context ");
5426 } 5426 }
5427 return; 5427 return;
5428 } 5428 }
5429 5429
5430 RefPtr<WebGLRenderingContextEvictionManager> contextEvictionManager = adoptR ef(new WebGLRenderingContextEvictionManager()); 5430 RefPtr<WebGLRenderingContextEvictionManager> contextEvictionManager = adoptR ef(new WebGLRenderingContextEvictionManager());
5431 5431
5432 // Construct a new drawing buffer with the new GraphicsContext3D. 5432 // Construct a new drawing buffer with the new GraphicsContext3D.
5433 m_drawingBuffer->releaseResources(); 5433 m_drawingBuffer->releaseResources();
5434 DrawingBuffer::PreserveDrawingBuffer preserve = m_preserveDrawingBuffer ? Dr awingBuffer::Preserve : DrawingBuffer::Discard; 5434 DrawingBuffer::PreserveDrawingBuffer preserve = m_preserveDrawingBuffer ? Dr awingBuffer::Preserve : DrawingBuffer::Discard;
5435 m_drawingBuffer = DrawingBuffer::create(contextSupport.get(), clampedCanvasS ize(), preserve, contextEvictionManager.release()); 5435 m_drawingBuffer = DrawingBuffer::create(context.get(), clampedCanvasSize(), preserve, contextEvictionManager.release());
5436 5436
5437 if (m_drawingBuffer->isZeroSized()) 5437 if (m_drawingBuffer->isZeroSized())
5438 return; 5438 return;
5439 5439
5440 m_drawingBuffer->bind(); 5440 m_drawingBuffer->bind();
5441 5441
5442 m_lostContextErrors.clear(); 5442 m_lostContextErrors.clear();
5443 5443
5444 m_contextSupport = contextSupport; 5444 m_contextSupport = contextSupport;
5445 m_context = context.release(); 5445 m_context = context.release();
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
5637 if (m_textureUnits[i].m_texture2DBinding 5637 if (m_textureUnits[i].m_texture2DBinding
5638 || m_textureUnits[i].m_textureCubeMapBinding) { 5638 || m_textureUnits[i].m_textureCubeMapBinding) {
5639 m_onePlusMaxNonDefaultTextureUnit = i + 1; 5639 m_onePlusMaxNonDefaultTextureUnit = i + 1;
5640 return; 5640 return;
5641 } 5641 }
5642 } 5642 }
5643 m_onePlusMaxNonDefaultTextureUnit = 0; 5643 m_onePlusMaxNonDefaultTextureUnit = 0;
5644 } 5644 }
5645 5645
5646 } // namespace WebCore 5646 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/platform/graphics/GraphicsContext3D.h » ('j') | Source/platform/graphics/gpu/DrawingBuffer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698