// // Copyright 2017 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // RobustBufferAccessBehaviorTest: // Various tests related for GL_KHR_robust_buffer_access_behavior. // #include "test_utils/ANGLETest.h" #include "test_utils/gl_raii.h" #include "util/EGLWindow.h" #include "util/OSWindow.h" #include <array> usingnamespaceangle; namespace { class RobustBufferAccessBehaviorTest : public ANGLETest<> { … }; // Test that static draw with out-of-bounds reads will not read outside of the data store of the // buffer object and will not result in GL interruption or termination when // GL_KHR_robust_buffer_access_behavior is supported. TEST_P(RobustBufferAccessBehaviorTest, DrawElementsIndexOutOfRangeWithStaticDraw) { … } // Test that dynamic draw with out-of-bounds reads will not read outside of the data store of the // buffer object and will not result in GL interruption or termination when // GL_KHR_robust_buffer_access_behavior is supported. TEST_P(RobustBufferAccessBehaviorTest, DrawElementsIndexOutOfRangeWithDynamicDraw) { … } // Test that vertex buffers are rebound with the correct offsets in subsequent calls in the D3D11 // backend. http://crbug.com/837002 TEST_P(RobustBufferAccessBehaviorTest, D3D11StateSynchronizationOrderBug) { … } // Covers drawing with a very large vertex range which overflows GLsizei. http://crbug.com/842028 TEST_P(RobustBufferAccessBehaviorTest, VeryLargeVertexCountWithDynamicVertexData) { … } // Test that robust access works even if there's no data uploaded to the vertex buffer at all. TEST_P(RobustBufferAccessBehaviorTest, NoBufferData) { … } constexpr char kWebGLVS[] = …; constexpr char kWebGLFS[] = …; // Test buffer with interleaved (3+2) float vectors. Adapted from WebGL test // conformance/rendering/draw-arrays-out-of-bounds.html TEST_P(RobustBufferAccessBehaviorTest, InterleavedAttributes) { … } // Tests redefining an empty buffer. Adapted from WebGL test // conformance/rendering/draw-arrays-out-of-bounds.html TEST_P(RobustBufferAccessBehaviorTest, EmptyBuffer) { … } // Tests robust buffer access with dynamic buffer usage. TEST_P(RobustBufferAccessBehaviorTest, DynamicBuffer) { … } // Tests out of bounds read by divisor emulation due to a user-provided offset. // Adapted from https://crbug.com/1285885. TEST_P(RobustBufferAccessBehaviorTest, IndexOutOfBounds) { … } // Similar to the test above but index is first within bounds then goes out of bounds. TEST_P(RobustBufferAccessBehaviorTest, IndexGoingOutOfBounds) { … } // Draw out-of-bounds beginning with the start offset passed in. // Ensure that drawArrays flags either no error or INVALID_OPERATION. In the case of // INVALID_OPERATION, no canvas pixels can be touched. In the case of NO_ERROR, all written values // must either be the zero vertex or a value in the vertex buffer. See vsCheckOutOfBounds shader. void DrawAndVerifyOutOfBoundsArrays(int first, int count) { … } // Adapted from WebGL test // conformance/rendering/out-of-bounds-array-buffers.html // This test verifies that out-of-bounds array buffers behave according to spec. TEST_P(RobustBufferAccessBehaviorTest, OutOfBoundsArrayBuffers) { … } // Regression test for glBufferData with slightly increased size. Implementation may decided to // reuse the buffer storage if underline storage is big enough (due to alignment, implementation may // allocate more storage than data size.) This tests ensure it works correctly when this reuse // happens. TEST_P(RobustBufferAccessBehaviorTest, BufferDataWithIncreasedSize) { … } // Similar to BufferDataWithIncreasedSize. But this time the buffer is bound to two VAOs. The change // in the buffer should be picked up by both VAOs. TEST_P(RobustBufferAccessBehaviorTest, BufferDataWithIncreasedSizeAndUseWithVAOs) { … } // Prepare an element array buffer that indexes out-of-bounds beginning with the start index passed // in. Ensure that drawElements flags either no error or INVALID_OPERATION. In the case of // INVALID_OPERATION, no canvas pixels can be touched. In the case of NO_ERROR, all written values // must either be the zero vertex or a value in the vertex buffer. See vsCheckOutOfBounds shader. void DrawAndVerifyOutOfBoundsIndex(int startIndex) { … } // Adapted from WebGL test // conformance/rendering/out-of-bounds-index-buffers.html // This test verifies that out-of-bounds index buffers behave according to spec. TEST_P(RobustBufferAccessBehaviorTest, OutOfBoundsIndexBuffers) { … } ANGLE_INSTANTIATE_TEST(…); } // namespace