| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, buffer); | 138 GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, buffer); |
| 139 } | 139 } |
| 140 | 140 |
| 141 Vector<GLuint> colors; | 141 Vector<GLuint> colors; |
| 142 bool ok = true; | 142 bool ok = true; |
| 143 GLint maxAllowedBuffers = std::min(maxDrawBuffers, maxColorAttachments); | 143 GLint maxAllowedBuffers = std::min(maxDrawBuffers, maxColorAttachments); |
| 144 for (GLint i = 0; i < maxAllowedBuffers; ++i) { | 144 for (GLint i = 0; i < maxAllowedBuffers; ++i) { |
| 145 GLuint color; | 145 GLuint color; |
| 146 | 146 |
| 147 gl->GenTextures(1, &color); | 147 gl->GenTextures(1, &color); |
| 148 colors.append(color); | 148 colors.push_back(color); |
| 149 gl->BindTexture(GL_TEXTURE_2D, color); | 149 gl->BindTexture(GL_TEXTURE_2D, color); |
| 150 gl->TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, | 150 gl->TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, |
| 151 GL_UNSIGNED_BYTE, buffer); | 151 GL_UNSIGNED_BYTE, buffer); |
| 152 gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, | 152 gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, |
| 153 GL_TEXTURE_2D, color, 0); | 153 GL_TEXTURE_2D, color, 0); |
| 154 if (gl->CheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { | 154 if (gl->CheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { |
| 155 ok = false; | 155 ok = false; |
| 156 break; | 156 break; |
| 157 } | 157 } |
| 158 if (supportsDepth) { | 158 if (supportsDepth) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 187 if (supportsDepth) | 187 if (supportsDepth) |
| 188 gl->DeleteTextures(1, &depth); | 188 gl->DeleteTextures(1, &depth); |
| 189 if (supportsDepthStencil) | 189 if (supportsDepthStencil) |
| 190 gl->DeleteTextures(1, &depthStencil); | 190 gl->DeleteTextures(1, &depthStencil); |
| 191 gl->DeleteTextures(colors.size(), colors.data()); | 191 gl->DeleteTextures(colors.size(), colors.data()); |
| 192 | 192 |
| 193 return ok; | 193 return ok; |
| 194 } | 194 } |
| 195 | 195 |
| 196 } // namespace blink | 196 } // namespace blink |
| OLD | NEW |