chromium/third_party/dawn/src/tint/lang/wgsl/ast/transform/demote_to_helper_test.cc

// Copyright 2022 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 "src/tint/lang/wgsl/ast/transform/demote_to_helper.h"

#include <utility>

#include "src/tint/lang/wgsl/ast/transform/helper_test.h"

namespace tint::ast::transform {
namespace {

DemoteToHelperTest;

TEST_F(DemoteToHelperTest, ShouldRunEmptyModule) {}

TEST_F(DemoteToHelperTest, ShouldRunNoDiscard) {}

TEST_F(DemoteToHelperTest, ShouldRunDiscardInEntryPoint) {}

TEST_F(DemoteToHelperTest, ShouldRunDiscardInHelper) {}

TEST_F(DemoteToHelperTest, EmptyModule) {}

TEST_F(DemoteToHelperTest, WriteInEntryPoint_DiscardInEntryPoint) {}

TEST_F(DemoteToHelperTest, WriteInEntryPoint_DiscardInHelper) {}

TEST_F(DemoteToHelperTest, WriteInHelper_DiscardInEntryPoint) {}

TEST_F(DemoteToHelperTest, WriteInHelper_DiscardInHelper) {}

TEST_F(DemoteToHelperTest, WriteInEntryPoint_NoDiscard) {}

// Test that write via sugared pointer also discards
TEST_F(DemoteToHelperTest, WriteInEntryPoint_DiscardInEntryPoint_ViaPointerDot) {}

// Test that no additional discards are inserted when the function unconditionally returns in a
// nested block.
TEST_F(DemoteToHelperTest, EntryPointReturn_NestedInBlock) {}

// Test that a discard statement is inserted before every return statement in an entry point that
// contains a discard.
TEST_F(DemoteToHelperTest, EntryPointReturns_DiscardInEntryPoint) {}

// Test that a discard statement is inserted before every return statement in an entry point that
// calls a function that contains a discard.
TEST_F(DemoteToHelperTest, EntryPointReturns_DiscardInHelper) {}

// Test that no return statements are modified in an entry point that does not discard.
TEST_F(DemoteToHelperTest, EntryPointReturns_NoDiscard) {}

// Test that only functions that are part of a shader that discards are transformed.
// Functions in non-discarding stages should not have their writes masked, and non-discarding entry
// points should not have their return statements replaced.
TEST_F(DemoteToHelperTest, MultipleShaders) {}

// Test that we do not mask writes to invocation-private address spaces.
TEST_F(DemoteToHelperTest, InvocationPrivateWrites) {}

// Test that we do not mask writes to invocation-private address spaces via a sugared pointer write
TEST_F(DemoteToHelperTest, InvocationPrivateWritesViaPointerDot) {}

TEST_F(DemoteToHelperTest, TextureStoreInEntryPoint) {}

TEST_F(DemoteToHelperTest, TextureStoreInHelper) {}

TEST_F(DemoteToHelperTest, TextureStore_NoDiscard) {}

TEST_F(DemoteToHelperTest, AtomicStoreInEntryPoint) {}

TEST_F(DemoteToHelperTest, AtomicStoreInHelper) {}

TEST_F(DemoteToHelperTest, AtomicStore_NoDiscard) {}

TEST_F(DemoteToHelperTest, AtomicBuiltinExpression) {}

TEST_F(DemoteToHelperTest, AtomicBuiltinExpression_InForLoopContinuing) {}

TEST_F(DemoteToHelperTest, AtomicCompareExchangeWeak) {}

// Test that no masking is generated for calls to `atomicLoad()`.
TEST_F(DemoteToHelperTest, AtomicLoad) {}

TEST_F(DemoteToHelperTest, PhonyAssignment) {}

TEST_F(DemoteToHelperTest, Assignment_HoistExplicitDerivative) {}

TEST_F(DemoteToHelperTest, Assignment_HoistImplicitDerivative) {}

}  // namespace
}  // namespace tint::ast::transform