blob: 4adbdd3b56590796fb8e62b7e6be97f999fefa0b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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 };
}
|