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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 .WillOnce(Return(GL_NO_ERROR)) | 172 .WillOnce(Return(GL_NO_ERROR)) |
173 .WillOnce(Return(GL_NO_ERROR)) | 173 .WillOnce(Return(GL_NO_ERROR)) |
174 .RetiresOnSaturation(); | 174 .RetiresOnSaturation(); |
175 FramebufferTexture2D cmd; | 175 FramebufferTexture2D cmd; |
176 cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, | 176 cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, |
177 client_texture_id_, 1); | 177 client_texture_id_, 1); |
178 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 178 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
179 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 179 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
180 } | 180 } |
181 | 181 |
| 182 TEST_P(GLES3DecoderTest, FramebufferTexture2DDepthStencil) { |
| 183 DoBindFramebuffer( |
| 184 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
| 185 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 186 EXPECT_CALL(*gl_, GetError()) |
| 187 .WillOnce(Return(GL_NO_ERROR)) |
| 188 .WillOnce(Return(GL_NO_ERROR)) |
| 189 .WillOnce(Return(GL_NO_ERROR)) |
| 190 .RetiresOnSaturation(); |
| 191 EXPECT_CALL(*gl_, |
| 192 FramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, |
| 193 GL_TEXTURE_2D, kServiceTextureId, 4)) |
| 194 .Times(1) |
| 195 .RetiresOnSaturation(); |
| 196 EXPECT_CALL(*gl_, |
| 197 FramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, |
| 198 GL_TEXTURE_2D, kServiceTextureId, 4)) |
| 199 .Times(1) |
| 200 .RetiresOnSaturation(); |
| 201 FramebufferTexture2D cmd; |
| 202 cmd.Init(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, |
| 203 client_texture_id_, 4); |
| 204 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 205 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 206 Framebuffer* framebuffer = GetFramebuffer(client_framebuffer_id_); |
| 207 ASSERT_TRUE(framebuffer); |
| 208 ASSERT_FALSE(framebuffer->GetAttachment(GL_DEPTH_STENCIL_ATTACHMENT)); |
| 209 ASSERT_TRUE(framebuffer->GetAttachment(GL_DEPTH_ATTACHMENT)); |
| 210 ASSERT_TRUE(framebuffer->GetAttachment(GL_STENCIL_ATTACHMENT)); |
| 211 } |
| 212 |
182 TEST_P(GLES2DecoderTest, FramebufferTexture2DInvalidArgs0_0) { | 213 TEST_P(GLES2DecoderTest, FramebufferTexture2DInvalidArgs0_0) { |
183 EXPECT_CALL(*gl_, FramebufferTexture2DEXT(_, _, _, _, _)).Times(0); | 214 EXPECT_CALL(*gl_, FramebufferTexture2DEXT(_, _, _, _, _)).Times(0); |
184 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 215 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
185 DoBindFramebuffer( | 216 DoBindFramebuffer( |
186 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 217 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
187 FramebufferTexture2D cmd; | 218 FramebufferTexture2D cmd; |
188 cmd.Init(GL_RENDERBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, | 219 cmd.Init(GL_RENDERBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, |
189 client_texture_id_, 0); | 220 client_texture_id_, 0); |
190 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 221 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
191 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 222 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
(...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1562 .Times(1) | 1593 .Times(1) |
1563 .RetiresOnSaturation(); | 1594 .RetiresOnSaturation(); |
1564 EXPECT_CALL(*gl_, GetError()) | 1595 EXPECT_CALL(*gl_, GetError()) |
1565 .WillOnce(Return(GL_NO_ERROR)) | 1596 .WillOnce(Return(GL_NO_ERROR)) |
1566 .RetiresOnSaturation(); | 1597 .RetiresOnSaturation(); |
1567 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_cmd)); | 1598 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_cmd)); |
1568 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_mask_separate_cmd)); | 1599 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_mask_separate_cmd)); |
1569 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1600 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1570 } | 1601 } |
1571 | 1602 |
1572 #if 0 // Turn this test on once we allow GL_DEPTH_STENCIL_ATTACHMENT | 1603 TEST_P(GLES3DecoderTest, FramebufferRenderbufferClearDepthStencil) { |
1573 TEST_P(GLES2DecoderTest, FramebufferRenderbufferClearDepthStencil) { | |
1574 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, | 1604 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, |
1575 kServiceFramebufferId); | 1605 kServiceFramebufferId); |
1576 ClearDepthf depth_cmd; | 1606 ClearDepthf depth_cmd; |
1577 ClearStencil stencil_cmd; | 1607 ClearStencil stencil_cmd; |
1578 FramebufferRenderbuffer cmd; | 1608 FramebufferRenderbuffer cmd; |
1579 depth_cmd.Init(0.5f); | 1609 depth_cmd.Init(0.5f); |
1580 stencil_cmd.Init(123); | 1610 stencil_cmd.Init(123); |
1581 cmd.Init( | 1611 cmd.Init( |
1582 GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, | 1612 GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, |
1583 client_renderbuffer_id_); | 1613 client_renderbuffer_id_); |
1584 InSequence sequence; | 1614 InSequence sequence; |
1585 EXPECT_CALL(*gl_, ClearDepth(0.5f)) | 1615 EXPECT_CALL(*gl_, ClearDepth(0.5f)) |
1586 .Times(1) | 1616 .Times(1) |
1587 .RetiresOnSaturation(); | 1617 .RetiresOnSaturation(); |
1588 EXPECT_CALL(*gl_, ClearStencil(123)) | 1618 EXPECT_CALL(*gl_, ClearStencil(123)) |
1589 .Times(1) | 1619 .Times(1) |
1590 .RetiresOnSaturation(); | 1620 .RetiresOnSaturation(); |
| 1621 EXPECT_CALL(*gl_, GetError()) |
| 1622 .WillOnce(Return(GL_NO_ERROR)) |
| 1623 .RetiresOnSaturation(); |
1591 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( | 1624 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( |
1592 GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, | 1625 GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, |
1593 kServiceRenderbufferId)) | 1626 kServiceRenderbufferId)) |
1594 .Times(1) | 1627 .Times(1) |
1595 .RetiresOnSaturation(); | 1628 .RetiresOnSaturation(); |
| 1629 EXPECT_CALL(*gl_, GetError()) |
| 1630 .WillOnce(Return(GL_NO_ERROR)) |
| 1631 .RetiresOnSaturation(); |
| 1632 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( |
| 1633 GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, |
| 1634 kServiceRenderbufferId)) |
| 1635 .Times(1) |
| 1636 .RetiresOnSaturation(); |
| 1637 EXPECT_CALL(*gl_, GetError()) |
| 1638 .WillOnce(Return(GL_NO_ERROR)) |
| 1639 .RetiresOnSaturation(); |
1596 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_cmd)); | 1640 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_cmd)); |
1597 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_cmd)); | 1641 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_cmd)); |
1598 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1642 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1643 Framebuffer* framebuffer = GetFramebuffer(client_framebuffer_id_); |
| 1644 ASSERT_TRUE(framebuffer); |
| 1645 ASSERT_FALSE(framebuffer->GetAttachment(GL_DEPTH_STENCIL_ATTACHMENT)); |
| 1646 ASSERT_TRUE(framebuffer->GetAttachment(GL_DEPTH_ATTACHMENT)); |
| 1647 ASSERT_TRUE(framebuffer->GetAttachment(GL_STENCIL_ATTACHMENT)); |
1599 } | 1648 } |
1600 #endif | |
1601 | 1649 |
1602 TEST_P(GLES2DecoderManualInitTest, ActualAlphaMatchesRequestedAlpha) { | 1650 TEST_P(GLES2DecoderManualInitTest, ActualAlphaMatchesRequestedAlpha) { |
1603 InitState init; | 1651 InitState init; |
1604 init.has_alpha = true; | 1652 init.has_alpha = true; |
1605 init.request_alpha = true; | 1653 init.request_alpha = true; |
1606 init.bind_generates_resource = true; | 1654 init.bind_generates_resource = true; |
1607 InitDecoder(init); | 1655 InitDecoder(init); |
1608 | 1656 |
1609 EXPECT_CALL(*gl_, GetError()) | 1657 EXPECT_CALL(*gl_, GetError()) |
1610 .WillOnce(Return(GL_NO_ERROR)) | 1658 .WillOnce(Return(GL_NO_ERROR)) |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2175 1, 1, GL_NO_ERROR); | 2223 1, 1, GL_NO_ERROR); |
2176 DoFramebufferRenderbuffer( | 2224 DoFramebufferRenderbuffer( |
2177 GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, | 2225 GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, |
2178 client_renderbuffer_id_, kServiceRenderbufferId, GL_NO_ERROR); | 2226 client_renderbuffer_id_, kServiceRenderbufferId, GL_NO_ERROR); |
2179 | 2227 |
2180 // TODO(zmo): Set up expectations for the path where the attachment isn't | 2228 // TODO(zmo): Set up expectations for the path where the attachment isn't |
2181 // marked as cleared. | 2229 // marked as cleared. |
2182 Framebuffer* framebuffer = | 2230 Framebuffer* framebuffer = |
2183 group().framebuffer_manager()->GetFramebuffer(client_framebuffer_id_); | 2231 group().framebuffer_manager()->GetFramebuffer(client_framebuffer_id_); |
2184 framebuffer->MarkAttachmentAsCleared(group().renderbuffer_manager(), nullptr, | 2232 framebuffer->MarkAttachmentAsCleared(group().renderbuffer_manager(), nullptr, |
2185 GL_DEPTH_STENCIL_ATTACHMENT, true); | 2233 GL_DEPTH_ATTACHMENT, true); |
| 2234 framebuffer->MarkAttachmentAsCleared(group().renderbuffer_manager(), nullptr, |
| 2235 GL_STENCIL_ATTACHMENT, true); |
2186 | 2236 |
2187 Enable cmd_enable; | 2237 Enable cmd_enable; |
2188 cmd_enable.Init(GL_STENCIL_TEST); | 2238 cmd_enable.Init(GL_STENCIL_TEST); |
2189 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd_enable)); | 2239 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd_enable)); |
2190 cmd_enable.Init(GL_DEPTH_TEST); | 2240 cmd_enable.Init(GL_DEPTH_TEST); |
2191 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd_enable)); | 2241 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd_enable)); |
2192 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 2242 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
2193 | 2243 |
2194 ClearBufferfi cmd; | 2244 ClearBufferfi cmd; |
2195 cmd.Init(GL_DEPTH_STENCIL, 0, 1.0f, 0); | 2245 cmd.Init(GL_DEPTH_STENCIL, 0, 1.0f, 0); |
(...skipping 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3561 GL_COLOR_ATTACHMENT0, | 3611 GL_COLOR_ATTACHMENT0, |
3562 kServiceTextureId, 4, 5)) | 3612 kServiceTextureId, 4, 5)) |
3563 .Times(1) | 3613 .Times(1) |
3564 .RetiresOnSaturation(); | 3614 .RetiresOnSaturation(); |
3565 FramebufferTextureLayer cmd; | 3615 FramebufferTextureLayer cmd; |
3566 cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, client_texture_id_, 4, 5); | 3616 cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, client_texture_id_, 4, 5); |
3567 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 3617 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
3568 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3618 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
3569 } | 3619 } |
3570 | 3620 |
| 3621 TEST_P(GLES3DecoderTest, FramebufferTextureLayerDepthStencil) { |
| 3622 DoBindFramebuffer( |
| 3623 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
| 3624 DoBindTexture(GL_TEXTURE_2D_ARRAY, client_texture_id_, kServiceTextureId); |
| 3625 EXPECT_CALL(*gl_, FramebufferTextureLayer(GL_FRAMEBUFFER, |
| 3626 GL_DEPTH_STENCIL_ATTACHMENT, |
| 3627 kServiceTextureId, 4, 5)) |
| 3628 .Times(1) |
| 3629 .RetiresOnSaturation(); |
| 3630 FramebufferTextureLayer cmd; |
| 3631 cmd.Init(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, client_texture_id_, 4, |
| 3632 5); |
| 3633 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 3634 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3635 Framebuffer* framebuffer = GetFramebuffer(client_framebuffer_id_); |
| 3636 ASSERT_TRUE(framebuffer); |
| 3637 ASSERT_FALSE(framebuffer->GetAttachment(GL_DEPTH_STENCIL_ATTACHMENT)); |
| 3638 ASSERT_TRUE(framebuffer->GetAttachment(GL_DEPTH_ATTACHMENT)); |
| 3639 ASSERT_TRUE(framebuffer->GetAttachment(GL_STENCIL_ATTACHMENT)); |
| 3640 } |
| 3641 |
3571 TEST_P(GLES3DecoderTest, InvalidateFramebufferDepthStencilAttachment) { | 3642 TEST_P(GLES3DecoderTest, InvalidateFramebufferDepthStencilAttachment) { |
3572 DoBindFramebuffer( | 3643 DoBindFramebuffer( |
3573 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 3644 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
3574 DoBindRenderbuffer( | 3645 DoBindRenderbuffer( |
3575 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); | 3646 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); |
3576 DoRenderbufferStorage( | 3647 DoRenderbufferStorage( |
3577 GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, GL_DEPTH24_STENCIL8, | 3648 GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, GL_DEPTH24_STENCIL8, |
3578 1, 1, GL_NO_ERROR); | 3649 1, 1, GL_NO_ERROR); |
3579 DoFramebufferRenderbuffer( | 3650 DoFramebufferRenderbuffer( |
3580 GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, | 3651 GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, |
3581 client_renderbuffer_id_, kServiceRenderbufferId, GL_NO_ERROR); | 3652 client_renderbuffer_id_, kServiceRenderbufferId, GL_NO_ERROR); |
3582 | 3653 |
3583 Framebuffer* framebuffer = | 3654 Framebuffer* framebuffer = |
3584 group().framebuffer_manager()->GetFramebuffer(client_framebuffer_id_); | 3655 group().framebuffer_manager()->GetFramebuffer(client_framebuffer_id_); |
3585 // TODO(qiankun.miao@intel.com): We should only mark DEPTH and STENCIL | 3656 ASSERT_TRUE(framebuffer); |
3586 // attachments as cleared when command buffer handles DEPTH_STENCIL well. | 3657 ASSERT_FALSE(framebuffer->GetAttachment(GL_DEPTH_STENCIL_ATTACHMENT)); |
3587 // http://crbug.com/630568 | 3658 ASSERT_TRUE(framebuffer->GetAttachment(GL_DEPTH_ATTACHMENT)); |
| 3659 ASSERT_TRUE(framebuffer->GetAttachment(GL_STENCIL_ATTACHMENT)); |
3588 framebuffer->MarkAttachmentAsCleared(group().renderbuffer_manager(), nullptr, | 3660 framebuffer->MarkAttachmentAsCleared(group().renderbuffer_manager(), nullptr, |
3589 GL_DEPTH_ATTACHMENT, true); | 3661 GL_DEPTH_ATTACHMENT, true); |
3590 framebuffer->MarkAttachmentAsCleared(group().renderbuffer_manager(), nullptr, | 3662 framebuffer->MarkAttachmentAsCleared(group().renderbuffer_manager(), nullptr, |
3591 GL_STENCIL_ATTACHMENT, true); | 3663 GL_STENCIL_ATTACHMENT, true); |
3592 framebuffer->MarkAttachmentAsCleared(group().renderbuffer_manager(), nullptr, | |
3593 GL_DEPTH_STENCIL_ATTACHMENT, true); | |
3594 EXPECT_TRUE(framebuffer->IsCleared()); | 3664 EXPECT_TRUE(framebuffer->IsCleared()); |
3595 | 3665 |
3596 const GLenum target = GL_FRAMEBUFFER; | 3666 const GLenum target = GL_FRAMEBUFFER; |
3597 const GLsizei count = 1; | 3667 const GLsizei count = 1; |
3598 GLenum attachments[] = {GL_DEPTH_ATTACHMENT}; | 3668 GLenum attachments[] = {GL_DEPTH_ATTACHMENT}; |
3599 EXPECT_CALL(*gl_, InvalidateFramebuffer(target, 0, _)) | 3669 EXPECT_CALL(*gl_, InvalidateFramebuffer(target, 0, _)) |
3600 .Times(1) | 3670 .Times(1) |
3601 .RetiresOnSaturation(); | 3671 .RetiresOnSaturation(); |
3602 InvalidateFramebufferImmediate& cmd = | 3672 InvalidateFramebufferImmediate& cmd = |
3603 *GetImmediateAs<InvalidateFramebufferImmediate>(); | 3673 *GetImmediateAs<InvalidateFramebufferImmediate>(); |
3604 cmd.Init(target, count, attachments); | 3674 cmd.Init(target, count, attachments); |
3605 | 3675 |
3606 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(attachments))); | 3676 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(attachments))); |
3607 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3677 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
3608 // Invalidating part of DEPTH_STENCIL attachment doesn't change framebuffer | 3678 // Invalidating part of DEPTH_STENCIL attachment doesn't change framebuffer |
3609 // clearance status. | 3679 // clearance status. |
3610 EXPECT_TRUE(framebuffer->IsCleared()); | 3680 EXPECT_TRUE(framebuffer->IsCleared()); |
3611 EXPECT_FALSE(framebuffer->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT)); | 3681 EXPECT_FALSE(framebuffer->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT)); |
3612 EXPECT_FALSE(framebuffer->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT)); | 3682 EXPECT_FALSE(framebuffer->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT)); |
3613 EXPECT_FALSE(framebuffer->HasUnclearedAttachment( | |
3614 GL_DEPTH_STENCIL_ATTACHMENT)); | |
3615 | 3683 |
3616 attachments[0] = GL_DEPTH_STENCIL_ATTACHMENT; | 3684 attachments[0] = GL_DEPTH_STENCIL_ATTACHMENT; |
3617 EXPECT_CALL(*gl_, InvalidateFramebuffer(target, 1, _)) | 3685 EXPECT_CALL(*gl_, InvalidateFramebuffer(target, 1, _)) |
3618 .Times(1) | 3686 .Times(1) |
3619 .RetiresOnSaturation(); | 3687 .RetiresOnSaturation(); |
3620 cmd.Init(target, count, attachments); | 3688 cmd.Init(target, count, attachments); |
3621 | 3689 |
3622 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(attachments))); | 3690 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(attachments))); |
3623 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3691 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
3624 // Invalidating DEPTH_STENCIL attachment should make framebuffer uncleared. | 3692 // Invalidating DEPTH_STENCIL attachment should make framebuffer uncleared. |
3625 EXPECT_FALSE(framebuffer->IsCleared()); | 3693 EXPECT_FALSE(framebuffer->IsCleared()); |
3626 EXPECT_TRUE(framebuffer->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT)); | 3694 EXPECT_TRUE(framebuffer->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT)); |
3627 EXPECT_TRUE(framebuffer->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT)); | 3695 EXPECT_TRUE(framebuffer->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT)); |
3628 EXPECT_TRUE(framebuffer->HasUnclearedAttachment( | |
3629 GL_DEPTH_STENCIL_ATTACHMENT)); | |
3630 } | 3696 } |
3631 | 3697 |
3632 TEST_P(GLES3DecoderTest, BlitFramebufferFeedbackLoopDefaultFramebuffer) { | 3698 TEST_P(GLES3DecoderTest, BlitFramebufferFeedbackLoopDefaultFramebuffer) { |
3633 // Run BlitFramebufferCHROMIUM targetting the default framebuffer for both | 3699 // Run BlitFramebufferCHROMIUM targetting the default framebuffer for both |
3634 // read and draw, should result in a feedback loop. | 3700 // read and draw, should result in a feedback loop. |
3635 BlitFramebufferCHROMIUM cmd; | 3701 BlitFramebufferCHROMIUM cmd; |
3636 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_COLOR_BUFFER_BIT, GL_LINEAR); | 3702 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_COLOR_BUFFER_BIT, GL_LINEAR); |
3637 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 3703 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
3638 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 3704 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
3639 | 3705 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3755 .Times(0); | 3821 .Times(0); |
3756 BlitFramebufferCHROMIUM cmd; | 3822 BlitFramebufferCHROMIUM cmd; |
3757 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_DEPTH_BUFFER_BIT, GL_NEAREST); | 3823 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_DEPTH_BUFFER_BIT, GL_NEAREST); |
3758 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 3824 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
3759 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3825 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
3760 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_STENCIL_BUFFER_BIT, GL_NEAREST); | 3826 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_STENCIL_BUFFER_BIT, GL_NEAREST); |
3761 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 3827 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
3762 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3828 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
3763 } | 3829 } |
3764 | 3830 |
3765 // Same using DEPTH_STENCIL_ATTACHMENT instead of separate ones. | |
3766 DoFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, | |
3767 GL_RENDERBUFFER, 0, 0, GL_NO_ERROR); | |
3768 DoFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, | |
3769 GL_RENDERBUFFER, 0, 0, GL_NO_ERROR); | |
3770 DoFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, | |
3771 GL_RENDERBUFFER, client_renderbuffer_id_, | |
3772 kServiceRenderbufferId, GL_NO_ERROR); | |
3773 { | |
3774 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER)) | |
3775 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) | |
3776 .RetiresOnSaturation(); | |
3777 EXPECT_CALL(*gl_, BlitFramebufferEXT(0, 0, 1, 1, 0, 0, 1, 1, | |
3778 _, _)) | |
3779 .Times(0); | |
3780 BlitFramebufferCHROMIUM cmd; | |
3781 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_DEPTH_BUFFER_BIT, GL_NEAREST); | |
3782 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | |
3783 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | |
3784 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_STENCIL_BUFFER_BIT, GL_NEAREST); | |
3785 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | |
3786 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | |
3787 } | |
3788 | |
3789 // Switch FBOs and try the same. | 3831 // Switch FBOs and try the same. |
3790 DoBindFramebuffer(GL_READ_FRAMEBUFFER, client_framebuffer_id_, | 3832 DoBindFramebuffer(GL_READ_FRAMEBUFFER, client_framebuffer_id_, |
3791 kServiceFramebufferId); | 3833 kServiceFramebufferId); |
3792 DoBindFramebuffer(GL_DRAW_FRAMEBUFFER, color_fbo, kNewServiceId); | 3834 DoBindFramebuffer(GL_DRAW_FRAMEBUFFER, color_fbo, kNewServiceId); |
3793 { | 3835 { |
3794 EXPECT_CALL(*gl_, BlitFramebufferEXT(0, 0, 1, 1, 0, 0, 1, 1, | 3836 EXPECT_CALL(*gl_, BlitFramebufferEXT(0, 0, 1, 1, 0, 0, 1, 1, |
3795 _, _)) | 3837 _, _)) |
3796 .Times(0); | 3838 .Times(0); |
3797 BlitFramebufferCHROMIUM cmd; | 3839 BlitFramebufferCHROMIUM cmd; |
3798 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_DEPTH_BUFFER_BIT, GL_NEAREST); | 3840 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_DEPTH_BUFFER_BIT, GL_NEAREST); |
3799 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 3841 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
3800 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3842 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
3801 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_STENCIL_BUFFER_BIT, GL_NEAREST); | 3843 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_STENCIL_BUFFER_BIT, GL_NEAREST); |
3802 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 3844 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
3803 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3845 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
3804 } | 3846 } |
3805 } | 3847 } |
3806 | 3848 |
3807 // TODO(gman): PixelStorei | 3849 // TODO(gman): PixelStorei |
3808 | 3850 |
3809 // TODO(gman): SwapBuffers | 3851 // TODO(gman): SwapBuffers |
3810 | 3852 |
3811 } // namespace gles2 | 3853 } // namespace gles2 |
3812 } // namespace gpu | 3854 } // namespace gpu |
OLD | NEW |