Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 | 7 |
| 8 #include "gpu/command_buffer/tests/gl_manager.h" | 8 #include "gpu/command_buffer/tests/gl_manager.h" |
| 9 #include "gpu/command_buffer/tests/gl_test_utils.h" | 9 #include "gpu/command_buffer/tests/gl_test_utils.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 GLManager gl_; | 42 GLManager gl_; |
| 43 GLuint tex_; | 43 GLuint tex_; |
| 44 GLuint fbo_; | 44 GLuint fbo_; |
| 45 bool extension_available_; | 45 bool extension_available_; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 TEST_F(TextureStorageTest, CorrectPixels) { | 48 TEST_F(TextureStorageTest, CorrectPixels) { |
| 49 if (!extension_available_) | 49 if (!extension_available_) |
| 50 return; | 50 return; |
| 51 | 51 |
| 52 // TODO(dshwang): After fixing mesa bug, which crashes on updating immutable | |
| 53 // texture bound to FBO, remove this workaround. crbug.com/521904 | |
|
piman
2015/08/19 21:07:21
Is this something that should be fixed / worked ar
dshwang
2015/08/20 07:47:46
right, client can kill gpu process via this patter
dshwang
2015/08/20 15:41:24
Done.
| |
| 54 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, | |
| 55 0); | |
| 56 | |
| 52 glTexStorage2DEXT(GL_TEXTURE_2D, 2, GL_RGBA8_OES, 2, 2); | 57 glTexStorage2DEXT(GL_TEXTURE_2D, 2, GL_RGBA8_OES, 2, 2); |
| 53 | 58 |
| 54 uint8 source_pixels[16] = { | 59 uint8 source_pixels[16] = { |
| 55 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4 | 60 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4 |
| 56 }; | 61 }; |
| 57 glTexSubImage2D(GL_TEXTURE_2D, | 62 glTexSubImage2D(GL_TEXTURE_2D, |
| 58 0, | 63 0, |
| 59 0, 0, | 64 0, 0, |
| 60 2, 2, | 65 2, 2, |
| 61 GL_RGBA, GL_UNSIGNED_BYTE, | 66 GL_RGBA, GL_UNSIGNED_BYTE, |
| 62 source_pixels); | 67 source_pixels); |
| 68 | |
| 69 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, | |
| 70 tex_, 0); | |
| 71 | |
| 63 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 2, 2, 0, source_pixels)); | 72 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 2, 2, 0, source_pixels)); |
| 64 } | 73 } |
| 65 | 74 |
| 66 TEST_F(TextureStorageTest, IsImmutable) { | 75 TEST_F(TextureStorageTest, IsImmutable) { |
| 67 if (!extension_available_) | 76 if (!extension_available_) |
| 68 return; | 77 return; |
| 69 | 78 |
| 70 glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8_OES, 4, 4); | 79 glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8_OES, 4, 4); |
| 71 | 80 |
| 72 GLint param = 0; | 81 GLint param = 0; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 GL_RGBA, | 158 GL_RGBA, |
| 150 GL_UNSIGNED_BYTE, | 159 GL_UNSIGNED_BYTE, |
| 151 NULL); | 160 NULL); |
| 152 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_OPERATION), glGetError()); | 161 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_OPERATION), glGetError()); |
| 153 } | 162 } |
| 154 | 163 |
| 155 } // namespace gpu | 164 } // namespace gpu |
| 156 | 165 |
| 157 | 166 |
| 158 | 167 |
| OLD | NEW |