diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /third_party/rust/gfx-backend-metal/shaders/clear.metal | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/gfx-backend-metal/shaders/clear.metal')
-rw-r--r-- | third_party/rust/gfx-backend-metal/shaders/clear.metal | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/third_party/rust/gfx-backend-metal/shaders/clear.metal b/third_party/rust/gfx-backend-metal/shaders/clear.metal new file mode 100644 index 0000000000..4adbdd3b56 --- /dev/null +++ b/third_party/rust/gfx-backend-metal/shaders/clear.metal @@ -0,0 +1,79 @@ +#include "macros.h" +#include <metal_stdlib> +using namespace metal; + +//TODO: simplified code path for Metal 2.0? +//> Starting in Metal 2.0, the [[color(n)]] and [[raster_order_group(index)]] indices can +//> also be a function constant. The function constant specified as indices for color and +//> raster order group attributes must be a scalar integer type. + +typedef struct { + float4 coords [[attribute(0)]]; +} ClearAttributes; + +typedef struct { + float4 position [[position]]; + uint layer GFX_RENDER_TARGET_ARRAY_INDEX; +} ClearVertexData; + +vertex ClearVertexData vs_clear(ClearAttributes in [[stage_in]]) { + float4 pos = { 0.0, 0.0, in.coords.z, 1.0f }; + pos.xy = in.coords.xy * 2.0 - 1.0; + return ClearVertexData { pos, uint(in.coords.w) }; +} + + +fragment float4 ps_clear0_float( + ClearVertexData in [[stage_in]], + constant float4 &value [[ buffer(0) ]] +) { + return value; +} + +fragment int4 ps_clear0_int( + ClearVertexData in [[stage_in]], + constant int4 &value [[ buffer(0) ]] +) { + return value; +} + +fragment uint4 ps_clear0_uint( + ClearVertexData in [[stage_in]], + constant uint4 &value [[ buffer(0) ]] +) { + return value; +} + + +typedef struct { + float4 color [[color(1)]]; +} Clear1FloatFragment; + +fragment Clear1FloatFragment ps_clear1_float( + ClearVertexData in [[stage_in]], + constant float4 &value [[ buffer(0) ]] +) { + return Clear1FloatFragment { value }; +} + +typedef struct { + int4 color [[color(1)]]; +} Clear1IntFragment; + +fragment Clear1IntFragment ps_clear1_int( + ClearVertexData in [[stage_in]], + constant int4 &value [[ buffer(0) ]] +) { + return Clear1IntFragment { value }; +} + +typedef struct { + uint4 color [[color(1)]]; +} Clear1UintFragment; + +fragment Clear1UintFragment ps_clear1_uint( + ClearVertexData in [[stage_in]], + constant uint4 &value [[ buffer(0) ]] +) { + return Clear1UintFragment { value }; +} |