| 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, | 348 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, |
| 349 shared_memory_id_, | 349 shared_memory_id_, |
| 350 shared_memory_offset_); | 350 shared_memory_offset_); |
| 351 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 351 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 352 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 352 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 353 } | 353 } |
| 354 | 354 |
| 355 TEST_P(GLES2DecoderTest, GetFramebufferAttachmentParameterivWithRenderbuffer) { | 355 TEST_P(GLES2DecoderTest, GetFramebufferAttachmentParameterivWithRenderbuffer) { |
| 356 DoBindFramebuffer( | 356 DoBindFramebuffer( |
| 357 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 357 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
| 358 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, |
| 359 kServiceRenderbufferId); |
| 358 EXPECT_CALL(*gl_, GetError()) | 360 EXPECT_CALL(*gl_, GetError()) |
| 359 .WillRepeatedly(Return(GL_NO_ERROR)); | 361 .WillRepeatedly(Return(GL_NO_ERROR)); |
| 360 EXPECT_CALL(*gl_, | 362 EXPECT_CALL(*gl_, |
| 361 FramebufferRenderbufferEXT(GL_FRAMEBUFFER, | 363 FramebufferRenderbufferEXT(GL_FRAMEBUFFER, |
| 362 GL_COLOR_ATTACHMENT0, | 364 GL_COLOR_ATTACHMENT0, |
| 363 GL_RENDERBUFFER, | 365 GL_RENDERBUFFER, |
| 364 kServiceRenderbufferId)) | 366 kServiceRenderbufferId)) |
| 365 .Times(1) | 367 .Times(1) |
| 366 .RetiresOnSaturation(); | 368 .RetiresOnSaturation(); |
| 367 GetFramebufferAttachmentParameteriv::Result* result = | 369 GetFramebufferAttachmentParameteriv::Result* result = |
| (...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1482 FinishReadPixelsAndCheckResult(kWidth, kHeight, pixels); | 1484 FinishReadPixelsAndCheckResult(kWidth, kHeight, pixels); |
| 1483 } | 1485 } |
| 1484 | 1486 |
| 1485 INSTANTIATE_TEST_CASE_P(Service, GLES2ReadPixelsAsyncTest, ::testing::Bool()); | 1487 INSTANTIATE_TEST_CASE_P(Service, GLES2ReadPixelsAsyncTest, ::testing::Bool()); |
| 1486 | 1488 |
| 1487 // Check that if a renderbuffer is attached and GL returns | 1489 // Check that if a renderbuffer is attached and GL returns |
| 1488 // GL_FRAMEBUFFER_COMPLETE that the buffer is cleared and state is restored. | 1490 // GL_FRAMEBUFFER_COMPLETE that the buffer is cleared and state is restored. |
| 1489 TEST_P(GLES2DecoderTest, FramebufferRenderbufferClearColor) { | 1491 TEST_P(GLES2DecoderTest, FramebufferRenderbufferClearColor) { |
| 1490 DoBindFramebuffer( | 1492 DoBindFramebuffer( |
| 1491 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 1493 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
| 1494 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, |
| 1495 kServiceRenderbufferId); |
| 1492 ClearColor color_cmd; | 1496 ClearColor color_cmd; |
| 1493 ColorMask color_mask_cmd; | 1497 ColorMask color_mask_cmd; |
| 1494 Enable enable_cmd; | 1498 Enable enable_cmd; |
| 1495 FramebufferRenderbuffer cmd; | 1499 FramebufferRenderbuffer cmd; |
| 1496 color_cmd.Init(0.1f, 0.2f, 0.3f, 0.4f); | 1500 color_cmd.Init(0.1f, 0.2f, 0.3f, 0.4f); |
| 1497 color_mask_cmd.Init(0, 1, 0, 1); | 1501 color_mask_cmd.Init(0, 1, 0, 1); |
| 1498 enable_cmd.Init(GL_SCISSOR_TEST); | 1502 enable_cmd.Init(GL_SCISSOR_TEST); |
| 1499 cmd.Init(GL_FRAMEBUFFER, | 1503 cmd.Init(GL_FRAMEBUFFER, |
| 1500 GL_COLOR_ATTACHMENT0, | 1504 GL_COLOR_ATTACHMENT0, |
| 1501 GL_RENDERBUFFER, | 1505 GL_RENDERBUFFER, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1520 .RetiresOnSaturation(); | 1524 .RetiresOnSaturation(); |
| 1521 EXPECT_EQ(error::kNoError, ExecuteCmd(color_cmd)); | 1525 EXPECT_EQ(error::kNoError, ExecuteCmd(color_cmd)); |
| 1522 EXPECT_EQ(error::kNoError, ExecuteCmd(color_mask_cmd)); | 1526 EXPECT_EQ(error::kNoError, ExecuteCmd(color_mask_cmd)); |
| 1523 EXPECT_EQ(error::kNoError, ExecuteCmd(enable_cmd)); | 1527 EXPECT_EQ(error::kNoError, ExecuteCmd(enable_cmd)); |
| 1524 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1528 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1525 } | 1529 } |
| 1526 | 1530 |
| 1527 TEST_P(GLES2DecoderTest, FramebufferRenderbufferClearDepth) { | 1531 TEST_P(GLES2DecoderTest, FramebufferRenderbufferClearDepth) { |
| 1528 DoBindFramebuffer( | 1532 DoBindFramebuffer( |
| 1529 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 1533 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
| 1534 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, |
| 1535 kServiceRenderbufferId); |
| 1530 ClearDepthf depth_cmd; | 1536 ClearDepthf depth_cmd; |
| 1531 DepthMask depth_mask_cmd; | 1537 DepthMask depth_mask_cmd; |
| 1532 FramebufferRenderbuffer cmd; | 1538 FramebufferRenderbuffer cmd; |
| 1533 depth_cmd.Init(0.5f); | 1539 depth_cmd.Init(0.5f); |
| 1534 depth_mask_cmd.Init(false); | 1540 depth_mask_cmd.Init(false); |
| 1535 cmd.Init(GL_FRAMEBUFFER, | 1541 cmd.Init(GL_FRAMEBUFFER, |
| 1536 GL_DEPTH_ATTACHMENT, | 1542 GL_DEPTH_ATTACHMENT, |
| 1537 GL_RENDERBUFFER, | 1543 GL_RENDERBUFFER, |
| 1538 client_renderbuffer_id_); | 1544 client_renderbuffer_id_); |
| 1539 InSequence sequence; | 1545 InSequence sequence; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1552 .WillOnce(Return(GL_NO_ERROR)) | 1558 .WillOnce(Return(GL_NO_ERROR)) |
| 1553 .RetiresOnSaturation(); | 1559 .RetiresOnSaturation(); |
| 1554 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_cmd)); | 1560 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_cmd)); |
| 1555 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_mask_cmd)); | 1561 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_mask_cmd)); |
| 1556 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1562 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1557 } | 1563 } |
| 1558 | 1564 |
| 1559 TEST_P(GLES2DecoderTest, FramebufferRenderbufferClearStencil) { | 1565 TEST_P(GLES2DecoderTest, FramebufferRenderbufferClearStencil) { |
| 1560 DoBindFramebuffer( | 1566 DoBindFramebuffer( |
| 1561 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 1567 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
| 1568 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, |
| 1569 kServiceRenderbufferId); |
| 1562 ClearStencil stencil_cmd; | 1570 ClearStencil stencil_cmd; |
| 1563 StencilMaskSeparate stencil_mask_separate_cmd; | 1571 StencilMaskSeparate stencil_mask_separate_cmd; |
| 1564 FramebufferRenderbuffer cmd; | 1572 FramebufferRenderbuffer cmd; |
| 1565 stencil_cmd.Init(123); | 1573 stencil_cmd.Init(123); |
| 1566 stencil_mask_separate_cmd.Init(GL_BACK, 0x1234u); | 1574 stencil_mask_separate_cmd.Init(GL_BACK, 0x1234u); |
| 1567 cmd.Init(GL_FRAMEBUFFER, | 1575 cmd.Init(GL_FRAMEBUFFER, |
| 1568 GL_STENCIL_ATTACHMENT, | 1576 GL_STENCIL_ATTACHMENT, |
| 1569 GL_RENDERBUFFER, | 1577 GL_RENDERBUFFER, |
| 1570 client_renderbuffer_id_); | 1578 client_renderbuffer_id_); |
| 1571 InSequence sequence; | 1579 InSequence sequence; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1584 .WillOnce(Return(GL_NO_ERROR)) | 1592 .WillOnce(Return(GL_NO_ERROR)) |
| 1585 .RetiresOnSaturation(); | 1593 .RetiresOnSaturation(); |
| 1586 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_cmd)); | 1594 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_cmd)); |
| 1587 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_mask_separate_cmd)); | 1595 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_mask_separate_cmd)); |
| 1588 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1596 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1589 } | 1597 } |
| 1590 | 1598 |
| 1591 TEST_P(GLES3DecoderTest, FramebufferRenderbufferClearDepthStencil) { | 1599 TEST_P(GLES3DecoderTest, FramebufferRenderbufferClearDepthStencil) { |
| 1592 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, | 1600 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, |
| 1593 kServiceFramebufferId); | 1601 kServiceFramebufferId); |
| 1602 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, |
| 1603 kServiceRenderbufferId); |
| 1594 ClearDepthf depth_cmd; | 1604 ClearDepthf depth_cmd; |
| 1595 ClearStencil stencil_cmd; | 1605 ClearStencil stencil_cmd; |
| 1596 FramebufferRenderbuffer cmd; | 1606 FramebufferRenderbuffer cmd; |
| 1597 depth_cmd.Init(0.5f); | 1607 depth_cmd.Init(0.5f); |
| 1598 stencil_cmd.Init(123); | 1608 stencil_cmd.Init(123); |
| 1599 cmd.Init( | 1609 cmd.Init( |
| 1600 GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, | 1610 GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, |
| 1601 client_renderbuffer_id_); | 1611 client_renderbuffer_id_); |
| 1602 InSequence sequence; | 1612 InSequence sequence; |
| 1603 EXPECT_CALL(*gl_, ClearDepth(0.5f)) | 1613 EXPECT_CALL(*gl_, ClearDepth(0.5f)) |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2001 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 2011 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 2002 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), | 2012 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), |
| 2003 result->GetNumResults()); | 2013 result->GetNumResults()); |
| 2004 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 2014 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 2005 EXPECT_EQ(0, result->GetData()[0]); | 2015 EXPECT_EQ(0, result->GetData()[0]); |
| 2006 } | 2016 } |
| 2007 | 2017 |
| 2008 TEST_P(GLES2DecoderTest, FramebufferRenderbufferGLError) { | 2018 TEST_P(GLES2DecoderTest, FramebufferRenderbufferGLError) { |
| 2009 DoBindFramebuffer( | 2019 DoBindFramebuffer( |
| 2010 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 2020 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
| 2021 FramebufferRenderbuffer cmd; |
| 2022 cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, |
| 2023 client_renderbuffer_id_); |
| 2024 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2025 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 2026 |
| 2027 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, |
| 2028 kServiceRenderbufferId); |
| 2011 EXPECT_CALL(*gl_, GetError()) | 2029 EXPECT_CALL(*gl_, GetError()) |
| 2012 .WillOnce(Return(GL_NO_ERROR)) | 2030 .WillOnce(Return(GL_NO_ERROR)) |
| 2013 .WillOnce(Return(GL_OUT_OF_MEMORY)) | 2031 .WillOnce(Return(GL_OUT_OF_MEMORY)) |
| 2014 .RetiresOnSaturation(); | 2032 .RetiresOnSaturation(); |
| 2015 EXPECT_CALL(*gl_, | 2033 EXPECT_CALL(*gl_, |
| 2016 FramebufferRenderbufferEXT(GL_FRAMEBUFFER, | 2034 FramebufferRenderbufferEXT(GL_FRAMEBUFFER, |
| 2017 GL_COLOR_ATTACHMENT0, | 2035 GL_COLOR_ATTACHMENT0, |
| 2018 GL_RENDERBUFFER, | 2036 GL_RENDERBUFFER, |
| 2019 kServiceRenderbufferId)) | 2037 kServiceRenderbufferId)) |
| 2020 .Times(1) | 2038 .Times(1) |
| 2021 .RetiresOnSaturation(); | 2039 .RetiresOnSaturation(); |
| 2022 FramebufferRenderbuffer cmd; | |
| 2023 cmd.Init(GL_FRAMEBUFFER, | |
| 2024 GL_COLOR_ATTACHMENT0, | |
| 2025 GL_RENDERBUFFER, | |
| 2026 client_renderbuffer_id_); | |
| 2027 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2040 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2028 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 2041 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
| 2029 } | 2042 } |
| 2030 | 2043 |
| 2031 TEST_P(GLES2DecoderTest, FramebufferTexture2DGLError) { | 2044 TEST_P(GLES2DecoderTest, FramebufferTexture2DGLError) { |
| 2032 const GLsizei kWidth = 5; | 2045 const GLsizei kWidth = 5; |
| 2033 const GLsizei kHeight = 3; | 2046 const GLsizei kHeight = 3; |
| 2034 const GLenum kFormat = GL_RGB; | 2047 const GLenum kFormat = GL_RGB; |
| 2035 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 2048 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 2036 DoTexImage2D(GL_TEXTURE_2D, | 2049 DoTexImage2D(GL_TEXTURE_2D, |
| (...skipping 2021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4058 INSTANTIATE_TEST_CASE_P(Service, | 4071 INSTANTIATE_TEST_CASE_P(Service, |
| 4059 GLES2DecoderTestWithDrawRectangle, | 4072 GLES2DecoderTestWithDrawRectangle, |
| 4060 ::testing::Bool()); | 4073 ::testing::Bool()); |
| 4061 | 4074 |
| 4062 // TODO(gman): PixelStorei | 4075 // TODO(gman): PixelStorei |
| 4063 | 4076 |
| 4064 // TODO(gman): SwapBuffers | 4077 // TODO(gman): SwapBuffers |
| 4065 | 4078 |
| 4066 } // namespace gles2 | 4079 } // namespace gles2 |
| 4067 } // namespace gpu | 4080 } // namespace gpu |
| OLD | NEW |