| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <GLES2/gl2.h> | 5 #include <GLES2/gl2.h> |
| 6 #include <GLES2/gl2ext.h> | 6 #include <GLES2/gl2ext.h> |
| 7 #include <GLES2/gl2extchromium.h> | 7 #include <GLES2/gl2extchromium.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "gpu/command_buffer/tests/gl_manager.h" | 10 #include "gpu/command_buffer/tests/gl_manager.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 GL_COLOR_ATTACHMENT0, | 93 GL_COLOR_ATTACHMENT0, |
| 94 GL_RENDERBUFFER, | 94 GL_RENDERBUFFER, |
| 95 sample_rb); | 95 sample_rb); |
| 96 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 96 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
| 97 glCheckFramebufferStatus(GL_FRAMEBUFFER)); | 97 glCheckFramebufferStatus(GL_FRAMEBUFFER)); |
| 98 | 98 |
| 99 // Create another FBO to resolve the multisample buffer into. | 99 // Create another FBO to resolve the multisample buffer into. |
| 100 GLuint resolve_fbo, resolve_tex; | 100 GLuint resolve_fbo, resolve_tex; |
| 101 glGenTextures(1, &resolve_tex); | 101 glGenTextures(1, &resolve_tex); |
| 102 glBindTexture(GL_TEXTURE_2D, resolve_tex); | 102 glBindTexture(GL_TEXTURE_2D, resolve_tex); |
| 103 glTexImage2D(GL_TEXTURE_2D, | 103 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, |
| 104 0, | 104 GL_UNSIGNED_BYTE, nullptr); |
| 105 GL_RGBA, | |
| 106 width, | |
| 107 height, | |
| 108 0, | |
| 109 GL_RGBA, | |
| 110 GL_UNSIGNED_BYTE, | |
| 111 NULL); | |
| 112 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 105 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| 113 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 106 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
| 114 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 107 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 115 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 108 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 116 glGenFramebuffers(1, &resolve_fbo); | 109 glGenFramebuffers(1, &resolve_fbo); |
| 117 glBindFramebuffer(GL_FRAMEBUFFER, resolve_fbo); | 110 glBindFramebuffer(GL_FRAMEBUFFER, resolve_fbo); |
| 118 glFramebufferTexture2D(GL_FRAMEBUFFER, | 111 glFramebufferTexture2D(GL_FRAMEBUFFER, |
| 119 GL_COLOR_ATTACHMENT0, | 112 GL_COLOR_ATTACHMENT0, |
| 120 GL_TEXTURE_2D, | 113 GL_TEXTURE_2D, |
| 121 resolve_tex, | 114 resolve_tex, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 143 0, | 136 0, |
| 144 width, | 137 width, |
| 145 height, | 138 height, |
| 146 GL_COLOR_BUFFER_BIT, | 139 GL_COLOR_BUFFER_BIT, |
| 147 GL_NEAREST); | 140 GL_NEAREST); |
| 148 | 141 |
| 149 // Verify. | 142 // Verify. |
| 150 const uint8_t green[] = {0, 255, 0, 255}; | 143 const uint8_t green[] = {0, 255, 0, 255}; |
| 151 const uint8_t black[] = {0, 0, 0, 0}; | 144 const uint8_t black[] = {0, 0, 0, 0}; |
| 152 glBindFramebuffer(GL_READ_FRAMEBUFFER, resolve_fbo); | 145 glBindFramebuffer(GL_READ_FRAMEBUFFER, resolve_fbo); |
| 153 EXPECT_TRUE( | 146 EXPECT_TRUE(GLTestHelper::CheckPixels(width / 4, (3 * height) / 4, 1, 1, 0, |
| 154 GLTestHelper::CheckPixels(width / 4, (3 * height) / 4, 1, 1, 0, green)); | 147 green, nullptr)); |
| 155 EXPECT_TRUE(GLTestHelper::CheckPixels(width - 1, 0, 1, 1, 0, black)); | 148 EXPECT_TRUE(GLTestHelper::CheckPixels(width - 1, 0, 1, 1, 0, black, nullptr)); |
| 156 } | 149 } |
| 157 | 150 |
| 158 } // namespace gpu | 151 } // namespace gpu |
| 159 | 152 |
| OLD | NEW |