| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 WebGLDrawBuffers::~WebGLDrawBuffers() | 41 WebGLDrawBuffers::~WebGLDrawBuffers() |
| 42 { | 42 { |
| 43 } | 43 } |
| 44 | 44 |
| 45 WebGLExtension::ExtensionName WebGLDrawBuffers::getName() const | 45 WebGLExtension::ExtensionName WebGLDrawBuffers::getName() const |
| 46 { | 46 { |
| 47 return WebGLExtension::WebGLDrawBuffersName; | 47 return WebGLExtension::WebGLDrawBuffersName; |
| 48 } | 48 } |
| 49 | 49 |
| 50 PassOwnPtr<WebGLDrawBuffers> WebGLDrawBuffers::create(WebGLRenderingContext* con
text) | 50 PassRefPtr<WebGLDrawBuffers> WebGLDrawBuffers::create(WebGLRenderingContext* con
text) |
| 51 { | 51 { |
| 52 return adoptPtr(new WebGLDrawBuffers(context)); | 52 return adoptRef(new WebGLDrawBuffers(context)); |
| 53 } | 53 } |
| 54 | 54 |
| 55 // static | 55 // static |
| 56 bool WebGLDrawBuffers::supported(WebGLRenderingContext* context) | 56 bool WebGLDrawBuffers::supported(WebGLRenderingContext* context) |
| 57 { | 57 { |
| 58 Extensions3D* extensions = context->graphicsContext3D()->getExtensions(); | 58 Extensions3D* extensions = context->graphicsContext3D()->getExtensions(); |
| 59 return (extensions->supports("GL_EXT_draw_buffers") | 59 return (extensions->supports("GL_EXT_draw_buffers") |
| 60 && satisfiesWebGLRequirements(context)); | 60 && satisfiesWebGLRequirements(context)); |
| 61 } | 61 } |
| 62 | 62 |
| 63 const char* WebGLDrawBuffers::getExtensionName() | 63 const char* WebGLDrawBuffers::getExtensionName() |
| 64 { | 64 { |
| 65 return "WEBGL_draw_buffers"; | 65 return "WEBGL_draw_buffers"; |
| 66 } | 66 } |
| 67 | 67 |
| 68 void WebGLDrawBuffers::drawBuffersWEBGL(const Vector<GC3Denum>& buffers) | 68 void WebGLDrawBuffers::drawBuffersWEBGL(const Vector<GC3Denum>& buffers) |
| 69 { | 69 { |
| 70 if (m_context->isContextLost()) | 70 if (isLost()) |
| 71 return; | 71 return; |
| 72 GC3Dsizei n = buffers.size(); | 72 GC3Dsizei n = buffers.size(); |
| 73 const GC3Denum* bufs = buffers.data(); | 73 const GC3Denum* bufs = buffers.data(); |
| 74 if (!m_context->m_framebufferBinding) { | 74 if (!m_context->m_framebufferBinding) { |
| 75 if (n != 1) { | 75 if (n != 1) { |
| 76 m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "draw
BuffersWEBGL", "more than one buffer"); | 76 m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "draw
BuffersWEBGL", "more than one buffer"); |
| 77 return; | 77 return; |
| 78 } | 78 } |
| 79 if (bufs[0] != GraphicsContext3D::BACK && bufs[0] != GraphicsContext3D::
NONE) { | 79 if (bufs[0] != GraphicsContext3D::BACK && bufs[0] != GraphicsContext3D::
NONE) { |
| 80 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "
drawBuffersWEBGL", "BACK or NONE"); | 80 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "
drawBuffersWEBGL", "BACK or NONE"); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 if (supportsDepth) | 173 if (supportsDepth) |
| 174 context->deleteTexture(depth); | 174 context->deleteTexture(depth); |
| 175 if (supportsDepthStencil) | 175 if (supportsDepthStencil) |
| 176 context->deleteTexture(depthStencil); | 176 context->deleteTexture(depthStencil); |
| 177 for (size_t i = 0; i < colors.size(); ++i) | 177 for (size_t i = 0; i < colors.size(); ++i) |
| 178 context->deleteTexture(colors[i]); | 178 context->deleteTexture(colors[i]); |
| 179 return ok; | 179 return ok; |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace WebCore | 182 } // namespace WebCore |
| OLD | NEW |