// Copyright 2019 The Dawn & Tint Authors // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // 3. Neither the name of the copyright holder nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <algorithm> #include <numeric> #include <string> #include <vector> #include "dawn/common/Math.h" #include "dawn/tests/DawnTest.h" #include "dawn/utils/ComboRenderPipelineDescriptor.h" #include "dawn/utils/WGPUHelpers.h" namespace dawn { namespace { constexpr uint32_t kRTSize = …; constexpr uint32_t kBindingSize = …; class DynamicBufferOffsetTests : public DawnTest { … }; // Dynamic offsets are all zero and no effect to result. TEST_P(DynamicBufferOffsetTests, BasicRenderPipeline) { … } // Have non-zero dynamic offsets. TEST_P(DynamicBufferOffsetTests, SetDynamicOffsetsRenderPipeline) { … } // Dynamic offsets are all zero and no effect to result. TEST_P(DynamicBufferOffsetTests, BasicComputePipeline) { … } // Have non-zero dynamic offsets. TEST_P(DynamicBufferOffsetTests, SetDynamicOffsetsComputePipeline) { … } // Test basic inherit on render pipeline TEST_P(DynamicBufferOffsetTests, BasicInheritRenderPipeline) { … } // Test inherit dynamic offsets on render pipeline TEST_P(DynamicBufferOffsetTests, InheritDynamicOffsetsRenderPipeline) { … } // Test inherit dynamic offsets on compute pipeline TEST_P(DynamicBufferOffsetTests, InheritDynamicOffsetsComputePipeline) { … } // Setting multiple dynamic offsets for the same bindgroup in one render pass. TEST_P(DynamicBufferOffsetTests, UpdateDynamicOffsetsMultipleTimesRenderPipeline) { … } // Setting multiple dynamic offsets for the same bindgroup in one compute pass. TEST_P(DynamicBufferOffsetTests, UpdateDynamicOffsetsMultipleTimesComputePipeline) { … } namespace { ReadBufferUsage; OOBRead; OOBWrite; DAWN_TEST_PARAM_STRUCT(ClampedOOBDynamicBufferOffsetParams, ReadBufferUsage, OOBRead, OOBWrite); } // anonymous namespace class ClampedOOBDynamicBufferOffsetTests : public DawnTestWithParams<ClampedOOBDynamicBufferOffsetParams> { … }; // Test robust buffer access behavior for out of bounds accesses to dynamic buffer bindings. TEST_P(ClampedOOBDynamicBufferOffsetTests, CheckOOBAccess) { … } DAWN_INSTANTIATE_TEST(DynamicBufferOffsetTests, D3D11Backend(), D3D12Backend(), D3D12Backend({ … }; // Only instantiate on D3D12 / Metal where we are sure of the robustness implementation. // Tint injects clamping in the shader. OpenGL(ES) / Vulkan robustness is less constrained. DAWN_INSTANTIATE_TEST_P(…); } // anonymous namespace } // namespace dawn