blob: 618ba2242ea148addebea165da2c1757d93481ee [file] [log] [blame]
Allan MacKinnon4359d522018-06-19 13:57:04 -07001/*
2 * Copyright 2017 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can
5 * be found in the LICENSE file.
6 *
7 */
8
9#ifndef SKC_COMMON_ONCE
10#define SKC_COMMON_ONCE
11
12//
13// structures common to both host and device -- placeholder until
14// everything shakes out
15//
16
17union skc_transform
18{
19 //
20 // Transform is always scaled s.t. w2 is 1.0f
21 //
22 skc_float f32a8[8];
23
24 skc_float8 f32v8;
25
26 struct {
27 skc_float sx;
28 skc_float shx;
29 skc_float tx;
30
31 skc_float shy;
32 skc_float sy;
33 skc_float ty;
34
35 skc_float w0;
36 skc_float w1;
37 };
38};
39
40//
41//
42//
43
44union skc_path_clip
45{
46 skc_float f32a4[4]; // FIXME -- use the SIMD4 representation trick
47
48 skc_float4 f32v4;
49
50 struct {
51 skc_float x0;
52 skc_float y0;
53 skc_float x1;
54 skc_float y1;
55 };
56};
57
58//
59// host-side path fill cmd that is expanded into rasterization cmds
60//
61// FIXME -- these magic numbers will be replaced with tile.h constants
62//
63// FIXME -- make this command opaque by moving it into the platform impl
64//
65// FIXME -- NEED TO EVALUATE IF THIS DISTRIBUTION OF BITS IS GOING TO
66// BE TOO SMALL -- plenty of room to jiggle these bits
67//
68
69#define SKC_CMD_FILL_BITS_TRANSFORM 12 // distinct transforms -- perhaps too generous
70#define SKC_CMD_FILL_BITS_CLIP 12 // distinct clips -- perhaps too generous
71#define SKC_CMD_FILL_BITS_COHORT 8 // perhaps too small
72
73//
74//
75//
76
77typedef skc_uint skc_path_h; // host path handle
78
79union skc_cmd_fill
80{
81 skc_ulong u64;
82
83 skc_uint2 u32v2;
84
85 struct {
86 skc_path_h path; // host path id
87#if defined(__OPENCL_C_VERSION__)
88 skc_uint tcc;
89#else
90 skc_uint transform : SKC_CMD_FILL_BITS_TRANSFORM;
91 skc_uint clip : SKC_CMD_FILL_BITS_CLIP;
92 skc_uint cohort : SKC_CMD_FILL_BITS_COHORT;
93#endif
94 };
95};
96
97//
98//
99//
100
101typedef skc_uint skc_raster_h;
102
103union skc_cmd_place
104{
105 skc_uint4 u32v4;
106
107 struct {
108 skc_raster_h raster_h;
109 skc_uint layer_id;
110 skc_uint tx;
111 skc_uint ty;
112 };
113};
114
115SKC_STATIC_ASSERT(sizeof(union skc_cmd_place) == sizeof(skc_uint4));
116
117//
118//
119//
120
121#endif
122
123//
124//
125//