2020-12-12 01:01:48 +11:00
|
|
|
// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense
|
|
|
|
|
2020-05-12 13:01:06 +10:00
|
|
|
// Code auto-generated by piet-gpu-derive
|
|
|
|
|
|
|
|
struct StateRef {
|
|
|
|
uint offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct State {
|
|
|
|
vec4 mat;
|
|
|
|
vec2 translate;
|
|
|
|
vec4 bbox;
|
|
|
|
float linewidth;
|
|
|
|
uint flags;
|
2020-06-03 10:10:20 +10:00
|
|
|
uint path_count;
|
|
|
|
uint pathseg_count;
|
2021-03-15 22:28:04 +11:00
|
|
|
uint trans_count;
|
2020-05-12 13:01:06 +10:00
|
|
|
};
|
|
|
|
|
2021-03-15 22:28:04 +11:00
|
|
|
#define State_size 60
|
2020-05-12 13:01:06 +10:00
|
|
|
|
|
|
|
StateRef State_index(StateRef ref, uint index) {
|
|
|
|
return StateRef(ref.offset + index * State_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
State State_read(StateRef ref) {
|
|
|
|
uint ix = ref.offset >> 2;
|
|
|
|
uint raw0 = state[ix + 0];
|
|
|
|
uint raw1 = state[ix + 1];
|
|
|
|
uint raw2 = state[ix + 2];
|
|
|
|
uint raw3 = state[ix + 3];
|
|
|
|
uint raw4 = state[ix + 4];
|
|
|
|
uint raw5 = state[ix + 5];
|
|
|
|
uint raw6 = state[ix + 6];
|
|
|
|
uint raw7 = state[ix + 7];
|
|
|
|
uint raw8 = state[ix + 8];
|
|
|
|
uint raw9 = state[ix + 9];
|
|
|
|
uint raw10 = state[ix + 10];
|
|
|
|
uint raw11 = state[ix + 11];
|
2020-06-03 10:10:20 +10:00
|
|
|
uint raw12 = state[ix + 12];
|
|
|
|
uint raw13 = state[ix + 13];
|
2021-03-15 22:28:04 +11:00
|
|
|
uint raw14 = state[ix + 14];
|
2020-05-12 13:01:06 +10:00
|
|
|
State s;
|
|
|
|
s.mat = vec4(uintBitsToFloat(raw0), uintBitsToFloat(raw1), uintBitsToFloat(raw2), uintBitsToFloat(raw3));
|
|
|
|
s.translate = vec2(uintBitsToFloat(raw4), uintBitsToFloat(raw5));
|
|
|
|
s.bbox = vec4(uintBitsToFloat(raw6), uintBitsToFloat(raw7), uintBitsToFloat(raw8), uintBitsToFloat(raw9));
|
|
|
|
s.linewidth = uintBitsToFloat(raw10);
|
|
|
|
s.flags = raw11;
|
2020-06-03 10:10:20 +10:00
|
|
|
s.path_count = raw12;
|
|
|
|
s.pathseg_count = raw13;
|
2021-03-15 22:28:04 +11:00
|
|
|
s.trans_count = raw14;
|
2020-05-12 13:01:06 +10:00
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
void State_write(StateRef ref, State s) {
|
|
|
|
uint ix = ref.offset >> 2;
|
|
|
|
state[ix + 0] = floatBitsToUint(s.mat.x);
|
|
|
|
state[ix + 1] = floatBitsToUint(s.mat.y);
|
|
|
|
state[ix + 2] = floatBitsToUint(s.mat.z);
|
|
|
|
state[ix + 3] = floatBitsToUint(s.mat.w);
|
|
|
|
state[ix + 4] = floatBitsToUint(s.translate.x);
|
|
|
|
state[ix + 5] = floatBitsToUint(s.translate.y);
|
|
|
|
state[ix + 6] = floatBitsToUint(s.bbox.x);
|
|
|
|
state[ix + 7] = floatBitsToUint(s.bbox.y);
|
|
|
|
state[ix + 8] = floatBitsToUint(s.bbox.z);
|
|
|
|
state[ix + 9] = floatBitsToUint(s.bbox.w);
|
|
|
|
state[ix + 10] = floatBitsToUint(s.linewidth);
|
|
|
|
state[ix + 11] = s.flags;
|
2020-06-03 10:10:20 +10:00
|
|
|
state[ix + 12] = s.path_count;
|
|
|
|
state[ix + 13] = s.pathseg_count;
|
2021-03-15 22:28:04 +11:00
|
|
|
state[ix + 14] = s.trans_count;
|
2020-05-12 13:01:06 +10:00
|
|
|
}
|
|
|
|
|