aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/compute/skc/common.h
blob: 618ba2242ea148addebea165da2c1757d93481ee (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
 * Copyright 2017 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can
 * be found in the LICENSE file.
 *
 */

#ifndef SKC_COMMON_ONCE
#define SKC_COMMON_ONCE

//
// structures common to both host and device -- placeholder until
// everything shakes out
//

union skc_transform
{
  //
  // Transform is always scaled s.t. w2 is 1.0f
  //
  skc_float   f32a8[8];

  skc_float8  f32v8;

  struct {
    skc_float sx;
    skc_float shx;
    skc_float tx;

    skc_float shy;
    skc_float sy;
    skc_float ty;

    skc_float w0;
    skc_float w1;
  };
};

//
//
//

union skc_path_clip
{
  skc_float   f32a4[4]; // FIXME -- use the SIMD4 representation trick

  skc_float4  f32v4;

  struct {
    skc_float x0;
    skc_float y0;
    skc_float x1;
    skc_float y1;
  };
};

//
// host-side path fill cmd that is expanded into rasterization cmds
//
// FIXME -- these magic numbers will be replaced with tile.h constants
//
// FIXME -- make this command opaque by moving it into the platform impl
//
// FIXME -- NEED TO EVALUATE IF THIS DISTRIBUTION OF BITS IS GOING TO
// BE TOO SMALL -- plenty of room to jiggle these bits
//

#define SKC_CMD_FILL_BITS_TRANSFORM  12  // distinct transforms -- perhaps too generous
#define SKC_CMD_FILL_BITS_CLIP       12  // distinct clips      -- perhaps too generous
#define SKC_CMD_FILL_BITS_COHORT      8  // perhaps too small

//
//
//

typedef skc_uint skc_path_h; // host path handle

union skc_cmd_fill
{
  skc_ulong    u64;

  skc_uint2    u32v2;

  struct {
    skc_path_h path;           // host path id
#if defined(__OPENCL_C_VERSION__)
    skc_uint   tcc;
#else
    skc_uint   transform : SKC_CMD_FILL_BITS_TRANSFORM;
    skc_uint   clip      : SKC_CMD_FILL_BITS_CLIP;
    skc_uint   cohort    : SKC_CMD_FILL_BITS_COHORT;
#endif
  };
};

//
//
//

typedef skc_uint skc_raster_h;

union skc_cmd_place
{
  skc_uint4       u32v4;

  struct {
    skc_raster_h  raster_h;
    skc_uint      layer_id;
    skc_uint      tx;
    skc_uint      ty;
  };
};

SKC_STATIC_ASSERT(sizeof(union skc_cmd_place) == sizeof(skc_uint4));

//
//
//

#endif

//
//
//