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

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: 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 | « no previous file | 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 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 GLenum WebGLRenderingContextBase::checkFramebufferStatus(GLenum target) 1368 GLenum WebGLRenderingContextBase::checkFramebufferStatus(GLenum target)
1369 { 1369 {
1370 if (isContextLost()) 1370 if (isContextLost())
1371 return GL_FRAMEBUFFER_UNSUPPORTED; 1371 return GL_FRAMEBUFFER_UNSUPPORTED;
1372 if (target != GL_FRAMEBUFFER) { 1372 if ((target != GL_FRAMEBUFFER && !isWebGL2OrHigher()) || (target != GL_READ_ FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER)) {
Zhenyao Mo 2015/04/22 22:39:43 This is incorrect. GL_FRAMEBUFFER is also a valid
yunchao 2015/04/23 06:46:46 Yeah. But I made a mistake by this logic.
1373 synthesizeGLError(GL_INVALID_ENUM, "checkFramebufferStatus", "invalid ta rget"); 1373 synthesizeGLError(GL_INVALID_ENUM, "checkFramebufferStatus", "invalid ta rget");
1374 return 0; 1374 return 0;
1375 } 1375 }
1376 if (!m_framebufferBinding || !m_framebufferBinding->object()) 1376 if (!m_framebufferBinding || !m_framebufferBinding->object())
1377 return GL_FRAMEBUFFER_COMPLETE; 1377 return GL_FRAMEBUFFER_COMPLETE;
1378 const char* reason = "framebuffer incomplete"; 1378 const char* reason = "framebuffer incomplete";
1379 GLenum result = m_framebufferBinding->checkStatus(&reason); 1379 GLenum result = m_framebufferBinding->checkStatus(&reason);
1380 if (result != GL_FRAMEBUFFER_COMPLETE) { 1380 if (result != GL_FRAMEBUFFER_COMPLETE) {
1381 emitGLWarning("checkFramebufferStatus", reason); 1381 emitGLWarning("checkFramebufferStatus", reason);
1382 return result; 1382 return result;
(...skipping 3984 matching lines...) Expand 10 before | Expand all | Expand 10 after
5367 5367
5368 void WebGLRenderingContextBase::printWarningToConsole(const String& message) 5368 void WebGLRenderingContextBase::printWarningToConsole(const String& message)
5369 { 5369 {
5370 if (!canvas()) 5370 if (!canvas())
5371 return; 5371 return;
5372 canvas()->document().addConsoleMessage(ConsoleMessage::create(RenderingMessa geSource, WarningMessageLevel, message)); 5372 canvas()->document().addConsoleMessage(ConsoleMessage::create(RenderingMessa geSource, WarningMessageLevel, message));
5373 } 5373 }
5374 5374
5375 bool WebGLRenderingContextBase::validateFramebufferFuncParameters(const char* fu nctionName, GLenum target, GLenum attachment) 5375 bool WebGLRenderingContextBase::validateFramebufferFuncParameters(const char* fu nctionName, GLenum target, GLenum attachment)
5376 { 5376 {
5377 if (target != GL_FRAMEBUFFER) { 5377 if ((target != GL_FRAMEBUFFER && !isWebGL2OrHigher()) || (target != GL_READ_ FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER)) {
Zhenyao Mo 2015/04/22 22:39:43 Ditto.
yunchao 2015/04/23 06:46:46 Done.
5378 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid target"); 5378 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid target");
5379 return false; 5379 return false;
5380 } 5380 }
5381 switch (attachment) { 5381 switch (attachment) {
5382 case GL_COLOR_ATTACHMENT0: 5382 case GL_COLOR_ATTACHMENT0:
5383 case GL_DEPTH_ATTACHMENT: 5383 case GL_DEPTH_ATTACHMENT:
5384 case GL_STENCIL_ATTACHMENT: 5384 case GL_STENCIL_ATTACHMENT:
5385 case GC3D_DEPTH_STENCIL_ATTACHMENT_WEBGL: 5385 case GC3D_DEPTH_STENCIL_ATTACHMENT_WEBGL:
5386 break; 5386 break;
5387 default: 5387 default:
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
6093 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0; 6093 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0;
6094 } 6094 }
6095 #else 6095 #else
6096 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const 6096 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const
6097 { 6097 {
6098 return m_drawingBuffer.get(); 6098 return m_drawingBuffer.get();
6099 } 6099 }
6100 #endif 6100 #endif
6101 6101
6102 } // namespace blink 6102 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698