mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 09:25:25 +00:00
tint/resolver: Validate discard is only used by fragment shaders
Fixed: tint:1373 Change-Id: Ieb2a808982d8fa8b199e57d4df44f29390fa6e74 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105961 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Auto-Submit: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
1a567780d9
commit
d9222f44c9
@@ -237,12 +237,17 @@ class Function final : public Castable<Function, CallTarget> {
|
||||
/// @returns true if `sym` is an ancestor entry point of this function
|
||||
bool HasAncestorEntryPoint(Symbol sym) const;
|
||||
|
||||
/// Sets that this function has a discard statement
|
||||
void SetHasDiscard() { has_discard_ = true; }
|
||||
/// Records the first discard statement in the function
|
||||
/// @param stmt the `discard` statement.
|
||||
void SetDiscardStatement(const Statement* stmt) {
|
||||
if (!discard_stmt_) {
|
||||
discard_stmt_ = stmt;
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns true if this function has a discard statement
|
||||
/// @returns true if this function has a discard statement
|
||||
bool HasDiscard() const { return has_discard_; }
|
||||
/// @returns the first discard statement for the function, or nullptr if the function does not
|
||||
/// use `discard`.
|
||||
const Statement* DiscardStatement() const { return discard_stmt_; }
|
||||
|
||||
/// @return the behaviors of this function
|
||||
const sem::Behaviors& Behaviors() const { return behaviors_; }
|
||||
@@ -271,7 +276,7 @@ class Function final : public Castable<Function, CallTarget> {
|
||||
std::vector<const Call*> direct_calls_;
|
||||
std::vector<const Call*> callsites_;
|
||||
std::vector<const Function*> ancestor_entry_points_;
|
||||
bool has_discard_ = false;
|
||||
const Statement* discard_stmt_ = nullptr;
|
||||
sem::Behaviors behaviors_{sem::Behavior::kNext};
|
||||
|
||||
std::optional<uint32_t> return_location_;
|
||||
|
||||
Reference in New Issue
Block a user