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