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

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: get the 'correct' framebuffer bound to give target 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
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 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 1358
1359 void WebGLRenderingContextBase::bufferSubData(GLenum target, long long offset, D OMArrayBufferView* data) 1359 void WebGLRenderingContextBase::bufferSubData(GLenum target, long long offset, D OMArrayBufferView* data)
1360 { 1360 {
1361 if (isContextLost()) 1361 if (isContextLost())
1362 return; 1362 return;
1363 if (!data) 1363 if (!data)
1364 return; 1364 return;
1365 bufferSubDataImpl(target, offset, data->byteLength(), data->baseAddress()); 1365 bufferSubDataImpl(target, offset, data->byteLength(), data->baseAddress());
1366 } 1366 }
1367 1367
1368 bool WebGLRenderingContextBase::validateFramebufferTarget(GLenum target)
1369 {
1370 if (target == GL_FRAMEBUFFER)
1371 return true;
1372 return false;
1373 }
1374
1375 RefPtrWillBeMember<WebGLFramebuffer> WebGLRenderingContextBase::getFramebufferBi nding(GLenum target)
1376 {
1377 return m_framebufferBinding;
1378 }
1379
1368 GLenum WebGLRenderingContextBase::checkFramebufferStatus(GLenum target) 1380 GLenum WebGLRenderingContextBase::checkFramebufferStatus(GLenum target)
1369 { 1381 {
1370 if (isContextLost()) 1382 if (isContextLost())
1371 return GL_FRAMEBUFFER_UNSUPPORTED; 1383 return GL_FRAMEBUFFER_UNSUPPORTED;
1372 if (target != GL_FRAMEBUFFER) { 1384 if (!validateFramebufferTarget(target)) {
1373 synthesizeGLError(GL_INVALID_ENUM, "checkFramebufferStatus", "invalid ta rget"); 1385 synthesizeGLError(GL_INVALID_ENUM, "checkFramebufferStatus", "invalid ta rget");
1374 return 0; 1386 return 0;
1375 } 1387 }
1376 if (!m_framebufferBinding || !m_framebufferBinding->object()) 1388 if (!getFramebufferBinding(target) || !getFramebufferBinding(target)->object ())
1377 return GL_FRAMEBUFFER_COMPLETE; 1389 return GL_FRAMEBUFFER_COMPLETE;
1378 const char* reason = "framebuffer incomplete"; 1390 const char* reason = "framebuffer incomplete";
1379 GLenum result = m_framebufferBinding->checkStatus(&reason); 1391 GLenum result = m_framebufferBinding->checkStatus(&reason);
1380 if (result != GL_FRAMEBUFFER_COMPLETE) { 1392 if (result != GL_FRAMEBUFFER_COMPLETE) {
1381 emitGLWarning("checkFramebufferStatus", reason); 1393 emitGLWarning("checkFramebufferStatus", reason);
1382 return result; 1394 return result;
1383 } 1395 }
1384 result = webContext()->checkFramebufferStatus(target); 1396 result = webContext()->checkFramebufferStatus(target);
1385 return result; 1397 return result;
1386 } 1398 }
(...skipping 3980 matching lines...) Expand 10 before | Expand all | Expand 10 after
5367 5379
5368 void WebGLRenderingContextBase::printWarningToConsole(const String& message) 5380 void WebGLRenderingContextBase::printWarningToConsole(const String& message)
5369 { 5381 {
5370 if (!canvas()) 5382 if (!canvas())
5371 return; 5383 return;
5372 canvas()->document().addConsoleMessage(ConsoleMessage::create(RenderingMessa geSource, WarningMessageLevel, message)); 5384 canvas()->document().addConsoleMessage(ConsoleMessage::create(RenderingMessa geSource, WarningMessageLevel, message));
5373 } 5385 }
5374 5386
5375 bool WebGLRenderingContextBase::validateFramebufferFuncParameters(const char* fu nctionName, GLenum target, GLenum attachment) 5387 bool WebGLRenderingContextBase::validateFramebufferFuncParameters(const char* fu nctionName, GLenum target, GLenum attachment)
5376 { 5388 {
5377 if (target != GL_FRAMEBUFFER) { 5389 if (!validateFramebufferTarget(target)) {
5378 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid target"); 5390 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid target");
5379 return false; 5391 return false;
5380 } 5392 }
5381 switch (attachment) { 5393 switch (attachment) {
5382 case GL_COLOR_ATTACHMENT0: 5394 case GL_COLOR_ATTACHMENT0:
5383 case GL_DEPTH_ATTACHMENT: 5395 case GL_DEPTH_ATTACHMENT:
5384 case GL_STENCIL_ATTACHMENT: 5396 case GL_STENCIL_ATTACHMENT:
5385 case GC3D_DEPTH_STENCIL_ATTACHMENT_WEBGL: 5397 case GC3D_DEPTH_STENCIL_ATTACHMENT_WEBGL:
5386 break; 5398 break;
5387 default: 5399 default:
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
6093 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0; 6105 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0;
6094 } 6106 }
6095 #else 6107 #else
6096 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const 6108 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const
6097 { 6109 {
6098 return m_drawingBuffer.get(); 6110 return m_drawingBuffer.get();
6099 } 6111 }
6100 #endif 6112 #endif
6101 6113
6102 } // namespace blink 6114 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698