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

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: add a validation function to make it clear Created 5 years, 8 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 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
1368 GLenum WebGLRenderingContextBase::checkFramebufferStatus(GLenum target) 1376 GLenum WebGLRenderingContextBase::checkFramebufferStatus(GLenum target)
1369 { 1377 {
1370 if (isContextLost()) 1378 if (isContextLost())
1371 return GL_FRAMEBUFFER_UNSUPPORTED; 1379 return GL_FRAMEBUFFER_UNSUPPORTED;
1372 if (target != GL_FRAMEBUFFER) { 1380 if (!validateFramebufferTarget(target)) {
1373 synthesizeGLError(GL_INVALID_ENUM, "checkFramebufferStatus", "invalid ta rget"); 1381 synthesizeGLError(GL_INVALID_ENUM, "checkFramebufferStatus", "invalid ta rget");
1374 return 0; 1382 return 0;
1375 } 1383 }
1376 if (!m_framebufferBinding || !m_framebufferBinding->object()) 1384 if (!m_framebufferBinding || !m_framebufferBinding->object())
Ken Russell (switch to Gerrit) 2015/04/28 05:18:59 Looking at this again, it occurs to me that this c
yunchao 2015/04/29 07:43:22 Agree. I add a function getFramebufferBinding() to
1377 return GL_FRAMEBUFFER_COMPLETE; 1385 return GL_FRAMEBUFFER_COMPLETE;
1378 const char* reason = "framebuffer incomplete"; 1386 const char* reason = "framebuffer incomplete";
1379 GLenum result = m_framebufferBinding->checkStatus(&reason); 1387 GLenum result = m_framebufferBinding->checkStatus(&reason);
1380 if (result != GL_FRAMEBUFFER_COMPLETE) { 1388 if (result != GL_FRAMEBUFFER_COMPLETE) {
1381 emitGLWarning("checkFramebufferStatus", reason); 1389 emitGLWarning("checkFramebufferStatus", reason);
1382 return result; 1390 return result;
1383 } 1391 }
1384 result = webContext()->checkFramebufferStatus(target); 1392 result = webContext()->checkFramebufferStatus(target);
1385 return result; 1393 return result;
1386 } 1394 }
(...skipping 3980 matching lines...) Expand 10 before | Expand all | Expand 10 after
5367 5375
5368 void WebGLRenderingContextBase::printWarningToConsole(const String& message) 5376 void WebGLRenderingContextBase::printWarningToConsole(const String& message)
5369 { 5377 {
5370 if (!canvas()) 5378 if (!canvas())
5371 return; 5379 return;
5372 canvas()->document().addConsoleMessage(ConsoleMessage::create(RenderingMessa geSource, WarningMessageLevel, message)); 5380 canvas()->document().addConsoleMessage(ConsoleMessage::create(RenderingMessa geSource, WarningMessageLevel, message));
5373 } 5381 }
5374 5382
5375 bool WebGLRenderingContextBase::validateFramebufferFuncParameters(const char* fu nctionName, GLenum target, GLenum attachment) 5383 bool WebGLRenderingContextBase::validateFramebufferFuncParameters(const char* fu nctionName, GLenum target, GLenum attachment)
5376 { 5384 {
5377 if (target != GL_FRAMEBUFFER) { 5385 if (!validateFramebufferTarget(target)) {
5378 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid target"); 5386 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid target");
5379 return false; 5387 return false;
5380 } 5388 }
5381 switch (attachment) { 5389 switch (attachment) {
5382 case GL_COLOR_ATTACHMENT0: 5390 case GL_COLOR_ATTACHMENT0:
5383 case GL_DEPTH_ATTACHMENT: 5391 case GL_DEPTH_ATTACHMENT:
5384 case GL_STENCIL_ATTACHMENT: 5392 case GL_STENCIL_ATTACHMENT:
5385 case GC3D_DEPTH_STENCIL_ATTACHMENT_WEBGL: 5393 case GC3D_DEPTH_STENCIL_ATTACHMENT_WEBGL:
5386 break; 5394 break;
5387 default: 5395 default:
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
6093 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0; 6101 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0;
6094 } 6102 }
6095 #else 6103 #else
6096 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const 6104 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const
6097 { 6105 {
6098 return m_drawingBuffer.get(); 6106 return m_drawingBuffer.get();
6099 } 6107 }
6100 #endif 6108 #endif
6101 6109
6102 } // namespace blink 6110 } // 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