// Copyright 2017 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 <vector> #include "dawn/common/Assert.h" #include "dawn/tests/DawnTest.h" #include "dawn/utils/ComboRenderPipelineDescriptor.h" #include "dawn/utils/WGPUHelpers.h" namespace dawn { namespace { constexpr static unsigned int kRTSize = …; class DepthStencilStateTest : public DawnTest { … }; // Test compilation and usage of the fixture TEST_P(DepthStencilStateTest, Basic) { … } // Test defaults: depth and stencil tests disabled TEST_P(DepthStencilStateTest, DepthStencilDisabled) { … } // The following tests check that each depth comparison function works TEST_P(DepthStencilStateTest, DepthAlways) { … } TEST_P(DepthStencilStateTest, DepthEqual) { … } TEST_P(DepthStencilStateTest, DepthGreater) { … } TEST_P(DepthStencilStateTest, DepthGreaterEqual) { … } TEST_P(DepthStencilStateTest, DepthLess) { … } TEST_P(DepthStencilStateTest, DepthLessEqual) { … } TEST_P(DepthStencilStateTest, DepthNever) { … } TEST_P(DepthStencilStateTest, DepthNotEqual) { … } // Test that disabling depth writes works and leaves the depth buffer unchanged TEST_P(DepthStencilStateTest, DepthWriteDisabled) { … } // The following tests check that each stencil comparison function works TEST_P(DepthStencilStateTest, StencilAlways) { … } TEST_P(DepthStencilStateTest, StencilEqual) { … } TEST_P(DepthStencilStateTest, StencilGreater) { … } TEST_P(DepthStencilStateTest, StencilGreaterEqual) { … } TEST_P(DepthStencilStateTest, StencilLess) { … } TEST_P(DepthStencilStateTest, StencilLessEqual) { … } TEST_P(DepthStencilStateTest, StencilNever) { … } TEST_P(DepthStencilStateTest, StencilNotEqual) { … } // The following tests check that each stencil operation works TEST_P(DepthStencilStateTest, StencilKeep) { … } TEST_P(DepthStencilStateTest, StencilZero) { … } TEST_P(DepthStencilStateTest, StencilReplace) { … } TEST_P(DepthStencilStateTest, StencilInvert) { … } TEST_P(DepthStencilStateTest, StencilIncrementClamp) { … } TEST_P(DepthStencilStateTest, StencilIncrementWrap) { … } TEST_P(DepthStencilStateTest, StencilDecrementClamp) { … } TEST_P(DepthStencilStateTest, StencilDecrementWrap) { … } // Check that the setting a stencil read mask works TEST_P(DepthStencilStateTest, StencilReadMask) { … } // Check that setting a stencil write mask works TEST_P(DepthStencilStateTest, StencilWriteMask) { … } // Test that the stencil operation is executed on stencil fail TEST_P(DepthStencilStateTest, StencilFail) { … } // Test that the stencil operation is executed on stencil pass, depth fail TEST_P(DepthStencilStateTest, StencilDepthFail) { … } // Test that the stencil operation is executed on stencil pass, depth pass TEST_P(DepthStencilStateTest, StencilDepthPass) { … } // Test that creating a render pipeline works with for all depth and combined formats TEST_P(DepthStencilStateTest, CreatePipelineWithAllFormats) { … } // Test that the front and back stencil states are set correctly (and take frontFace into account) TEST_P(DepthStencilStateTest, StencilFrontAndBackFace) { … } // Test that the depth reference of a new render pass is initialized to default value 0 TEST_P(DepthStencilStateTest, StencilReferenceInitialized) { … } DAWN_INSTANTIATE_TEST(DepthStencilStateTest, D3D11Backend(), D3D12Backend(), MetalBackend(), OpenGLBackend(), OpenGLESBackend(), VulkanBackend({ … }; } // anonymous namespace } // namespace dawn