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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 void WebGLDrawBuffers::drawBuffersWEBGL(const Vector<GLenum>& buffers) | 66 void WebGLDrawBuffers::drawBuffersWEBGL(const Vector<GLenum>& buffers) |
67 { | 67 { |
68 WebGLExtensionScopedContext scoped(this); | 68 WebGLExtensionScopedContext scoped(this); |
69 if (scoped.isLost()) | 69 if (scoped.isLost()) |
70 return; | 70 return; |
71 GLsizei n = buffers.size(); | 71 GLsizei n = buffers.size(); |
72 const GLenum* bufs = buffers.data(); | 72 const GLenum* bufs = buffers.data(); |
73 if (!scoped.context()->m_framebufferBinding) { | 73 if (!scoped.context()->m_framebufferBinding) { |
74 if (n != 1) { | 74 if (n != 1) { |
75 scoped.context()->synthesizeGLError(GL_INVALID_VALUE, "drawBuffersWE
BGL", "more than one buffer"); | 75 scoped.context()->synthesizeGLError(GL_INVALID_OPERATION, "drawBuffe
rsWEBGL", "must provide exactly one buffer"); |
76 return; | 76 return; |
77 } | 77 } |
78 if (bufs[0] != GL_BACK && bufs[0] != GL_NONE) { | 78 if (bufs[0] != GL_BACK && bufs[0] != GL_NONE) { |
79 scoped.context()->synthesizeGLError(GL_INVALID_OPERATION, "drawBuffe
rsWEBGL", "BACK or NONE"); | 79 scoped.context()->synthesizeGLError(GL_INVALID_OPERATION, "drawBuffe
rsWEBGL", "BACK or NONE"); |
80 return; | 80 return; |
81 } | 81 } |
82 // Because the backbuffer is simulated on all current WebKit ports, we n
eed to change BACK to COLOR_ATTACHMENT0. | 82 // Because the backbuffer is simulated on all current WebKit ports, we n
eed to change BACK to COLOR_ATTACHMENT0. |
83 GLenum value = (bufs[0] == GL_BACK) ? GL_COLOR_ATTACHMENT0 : GL_NONE; | 83 GLenum value = (bufs[0] == GL_BACK) ? GL_COLOR_ATTACHMENT0 : GL_NONE; |
84 scoped.context()->webContext()->drawBuffersEXT(1, &value); | 84 scoped.context()->webContext()->drawBuffersEXT(1, &value); |
85 scoped.context()->setBackDrawBuffer(bufs[0]); | 85 scoped.context()->setBackDrawBuffer(bufs[0]); |
(...skipping 87 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 blink | 182 } // namespace blink |
OLD | NEW |