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