1//
2// Copyright 2019 The ANGLE Project. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6// clear.metal: Implements viewport clearing.
7
8#include "common.h"
9
10using namespace rx::mtl_shader;
11
12struct ClearParams
13{
14    float4 clearColor;
15    float clearDepth;
16};
17
18vertex float4 clearVS(unsigned int vid [[ vertex_id ]],
19                      constant ClearParams &clearParams [[buffer(0)]])
20{
21    return float4(gCorners[vid], clearParams.clearDepth, 1.0);
22}
23
24fragment MultipleColorOutputs<float> clearFloatFS(constant ClearParams &clearParams [[buffer(0)]])
25{
26    return toMultipleColorOutputs(clearParams.clearColor);
27}
28
29fragment MultipleColorOutputs<int> clearIntFS(constant ClearParams &clearParams [[buffer(0)]])
30{
31    return toMultipleColorOutputs(as_type<int4>(clearParams.clearColor));
32}
33
34fragment MultipleColorOutputs<uint> clearUIntFS(constant ClearParams &clearParams [[buffer(0)]])
35{
36    return toMultipleColorOutputs(as_type<uint4>(clearParams.clearColor));
37}
38