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

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

Issue 1099853002: WebGL: add targets for WebGL 2 when check FBO targets (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: addressed kbr@'s feedback Created 5 years, 7 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 | « Source/core/html/canvas/WebGLRenderingContextBase.h ('k') | no next file » | 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 (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 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 1360
1361 void WebGLRenderingContextBase::bufferSubData(GLenum target, long long offset, D OMArrayBufferView* data) 1361 void WebGLRenderingContextBase::bufferSubData(GLenum target, long long offset, D OMArrayBufferView* data)
1362 { 1362 {
1363 if (isContextLost()) 1363 if (isContextLost())
1364 return; 1364 return;
1365 if (!data) 1365 if (!data)
1366 return; 1366 return;
1367 bufferSubDataImpl(target, offset, data->byteLength(), data->baseAddress()); 1367 bufferSubDataImpl(target, offset, data->byteLength(), data->baseAddress());
1368 } 1368 }
1369 1369
1370 bool WebGLRenderingContextBase::validateFramebufferTarget(GLenum target)
1371 {
1372 if (target == GL_FRAMEBUFFER)
1373 return true;
1374 return false;
1375 }
1376
1377 WebGLFramebuffer* WebGLRenderingContextBase::getFramebufferBinding(GLenum target )
1378 {
1379 return m_framebufferBinding.get();
1380 }
1381
1370 GLenum WebGLRenderingContextBase::checkFramebufferStatus(GLenum target) 1382 GLenum WebGLRenderingContextBase::checkFramebufferStatus(GLenum target)
1371 { 1383 {
1372 if (isContextLost()) 1384 if (isContextLost())
1373 return GL_FRAMEBUFFER_UNSUPPORTED; 1385 return GL_FRAMEBUFFER_UNSUPPORTED;
1374 if (target != GL_FRAMEBUFFER) { 1386 if (!validateFramebufferTarget(target)) {
1375 synthesizeGLError(GL_INVALID_ENUM, "checkFramebufferStatus", "invalid ta rget"); 1387 synthesizeGLError(GL_INVALID_ENUM, "checkFramebufferStatus", "invalid ta rget");
1376 return 0; 1388 return 0;
1377 } 1389 }
1378 if (!m_framebufferBinding || !m_framebufferBinding->object()) 1390 if (!getFramebufferBinding(target) || !getFramebufferBinding(target)->object ())
1379 return GL_FRAMEBUFFER_COMPLETE; 1391 return GL_FRAMEBUFFER_COMPLETE;
1380 const char* reason = "framebuffer incomplete"; 1392 const char* reason = "framebuffer incomplete";
1381 GLenum result = m_framebufferBinding->checkStatus(&reason); 1393 GLenum result = m_framebufferBinding->checkStatus(&reason);
1382 if (result != GL_FRAMEBUFFER_COMPLETE) { 1394 if (result != GL_FRAMEBUFFER_COMPLETE) {
1383 emitGLWarning("checkFramebufferStatus", reason); 1395 emitGLWarning("checkFramebufferStatus", reason);
1384 return result; 1396 return result;
1385 } 1397 }
1386 result = webContext()->checkFramebufferStatus(target); 1398 result = webContext()->checkFramebufferStatus(target);
1387 return result; 1399 return result;
1388 } 1400 }
(...skipping 4068 matching lines...) Expand 10 before | Expand all | Expand 10 after
5457 5469
5458 void WebGLRenderingContextBase::printWarningToConsole(const String& message) 5470 void WebGLRenderingContextBase::printWarningToConsole(const String& message)
5459 { 5471 {
5460 if (!canvas()) 5472 if (!canvas())
5461 return; 5473 return;
5462 canvas()->document().addConsoleMessage(ConsoleMessage::create(RenderingMessa geSource, WarningMessageLevel, message)); 5474 canvas()->document().addConsoleMessage(ConsoleMessage::create(RenderingMessa geSource, WarningMessageLevel, message));
5463 } 5475 }
5464 5476
5465 bool WebGLRenderingContextBase::validateFramebufferFuncParameters(const char* fu nctionName, GLenum target, GLenum attachment) 5477 bool WebGLRenderingContextBase::validateFramebufferFuncParameters(const char* fu nctionName, GLenum target, GLenum attachment)
5466 { 5478 {
5467 if (target != GL_FRAMEBUFFER) { 5479 if (!validateFramebufferTarget(target)) {
5468 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid target"); 5480 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid target");
5469 return false; 5481 return false;
5470 } 5482 }
5471 switch (attachment) { 5483 switch (attachment) {
5472 case GL_COLOR_ATTACHMENT0: 5484 case GL_COLOR_ATTACHMENT0:
5473 case GL_DEPTH_ATTACHMENT: 5485 case GL_DEPTH_ATTACHMENT:
5474 case GL_STENCIL_ATTACHMENT: 5486 case GL_STENCIL_ATTACHMENT:
5475 case GC3D_DEPTH_STENCIL_ATTACHMENT_WEBGL: 5487 case GC3D_DEPTH_STENCIL_ATTACHMENT_WEBGL:
5476 break; 5488 break;
5477 default: 5489 default:
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
6185 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0; 6197 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0;
6186 } 6198 }
6187 #else 6199 #else
6188 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const 6200 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const
6189 { 6201 {
6190 return m_drawingBuffer.get(); 6202 return m_drawingBuffer.get();
6191 } 6203 }
6192 #endif 6204 #endif
6193 6205
6194 } // namespace blink 6206 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/canvas/WebGLRenderingContextBase.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698