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 "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
(...skipping 2662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2673 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get()); | 2673 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get()); |
2674 | 2674 |
2675 // ClearLevel should use glTexSubImage2D to avoid unbinding GLImage. | 2675 // ClearLevel should use glTexSubImage2D to avoid unbinding GLImage. |
2676 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) | 2676 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) |
2677 .Times(2) | 2677 .Times(2) |
2678 .RetiresOnSaturation(); | 2678 .RetiresOnSaturation(); |
2679 EXPECT_CALL(*gl_, TexSubImage2D(target, level, xoffset, yoffset, width, | 2679 EXPECT_CALL(*gl_, TexSubImage2D(target, level, xoffset, yoffset, width, |
2680 height, format, type, _)) | 2680 height, format, type, _)) |
2681 .Times(1) | 2681 .Times(1) |
2682 .RetiresOnSaturation(); | 2682 .RetiresOnSaturation(); |
2683 GetDecoder()->ClearLevel(texture, target, level, format, format, type, width, | 2683 GetDecoder()->ClearLevel(texture, target, level, format, type, 0, 0, width, |
2684 height, false); | 2684 height); |
2685 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get()); | 2685 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get()); |
2686 } | 2686 } |
2687 | 2687 |
2688 TEST_P(GLES2DecoderTest, ReleaseTexImage2DCHROMIUM) { | 2688 TEST_P(GLES2DecoderTest, ReleaseTexImage2DCHROMIUM) { |
2689 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 2689 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
2690 DoTexImage2D( | 2690 DoTexImage2D( |
2691 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); | 2691 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
2692 TextureRef* texture_ref = | 2692 TextureRef* texture_ref = |
2693 group().texture_manager()->GetTexture(client_texture_id_); | 2693 group().texture_manager()->GetTexture(client_texture_id_); |
2694 ASSERT_TRUE(texture_ref != NULL); | 2694 ASSERT_TRUE(texture_ref != NULL); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2888 init.has_alpha = true; | 2888 init.has_alpha = true; |
2889 init.has_depth = true; | 2889 init.has_depth = true; |
2890 init.request_alpha = true; | 2890 init.request_alpha = true; |
2891 init.request_depth = true; | 2891 init.request_depth = true; |
2892 init.bind_generates_resource = true; | 2892 init.bind_generates_resource = true; |
2893 InitDecoder(init); | 2893 InitDecoder(init); |
2894 | 2894 |
2895 TextureRef* texture_ref = GetTexture(client_texture_id_); | 2895 TextureRef* texture_ref = GetTexture(client_texture_id_); |
2896 scoped_refptr<MockGLImage> image(new MockGLImage); | 2896 scoped_refptr<MockGLImage> image(new MockGLImage); |
2897 group().texture_manager()->SetTarget(texture_ref, GL_TEXTURE_EXTERNAL_OES); | 2897 group().texture_manager()->SetTarget(texture_ref, GL_TEXTURE_EXTERNAL_OES); |
2898 group().texture_manager()->SetLevelInfo(texture_ref, | 2898 group().texture_manager()->SetLevelInfo(texture_ref, GL_TEXTURE_EXTERNAL_OES, |
2899 GL_TEXTURE_EXTERNAL_OES, | 2899 0, GL_RGBA, 0, 0, 1, 0, GL_RGBA, |
2900 0, | 2900 GL_UNSIGNED_BYTE, gfx::Rect()); |
2901 GL_RGBA, | |
2902 0, | |
2903 0, | |
2904 1, | |
2905 0, | |
2906 GL_RGBA, | |
2907 GL_UNSIGNED_BYTE, | |
2908 true); | |
2909 group().texture_manager()->SetLevelImage( | 2901 group().texture_manager()->SetLevelImage( |
2910 texture_ref, GL_TEXTURE_EXTERNAL_OES, 0, image.get()); | 2902 texture_ref, GL_TEXTURE_EXTERNAL_OES, 0, image.get()); |
2911 | 2903 |
2912 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); | 2904 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); |
2913 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 2905 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
2914 | 2906 |
2915 SetupSamplerExternalProgram(); | 2907 SetupSamplerExternalProgram(); |
2916 SetupIndexBuffer(); | 2908 SetupIndexBuffer(); |
2917 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, 0); | 2909 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, 0); |
2918 SetupExpectationsForApplyingDefaultDirtyState(); | 2910 SetupExpectationsForApplyingDefaultDirtyState(); |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3292 // TODO(gman): CompressedTexSubImage2DImmediate | 3284 // TODO(gman): CompressedTexSubImage2DImmediate |
3293 | 3285 |
3294 // TODO(gman): TexImage2D | 3286 // TODO(gman): TexImage2D |
3295 | 3287 |
3296 // TODO(gman): TexImage2DImmediate | 3288 // TODO(gman): TexImage2DImmediate |
3297 | 3289 |
3298 // TODO(gman): TexSubImage2DImmediate | 3290 // TODO(gman): TexSubImage2DImmediate |
3299 | 3291 |
3300 } // namespace gles2 | 3292 } // namespace gles2 |
3301 } // namespace gpu | 3293 } // namespace gpu |
OLD | NEW |