Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc

Issue 2474593002: Float formats are allowed for CopyTexImage with EXT_color_buffer_float (Closed)
Patch Set: rebase only Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2676 matching lines...) Expand 10 before | Expand all | Expand 10 after
2687 .WillOnce(Return(GL_NO_ERROR)) 2687 .WillOnce(Return(GL_NO_ERROR))
2688 .RetiresOnSaturation(); 2688 .RetiresOnSaturation();
2689 2689
2690 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 2690 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
2691 CopyTexImage2D cmd; 2691 CopyTexImage2D cmd;
2692 cmd.Init(target, level, internal_format, 0, 0, width, height); 2692 cmd.Init(target, level, internal_format, 0, 0, width, height);
2693 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2693 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2694 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 2694 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2695 } 2695 }
2696 2696
2697 TEST_P(GLES3DecoderManualInitTest, CopyTexImage2DValidInternalFormat_FloatEXT) {
2698 InitState init;
2699 init.extensions = "GL_EXT_color_buffer_float";
2700 init.gl_version = "OpenGL ES 3.0";
2701 init.bind_generates_resource = true;
2702 init.context_type = CONTEXT_TYPE_OPENGLES3;
2703 InitDecoder(init);
2704
2705 const GLuint kFBOClientTextureId = 4100;
2706 const GLuint kFBOServiceTextureId = 4101;
2707
2708 GLenum target = GL_TEXTURE_2D;
2709 GLint level = 0;
2710 GLenum internal_format = GL_RG16F;
2711 GLenum format = GL_RGBA;
2712 GLenum type = GL_HALF_FLOAT;
2713 GLsizei width = 16;
2714 GLsizei height = 8;
2715 GLint border = 0;
2716
2717 EXPECT_CALL(*gl_, GenTextures(_, _))
2718 .WillOnce(SetArgPointee<1>(kFBOServiceTextureId))
2719 .RetiresOnSaturation();
2720 GenHelper<GenTexturesImmediate>(kFBOClientTextureId);
2721
2722 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId);
2723 DoTexImage2D(GL_TEXTURE_2D,
2724 level,
2725 GL_RGBA16F,
2726 width,
2727 height,
2728 0,
2729 format,
2730 type,
2731 kSharedMemoryId,
2732 kSharedMemoryOffset);
2733 DoBindFramebuffer(
2734 GL_READ_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId);
2735 DoFramebufferTexture2D(GL_READ_FRAMEBUFFER,
2736 GL_COLOR_ATTACHMENT0,
2737 GL_TEXTURE_2D,
2738 kFBOClientTextureId,
2739 kFBOServiceTextureId,
2740 0,
2741 GL_NO_ERROR);
2742 EXPECT_CALL(*gl_,
2743 CopyTexImage2D(
2744 target, level, internal_format, 0, 0, width, height, border))
2745 .Times(1)
2746 .RetiresOnSaturation();
2747 EXPECT_CALL(*gl_, GetError())
2748 .WillOnce(Return(GL_NO_ERROR))
2749 .WillOnce(Return(GL_NO_ERROR))
2750 .RetiresOnSaturation();
2751 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER))
2752 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
2753 .RetiresOnSaturation();
2754 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
2755 CopyTexImage2D cmd;
2756 cmd.Init(target, level, internal_format, 0, 0, width, height);
2757 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2758 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2759 }
2760
2761 TEST_P(GLES3DecoderManualInitTest,
2762 CopyTexImage2DInvalidInternalFormat_FloatEXT) {
2763 InitState init;
2764 init.extensions = "GL_EXT_color_buffer_float";
2765 init.gl_version = "OpenGL ES 3.0";
2766 init.bind_generates_resource = true;
2767 init.context_type = CONTEXT_TYPE_OPENGLES3;
2768 InitDecoder(init);
2769
2770 const GLuint kFBOClientTextureId = 4100;
2771 const GLuint kFBOServiceTextureId = 4101;
2772
2773 GLenum target = GL_TEXTURE_2D;
2774 GLint level = 0;
2775 GLenum internal_format = GL_RG16F;
2776 GLenum format = GL_RGBA;
2777 GLenum type = GL_UNSIGNED_BYTE;
2778 GLsizei width = 16;
2779 GLsizei height = 8;
2780 GLint border = 0;
2781
2782 EXPECT_CALL(*gl_, GenTextures(_, _))
2783 .WillOnce(SetArgPointee<1>(kFBOServiceTextureId))
2784 .RetiresOnSaturation();
2785 GenHelper<GenTexturesImmediate>(kFBOClientTextureId);
2786
2787 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId);
2788 DoTexImage2D(GL_TEXTURE_2D,
2789 level,
2790 GL_RGBA8,
2791 width,
2792 height,
2793 0,
2794 format,
2795 type,
2796 kSharedMemoryId,
2797 kSharedMemoryOffset);
2798 DoBindFramebuffer(
2799 GL_READ_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId);
2800 DoFramebufferTexture2D(GL_READ_FRAMEBUFFER,
2801 GL_COLOR_ATTACHMENT0,
2802 GL_TEXTURE_2D,
2803 kFBOClientTextureId,
2804 kFBOServiceTextureId,
2805 0,
2806 GL_NO_ERROR);
2807 EXPECT_CALL(*gl_,
2808 CopyTexImage2D(
2809 target, level, internal_format, 0, 0, width, height, border))
2810 .Times(0);
2811 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER))
2812 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
2813 .RetiresOnSaturation();
2814 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
2815 CopyTexImage2D cmd;
2816 cmd.Init(target, level, internal_format, 0, 0, width, height);
2817 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2818 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
2819 }
2820
2697 TEST_P(GLES3DecoderTest, CopyTexImage2DInvalidInternalFormat) { 2821 TEST_P(GLES3DecoderTest, CopyTexImage2DInvalidInternalFormat) {
2698 const GLuint kFBOClientTextureId = 4100; 2822 const GLuint kFBOClientTextureId = 4100;
2699 const GLuint kFBOServiceTextureId = 4101; 2823 const GLuint kFBOServiceTextureId = 4101;
2700 2824
2701 GLenum target = GL_TEXTURE_2D; 2825 GLenum target = GL_TEXTURE_2D;
2702 GLint level = 0; 2826 GLint level = 0;
2703 GLenum internal_format = GL_RG_INTEGER; 2827 GLenum internal_format = GL_RG_INTEGER;
2704 GLenum format = GL_RG; 2828 GLenum format = GL_RG;
2705 GLenum type = GL_UNSIGNED_BYTE; 2829 GLenum type = GL_UNSIGNED_BYTE;
2706 GLsizei width = 16; 2830 GLsizei width = 16;
(...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after
3842 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 3966 EXPECT_EQ(GL_NO_ERROR, GetGLError());
3843 } 3967 }
3844 } 3968 }
3845 3969
3846 // TODO(gman): PixelStorei 3970 // TODO(gman): PixelStorei
3847 3971
3848 // TODO(gman): SwapBuffers 3972 // TODO(gman): SwapBuffers
3849 3973
3850 } // namespace gles2 3974 } // namespace gles2
3851 } // namespace gpu 3975 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | gpu/command_buffer/service/test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698