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 "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 2679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2690 .WillOnce(Return(GL_NO_ERROR)) | 2690 .WillOnce(Return(GL_NO_ERROR)) |
| 2691 .RetiresOnSaturation(); | 2691 .RetiresOnSaturation(); |
| 2692 | 2692 |
| 2693 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 2693 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 2694 CopyTexImage2D cmd; | 2694 CopyTexImage2D cmd; |
| 2695 cmd.Init(target, level, internal_format, 0, 0, width, height); | 2695 cmd.Init(target, level, internal_format, 0, 0, width, height); |
| 2696 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2696 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2697 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 2697 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 2698 } | 2698 } |
| 2699 | 2699 |
| 2700 TEST_P(GLES3DecoderManualInitTest, CopyTexImage2DValidInternalFormat_FloatEXT) { | |
| 2701 base::CommandLine command_line(0, nullptr); | |
| 2702 command_line.AppendSwitch(switches::kEnableUnsafeES3APIs); | |
|
Zhenyao Mo
2016/11/02 18:26:09
Again, this will conflict with kainino's effort of
Kai Ninomiya
2016/11/02 18:47:34
qiankun, don't worry about using kEnableUnsafeES3A
Kai Ninomiya
2016/11/03 02:11:30
My changes removing it have landed:
https://codere
| |
| 2703 InitState init; | |
| 2704 init.extensions = "GL_EXT_color_buffer_float"; | |
| 2705 init.gl_version = "OpenGL ES 3.0"; | |
| 2706 init.bind_generates_resource = true; | |
| 2707 init.context_type = CONTEXT_TYPE_OPENGLES3; | |
| 2708 InitDecoderWithCommandLine(init, &command_line); | |
| 2709 | |
| 2710 const GLuint kFBOClientTextureId = 4100; | |
| 2711 const GLuint kFBOServiceTextureId = 4101; | |
| 2712 | |
| 2713 GLenum target = GL_TEXTURE_2D; | |
| 2714 GLint level = 0; | |
| 2715 GLenum internal_format = GL_RG16F; | |
| 2716 GLenum format = GL_RGBA; | |
| 2717 GLenum type = GL_HALF_FLOAT; | |
| 2718 GLsizei width = 16; | |
| 2719 GLsizei height = 8; | |
| 2720 GLint border = 0; | |
| 2721 | |
| 2722 EXPECT_CALL(*gl_, GenTextures(_, _)) | |
| 2723 .WillOnce(SetArgPointee<1>(kFBOServiceTextureId)) | |
| 2724 .RetiresOnSaturation(); | |
| 2725 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); | |
| 2726 | |
| 2727 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); | |
| 2728 DoTexImage2D(GL_TEXTURE_2D, | |
| 2729 level, | |
| 2730 GL_RGBA16F, | |
| 2731 width, | |
| 2732 height, | |
| 2733 0, | |
| 2734 format, | |
| 2735 type, | |
| 2736 kSharedMemoryId, | |
| 2737 kSharedMemoryOffset); | |
| 2738 DoBindFramebuffer( | |
| 2739 GL_READ_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | |
| 2740 DoFramebufferTexture2D(GL_READ_FRAMEBUFFER, | |
| 2741 GL_COLOR_ATTACHMENT0, | |
| 2742 GL_TEXTURE_2D, | |
| 2743 kFBOClientTextureId, | |
| 2744 kFBOServiceTextureId, | |
| 2745 0, | |
| 2746 GL_NO_ERROR); | |
| 2747 EXPECT_CALL(*gl_, | |
| 2748 CopyTexImage2D( | |
| 2749 target, level, internal_format, 0, 0, width, height, border)) | |
| 2750 .Times(1) | |
| 2751 .RetiresOnSaturation(); | |
| 2752 EXPECT_CALL(*gl_, GetError()) | |
| 2753 .WillOnce(Return(GL_NO_ERROR)) | |
| 2754 .WillOnce(Return(GL_NO_ERROR)) | |
| 2755 .RetiresOnSaturation(); | |
| 2756 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER)) | |
| 2757 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) | |
| 2758 .RetiresOnSaturation(); | |
| 2759 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | |
| 2760 CopyTexImage2D cmd; | |
| 2761 cmd.Init(target, level, internal_format, 0, 0, width, height); | |
| 2762 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | |
| 2763 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | |
| 2764 } | |
| 2765 | |
| 2766 TEST_P(GLES3DecoderManualInitTest, | |
| 2767 CopyTexImage2DInvalidInternalFormat_FloatEXT) { | |
| 2768 base::CommandLine command_line(0, nullptr); | |
| 2769 command_line.AppendSwitch(switches::kEnableUnsafeES3APIs); | |
|
Zhenyao Mo
2016/11/02 18:26:09
Same here.
| |
| 2770 InitState init; | |
| 2771 init.extensions = "GL_EXT_color_buffer_float"; | |
| 2772 init.gl_version = "OpenGL ES 3.0"; | |
| 2773 init.bind_generates_resource = true; | |
| 2774 init.context_type = CONTEXT_TYPE_OPENGLES3; | |
| 2775 InitDecoderWithCommandLine(init, &command_line); | |
| 2776 | |
| 2777 const GLuint kFBOClientTextureId = 4100; | |
| 2778 const GLuint kFBOServiceTextureId = 4101; | |
| 2779 | |
| 2780 GLenum target = GL_TEXTURE_2D; | |
| 2781 GLint level = 0; | |
| 2782 GLenum internal_format = GL_RG16F; | |
| 2783 GLenum format = GL_RGBA; | |
| 2784 GLenum type = GL_UNSIGNED_BYTE; | |
| 2785 GLsizei width = 16; | |
| 2786 GLsizei height = 8; | |
| 2787 GLint border = 0; | |
| 2788 | |
| 2789 EXPECT_CALL(*gl_, GenTextures(_, _)) | |
| 2790 .WillOnce(SetArgPointee<1>(kFBOServiceTextureId)) | |
| 2791 .RetiresOnSaturation(); | |
| 2792 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); | |
| 2793 | |
| 2794 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); | |
| 2795 DoTexImage2D(GL_TEXTURE_2D, | |
| 2796 level, | |
| 2797 GL_RGBA8, | |
| 2798 width, | |
| 2799 height, | |
| 2800 0, | |
| 2801 format, | |
| 2802 type, | |
| 2803 kSharedMemoryId, | |
| 2804 kSharedMemoryOffset); | |
| 2805 DoBindFramebuffer( | |
| 2806 GL_READ_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | |
| 2807 DoFramebufferTexture2D(GL_READ_FRAMEBUFFER, | |
| 2808 GL_COLOR_ATTACHMENT0, | |
| 2809 GL_TEXTURE_2D, | |
| 2810 kFBOClientTextureId, | |
| 2811 kFBOServiceTextureId, | |
| 2812 0, | |
| 2813 GL_NO_ERROR); | |
| 2814 EXPECT_CALL(*gl_, | |
| 2815 CopyTexImage2D( | |
| 2816 target, level, internal_format, 0, 0, width, height, border)) | |
| 2817 .Times(0); | |
| 2818 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER)) | |
| 2819 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) | |
| 2820 .RetiresOnSaturation(); | |
| 2821 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | |
| 2822 CopyTexImage2D cmd; | |
| 2823 cmd.Init(target, level, internal_format, 0, 0, width, height); | |
| 2824 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | |
| 2825 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | |
| 2826 } | |
| 2827 | |
| 2700 TEST_P(GLES3DecoderTest, CopyTexImage2DInvalidInternalFormat) { | 2828 TEST_P(GLES3DecoderTest, CopyTexImage2DInvalidInternalFormat) { |
| 2701 const GLuint kFBOClientTextureId = 4100; | 2829 const GLuint kFBOClientTextureId = 4100; |
| 2702 const GLuint kFBOServiceTextureId = 4101; | 2830 const GLuint kFBOServiceTextureId = 4101; |
| 2703 | 2831 |
| 2704 GLenum target = GL_TEXTURE_2D; | 2832 GLenum target = GL_TEXTURE_2D; |
| 2705 GLint level = 0; | 2833 GLint level = 0; |
| 2706 GLenum internal_format = GL_RG_INTEGER; | 2834 GLenum internal_format = GL_RG_INTEGER; |
| 2707 GLenum format = GL_RG; | 2835 GLenum format = GL_RG; |
| 2708 GLenum type = GL_UNSIGNED_BYTE; | 2836 GLenum type = GL_UNSIGNED_BYTE; |
| 2709 GLsizei width = 16; | 2837 GLsizei width = 16; |
| (...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3845 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3973 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3846 } | 3974 } |
| 3847 } | 3975 } |
| 3848 | 3976 |
| 3849 // TODO(gman): PixelStorei | 3977 // TODO(gman): PixelStorei |
| 3850 | 3978 |
| 3851 // TODO(gman): SwapBuffers | 3979 // TODO(gman): SwapBuffers |
| 3852 | 3980 |
| 3853 } // namespace gles2 | 3981 } // namespace gles2 |
| 3854 } // namespace gpu | 3982 } // namespace gpu |
| OLD | NEW |