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 3943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3954 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER)) | 3954 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER)) |
3955 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) | 3955 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) |
3956 .RetiresOnSaturation(); | 3956 .RetiresOnSaturation(); |
3957 SetupExpectationsForFramebufferClearing(GL_DRAW_FRAMEBUFFER, // target | 3957 SetupExpectationsForFramebufferClearing(GL_DRAW_FRAMEBUFFER, // target |
3958 GL_COLOR_BUFFER_BIT, // clear bits | 3958 GL_COLOR_BUFFER_BIT, // clear bits |
3959 0, 0, 0, 0, // color | 3959 0, 0, 0, 0, // color |
3960 0, // stencil | 3960 0, // stencil |
3961 1.0f, // depth | 3961 1.0f, // depth |
3962 false, // scissor test | 3962 false, // scissor test |
3963 0, 0, 128, 64); | 3963 0, 0, 128, 64); |
3964 EXPECT_CALL(*gl_, BlitFramebufferEXT(0, 0, _, _, 0, 0, _, _, | |
3965 GL_COLOR_BUFFER_BIT, GL_LINEAR)) | |
3966 .Times(1) | |
3967 .RetiresOnSaturation(); | |
3968 BlitFramebufferCHROMIUM cmd; | 3964 BlitFramebufferCHROMIUM cmd; |
3969 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_COLOR_BUFFER_BIT, GL_LINEAR); | 3965 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_COLOR_BUFFER_BIT, GL_LINEAR); |
3970 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 3966 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
3971 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3967 // Generate INVALID_OPERATION because of missing read buffer image. |
| 3968 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
3972 } | 3969 } |
3973 } | 3970 } |
3974 | 3971 |
3975 TEST_P(GLES3DecoderTest, BlitFramebufferMissingDepthOrStencil) { | 3972 TEST_P(GLES3DecoderTest, BlitFramebufferMissingDepthOrStencil) { |
3976 // Run BlitFramebufferCHROMIUM with depth or stencil bits, from/to a read/draw | 3973 // Run BlitFramebufferCHROMIUM with depth or stencil bits, from/to a read/draw |
3977 // framebuffer that doesn't have depth/stencil. The bits should be silently | 3974 // framebuffer that doesn't have depth/stencil. It should generate |
3978 // ignored. | 3975 // INVALID_OPERATION. |
3979 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, | 3976 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, |
3980 kServiceRenderbufferId); | 3977 kServiceRenderbufferId); |
3981 DoRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, | 3978 DoRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, |
3982 GL_DEPTH24_STENCIL8, 1, 1, GL_NO_ERROR); | 3979 GL_DEPTH24_STENCIL8, 1, 1, GL_NO_ERROR); |
3983 GLuint color_renderbuffer = client_renderbuffer_id_ + 1; | 3980 GLuint color_renderbuffer = client_renderbuffer_id_ + 1; |
3984 GLuint color_renderbuffer_service = kServiceRenderbufferId + 1; | 3981 GLuint color_renderbuffer_service = kServiceRenderbufferId + 1; |
3985 EXPECT_CALL(*gl_, GenRenderbuffersEXT(1, _)) | 3982 EXPECT_CALL(*gl_, GenRenderbuffersEXT(1, _)) |
3986 .WillOnce(SetArgPointee<1>(color_renderbuffer_service)) | 3983 .WillOnce(SetArgPointee<1>(color_renderbuffer_service)) |
3987 .RetiresOnSaturation(); | 3984 .RetiresOnSaturation(); |
3988 DoBindRenderbuffer(GL_RENDERBUFFER, color_renderbuffer, | 3985 DoBindRenderbuffer(GL_RENDERBUFFER, color_renderbuffer, |
(...skipping 27 matching lines...) Expand all Loading... |
4016 GL_STENCIL_BUFFER_BIT, // clear bits | 4013 GL_STENCIL_BUFFER_BIT, // clear bits |
4017 0, | 4014 0, |
4018 0, 0, 0, // color | 4015 0, 0, 0, // color |
4019 0, // stencil | 4016 0, // stencil |
4020 1.0f, // depth | 4017 1.0f, // depth |
4021 false, // scissor test | 4018 false, // scissor test |
4022 0, 0, 128, 64); | 4019 0, 0, 128, 64); |
4023 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER)) | 4020 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER)) |
4024 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) | 4021 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) |
4025 .RetiresOnSaturation(); | 4022 .RetiresOnSaturation(); |
4026 EXPECT_CALL(*gl_, BlitFramebufferEXT(0, 0, 1, 1, 0, 0, 1, 1, | |
4027 _, _)) | |
4028 .Times(0); | |
4029 BlitFramebufferCHROMIUM cmd; | 4023 BlitFramebufferCHROMIUM cmd; |
4030 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_DEPTH_BUFFER_BIT, GL_NEAREST); | 4024 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_DEPTH_BUFFER_BIT, GL_NEAREST); |
4031 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4025 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
4032 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4026 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
4033 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_STENCIL_BUFFER_BIT, GL_NEAREST); | 4027 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_STENCIL_BUFFER_BIT, GL_NEAREST); |
4034 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4028 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
4035 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4029 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
4036 } | 4030 } |
4037 | 4031 |
4038 // Switch FBOs and try the same. | 4032 // Switch FBOs and try the same. |
4039 DoBindFramebuffer(GL_READ_FRAMEBUFFER, client_framebuffer_id_, | 4033 DoBindFramebuffer(GL_READ_FRAMEBUFFER, client_framebuffer_id_, |
4040 kServiceFramebufferId); | 4034 kServiceFramebufferId); |
4041 DoBindFramebuffer(GL_DRAW_FRAMEBUFFER, color_fbo, kNewServiceId); | 4035 DoBindFramebuffer(GL_DRAW_FRAMEBUFFER, color_fbo, kNewServiceId); |
4042 { | 4036 { |
4043 EXPECT_CALL(*gl_, BlitFramebufferEXT(0, 0, 1, 1, 0, 0, 1, 1, | 4037 EXPECT_CALL(*gl_, BlitFramebufferEXT(0, 0, 1, 1, 0, 0, 1, 1, |
4044 _, _)) | 4038 _, _)) |
4045 .Times(0); | 4039 .Times(0); |
4046 BlitFramebufferCHROMIUM cmd; | 4040 BlitFramebufferCHROMIUM cmd; |
4047 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_DEPTH_BUFFER_BIT, GL_NEAREST); | 4041 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_DEPTH_BUFFER_BIT, GL_NEAREST); |
4048 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4042 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
4049 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4043 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
4050 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_STENCIL_BUFFER_BIT, GL_NEAREST); | 4044 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_STENCIL_BUFFER_BIT, GL_NEAREST); |
4051 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4045 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
4052 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4046 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
4053 } | 4047 } |
4054 } | 4048 } |
4055 | 4049 |
4056 // TODO(gman): PixelStorei | 4050 // TODO(gman): PixelStorei |
4057 | 4051 |
4058 // TODO(gman): SwapBuffers | 4052 // TODO(gman): SwapBuffers |
4059 | 4053 |
4060 } // namespace gles2 | 4054 } // namespace gles2 |
4061 } // namespace gpu | 4055 } // namespace gpu |
OLD | NEW |