unsigned int vkvg_main_frag_spv_len = 5780;
unsigned char vkvg_main_vert_spv[] = {
0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x0d, 0x00,
- 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00,
+ 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00,
0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30,
0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x1a, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00,
- 0x42, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00,
- 0x56, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00,
+ 0x4e, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00,
+ 0x62, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00,
0xc2, 0x01, 0x00, 0x00, 0x04, 0x00, 0x09, 0x00, 0x47, 0x4c, 0x5f, 0x41,
0x52, 0x42, 0x5f, 0x73, 0x65, 0x70, 0x61, 0x72, 0x61, 0x74, 0x65, 0x5f,
0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x6f, 0x62, 0x6a, 0x65, 0x63,
0x6e, 0x76, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x0f, 0x00, 0x00, 0x00,
0x70, 0x63, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x15, 0x00, 0x00, 0x00,
0x6f, 0x75, 0x74, 0x53, 0x72, 0x63, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00,
- 0x17, 0x00, 0x00, 0x00, 0x69, 0x6e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00,
- 0x05, 0x00, 0x04, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x6f, 0x75, 0x74, 0x4d,
- 0x61, 0x74, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x27, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x69, 0x6e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00,
+ 0x05, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x6f, 0x75, 0x74, 0x4d,
+ 0x61, 0x74, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x33, 0x00, 0x00, 0x00,
0x67, 0x6c, 0x5f, 0x50, 0x65, 0x72, 0x56, 0x65, 0x72, 0x74, 0x65, 0x78,
- 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x27, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x33, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74,
- 0x69, 0x6f, 0x6e, 0x00, 0x05, 0x00, 0x03, 0x00, 0x29, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x2b, 0x00, 0x00, 0x00,
+ 0x69, 0x6f, 0x6e, 0x00, 0x05, 0x00, 0x03, 0x00, 0x35, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x37, 0x00, 0x00, 0x00,
0x67, 0x6c, 0x5f, 0x56, 0x65, 0x72, 0x74, 0x65, 0x78, 0x49, 0x6e, 0x64,
- 0x65, 0x78, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x42, 0x00, 0x00, 0x00,
+ 0x65, 0x78, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x4e, 0x00, 0x00, 0x00,
0x6f, 0x75, 0x74, 0x55, 0x56, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00,
- 0x46, 0x00, 0x00, 0x00, 0x69, 0x6e, 0x55, 0x56, 0x00, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x04, 0x00, 0x48, 0x00, 0x00, 0x00, 0x69, 0x6e, 0x55, 0x56,
- 0x5a, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x4f, 0x00, 0x00, 0x00,
- 0x70, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x56, 0x00, 0x00, 0x00,
+ 0x52, 0x00, 0x00, 0x00, 0x69, 0x6e, 0x55, 0x56, 0x00, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x04, 0x00, 0x54, 0x00, 0x00, 0x00, 0x69, 0x6e, 0x55, 0x56,
+ 0x5a, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x5b, 0x00, 0x00, 0x00,
+ 0x70, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x62, 0x00, 0x00, 0x00,
0x69, 0x6e, 0x50, 0x6f, 0x73, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00,
0x08, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00,
0x08, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x47, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x47, 0x00, 0x04, 0x00, 0x15, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00,
- 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00,
- 0x1a, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x48, 0x00, 0x05, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x48, 0x00, 0x05, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00,
- 0x27, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00,
- 0x2b, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00,
- 0x47, 0x00, 0x04, 0x00, 0x42, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00,
+ 0x33, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00,
+ 0x37, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00,
+ 0x47, 0x00, 0x04, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x52, 0x00, 0x00, 0x00,
0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00,
- 0x48, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x47, 0x00, 0x04, 0x00, 0x56, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00,
+ 0x54, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x47, 0x00, 0x04, 0x00, 0x62, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00,
0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x15, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
0x11, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
0x20, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x0a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00,
- 0x15, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00,
- 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
- 0x3b, 0x00, 0x04, 0x00, 0x16, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x19, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00,
- 0x19, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1c, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x02, 0x00, 0x23, 0x00, 0x00, 0x00,
- 0x1e, 0x00, 0x03, 0x00, 0x27, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x27, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00,
- 0x29, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00,
- 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x3b, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x2d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
- 0x2b, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x80, 0xbf, 0x2b, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00,
- 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
- 0x17, 0x00, 0x04, 0x00, 0x40, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x41, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00,
- 0x41, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x2c, 0x00, 0x06, 0x00, 0x40, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00,
- 0x3a, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x04, 0x00, 0x45, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x45, 0x00, 0x00, 0x00,
- 0x46, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00,
- 0x2a, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x04, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x0b, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x50, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00,
- 0x51, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x2b, 0x00, 0x04, 0x00, 0x51, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x53, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00,
- 0x45, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x04, 0x00, 0x57, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x51, 0x00, 0x00, 0x00,
- 0x5d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x05, 0x00,
- 0x0b, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00,
- 0x35, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x77, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x05, 0x00,
- 0x0b, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00,
- 0x3b, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00,
- 0x4e, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x15, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x02, 0x00, 0x19, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00,
+ 0x1b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00,
+ 0x23, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x2d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00,
+ 0x33, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00,
+ 0x34, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00,
+ 0x3b, 0x00, 0x04, 0x00, 0x34, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x36, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00,
+ 0x36, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00,
+ 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x2b, 0x00, 0x04, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xbf,
+ 0x2b, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00,
+ 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x17, 0x00, 0x04, 0x00,
+ 0x4c, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x04, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x4c, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4d, 0x00, 0x00, 0x00,
+ 0x4e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x06, 0x00,
+ 0x4c, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00,
+ 0x46, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00,
+ 0x51, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00,
+ 0x3b, 0x00, 0x04, 0x00, 0x51, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x36, 0x00, 0x00, 0x00,
+ 0x54, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00,
+ 0x5a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00,
+ 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x5d, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00,
+ 0x5d, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x04, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x51, 0x00, 0x00, 0x00,
+ 0x62, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00,
+ 0x63, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
+ 0x2b, 0x00, 0x04, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00,
+ 0x81, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x04, 0x00, 0x83, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
+ 0x0b, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00,
+ 0x87, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00,
+ 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00,
+ 0x1c, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00,
+ 0x5a, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0x41, 0x00, 0x05, 0x00, 0x11, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00,
0x0f, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00,
0x06, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00,
0x3e, 0x00, 0x03, 0x00, 0x08, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00,
- 0x3d, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
- 0x17, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x15, 0x00, 0x00, 0x00,
- 0x18, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x1c, 0x00, 0x00, 0x00,
- 0x1d, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00,
- 0x3d, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00,
- 0x1d, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x1a, 0x00, 0x00, 0x00,
- 0x1e, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x11, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00,
- 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0xab, 0x00, 0x05, 0x00, 0x23, 0x00, 0x00, 0x00,
- 0x24, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00,
- 0xf7, 0x00, 0x03, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xfa, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00,
- 0x26, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x25, 0x00, 0x00, 0x00,
- 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00,
- 0x2b, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x2e, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00,
- 0xc7, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00,
- 0x2e, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x04, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00,
- 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00,
- 0x2b, 0x00, 0x00, 0x00, 0xc7, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x32, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x6f, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00,
- 0x32, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00,
- 0x34, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00,
- 0x8e, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00,
- 0x34, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00,
- 0x0b, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00,
- 0x37, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00,
- 0x39, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00,
- 0x51, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,
- 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x0a, 0x00, 0x00, 0x00,
- 0x3e, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00,
- 0x3a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00,
- 0x22, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x3f, 0x00, 0x00, 0x00,
- 0x3e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x42, 0x00, 0x00, 0x00,
- 0x43, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0xf8, 0x00, 0x02, 0x00,
- 0x26, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00,
- 0x47, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00,
- 0x6f, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00,
- 0x49, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00,
- 0x4b, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x51, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00,
- 0x47, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00,
- 0x40, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00,
- 0x4c, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00,
- 0x42, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x41, 0x00, 0x07, 0x00,
- 0x53, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
- 0x50, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00,
- 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00,
- 0x54, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x57, 0x00, 0x00, 0x00,
- 0x58, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00,
- 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00,
- 0x58, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00,
- 0x5a, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00,
- 0x41, 0x00, 0x07, 0x00, 0x53, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00,
- 0x0f, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00,
- 0x52, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00,
- 0x5c, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00,
- 0x57, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00,
- 0x5d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00,
- 0x5f, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00,
- 0x5f, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00,
- 0x61, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
- 0x41, 0x00, 0x07, 0x00, 0x53, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00,
- 0x0f, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x52, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00,
- 0x63, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00,
- 0x63, 0x00, 0x00, 0x00, 0x41, 0x00, 0x07, 0x00, 0x53, 0x00, 0x00, 0x00,
- 0x65, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
- 0x22, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00,
- 0x41, 0x00, 0x05, 0x00, 0x57, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00,
- 0x56, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00,
- 0x85, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00,
- 0x66, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x41, 0x00, 0x07, 0x00,
- 0x53, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
- 0x50, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00,
+ 0x41, 0x00, 0x05, 0x00, 0x11, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00,
+ 0x0f, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00,
+ 0xaa, 0x00, 0x05, 0x00, 0x19, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00,
+ 0x17, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00,
+ 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00,
+ 0x1a, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00,
+ 0xf8, 0x00, 0x02, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x3e, 0x00, 0x03, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00,
+ 0xf9, 0x00, 0x02, 0x00, 0x1e, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00,
+ 0x22, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x23, 0x00, 0x00, 0x00,
+ 0x24, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
+ 0x3d, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00,
+ 0x24, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x1c, 0x00, 0x00, 0x00,
+ 0x25, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0x1e, 0x00, 0x00, 0x00,
+ 0xf8, 0x00, 0x02, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
+ 0x3e, 0x00, 0x03, 0x00, 0x15, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00,
+ 0x41, 0x00, 0x05, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00,
+ 0x0f, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00,
+ 0x3e, 0x00, 0x03, 0x00, 0x28, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00,
+ 0x41, 0x00, 0x05, 0x00, 0x11, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00,
+ 0x0f, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00,
+ 0xab, 0x00, 0x05, 0x00, 0x19, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+ 0x2f, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00,
+ 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00,
+ 0x30, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00,
+ 0xf8, 0x00, 0x02, 0x00, 0x31, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00,
+ 0xc4, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00,
+ 0x38, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0xc7, 0x00, 0x05, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00,
+ 0x3c, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00,
+ 0xc7, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00,
+ 0x3d, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x04, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00,
+ 0x50, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
+ 0x3c, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00,
+ 0x0b, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
+ 0x41, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00,
+ 0x44, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00,
+ 0x81, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00,
+ 0x42, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00,
+ 0x49, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x50, 0x00, 0x07, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00,
+ 0x48, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00,
+ 0x47, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x4b, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
+ 0x3e, 0x00, 0x03, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00,
+ 0x3e, 0x00, 0x03, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00,
+ 0xfd, 0x00, 0x01, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x32, 0x00, 0x00, 0x00,
+ 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00,
+ 0x52, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x55, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x04, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00,
+ 0x51, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00,
+ 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, 0x4c, 0x00, 0x00, 0x00,
+ 0x59, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
+ 0x56, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x4e, 0x00, 0x00, 0x00,
+ 0x59, 0x00, 0x00, 0x00, 0x41, 0x00, 0x07, 0x00, 0x5f, 0x00, 0x00, 0x00,
+ 0x60, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00,
+ 0x18, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
+ 0x41, 0x00, 0x05, 0x00, 0x63, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
+ 0x62, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
+ 0x85, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00,
+ 0x61, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x41, 0x00, 0x07, 0x00,
+ 0x5f, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
+ 0x5c, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00,
+ 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00,
+ 0x67, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x63, 0x00, 0x00, 0x00,
+ 0x6a, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00,
0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00,
- 0x6a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x57, 0x00, 0x00, 0x00,
- 0x6c, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00,
- 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00,
- 0x6c, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00,
- 0x6e, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00,
- 0x81, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00,
- 0x69, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x41, 0x00, 0x07, 0x00,
- 0x53, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
- 0x50, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00,
- 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00,
- 0x70, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00,
- 0x72, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00,
- 0x50, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00,
- 0x64, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00,
- 0x4f, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00,
- 0x0b, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00,
- 0x85, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00,
- 0x74, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00,
- 0x77, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
- 0x2d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00,
- 0x79, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x88, 0x00, 0x05, 0x00,
- 0x0b, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00,
- 0x79, 0x00, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00,
- 0x7c, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00,
- 0x51, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00,
- 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x0a, 0x00, 0x00, 0x00,
- 0x7f, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,
- 0x3a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00,
- 0x22, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x80, 0x00, 0x00, 0x00,
- 0x7f, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00
+ 0x6a, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00,
+ 0x6c, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00,
+ 0x81, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00,
+ 0x66, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x41, 0x00, 0x07, 0x00,
+ 0x5f, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
+ 0x5c, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00,
+ 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00,
+ 0x6e, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00,
+ 0x70, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00,
+ 0x41, 0x00, 0x07, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00,
+ 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
+ 0x69, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00,
+ 0x72, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00,
+ 0x63, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00,
+ 0x5e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00,
+ 0x74, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00,
+ 0x74, 0x00, 0x00, 0x00, 0x41, 0x00, 0x07, 0x00, 0x5f, 0x00, 0x00, 0x00,
+ 0x76, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00,
+ 0x39, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00,
+ 0x41, 0x00, 0x05, 0x00, 0x63, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00,
+ 0x62, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00,
+ 0x85, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00,
+ 0x77, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00,
+ 0x7a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x07, 0x00, 0x5f, 0x00, 0x00, 0x00,
+ 0x7c, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00,
+ 0x81, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,
+ 0x7b, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00,
+ 0x0b, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
+ 0x7e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5b, 0x00, 0x00, 0x00,
+ 0x7f, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00,
+ 0x0b, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x81, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x83, 0x00, 0x00, 0x00,
+ 0x84, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00,
+ 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00,
+ 0x84, 0x00, 0x00, 0x00, 0x88, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00,
+ 0x86, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00,
+ 0x83, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00,
+ 0x86, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00,
+ 0x8a, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x50, 0x00, 0x07, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00,
+ 0x89, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00,
+ 0x47, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x8c, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
+ 0x3e, 0x00, 0x03, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00,
+ 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00
};
-unsigned int vkvg_main_vert_spv_len = 3480;
+unsigned int vkvg_main_vert_spv_len = 3704;
unsigned char vkvg_main_lcd_frag_spv[] = {
0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x0d, 0x00,
0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00,
#include "vkh_queue.h"
#include "vkh_image.h"
+const float LAB_COLOR_RP[4] = {0,0,1,1};
+const float LAB_COLOR_FLUSH[4] = {0,1,1,1};
+
void _check_vbo_size (VkvgContext ctx) {
- if (ctx->sizeVertices - ctx->vertCount > VKVG_ARRAY_THRESHOLD)
- return;
- ctx->sizeVertices += VKVG_VBO_SIZE;
- Vertex* tmp = (Vertex*) realloc (ctx->vertexCache, ctx->sizeVertices * sizeof(Vertex));
- if (tmp == NULL)
- ctx->status = VKVG_STATUS_NO_MEMORY;
- else
- ctx->vertexCache = tmp;
+ if (ctx->sizeVertices - ctx->vertCount > VKVG_ARRAY_THRESHOLD)
+ return;
+ ctx->sizeVertices += VKVG_VBO_SIZE;
+ Vertex* tmp = (Vertex*) realloc (ctx->vertexCache, ctx->sizeVertices * sizeof(Vertex));
+ if (tmp == NULL)
+ ctx->status = VKVG_STATUS_NO_MEMORY;
+ else
+ ctx->vertexCache = tmp;
}
void _check_ibo_size (VkvgContext ctx) {
- if (ctx->sizeIndices - ctx->indCount > VKVG_ARRAY_THRESHOLD)
- return;
- ctx->sizeIndices += VKVG_IBO_SIZE;
- VKVG_IBO_INDEX_TYPE* tmp = (VKVG_IBO_INDEX_TYPE*) realloc (ctx->indexCache, ctx->sizeIndices * sizeof(VKVG_IBO_INDEX_TYPE));
- if (tmp == NULL)
- ctx->status = VKVG_STATUS_NO_MEMORY;
- else
- ctx->indexCache = tmp;
+ if (ctx->sizeIndices - ctx->indCount > VKVG_ARRAY_THRESHOLD)
+ return;
+ ctx->sizeIndices += VKVG_IBO_SIZE;
+ VKVG_IBO_INDEX_TYPE* tmp = (VKVG_IBO_INDEX_TYPE*) realloc (ctx->indexCache, ctx->sizeIndices * sizeof(VKVG_IBO_INDEX_TYPE));
+ if (tmp == NULL)
+ ctx->status = VKVG_STATUS_NO_MEMORY;
+ else
+ ctx->indexCache = tmp;
}
void _check_pathes_array (VkvgContext ctx){
- if (ctx->sizePathes - ctx->pathPtr - ctx->curvePtr > VKVG_ARRAY_THRESHOLD)
- return;
- ctx->sizePathes += VKVG_PATHES_SIZE;
- uint32_t* tmp = (uint32_t*) realloc (ctx->pathes, ctx->sizePathes * sizeof(uint32_t));
- if (tmp == NULL){
- ctx->status = VKVG_STATUS_NO_MEMORY;
- ctx->pathPtr = 0 + (ctx->pathPtr % 2);
- }else
- ctx->pathes = tmp;
+ if (ctx->sizePathes - ctx->pathPtr - ctx->curvePtr > VKVG_ARRAY_THRESHOLD)
+ return;
+ ctx->sizePathes += VKVG_PATHES_SIZE;
+ uint32_t* tmp = (uint32_t*) realloc (ctx->pathes, ctx->sizePathes * sizeof(uint32_t));
+ if (tmp == NULL){
+ ctx->status = VKVG_STATUS_NO_MEMORY;
+ ctx->pathPtr = 0 + (ctx->pathPtr % 2);
+ }else
+ ctx->pathes = tmp;
}
void _check_point_array (VkvgContext ctx){
- if (ctx->sizePoints - ctx->pointCount > VKVG_ARRAY_THRESHOLD)
- return;
- ctx->sizePoints += VKVG_PATHES_SIZE;
- vec2* tmp = (vec2*) realloc (ctx->points, ctx->sizePoints * sizeof(vec2));
- if (tmp == NULL){
- ctx->status = VKVG_STATUS_NO_MEMORY;
- ctx->pointCount = 0;
- }else
- ctx->points = tmp;
+ if (ctx->sizePoints - ctx->pointCount > VKVG_ARRAY_THRESHOLD)
+ return;
+ ctx->sizePoints += VKVG_PATHES_SIZE;
+ vec2* tmp = (vec2*) realloc (ctx->points, ctx->sizePoints * sizeof(vec2));
+ if (tmp == NULL){
+ ctx->status = VKVG_STATUS_NO_MEMORY;
+ ctx->pointCount = 0;
+ }else
+ ctx->points = tmp;
}
//when empty, ptr is even, else it's odd
//when empty, no current point is defined.
inline bool _current_path_is_empty (VkvgContext ctx) {
- return ctx->pathPtr % 2 == 0;
+ return ctx->pathPtr % 2 == 0;
}
//this function expect that current point exists
inline vec2 _get_current_position (VkvgContext ctx) {
- return ctx->points[ctx->pointCount-1];
+ return ctx->points[ctx->pointCount-1];
}
//set curve start point and set path has curve bit
inline void _set_curve_start (VkvgContext ctx) {
- ctx->pathes[ctx->pathPtr+ctx->curvePtr+1] = (ctx->pointCount - 1);
- ctx->pathes[ctx->pathPtr-1] |= PATH_HAS_CURVES_BIT;
+ ctx->pathes[ctx->pathPtr+ctx->curvePtr+1] = (ctx->pointCount - 1);
+ ctx->pathes[ctx->pathPtr-1] |= PATH_HAS_CURVES_BIT;
}
//set curve end point and set path has curve bit
inline void _set_curve_end (VkvgContext ctx) {
- ctx->pathes[ctx->pathPtr+ctx->curvePtr+2] = (ctx->pointCount - 1)|PATH_IS_CURVE_BIT;
- ctx->curvePtr+=2;
- _check_pathes_array(ctx);
+ ctx->pathes[ctx->pathPtr+ctx->curvePtr+2] = (ctx->pointCount - 1)|PATH_IS_CURVE_BIT;
+ ctx->curvePtr+=2;
+ _check_pathes_array(ctx);
}
//path start pointed at ptrPath has curve bit
inline bool _path_has_curves (VkvgContext ctx, uint ptrPath) {
- return ctx->pathes[ptrPath] & PATH_HAS_CURVES_BIT;
+ return ctx->pathes[ptrPath] & PATH_HAS_CURVES_BIT;
}
//this function expect that current path is empty
void _start_sub_path (VkvgContext ctx, float x, float y) {
- //set start to current idx in point array
- ctx->pathes[ctx->pathPtr] = ctx->pointCount;
- _add_point(ctx, x, y);
- _check_pathes_array(ctx);
- ctx->pathPtr++;
+ //set start to current idx in point array
+ ctx->pathes[ctx->pathPtr] = ctx->pointCount;
+ _add_point(ctx, x, y);
+ _check_pathes_array(ctx);
+ ctx->pathPtr++;
}
void _finish_path (VkvgContext ctx){
- if (_current_path_is_empty(ctx))
- return;
- if ((ctx->pathes[ctx->pathPtr-1]&PATH_ELT_MASK) == ctx->pointCount - 1){
- //only current pos is in path
- ctx->pathPtr--;
- return;
- }
-
- //set end index of current path to last point in points array
- ctx->pathes[ctx->pathPtr] = ctx->pointCount - 1;
- _check_pathes_array(ctx);
- ctx->pathPtr += ctx->curvePtr + 1;
- ctx->curvePtr = 0;
+ if (_current_path_is_empty(ctx))
+ return;
+ if ((ctx->pathes[ctx->pathPtr-1]&PATH_ELT_MASK) == ctx->pointCount - 1){
+ //only current pos is in path
+ ctx->pathPtr--;
+ return;
+ }
+
+ //set end index of current path to last point in points array
+ ctx->pathes[ctx->pathPtr] = ctx->pointCount - 1;
+ _check_pathes_array(ctx);
+ ctx->pathPtr += ctx->curvePtr + 1;
+ ctx->curvePtr = 0;
}
void _clear_path (VkvgContext ctx){
- ctx->pathPtr = 0;
- ctx->pointCount = 0;
- ctx->curvePtr = 0;
- _resetMinMax(ctx);
+ ctx->pathPtr = 0;
+ ctx->pointCount = 0;
+ ctx->curvePtr = 0;
+ //_resetMinMax(ctx);
}
inline bool _path_is_closed (VkvgContext ctx, uint32_t ptrPath){
- return ctx->pathes[ptrPath] & PATH_CLOSED_BIT;
-}
-void _resetMinMax (VkvgContext ctx) {
- ctx->xMin = ctx->yMin = FLT_MAX;
- ctx->xMax = ctx->yMax = FLT_MIN;
+ return ctx->pathes[ptrPath] & PATH_CLOSED_BIT;
}
+/*void _resetMinMax (VkvgContext ctx) {
+ ctx->xMin = ctx->yMin = FLT_MAX;
+ ctx->xMax = ctx->yMax = FLT_MIN;
+}*/
void _add_point (VkvgContext ctx, float x, float y){
- ctx->points[ctx->pointCount] = (vec2){x,y};
- ctx->pointCount++;
-
- _check_point_array(ctx);
-
- //bounds are computed here to scissor the painting operation
- //that speed up fill drastically.
- vkvg_matrix_transform_point (&ctx->pushConsts.mat, &x, &y);
-
- if (x < ctx->xMin)
- ctx->xMin = x;
- if (x > ctx->xMax)
- ctx->xMax = x;
- if (y < ctx->yMin)
- ctx->yMin = y;
- if (y > ctx->yMax)
- ctx->yMax = y;
+ ctx->points[ctx->pointCount] = (vec2){x,y};
+ ctx->pointCount++;
+
+ _check_point_array(ctx);
+
+ //bounds are computed here to scissor the painting operation
+ //that speed up fill drastically.
+ /*vkvg_matrix_transform_point (&ctx->pushConsts.mat, &x, &y);
+
+ if (x < ctx->xMin)
+ ctx->xMin = x;
+ if (x > ctx->xMax)
+ ctx->xMax = x;
+ if (y < ctx->yMin)
+ ctx->yMin = y;
+ if (y > ctx->yMax)
+ ctx->yMax = y;*/
}
float _normalizeAngle(float a)
{
- float res = ROUND_DOWN(fmodf(a,2.0f*M_PIF),100);
- if (res < 0.0f)
- return res + 2.0f*M_PIF;
- else
- return res;
+ float res = ROUND_DOWN(fmodf(a,2.0f*M_PIF),100);
+ if (res < 0.0f)
+ return res + 2.0f*M_PIF;
+ else
+ return res;
}
inline float _get_arc_step (float radius) {
- return M_PIF/sqrtf(radius)*0.35f;
+ return M_PIF/sqrtf(radius)*0.35f;
}
void _create_gradient_buff (VkvgContext ctx){
- vkvg_buffer_create (ctx->pSurf->dev,
- VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
- VMA_MEMORY_USAGE_CPU_TO_GPU,
- sizeof(vkvg_gradient_t), &ctx->uboGrad);
+ vkvg_buffer_create (ctx->pSurf->dev,
+ VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
+ VMA_MEMORY_USAGE_CPU_TO_GPU,
+ sizeof(vkvg_gradient_t), &ctx->uboGrad);
}
void _create_vertices_buff (VkvgContext ctx){
- vkvg_buffer_create (ctx->pSurf->dev,
- VK_BUFFER_USAGE_VERTEX_BUFFER_BIT,
- VMA_MEMORY_USAGE_CPU_TO_GPU,
- ctx->sizeVBO * sizeof(Vertex), &ctx->vertices);
- vkvg_buffer_create (ctx->pSurf->dev,
- VK_BUFFER_USAGE_INDEX_BUFFER_BIT,
- VMA_MEMORY_USAGE_CPU_TO_GPU,
- ctx->sizeIBO * sizeof(VKVG_IBO_INDEX_TYPE), &ctx->indices);
+ vkvg_buffer_create (ctx->pSurf->dev,
+ VK_BUFFER_USAGE_VERTEX_BUFFER_BIT,
+ VMA_MEMORY_USAGE_CPU_TO_GPU,
+ ctx->sizeVBO * sizeof(Vertex), &ctx->vertices);
+ vkvg_buffer_create (ctx->pSurf->dev,
+ VK_BUFFER_USAGE_INDEX_BUFFER_BIT,
+ VMA_MEMORY_USAGE_CPU_TO_GPU,
+ ctx->sizeIBO * sizeof(VKVG_IBO_INDEX_TYPE), &ctx->indices);
}
void _resize_vbo (VkvgContext ctx, size_t new_size) {
- _wait_flush_fence (ctx);//wait previous cmd if not completed
- ctx->sizeVBO = new_size;
- ctx->sizeVBO += ctx->sizeVBO % VKVG_VBO_SIZE;
- vkvg_buffer_destroy (&ctx->vertices);
- vkvg_buffer_create (ctx->pSurf->dev,
- VK_BUFFER_USAGE_VERTEX_BUFFER_BIT,
- VMA_MEMORY_USAGE_CPU_TO_GPU,
- ctx->sizeVBO * sizeof(Vertex), &ctx->vertices);
+ _wait_flush_fence (ctx);//wait previous cmd if not completed
+ ctx->sizeVBO = new_size;
+ ctx->sizeVBO += ctx->sizeVBO % VKVG_VBO_SIZE;
+ vkvg_buffer_destroy (&ctx->vertices);
+ vkvg_buffer_create (ctx->pSurf->dev,
+ VK_BUFFER_USAGE_VERTEX_BUFFER_BIT,
+ VMA_MEMORY_USAGE_CPU_TO_GPU,
+ ctx->sizeVBO * sizeof(Vertex), &ctx->vertices);
}
void _resize_ibo (VkvgContext ctx, size_t new_size) {
- _wait_flush_fence (ctx);//wait previous cmd if not completed
- ctx->sizeIBO = new_size;
- ctx->sizeIBO += ctx->sizeIBO % VKVG_IBO_SIZE;
- vkvg_buffer_destroy (&ctx->indices);
- vkvg_buffer_create (ctx->pSurf->dev,
- VK_BUFFER_USAGE_INDEX_BUFFER_BIT,
- VMA_MEMORY_USAGE_CPU_TO_GPU,
- ctx->sizeIBO * sizeof(VKVG_IBO_INDEX_TYPE), &ctx->indices);
+ _wait_flush_fence (ctx);//wait previous cmd if not completed
+ ctx->sizeIBO = new_size;
+ ctx->sizeIBO += ctx->sizeIBO % VKVG_IBO_SIZE;
+ vkvg_buffer_destroy (&ctx->indices);
+ vkvg_buffer_create (ctx->pSurf->dev,
+ VK_BUFFER_USAGE_INDEX_BUFFER_BIT,
+ VMA_MEMORY_USAGE_CPU_TO_GPU,
+ ctx->sizeIBO * sizeof(VKVG_IBO_INDEX_TYPE), &ctx->indices);
}
void _add_vertexf (VkvgContext ctx, float x, float y){
- Vertex* pVert = &ctx->vertexCache[ctx->vertCount];
- pVert->pos.x = x;
- pVert->pos.y = y;
- pVert->color = ctx->curColor;
- pVert->uvZ = -1;
- ctx->vertCount++;
-
- _check_vbo_size(ctx);
+ Vertex* pVert = &ctx->vertexCache[ctx->vertCount];
+ pVert->pos.x = x;
+ pVert->pos.y = y;
+ pVert->color = ctx->curColor;
+ pVert->uvZ = -1;
+ ctx->vertCount++;
+
+ _check_vbo_size(ctx);
}
void _add_vertex(VkvgContext ctx, Vertex v){
- ctx->vertexCache[ctx->vertCount] = v;
- ctx->vertCount++;
+ ctx->vertexCache[ctx->vertCount] = v;
+ ctx->vertCount++;
- _check_vbo_size(ctx);
+ _check_vbo_size(ctx);
}
void _set_vertex(VkvgContext ctx, uint32_t idx, Vertex v){
- ctx->vertexCache[idx] = v;
+ ctx->vertexCache[idx] = v;
}
void _add_tri_indices_for_rect (VkvgContext ctx, VKVG_IBO_INDEX_TYPE i){
- VKVG_IBO_INDEX_TYPE* inds = &ctx->indexCache[ctx->indCount];
- inds[0] = i;
- inds[1] = i+2;
- inds[2] = i+1;
- inds[3] = i+1;
- inds[4] = i+2;
- inds[5] = i+3;
- ctx->indCount+=6;
-
- _check_ibo_size(ctx);
+ VKVG_IBO_INDEX_TYPE* inds = &ctx->indexCache[ctx->indCount];
+ inds[0] = i;
+ inds[1] = i+2;
+ inds[2] = i+1;
+ inds[3] = i+1;
+ inds[4] = i+2;
+ inds[5] = i+3;
+ ctx->indCount+=6;
+
+ _check_ibo_size(ctx);
}
void _add_triangle_indices(VkvgContext ctx, VKVG_IBO_INDEX_TYPE i0, VKVG_IBO_INDEX_TYPE i1, VKVG_IBO_INDEX_TYPE i2){
- VKVG_IBO_INDEX_TYPE* inds = &ctx->indexCache[ctx->indCount];
- inds[0] = i0;
- inds[1] = i1;
- inds[2] = i2;
- ctx->indCount+=3;
+ VKVG_IBO_INDEX_TYPE* inds = &ctx->indexCache[ctx->indCount];
+ inds[0] = i0;
+ inds[1] = i1;
+ inds[2] = i2;
+ ctx->indCount+=3;
- _check_ibo_size(ctx);
+ _check_ibo_size(ctx);
}
void _vao_add_rectangle (VkvgContext ctx, float x, float y, float width, float height){
- Vertex v[4] =
- {
- {{x,y}, ctx->curColor, {0,0},-1},
- {{x,y+height}, ctx->curColor, {0,0},-1},
- {{x+width,y}, ctx->curColor, {0,0},-1},
- {{x+width,y+height},ctx->curColor, {0,0},-1}
- };
- VKVG_IBO_INDEX_TYPE firstIdx = ctx->vertCount - ctx->curVertOffset;
- Vertex* pVert = &ctx->vertexCache[ctx->vertCount];
- memcpy (pVert,v,4*sizeof(Vertex));
- ctx->vertCount+=4;
-
- _check_vbo_size(ctx);
-
- _add_tri_indices_for_rect(ctx, firstIdx);
+ Vertex v[4] =
+ {
+ {{x,y}, ctx->curColor, {0,0},-1},
+ {{x,y+height}, ctx->curColor, {0,0},-1},
+ {{x+width,y}, ctx->curColor, {0,0},-1},
+ {{x+width,y+height},ctx->curColor, {0,0},-1}
+ };
+ VKVG_IBO_INDEX_TYPE firstIdx = ctx->vertCount - ctx->curVertOffset;
+ Vertex* pVert = &ctx->vertexCache[ctx->vertCount];
+ memcpy (pVert,v,4*sizeof(Vertex));
+ ctx->vertCount+=4;
+
+ _check_vbo_size(ctx);
+
+ _add_tri_indices_for_rect(ctx, firstIdx);
}
void _check_cmd_buff_state (VkvgContext ctx) {
- if (!ctx->cmdStarted)
- _start_cmd_for_render_pass(ctx);
- else if (ctx->pushCstDirty)
- _update_push_constants(ctx);
-}
-void _create_cmd_buff (VkvgContext ctx){
- vkh_cmd_buffs_create((VkhDevice)ctx->pSurf->dev, ctx->cmdPool,VK_COMMAND_BUFFER_LEVEL_PRIMARY, 2, ctx->cmdBuffers);
-#if defined(DEBUG) && defined(ENABLE_VALIDATION)
- vkh_device_set_object_name((VkhDevice)ctx->pSurf->dev, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)ctx->cmd, "vkvgCtxCmd");
-#endif
+ if (!ctx->cmdStarted)
+ _start_cmd_for_render_pass(ctx);
+ else if (ctx->pushCstDirty)
+ _update_push_constants(ctx);
}
void _clear_attachment (VkvgContext ctx) {
}
inline void _wait_flush_fence (VkvgContext ctx) {
- vkWaitForFences (ctx->pSurf->dev->vkDev, 1, &ctx->flushFence, VK_TRUE, VKVG_FENCE_TIMEOUT);
+ vkWaitForFences (ctx->pSurf->dev->vkDev, 1, &ctx->flushFence, VK_TRUE, VKVG_FENCE_TIMEOUT);
}
inline void _reset_flush_fence (VkvgContext ctx) {
- vkResetFences (ctx->pSurf->dev->vkDev, 1, &ctx->flushFence);
+ vkResetFences (ctx->pSurf->dev->vkDev, 1, &ctx->flushFence);
}
void _wait_and_submit_cmd (VkvgContext ctx){
- if (!ctx->cmdStarted)
- return;
+ if (!ctx->cmdStarted)
+ return;
- _wait_flush_fence (ctx);
- _reset_flush_fence(ctx);
+ _wait_flush_fence (ctx);
+ _reset_flush_fence(ctx);
- _submit_cmd (ctx->pSurf->dev, &ctx->cmd, ctx->flushFence);
+ _submit_cmd (ctx->pSurf->dev, &ctx->cmd, ctx->flushFence);
- if (ctx->cmd == ctx->cmdBuffers[0])
- ctx->cmd = ctx->cmdBuffers[1];
- else
- ctx->cmd = ctx->cmdBuffers[0];
+ if (ctx->cmd == ctx->cmdBuffers[0])
+ ctx->cmd = ctx->cmdBuffers[1];
+ else
+ ctx->cmd = ctx->cmdBuffers[0];
- vkResetCommandBuffer (ctx->cmd, 0);
- ctx->cmdStarted = false;
+ vkResetCommandBuffer (ctx->cmd, 0);
+ ctx->cmdStarted = false;
}
/*void _explicit_ms_resolve (VkvgContext ctx){//should init cmd before calling this (unused, using automatic resolve by renderpass)
- vkh_image_set_layout (ctx->cmd, ctx->pSurf->imgMS, VK_IMAGE_ASPECT_COLOR_BIT,
- VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
- VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
- vkh_image_set_layout (ctx->cmd, ctx->pSurf->img, VK_IMAGE_ASPECT_COLOR_BIT,
- VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
- VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
-
- VkImageResolve re = {
- .extent = {ctx->pSurf->width, ctx->pSurf->height,1},
- .srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT,0,0,1},
- .dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT,0,0,1}
- };
-
- vkCmdResolveImage(ctx->cmd,
- vkh_image_get_vkimage (ctx->pSurf->imgMS), VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
- vkh_image_get_vkimage (ctx->pSurf->img) ,VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
- 1,&re);
- vkh_image_set_layout (ctx->cmd, ctx->pSurf->imgMS, VK_IMAGE_ASPECT_COLOR_BIT,
- VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL ,
- VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
+ vkh_image_set_layout (ctx->cmd, ctx->pSurf->imgMS, VK_IMAGE_ASPECT_COLOR_BIT,
+ VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
+ VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
+ vkh_image_set_layout (ctx->cmd, ctx->pSurf->img, VK_IMAGE_ASPECT_COLOR_BIT,
+ VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
+ VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
+
+ VkImageResolve re = {
+ .extent = {ctx->pSurf->width, ctx->pSurf->height,1},
+ .srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT,0,0,1},
+ .dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT,0,0,1}
+ };
+
+ vkCmdResolveImage(ctx->cmd,
+ vkh_image_get_vkimage (ctx->pSurf->imgMS), VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
+ vkh_image_get_vkimage (ctx->pSurf->img) ,VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
+ 1,&re);
+ vkh_image_set_layout (ctx->cmd, ctx->pSurf->imgMS, VK_IMAGE_ASPECT_COLOR_BIT,
+ VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL ,
+ VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
}*/
//pre flush vertices because of vbo or ibo too small, all vertices except last draw call are flushed
//this function expects a vertex offset > 0
void _flush_vertices_caches_until_vertex_base (VkvgContext ctx) {
- _wait_flush_fence (ctx);
+ _wait_flush_fence (ctx);
- memcpy(ctx->vertices.allocInfo.pMappedData, ctx->vertexCache, ctx->curVertOffset * sizeof (Vertex));
- memcpy(ctx->indices.allocInfo.pMappedData, ctx->indexCache, ctx->curIndStart * sizeof (VKVG_IBO_INDEX_TYPE));
+ memcpy(ctx->vertices.allocInfo.pMappedData, ctx->vertexCache, ctx->curVertOffset * sizeof (Vertex));
+ memcpy(ctx->indices.allocInfo.pMappedData, ctx->indexCache, ctx->curIndStart * sizeof (VKVG_IBO_INDEX_TYPE));
- //copy remaining vertices and indices to caches starts
- ctx->vertCount -= ctx->curVertOffset;
- ctx->indCount -= ctx->curIndStart;
- memcpy(ctx->vertexCache, &ctx->vertexCache[ctx->curVertOffset], ctx->vertCount * sizeof (Vertex));
- memcpy(ctx->indexCache, &ctx->indexCache[ctx->curIndStart], ctx->indCount * sizeof (VKVG_IBO_INDEX_TYPE));
+ //copy remaining vertices and indices to caches starts
+ ctx->vertCount -= ctx->curVertOffset;
+ ctx->indCount -= ctx->curIndStart;
+ memcpy(ctx->vertexCache, &ctx->vertexCache[ctx->curVertOffset], ctx->vertCount * sizeof (Vertex));
+ memcpy(ctx->indexCache, &ctx->indexCache[ctx->curIndStart], ctx->indCount * sizeof (VKVG_IBO_INDEX_TYPE));
- ctx->curVertOffset = 0;
- ctx->curIndStart = 0;
+ ctx->curVertOffset = 0;
+ ctx->curIndStart = 0;
}
void _flush_vertices_caches (VkvgContext ctx) {
- //copy vertex and index caches to the vbo and ibo vkbuffers
- _wait_flush_fence (ctx);
+ //copy vertex and index caches to the vbo and ibo vkbuffers
+ _wait_flush_fence (ctx);
- memcpy(ctx->vertices.allocInfo.pMappedData, ctx->vertexCache, ctx->vertCount * sizeof (Vertex));
- memcpy(ctx->indices.allocInfo.pMappedData, ctx->indexCache, ctx->indCount * sizeof (VKVG_IBO_INDEX_TYPE));
+ memcpy(ctx->vertices.allocInfo.pMappedData, ctx->vertexCache, ctx->vertCount * sizeof (Vertex));
+ memcpy(ctx->indices.allocInfo.pMappedData, ctx->indexCache, ctx->indCount * sizeof (VKVG_IBO_INDEX_TYPE));
- ctx->vertCount = ctx->indCount = ctx->curIndStart = ctx->curVertOffset = 0;
+ ctx->vertCount = ctx->indCount = ctx->curIndStart = ctx->curVertOffset = 0;
}
//this func expect cmdStarted to be true
void _end_render_pass (VkvgContext ctx) {
- LOG(LOG_INFO, "END RENDER PASS: ctx = %lu;\n", ctx);
- CmdEndRenderPass (ctx->cmd);
- ctx->renderPassBeginInfo.renderPass = ctx->pSurf->dev->renderPass;
+ LOG(LOG_INFO, "END RENDER PASS: ctx = %lu;\n", ctx);
+ CmdEndRenderPass (ctx->cmd);
+#ifdef DEBUG
+ vkh_cmd_label_end (ctx->cmd);
+#endif
+ ctx->renderPassBeginInfo.renderPass = ctx->pSurf->dev->renderPass;
}
void _new_flush (VkvgContext ctx){
- if (ctx->indCount == ctx->curIndStart)
- return;
-
- if (ctx->vertCount > ctx->sizeVBO || ctx->indCount > ctx->sizeIBO){
- //vbo or ibo buffers too small
- if (ctx->cmdStarted) {
- //if cmd is started buffers, are already bound, so no resize is possible
- //instead we flush, and clear vbo and ibo caches
- _end_render_pass (ctx);
- _flush_vertices_caches_until_vertex_base (ctx);
- vkh_cmd_end (ctx->cmd);
- _wait_and_submit_cmd (ctx);
- _resize_vbo(ctx, ctx->sizeVertices);
- _resize_ibo(ctx, ctx->sizeIndices);
- }else{
- _resize_vbo(ctx, ctx->sizeVertices);
- _resize_ibo(ctx, ctx->sizeIndices);
- }
- }
-
- _check_cmd_buff_state(ctx);
- CmdDrawIndexed(ctx->cmd, ctx->indCount - ctx->curIndStart, 1, ctx->curIndStart, (int32_t)ctx->curVertOffset, 0);
-
- LOG(LOG_INFO, "RECORD DRAW CMD: ctx = %lu; vertices = %d; indices = %d\n", (ulong)ctx, ctx->vertCount - ctx->indexCache[ctx->curIndStart], ctx->indCount - ctx->curIndStart);
+ if (ctx->indCount == ctx->curIndStart)
+ return;
+
+ if (ctx->vertCount > ctx->sizeVBO || ctx->indCount > ctx->sizeIBO){
+ //vbo or ibo buffers too small
+ if (ctx->cmdStarted) {
+#ifdef DEBUG
+ vkh_cmd_label_start(ctx->cmd, "ctx flush for resize vao", LAB_COLOR_FLUSH);
+#endif
+ //if cmd is started buffers, are already bound, so no resize is possible
+ //instead we flush, and clear vbo and ibo caches
+ _end_render_pass (ctx);
+ _flush_vertices_caches_until_vertex_base (ctx);
+ vkh_cmd_end (ctx->cmd);
+ _wait_and_submit_cmd (ctx);
+ _resize_vbo(ctx, ctx->sizeVertices);
+ _resize_ibo(ctx, ctx->sizeIndices);
+ }else{
+ _resize_vbo(ctx, ctx->sizeVertices);
+ _resize_ibo(ctx, ctx->sizeIndices);
+ }
+ }
+
+ _check_cmd_buff_state(ctx);
+ CmdDrawIndexed(ctx->cmd, ctx->indCount - ctx->curIndStart, 1, ctx->curIndStart, (int32_t)ctx->curVertOffset, 0);
+
+ LOG(LOG_INFO, "RECORD DRAW CMD: ctx = %lu; vertices = %d; indices = %d\n", (ulong)ctx, ctx->vertCount - ctx->indexCache[ctx->curIndStart], ctx->indCount - ctx->curIndStart);
#ifdef VKVG_WIRED_DEBUG
- CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelineWired);
- CmdDrawIndexed(ctx->cmd, ctx->indCount - ctx->curIndStart, 1, ctx->curIndStart, (int32_t)ctx->curVertOffset, 0);
- CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipe_OVER);
+ CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelineWired);
+ CmdDrawIndexed(ctx->cmd, ctx->indCount - ctx->curIndStart, 1, ctx->curIndStart, (int32_t)ctx->curVertOffset, 0);
+ CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipe_OVER);
#endif
- ctx->curIndStart = ctx->indCount;
- ctx->curVertOffset = ctx->vertCount;
+ ctx->curIndStart = ctx->indCount;
+ ctx->curVertOffset = ctx->vertCount;
- _end_render_pass (ctx);
- _flush_vertices_caches (ctx);
- vkh_cmd_end (ctx->cmd);
+ _end_render_pass (ctx);
+ _flush_vertices_caches (ctx);
+ vkh_cmd_end (ctx->cmd);
- LOG(LOG_INFO, "FLUSH CTX: ctx = %lu; vertices = %d; indices = %d\n", ctx, ctx->vertCount, ctx->indCount);
- _wait_and_submit_cmd(ctx);
+ LOG(LOG_INFO, "FLUSH CTX: ctx = %lu; vertices = %d; indices = %d\n", ctx, ctx->vertCount, ctx->indCount);
+ _wait_and_submit_cmd(ctx);
}
inline bool _undrawn_vertices (VkvgContext ctx) {
- return ctx->indCount > ctx->curIndStart;
+ return ctx->indCount > ctx->curIndStart;
}
void _record_draw_cmd (VkvgContext ctx){
- if (ctx->vertCount > ctx->sizeVBO || ctx->indCount > ctx->sizeIBO){
- //vbo or ibo buffers too small
- if (ctx->cmdStarted) {
- //if cmd is started buffers, are already bound, so no resize is possible
- //instead we flush, and clear vbo and ibo caches
- _end_render_pass (ctx);
- _flush_vertices_caches_until_vertex_base (ctx);
- vkh_cmd_end (ctx->cmd);
- _wait_and_submit_cmd (ctx);
- _resize_vbo(ctx, ctx->sizeVertices);
- _resize_ibo(ctx, ctx->sizeIndices);
- }else{
- _resize_vbo(ctx, ctx->sizeVertices);
- _resize_ibo(ctx, ctx->sizeIndices);
- }
- }
-
- _check_cmd_buff_state(ctx);
- CmdDrawIndexed(ctx->cmd, ctx->indCount - ctx->curIndStart, 1, ctx->curIndStart, (int32_t)ctx->curVertOffset, 0);
-
- LOG(LOG_INFO, "RECORD DRAW CMD: ctx = %lu; vertices = %d; indices = %d\n", (ulong)ctx, ctx->vertCount - ctx->indexCache[ctx->curIndStart], ctx->indCount - ctx->curIndStart);
+ if (ctx->vertCount > ctx->sizeVBO || ctx->indCount > ctx->sizeIBO){
+ //vbo or ibo buffers too small
+ if (ctx->cmdStarted) {
+ //if cmd is started buffers, are already bound, so no resize is possible
+ //instead we flush, and clear vbo and ibo caches
+ _end_render_pass (ctx);
+ _flush_vertices_caches_until_vertex_base (ctx);
+ vkh_cmd_end (ctx->cmd);
+ _wait_and_submit_cmd (ctx);
+ }
+ _resize_vbo(ctx, ctx->sizeVertices);
+ _resize_ibo(ctx, ctx->sizeIndices);
+ }
+
+ _check_cmd_buff_state(ctx);
+ CmdDrawIndexed(ctx->cmd, ctx->indCount - ctx->curIndStart, 1, ctx->curIndStart, (int32_t)ctx->curVertOffset, 0);
+
+ LOG(LOG_INFO, "RECORD DRAW CMD: ctx = %lu; vertices = %d; indices = %d\n", (ulong)ctx, ctx->vertCount - ctx->indexCache[ctx->curIndStart], ctx->indCount - ctx->curIndStart);
#ifdef VKVG_WIRED_DEBUG
- CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelineWired);
- CmdDrawIndexed(ctx->cmd, ctx->indCount - ctx->curIndStart, 1, ctx->curIndStart, (int32_t)ctx->curVertOffset, 0);
- CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipe_OVER);
+ CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelineWired);
+ CmdDrawIndexed(ctx->cmd, ctx->indCount - ctx->curIndStart, 1, ctx->curIndStart, (int32_t)ctx->curVertOffset, 0);
+ CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipe_OVER);
#endif
- ctx->curIndStart = ctx->indCount;
- ctx->curVertOffset = ctx->vertCount;
+ ctx->curIndStart = ctx->indCount;
+ ctx->curVertOffset = ctx->vertCount;
}
void _flush_cmd_buff (VkvgContext ctx){
- if (_undrawn_vertices(ctx))
- _record_draw_cmd (ctx);
- else if (!ctx->cmdStarted)
- return;
- _end_render_pass (ctx);
- _flush_vertices_caches (ctx);
- vkh_cmd_end (ctx->cmd);
-
- LOG(LOG_INFO, "FLUSH CTX: ctx = %lu; vertices = %d; indices = %d\n", ctx, ctx->vertCount, ctx->indCount);
- _wait_and_submit_cmd(ctx);
+ if (_undrawn_vertices(ctx))
+ _record_draw_cmd (ctx);
+ else if (!ctx->cmdStarted)
+ return;
+ _end_render_pass (ctx);
+ _flush_vertices_caches (ctx);
+ vkh_cmd_end (ctx->cmd);
+
+ LOG(LOG_INFO, "FLUSH CTX: ctx = %lu; vertices = %d; indices = %d\n", ctx, ctx->vertCount, ctx->indCount);
+ _wait_and_submit_cmd(ctx);
}
//bind correct draw pipeline depending on current OPERATOR
void _bind_draw_pipeline (VkvgContext ctx) {
- switch (ctx->curOperator) {
- case VKVG_OPERATOR_OVER:
- CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipe_OVER);
- break;
- case VKVG_OPERATOR_CLEAR:
- vkvg_set_source_rgba(ctx,0,0,0,0);
- CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipe_CLEAR);
- break;
- default:
- CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipe_OVER);
- break;
- }
+ switch (ctx->curOperator) {
+ case VKVG_OPERATOR_OVER:
+ CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipe_OVER);
+ break;
+ case VKVG_OPERATOR_CLEAR:
+ vkvg_set_source_rgba(ctx,0,0,0,0);
+ CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipe_CLEAR);
+ break;
+ default:
+ CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipe_OVER);
+ break;
+ }
}
void _init_push_descriptor_writes (VkvgContext ctx) {
- ctx->descFontTex = vkh_image_get_descriptor (ctx->pSurf->dev->fontCache->texture, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
- VkWriteDescriptorSet wds = {0};
- wds.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
- wds.dstSet = 0;
- wds.dstBinding = 0;
- wds.descriptorCount = 1;
- wds.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
- wds.pImageInfo = &ctx->descSrcTex;
- ctx->wds[0] = wds;
-
- ctx->descSrcTex = vkh_image_get_descriptor (ctx->pSurf->dev->emptyImg, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
- wds.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
- wds.dstSet = 0;
- wds.dstBinding = 1;
- wds.descriptorCount = 1;
- wds.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
- wds.pImageInfo = &ctx->descFontTex;
- ctx->wds[1] = wds;
-
- wds.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
- wds.dstSet = 0;
- wds.dstBinding = 2;
- wds.descriptorCount = 1;
- wds.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
- wds.pImageInfo = 0;
- wds.pBufferInfo = &ctx->uboGrad.descriptor;
- ctx->wds[2] = wds;
+ ctx->descFontTex = vkh_image_get_descriptor (ctx->pSurf->dev->fontCache->texture, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
+ VkWriteDescriptorSet wds = {0};
+ wds.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
+ wds.dstSet = 0;
+ wds.dstBinding = 0;
+ wds.descriptorCount = 1;
+ wds.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
+ wds.pImageInfo = &ctx->descSrcTex;
+ ctx->wds[0] = wds;
+
+ ctx->descSrcTex = vkh_image_get_descriptor (ctx->pSurf->dev->emptyImg, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
+ wds.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
+ wds.dstSet = 0;
+ wds.dstBinding = 1;
+ wds.descriptorCount = 1;
+ wds.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
+ wds.pImageInfo = &ctx->descFontTex;
+ ctx->wds[1] = wds;
+
+ wds.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
+ wds.dstSet = 0;
+ wds.dstBinding = 2;
+ wds.descriptorCount = 1;
+ wds.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
+ wds.pImageInfo = 0;
+ wds.pBufferInfo = &ctx->uboGrad.descriptor;
+ ctx->wds[2] = wds;
}
+
void _start_cmd_for_render_pass (VkvgContext ctx) {
- LOG(LOG_INFO, "START RENDER PASS: ctx = %lu\n", ctx);
- vkh_cmd_begin (ctx->cmd,VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT);
-
- if (ctx->pSurf->img->layout == VK_IMAGE_LAYOUT_UNDEFINED){
- VkhImage imgMs = ctx->pSurf->imgMS;
- if (imgMs != NULL)
- vkh_image_set_layout(ctx->cmd, imgMs, VK_IMAGE_ASPECT_COLOR_BIT,
- VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
- VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT);
-
- vkh_image_set_layout(ctx->cmd, ctx->pSurf->img, VK_IMAGE_ASPECT_COLOR_BIT,
- VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
- VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT);
- }
-
- if (ctx->source && ctx->source->layout != VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
- vkh_image_set_layout (ctx->cmd, ctx->source, VK_IMAGE_ASPECT_COLOR_BIT,
- VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
- VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
-
- CmdBeginRenderPass (ctx->cmd, &ctx->renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
- VkViewport viewport = {0,0,ctx->pSurf->width,ctx->pSurf->height,0,1};
- CmdSetViewport(ctx->cmd, 0, 1, &viewport);
-
- CmdSetScissor(ctx->cmd, 0, 1, &ctx->bounds);
-
- if (CmdPushDescriptorSet) {
- CmdPushDescriptorSet(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelineLayout, 0, 3, &ctx->wds[0]);
- /*if (ctx->pattern){
- if (ctx->pattern->type == VKVG_PATTERN_TYPE_SURFACE)
- CmdPushDescriptorSet(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelineLayout, 0, 1, &ctx->wds[0]);
- else if (ctx->pattern->type != VKVG_PATTERN_TYPE_SOLID)
- CmdPushDescriptorSet(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelineLayout, 0, 1, &ctx->wds[2]);
- }*/
- }else{
- CmdBindDescriptorSets(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelineLayout,
- 0, 1, &ctx->dsSrc, 0, NULL);
- }
- VkDeviceSize offsets[1] = { 0 };
- CmdBindVertexBuffers(ctx->cmd, 0, 1, &ctx->vertices.buffer, offsets);
- if (sizeof (VKVG_IBO_INDEX_TYPE) == 4)
- CmdBindIndexBuffer(ctx->cmd, ctx->indices.buffer, 0, VK_INDEX_TYPE_UINT32);
- else
- CmdBindIndexBuffer(ctx->cmd, ctx->indices.buffer, 0, VK_INDEX_TYPE_UINT16);
-
- _update_push_constants (ctx);
-
- _bind_draw_pipeline (ctx);
- CmdSetStencilCompareMask(ctx->cmd, VK_STENCIL_FRONT_AND_BACK, STENCIL_CLIP_BIT);
-
-
- ctx->cmdStarted = true;
+ LOG(LOG_INFO, "START RENDER PASS: ctx = %lu\n", ctx);
+ vkh_cmd_begin (ctx->cmd,VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT);
+
+ if (ctx->pSurf->img->layout == VK_IMAGE_LAYOUT_UNDEFINED){
+ VkhImage imgMs = ctx->pSurf->imgMS;
+ if (imgMs != NULL)
+ vkh_image_set_layout(ctx->cmd, imgMs, VK_IMAGE_ASPECT_COLOR_BIT,
+ VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
+ VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT);
+
+ vkh_image_set_layout(ctx->cmd, ctx->pSurf->img, VK_IMAGE_ASPECT_COLOR_BIT,
+ VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
+ VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT);
+ }
+
+ if (ctx->source && ctx->source->layout != VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
+ vkh_image_set_layout (ctx->cmd, ctx->source, VK_IMAGE_ASPECT_COLOR_BIT,
+ VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
+ VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
+
+#ifdef DEBUG
+ vkh_cmd_label_start(ctx->cmd, "ctx render pass", LAB_COLOR_RP);
+#endif
+
+ CmdBeginRenderPass (ctx->cmd, &ctx->renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
+ VkViewport viewport = {0,0,ctx->pSurf->width,ctx->pSurf->height,0,1};
+ CmdSetViewport(ctx->cmd, 0, 1, &viewport);
+
+ CmdSetScissor(ctx->cmd, 0, 1, &ctx->bounds);
+
+ if (CmdPushDescriptorSet) {
+ CmdPushDescriptorSet(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelineLayout, 0, 3, &ctx->wds[0]);
+ /*if (ctx->pattern){
+ if (ctx->pattern->type == VKVG_PATTERN_TYPE_SURFACE)
+ CmdPushDescriptorSet(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelineLayout, 0, 1, &ctx->wds[0]);
+ else if (ctx->pattern->type != VKVG_PATTERN_TYPE_SOLID)
+ CmdPushDescriptorSet(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelineLayout, 0, 1, &ctx->wds[2]);
+ }*/
+ }else{
+ CmdBindDescriptorSets(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelineLayout,
+ 0, 1, &ctx->dsSrc, 0, NULL);
+ }
+ VkDeviceSize offsets[1] = { 0 };
+ CmdBindVertexBuffers(ctx->cmd, 0, 1, &ctx->vertices.buffer, offsets);
+ if (sizeof (VKVG_IBO_INDEX_TYPE) == 4)
+ CmdBindIndexBuffer(ctx->cmd, ctx->indices.buffer, 0, VK_INDEX_TYPE_UINT32);
+ else
+ CmdBindIndexBuffer(ctx->cmd, ctx->indices.buffer, 0, VK_INDEX_TYPE_UINT16);
+
+ _update_push_constants (ctx);
+
+ _bind_draw_pipeline (ctx);
+ CmdSetStencilCompareMask(ctx->cmd, VK_STENCIL_FRONT_AND_BACK, STENCIL_CLIP_BIT);
+
+
+ ctx->cmdStarted = true;
}
//compute inverse mat used in shader when context matrix has changed
//then trigger push constants command
void _set_mat_inv_and_vkCmdPush (VkvgContext ctx) {
- if (_undrawn_vertices(ctx))
- _record_draw_cmd (ctx);//emit draw cmd before push new cst
- ctx->pushConsts.matInv = ctx->pushConsts.mat;
- vkvg_matrix_invert (&ctx->pushConsts.matInv);
- ctx->pushCstDirty = true;
+ if (_undrawn_vertices(ctx))
+ _record_draw_cmd (ctx);//emit draw cmd before push new cst
+ ctx->pushConsts.matInv = ctx->pushConsts.mat;
+ vkvg_matrix_invert (&ctx->pushConsts.matInv);
+ ctx->pushCstDirty = true;
}
inline void _update_push_constants (VkvgContext ctx) {
- CmdPushConstants(ctx->cmd, ctx->pSurf->dev->pipelineLayout,
- VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(push_constants),&ctx->pushConsts);
- ctx->pushCstDirty = false;
+ CmdPushConstants(ctx->cmd, ctx->pSurf->dev->pipelineLayout,
+ VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(push_constants),&ctx->pushConsts);
+ ctx->pushCstDirty = false;
}
void _update_cur_pattern (VkvgContext ctx, VkvgPattern pat) {
- VkvgPattern lastPat = ctx->pattern;
- ctx->pattern = pat;
-
- switch (pat->type) {
- case VKVG_PATTERN_TYPE_SOLID:
- if (ctx->source)
- ctx->source = NULL;
- if (lastPat){
- if (lastPat->type == VKVG_PATTERN_TYPE_SURFACE){
- ctx->descSrcTex = vkh_image_get_descriptor (ctx->pSurf->dev->emptyImg, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
- _flush_cmd_buff(ctx);
- }
- if (lastPat->type == pat->type)
- break;
- ctx->pushConsts.patternType = pat->type;
- ctx->pushCstDirty = true;
- }
- break;
- case VKVG_PATTERN_TYPE_SURFACE:
- {
- _flush_cmd_buff (ctx);
-
- VkvgSurface surf = (VkvgSurface)pat->data;
- ctx->source = surf->img;
- ctx->pushConsts.source.width = surf->height;
- ctx->pushConsts.source.height = surf->width;
- ctx->pushConsts.patternType = pat->type;
- ctx->pushCstDirty = true;
-
- if (CmdPushDescriptorSet != VK_NULL_HANDLE) {
- ctx->descSrcTex = (VkDescriptorImageInfo) {
- _get_sampler_for_pattern(ctx->pSurf->dev, pat),
- vkh_image_get_view (ctx->source),
- VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL};
-
- if (!ctx->cmdStarted)
- _start_cmd_for_render_pass(ctx);
- else{
- vkh_image_set_layout (ctx->cmd, surf->img, VK_IMAGE_ASPECT_COLOR_BIT,
- VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
- VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
- CmdPushDescriptorSet(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelineLayout, 0, 1, &ctx->wds[0]);
- }
- }
- //flush ctx in two steps to add the src transitioning in the cmd buff
- /*if (ctx->cmdStarted){//transition of img without appropriate dependencies in subpass must be done outside renderpass.
- _record_draw_cmd (ctx);//ensure all vertices are flushed
- _end_render_pass (ctx);
- _flush_vertices_caches (ctx);
- }else {
- vkh_cmd_begin (ctx->cmd,VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT);
- ctx->cmdStarted = true;
- }
- */
- //transition source surface for sampling
- /*
- vkh_image_set_layout (ctx->cmd, surf->img, VK_IMAGE_ASPECT_COLOR_BIT,
- VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
- VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
-
- vkh_cmd_end (ctx->cmd);
- _wait_and_submit_cmd (ctx);*/
-
-
- /*if (vkh_image_get_layout (ctx->source) != VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL){
- vkh_cmd_begin (ctx->cmd,VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT);
-
- vkh_image_set_layout (ctx->cmd, ctx->source, VK_IMAGE_ASPECT_COLOR_BIT,
- VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
- VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
- vkh_cmd_end (ctx->cmd);
-
- _submit_wait_and_reset_cmd (ctx);
- }*/
+ VkvgPattern lastPat = ctx->pattern;
+ ctx->pattern = pat;
+
+ switch (pat->type) {
+ case VKVG_PATTERN_TYPE_SOLID:
+ if (ctx->source)
+ ctx->source = NULL;
+ if (lastPat){
+ if (lastPat->type == VKVG_PATTERN_TYPE_SURFACE){
+ ctx->descSrcTex = vkh_image_get_descriptor (ctx->pSurf->dev->emptyImg, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
+ _flush_cmd_buff(ctx);
+ }
+ if (lastPat->type == pat->type)
+ break;
+ ctx->pushConsts.patternType = pat->type;
+ ctx->pushCstDirty = true;
+ }
+ break;
+ case VKVG_PATTERN_TYPE_SURFACE:
+ {
+ _flush_cmd_buff (ctx);
+
+ VkvgSurface surf = (VkvgSurface)pat->data;
+ ctx->source = surf->img;
+ ctx->pushConsts.source.width = surf->height;
+ ctx->pushConsts.source.height = surf->width;
+ ctx->pushConsts.patternType = pat->type;
+ ctx->pushCstDirty = true;
+
+ if (CmdPushDescriptorSet != VK_NULL_HANDLE) {
+ ctx->descSrcTex = (VkDescriptorImageInfo) {
+ _get_sampler_for_pattern(ctx->pSurf->dev, pat),
+ vkh_image_get_view (ctx->source),
+ VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL};
+
+ if (!ctx->cmdStarted)
+ _start_cmd_for_render_pass(ctx);
+ else{
+ vkh_image_set_layout (ctx->cmd, surf->img, VK_IMAGE_ASPECT_COLOR_BIT,
+ VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
+ VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
+ CmdPushDescriptorSet(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelineLayout, 0, 1, &ctx->wds[0]);
+ }
+ }
+ //flush ctx in two steps to add the src transitioning in the cmd buff
+ /*if (ctx->cmdStarted){//transition of img without appropriate dependencies in subpass must be done outside renderpass.
+ _record_draw_cmd (ctx);//ensure all vertices are flushed
+ _end_render_pass (ctx);
+ _flush_vertices_caches (ctx);
+ }else {
+ vkh_cmd_begin (ctx->cmd,VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT);
+ ctx->cmdStarted = true;
+ }
+ */
+ //transition source surface for sampling
+ /*
+ vkh_image_set_layout (ctx->cmd, surf->img, VK_IMAGE_ASPECT_COLOR_BIT,
+ VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
+ VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
+
+ vkh_cmd_end (ctx->cmd);
+ _wait_and_submit_cmd (ctx);*/
+
+
+ /*if (vkh_image_get_layout (ctx->source) != VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL){
+ vkh_cmd_begin (ctx->cmd,VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT);
+
+ vkh_image_set_layout (ctx->cmd, ctx->source, VK_IMAGE_ASPECT_COLOR_BIT,
+ VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
+ VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
+ vkh_cmd_end (ctx->cmd);
+
+ _submit_wait_and_reset_cmd (ctx);
+ }*/
/*
- _update_descriptor_set (ctx, ctx->source, ctx->dsSrc);
+ _update_descriptor_set (ctx, ctx->source, ctx->dsSrc);
*/
- //_init_cmd_buff (ctx);
- break;
- }
- case VKVG_PATTERN_TYPE_LINEAR:
- _flush_cmd_buff (ctx);
+ //_init_cmd_buff (ctx);
+ break;
+ }
+ case VKVG_PATTERN_TYPE_LINEAR:
+ _flush_cmd_buff (ctx);
- //if (lastPat && lastPat->type == VKVG_PATTERN_TYPE_SURFACE)
- // _update_descriptor_set (ctx, ctx->pSurf->dev->emptyImg, ctx->dsSrc,1);
+ //if (lastPat && lastPat->type == VKVG_PATTERN_TYPE_SURFACE)
+ // _update_descriptor_set (ctx, ctx->pSurf->dev->emptyImg, ctx->dsSrc,1);
- ctx->pushConsts.source = (vec4){ctx->pSurf->width, ctx->pSurf->height, 0, 0};//store img bounds in unused source field
- ctx->pushConsts.patternType = pat->type;
- ctx->pushCstDirty = true;
+ ctx->pushConsts.source = (vec4){ctx->pSurf->width, ctx->pSurf->height, 0, 0};//store img bounds in unused source field
+ ctx->pushConsts.patternType = pat->type;
+ ctx->pushCstDirty = true;
- //transform control point with current ctx matrix
- vkvg_gradient_t grad = {};
- memcpy(&grad, pat->data, sizeof(vkvg_gradient_t));
+ //transform control point with current ctx matrix
+ vkvg_gradient_t grad = {};
+ memcpy(&grad, pat->data, sizeof(vkvg_gradient_t));
- vkvg_matrix_transform_point(&ctx->pushConsts.mat, &grad.cp[0].x, &grad.cp[0].y);
- vkvg_matrix_transform_point(&ctx->pushConsts.mat, &grad.cp[1].x, &grad.cp[1].y);
- //to do, scale radial radiuses in cp[2]
+ vkvg_matrix_transform_point(&ctx->pushConsts.mat, &grad.cp[0].x, &grad.cp[0].y);
+ vkvg_matrix_transform_point(&ctx->pushConsts.mat, &grad.cp[1].x, &grad.cp[1].y);
+ //to do, scale radial radiuses in cp[2]
- memcpy(ctx->uboGrad.allocInfo.pMappedData , &grad, sizeof(vkvg_gradient_t));
+ memcpy(ctx->uboGrad.allocInfo.pMappedData , &grad, sizeof(vkvg_gradient_t));
- if (CmdPushDescriptorSet != VK_NULL_HANDLE && ctx->cmdStarted)
- CmdPushDescriptorSet(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelineLayout, 0, 1, &ctx->wds[2]);
- break;
- }
+ if (CmdPushDescriptorSet != VK_NULL_HANDLE && ctx->cmdStarted)
+ CmdPushDescriptorSet(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelineLayout, 0, 1, &ctx->wds[2]);
+ break;
+ }
- if (lastPat)
- vkvg_pattern_destroy (lastPat);
+ if (lastPat)
+ vkvg_pattern_destroy (lastPat);
}
void _update_descriptor_set (VkvgContext ctx, VkhImage img, VkDescriptorSet ds, uint binding){
- _wait_flush_fence(ctx);//descriptorSet update invalidate cmd buffs
- VkDescriptorImageInfo descSrcTex = vkh_image_get_descriptor (img, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
- VkWriteDescriptorSet writeDescriptorSet = {
- .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
- .dstSet = ds,
- .dstBinding = binding,
- .descriptorCount = 1,
- .descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
- .pImageInfo = &descSrcTex
- };
- vkUpdateDescriptorSets(ctx->pSurf->dev->vkDev, 1, &writeDescriptorSet, 0, NULL);
+ _wait_flush_fence(ctx);//descriptorSet update invalidate cmd buffs
+ VkDescriptorImageInfo descSrcTex = vkh_image_get_descriptor (img, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
+ VkWriteDescriptorSet writeDescriptorSet = {
+ .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
+ .dstSet = ds,
+ .dstBinding = binding,
+ .descriptorCount = 1,
+ .descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
+ .pImageInfo = &descSrcTex
+ };
+ vkUpdateDescriptorSets(ctx->pSurf->dev->vkDev, 1, &writeDescriptorSet, 0, NULL);
}
void _update_gradient_desc_set (VkvgContext ctx){
- VkDescriptorBufferInfo dbi = {ctx->uboGrad.buffer, 0, VK_WHOLE_SIZE};
- VkWriteDescriptorSet writeDescriptorSet = {
- .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
- .dstSet = ctx->dsSrc,
- .dstBinding = 2,
- .descriptorCount = 1,
- .descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
- .pBufferInfo = &dbi
- };
- vkUpdateDescriptorSets(ctx->pSurf->dev->vkDev, 1, &writeDescriptorSet, 0, NULL);
+ VkDescriptorBufferInfo dbi = {ctx->uboGrad.buffer, 0, VK_WHOLE_SIZE};
+ VkWriteDescriptorSet writeDescriptorSet = {
+ .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
+ .dstSet = ctx->dsSrc,
+ .dstBinding = 2,
+ .descriptorCount = 1,
+ .descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
+ .pBufferInfo = &dbi
+ };
+ vkUpdateDescriptorSets(ctx->pSurf->dev->vkDev, 1, &writeDescriptorSet, 0, NULL);
}
/*
* Reset currently bound descriptor which image could be destroyed
*/
/*void _reset_src_descriptor_set (VkvgContext ctx){
- VkvgDevice dev = ctx->pSurf->dev;
- //VkDescriptorSet dss[] = {ctx->dsSrc};
- vkFreeDescriptorSets (dev->vkDev, ctx->descriptorPool, 1, &ctx->dsSrc);
-
- VkDescriptorSetAllocateInfo descriptorSetAllocateInfo = { .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,
- .descriptorPool = ctx->descriptorPool,
- .descriptorSetCount = 1,
- .pSetLayouts = &dev->dslSrc };
- VK_CHECK_RESULT(vkAllocateDescriptorSets(dev->vkDev, &descriptorSetAllocateInfo, &ctx->dsSrc));
+ VkvgDevice dev = ctx->pSurf->dev;
+ //VkDescriptorSet dss[] = {ctx->dsSrc};
+ vkFreeDescriptorSets (dev->vkDev, ctx->descriptorPool, 1, &ctx->dsSrc);
+
+ VkDescriptorSetAllocateInfo descriptorSetAllocateInfo = { .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,
+ .descriptorPool = ctx->descriptorPool,
+ .descriptorSetCount = 1,
+ .pSetLayouts = &dev->dslSrc };
+ VK_CHECK_RESULT(vkAllocateDescriptorSets(dev->vkDev, &descriptorSetAllocateInfo, &ctx->dsSrc));
}*/
void _createDescriptorPool (VkvgContext ctx) {
- VkvgDevice dev = ctx->pSurf->dev;
- const VkDescriptorPoolSize descriptorPoolSize[] = {
- {VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2 },
- {VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1 }
- };
- VkDescriptorPoolCreateInfo descriptorPoolCreateInfo = { .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
- .maxSets = 3,
- .flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT,
- .poolSizeCount = 2,
- .pPoolSizes = descriptorPoolSize };
- VK_CHECK_RESULT(vkCreateDescriptorPool (dev->vkDev, &descriptorPoolCreateInfo, NULL, &ctx->descriptorPool));
+ VkvgDevice dev = ctx->pSurf->dev;
+ const VkDescriptorPoolSize descriptorPoolSize[] = {
+ {VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2 },
+ {VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1 }
+ };
+ VkDescriptorPoolCreateInfo descriptorPoolCreateInfo = { .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
+ .maxSets = 3,
+ .flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT,
+ .poolSizeCount = 2,
+ .pPoolSizes = descriptorPoolSize };
+ VK_CHECK_RESULT(vkCreateDescriptorPool (dev->vkDev, &descriptorPoolCreateInfo, NULL, &ctx->descriptorPool));
}
void _init_descriptor_sets (VkvgContext ctx){
- VkvgDevice dev = ctx->pSurf->dev;
- VkDescriptorSetAllocateInfo descriptorSetAllocateInfo = { .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,
- .descriptorPool = ctx->descriptorPool,
- .descriptorSetCount = 1,
- .pSetLayouts = &dev->dslSrc };
- VK_CHECK_RESULT(vkAllocateDescriptorSets(dev->vkDev, &descriptorSetAllocateInfo, &ctx->dsSrc));
+ VkvgDevice dev = ctx->pSurf->dev;
+ VkDescriptorSetAllocateInfo descriptorSetAllocateInfo = { .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,
+ .descriptorPool = ctx->descriptorPool,
+ .descriptorSetCount = 1,
+ .pSetLayouts = &dev->dslSrc };
+ VK_CHECK_RESULT(vkAllocateDescriptorSets(dev->vkDev, &descriptorSetAllocateInfo, &ctx->dsSrc));
}
void _build_vb_step (vkvg_context* ctx, Vertex v, float hw, uint32_t iL, uint32_t i, uint32_t iR, bool isCurve){
- //if two of the three points are equal, normal is null
- vec2 v0n = vec2_line_norm(ctx->points[iL], ctx->points[i]);
- if (vec2_isnan(v0n))
- return;
- vec2 v1n = vec2_line_norm(ctx->points[i], ctx->points[iR]);
- if (vec2_isnan(v1n))
- return;
-
- vec2 bisec = vec2_norm(vec2_add(v0n,v1n));
-
- float alpha = acosf(v0n.x * v1n.x + v0n.y * v1n.y)/2;
- float cross = v0n.x * v1n.y - v0n.y * v1n.x;
-
- if (cross<0)
- alpha = -alpha;
-
- float lh = hw / cosf(alpha);
- bisec = vec2_perp(bisec);
- bisec = vec2_mult(bisec,lh);
-
- uint32_t idx = ctx->vertCount - ctx->curVertOffset;
-
- if (ctx->lineJoin == VKVG_LINE_JOIN_MITER || isCurve){
- v.pos = vec2_add(ctx->points[i], bisec);
- _add_vertex(ctx, v);
- v.pos = vec2_sub(ctx->points[i], bisec);
- _add_vertex(ctx, v);
- _add_tri_indices_for_rect(ctx, idx);
- }else{
- vec2 vp = vec2_perp(v0n);
- if (cross<0){
- v.pos = vec2_add (ctx->points[i], bisec);
- _add_vertex(ctx, v);
- v.pos = vec2_sub (ctx->points[i], vec2_mult (vp, hw));
- }else{
- v.pos = vec2_add (ctx->points[i], vec2_mult (vp, hw));
- _add_vertex(ctx, v);
- v.pos = vec2_sub (ctx->points[i], bisec);
- }
- _add_vertex(ctx, v);
-
- if (ctx->lineJoin == VKVG_LINE_JOIN_BEVEL){
- if (cross<0){
- _add_triangle_indices(ctx, idx, idx+2, idx+1);
- _add_triangle_indices(ctx, idx+2, idx+4, idx+0);
- _add_triangle_indices(ctx, idx, idx+3, idx+4);
- }else{
- _add_triangle_indices(ctx, idx, idx+2, idx+1);
- _add_triangle_indices(ctx, idx+2, idx+3, idx+1);
- _add_triangle_indices(ctx, idx+1, idx+3, idx+4);
- }
- }else if (ctx->lineJoin == VKVG_LINE_JOIN_ROUND){
- float step = M_PIF / hw;
- float a = acosf(vp.x);
- if (vp.y < 0)
- a = -a;
-
- if (cross<0){
- a+=M_PIF;
- float a1 = a + alpha*2;
- a-=step;
- while (a > a1){
- _add_vertexf(ctx, cosf(a) * hw + ctx->points[i].x, sinf(a) * hw + ctx->points[i].y);
- a-=step;
- }
- }else{
- float a1 = a + alpha*2;
- a+=step;
- while (a < a1){
- _add_vertexf(ctx, cosf(a) * hw + ctx->points[i].x, sinf(a) * hw + ctx->points[i].y);
- a+=step;
- }
- }
- uint32_t p0Idx = ctx->vertCount - ctx->curVertOffset;
- _add_triangle_indices(ctx, idx, idx+2, idx+1);
- if (cross<0){
- for (uint p = idx+2; p < p0Idx; p++)
- _add_triangle_indices(ctx, p, p+1, idx);
- _add_triangle_indices(ctx, p0Idx, p0Idx+2, idx);
- _add_triangle_indices(ctx, idx, p0Idx+1, p0Idx+2);
- }else{
- for (uint p = idx+2; p < p0Idx; p++)
- _add_triangle_indices(ctx, p, p+1, idx+1);
- _add_triangle_indices(ctx, p0Idx, p0Idx+1, idx+1);
- _add_triangle_indices(ctx, idx+1, p0Idx+1, p0Idx+2);
- }
-
- }
-
- vp = vec2_mult (vec2_perp(v1n), hw);
- if (cross<0)
- v.pos = vec2_sub (ctx->points[i], vp);
- else
- v.pos = vec2_add (ctx->points[i], vp);
- _add_vertex(ctx, v);
- }
+ //if two of the three points are equal, normal is null
+ vec2 v0n = vec2_line_norm(ctx->points[iL], ctx->points[i]);
+ if (vec2_isnan(v0n))
+ return;
+ vec2 v1n = vec2_line_norm(ctx->points[i], ctx->points[iR]);
+ if (vec2_isnan(v1n))
+ return;
+
+ vec2 bisec = vec2_norm(vec2_add(v0n,v1n));
+
+ float alpha = acosf(v0n.x * v1n.x + v0n.y * v1n.y)/2;
+ float cross = v0n.x * v1n.y - v0n.y * v1n.x;
+
+ if (cross<0)
+ alpha = -alpha;
+
+ float lh = hw / cosf(alpha);
+ bisec = vec2_perp(bisec);
+ bisec = vec2_mult(bisec,lh);
+
+ uint32_t idx = ctx->vertCount - ctx->curVertOffset;
+
+ if (ctx->lineJoin == VKVG_LINE_JOIN_MITER || isCurve){
+ v.pos = vec2_add(ctx->points[i], bisec);
+ _add_vertex(ctx, v);
+ v.pos = vec2_sub(ctx->points[i], bisec);
+ _add_vertex(ctx, v);
+ _add_tri_indices_for_rect(ctx, idx);
+ }else{
+ vec2 vp = vec2_perp(v0n);
+ if (cross<0){
+ v.pos = vec2_add (ctx->points[i], bisec);
+ _add_vertex(ctx, v);
+ v.pos = vec2_sub (ctx->points[i], vec2_mult (vp, hw));
+ }else{
+ v.pos = vec2_add (ctx->points[i], vec2_mult (vp, hw));
+ _add_vertex(ctx, v);
+ v.pos = vec2_sub (ctx->points[i], bisec);
+ }
+ _add_vertex(ctx, v);
+
+ if (ctx->lineJoin == VKVG_LINE_JOIN_BEVEL){
+ if (cross<0){
+ _add_triangle_indices(ctx, idx, idx+2, idx+1);
+ _add_triangle_indices(ctx, idx+2, idx+4, idx+0);
+ _add_triangle_indices(ctx, idx, idx+3, idx+4);
+ }else{
+ _add_triangle_indices(ctx, idx, idx+2, idx+1);
+ _add_triangle_indices(ctx, idx+2, idx+3, idx+1);
+ _add_triangle_indices(ctx, idx+1, idx+3, idx+4);
+ }
+ }else if (ctx->lineJoin == VKVG_LINE_JOIN_ROUND){
+ float step = M_PIF / hw;
+ float a = acosf(vp.x);
+ if (vp.y < 0)
+ a = -a;
+
+ if (cross<0){
+ a+=M_PIF;
+ float a1 = a + alpha*2;
+ a-=step;
+ while (a > a1){
+ _add_vertexf(ctx, cosf(a) * hw + ctx->points[i].x, sinf(a) * hw + ctx->points[i].y);
+ a-=step;
+ }
+ }else{
+ float a1 = a + alpha*2;
+ a+=step;
+ while (a < a1){
+ _add_vertexf(ctx, cosf(a) * hw + ctx->points[i].x, sinf(a) * hw + ctx->points[i].y);
+ a+=step;
+ }
+ }
+ uint32_t p0Idx = ctx->vertCount - ctx->curVertOffset;
+ _add_triangle_indices(ctx, idx, idx+2, idx+1);
+ if (cross<0){
+ for (uint p = idx+2; p < p0Idx; p++)
+ _add_triangle_indices(ctx, p, p+1, idx);
+ _add_triangle_indices(ctx, p0Idx, p0Idx+2, idx);
+ _add_triangle_indices(ctx, idx, p0Idx+1, p0Idx+2);
+ }else{
+ for (uint p = idx+2; p < p0Idx; p++)
+ _add_triangle_indices(ctx, p, p+1, idx+1);
+ _add_triangle_indices(ctx, p0Idx, p0Idx+1, idx+1);
+ _add_triangle_indices(ctx, idx+1, p0Idx+1, p0Idx+2);
+ }
+
+ }
+
+ vp = vec2_mult (vec2_perp(v1n), hw);
+ if (cross<0)
+ v.pos = vec2_sub (ctx->points[i], vp);
+ else
+ v.pos = vec2_add (ctx->points[i], vp);
+ _add_vertex(ctx, v);
+ }
/*
#ifdef DEBUG
- debugLinePoints[dlpCount] = ctx->points[i];
- debugLinePoints[dlpCount+1] = _v2add(ctx->points[i], _vec2dToVec2(_v2Multd(v0n,10)));
- dlpCount+=2;
- debugLinePoints[dlpCount] = ctx->points[i];
- debugLinePoints[dlpCount+1] = _v2add(ctx->points[i], _vec2dToVec2(_v2Multd(v1n,10)));
- dlpCount+=2;
- debugLinePoints[dlpCount] = ctx->points[i];
- debugLinePoints[dlpCount+1] = ctx->points[iR];
- dlpCount+=2;
+ debugLinePoints[dlpCount] = ctx->points[i];
+ debugLinePoints[dlpCount+1] = _v2add(ctx->points[i], _vec2dToVec2(_v2Multd(v0n,10)));
+ dlpCount+=2;
+ debugLinePoints[dlpCount] = ctx->points[i];
+ debugLinePoints[dlpCount+1] = _v2add(ctx->points[i], _vec2dToVec2(_v2Multd(v1n,10)));
+ dlpCount+=2;
+ debugLinePoints[dlpCount] = ctx->points[i];
+ debugLinePoints[dlpCount+1] = ctx->points[iR];
+ dlpCount+=2;
#endif*/
}
bool ptInTriangle(vec2 p, vec2 p0, vec2 p1, vec2 p2) {
- float dX = p.x-p2.x;
- float dY = p.y-p2.y;
- float dX21 = p2.x-p1.x;
- float dY12 = p1.y-p2.y;
- float D = dY12*(p0.x-p2.x) + dX21*(p0.y-p2.y);
- float s = dY12*dX + dX21*dY;
- float t = (p2.y-p0.y)*dX + (p0.x-p2.x)*dY;
- if (D<0)
- return (s<=0) && (t<=0) && (s+t>=D);
- return (s>=0) && (t>=0) && (s+t<=D);
+ float dX = p.x-p2.x;
+ float dY = p.y-p2.y;
+ float dX21 = p2.x-p1.x;
+ float dY12 = p1.y-p2.y;
+ float D = dY12*(p0.x-p2.x) + dX21*(p0.y-p2.y);
+ float s = dY12*dX + dX21*dY;
+ float t = (p2.y-p0.y)*dX + (p0.x-p2.x)*dY;
+ if (D<0)
+ return (s<=0) && (t<=0) && (s+t>=D);
+ return (s>=0) && (t>=0) && (s+t<=D);
}
void _free_ctx_save (vkvg_context_save_t* sav){
- free(sav->selectedFont.fontFile);
- free (sav);
+ free(sav->selectedFont.fontFile);
+ free (sav);
}
#define curve_angle_tolerance_epsilon 0.001
void _recursive_bezier (VkvgContext ctx,
- float x1, float y1, float x2, float y2,
- float x3, float y3, float x4, float y4,
- unsigned level) {
- if(level > curve_recursion_limit)
- {
- return;
- }
-
- // Calculate all the mid-points of the line segments
- //----------------------
- float x12 = (x1 + x2) / 2;
- float y12 = (y1 + y2) / 2;
- float x23 = (x2 + x3) / 2;
- float y23 = (y2 + y3) / 2;
- float x34 = (x3 + x4) / 2;
- float y34 = (y3 + y4) / 2;
- float x123 = (x12 + x23) / 2;
- float y123 = (y12 + y23) / 2;
- float x234 = (x23 + x34) / 2;
- float y234 = (y23 + y34) / 2;
- float x1234 = (x123 + x234) / 2;
- float y1234 = (y123 + y234) / 2;
-
- if(level > 0) // Enforce subdivision first time
- {
- // Try to approximate the full cubic curve by a single straight line
- //------------------
- float dx = x4-x1;
- float dy = y4-y1;
-
- float d2 = fabs(((x2 - x4) * dy - (y2 - y4) * dx));
- float d3 = fabs(((x3 - x4) * dy - (y3 - y4) * dx));
-
- float da1, da2;
-
- if(d2 > curve_collinearity_epsilon && d3 > curve_collinearity_epsilon)
- {
- // Regular care
- //-----------------
- if((d2 + d3)*(d2 + d3) <= m_distance_tolerance * (dx*dx + dy*dy))
- {
- // If the curvature doesn't exceed the distance_tolerance value
- // we tend to finish subdivisions.
- //----------------------
- if(m_angle_tolerance < curve_angle_tolerance_epsilon)
- {
- _add_point(ctx, x1234, y1234);
- return;
- }
-
- // Angle & Cusp Condition
- //----------------------
- float a23 = atan2(y3 - y2, x3 - x2);
- da1 = fabs(a23 - atan2(y2 - y1, x2 - x1));
- da2 = fabs(atan2(y4 - y3, x4 - x3) - a23);
- if(da1 >= M_PIF) da1 = M_2_PI - da1;
- if(da2 >= M_PIF) da2 = M_2_PI - da2;
-
- if(da1 + da2 < m_angle_tolerance)
- {
- // Finally we can stop the recursion
- //----------------------
- _add_point(ctx, x1234, y1234);
- return;
- }
-
- if(m_cusp_limit != 0.0)
- {
- if(da1 > m_cusp_limit)
- {
- _add_point (ctx, x2, y2);
- return;
- }
-
- if(da2 > m_cusp_limit)
- {
- _add_point (ctx, x3, y3);
- return;
- }
- }
- }
- } else {
- if(d2 > curve_collinearity_epsilon)
- {
- // p1,p3,p4 are collinear, p2 is considerable
- //----------------------
- if(d2 * d2 <= m_distance_tolerance * (dx*dx + dy*dy))
- {
- if(m_angle_tolerance < curve_angle_tolerance_epsilon)
- {
- _add_point (ctx, x1234, y1234);
- return;
- }
-
- // Angle Condition
- //----------------------
- da1 = fabs(atan2(y3 - y2, x3 - x2) - atan2(y2 - y1, x2 - x1));
- if(da1 >= M_PIF) da1 = M_2_PI - da1;
-
- if(da1 < m_angle_tolerance)
- {
- _add_point (ctx, x2, y2);
- _add_point (ctx, x3, y3);
- return;
- }
-
- if(m_cusp_limit != 0.0)
- {
- if(da1 > m_cusp_limit)
- {
- _add_point (ctx, x2, y2);
- return;
- }
- }
- }
- } else if(d3 > curve_collinearity_epsilon) {
- // p1,p2,p4 are collinear, p3 is considerable
- //----------------------
- if(d3 * d3 <= m_distance_tolerance * (dx*dx + dy*dy))
- {
- if(m_angle_tolerance < curve_angle_tolerance_epsilon)
- {
- _add_point (ctx, x1234, y1234);
- return;
- }
-
- // Angle Condition
- //----------------------
- da1 = fabs(atan2(y4 - y3, x4 - x3) - atan2(y3 - y2, x3 - x2));
- if(da1 >= M_PIF) da1 = M_2_PI - da1;
-
- if(da1 < m_angle_tolerance)
- {
- _add_point (ctx, x2, y2);
- _add_point (ctx, x3, y3);
- return;
- }
-
- if(m_cusp_limit != 0.0)
- {
- if(da1 > m_cusp_limit)
- {
- _add_point (ctx, x3, y3);
- return;
- }
- }
- }
- }
- else
- {
- // Collinear case
- //-----------------
- dx = x1234 - (x1 + x4) / 2;
- dy = y1234 - (y1 + y4) / 2;
- if(dx*dx + dy*dy <= m_distance_tolerance)
- {
- _add_point (ctx, x1234, y1234);
- return;
- }
- }
- }
- }
-
- // Continue subdivision
- //----------------------
- _recursive_bezier (ctx, x1, y1, x12, y12, x123, y123, x1234, y1234, level + 1);
- _recursive_bezier (ctx, x1234, y1234, x234, y234, x34, y34, x4, y4, level + 1);
+ float x1, float y1, float x2, float y2,
+ float x3, float y3, float x4, float y4,
+ unsigned level) {
+ if(level > curve_recursion_limit)
+ {
+ return;
+ }
+
+ // Calculate all the mid-points of the line segments
+ //----------------------
+ float x12 = (x1 + x2) / 2;
+ float y12 = (y1 + y2) / 2;
+ float x23 = (x2 + x3) / 2;
+ float y23 = (y2 + y3) / 2;
+ float x34 = (x3 + x4) / 2;
+ float y34 = (y3 + y4) / 2;
+ float x123 = (x12 + x23) / 2;
+ float y123 = (y12 + y23) / 2;
+ float x234 = (x23 + x34) / 2;
+ float y234 = (y23 + y34) / 2;
+ float x1234 = (x123 + x234) / 2;
+ float y1234 = (y123 + y234) / 2;
+
+ if(level > 0) // Enforce subdivision first time
+ {
+ // Try to approximate the full cubic curve by a single straight line
+ //------------------
+ float dx = x4-x1;
+ float dy = y4-y1;
+
+ float d2 = fabs(((x2 - x4) * dy - (y2 - y4) * dx));
+ float d3 = fabs(((x3 - x4) * dy - (y3 - y4) * dx));
+
+ float da1, da2;
+
+ if(d2 > curve_collinearity_epsilon && d3 > curve_collinearity_epsilon)
+ {
+ // Regular care
+ //-----------------
+ if((d2 + d3)*(d2 + d3) <= m_distance_tolerance * (dx*dx + dy*dy))
+ {
+ // If the curvature doesn't exceed the distance_tolerance value
+ // we tend to finish subdivisions.
+ //----------------------
+ if(m_angle_tolerance < curve_angle_tolerance_epsilon)
+ {
+ _add_point(ctx, x1234, y1234);
+ return;
+ }
+
+ // Angle & Cusp Condition
+ //----------------------
+ float a23 = atan2(y3 - y2, x3 - x2);
+ da1 = fabs(a23 - atan2(y2 - y1, x2 - x1));
+ da2 = fabs(atan2(y4 - y3, x4 - x3) - a23);
+ if(da1 >= M_PIF) da1 = M_2_PI - da1;
+ if(da2 >= M_PIF) da2 = M_2_PI - da2;
+
+ if(da1 + da2 < m_angle_tolerance)
+ {
+ // Finally we can stop the recursion
+ //----------------------
+ _add_point(ctx, x1234, y1234);
+ return;
+ }
+
+ if(m_cusp_limit != 0.0)
+ {
+ if(da1 > m_cusp_limit)
+ {
+ _add_point (ctx, x2, y2);
+ return;
+ }
+
+ if(da2 > m_cusp_limit)
+ {
+ _add_point (ctx, x3, y3);
+ return;
+ }
+ }
+ }
+ } else {
+ if(d2 > curve_collinearity_epsilon)
+ {
+ // p1,p3,p4 are collinear, p2 is considerable
+ //----------------------
+ if(d2 * d2 <= m_distance_tolerance * (dx*dx + dy*dy))
+ {
+ if(m_angle_tolerance < curve_angle_tolerance_epsilon)
+ {
+ _add_point (ctx, x1234, y1234);
+ return;
+ }
+
+ // Angle Condition
+ //----------------------
+ da1 = fabs(atan2(y3 - y2, x3 - x2) - atan2(y2 - y1, x2 - x1));
+ if(da1 >= M_PIF) da1 = M_2_PI - da1;
+
+ if(da1 < m_angle_tolerance)
+ {
+ _add_point (ctx, x2, y2);
+ _add_point (ctx, x3, y3);
+ return;
+ }
+
+ if(m_cusp_limit != 0.0)
+ {
+ if(da1 > m_cusp_limit)
+ {
+ _add_point (ctx, x2, y2);
+ return;
+ }
+ }
+ }
+ } else if(d3 > curve_collinearity_epsilon) {
+ // p1,p2,p4 are collinear, p3 is considerable
+ //----------------------
+ if(d3 * d3 <= m_distance_tolerance * (dx*dx + dy*dy))
+ {
+ if(m_angle_tolerance < curve_angle_tolerance_epsilon)
+ {
+ _add_point (ctx, x1234, y1234);
+ return;
+ }
+
+ // Angle Condition
+ //----------------------
+ da1 = fabs(atan2(y4 - y3, x4 - x3) - atan2(y3 - y2, x3 - x2));
+ if(da1 >= M_PIF) da1 = M_2_PI - da1;
+
+ if(da1 < m_angle_tolerance)
+ {
+ _add_point (ctx, x2, y2);
+ _add_point (ctx, x3, y3);
+ return;
+ }
+
+ if(m_cusp_limit != 0.0)
+ {
+ if(da1 > m_cusp_limit)
+ {
+ _add_point (ctx, x3, y3);
+ return;
+ }
+ }
+ }
+ }
+ else
+ {
+ // Collinear case
+ //-----------------
+ dx = x1234 - (x1 + x4) / 2;
+ dy = y1234 - (y1 + y4) / 2;
+ if(dx*dx + dy*dy <= m_distance_tolerance)
+ {
+ _add_point (ctx, x1234, y1234);
+ return;
+ }
+ }
+ }
+ }
+
+ // Continue subdivision
+ //----------------------
+ _recursive_bezier (ctx, x1, y1, x12, y12, x123, y123, x1234, y1234, level + 1);
+ _recursive_bezier (ctx, x1234, y1234, x234, y234, x34, y34, x4, y4, level + 1);
}
void _poly_fill (VkvgContext ctx){
- //we anticipate the check for vbo buffer size
- if (ctx->vertCount + ctx->pointCount > ctx->sizeVBO) {
- if (ctx->cmdStarted) {
- _end_render_pass(ctx);
- _flush_vertices_caches(ctx);
- vkh_cmd_end(ctx->cmd);
- _wait_and_submit_cmd(ctx);
- if (ctx->vertCount + ctx->pointCount > ctx->sizeVBO)
- _resize_vbo(ctx, ctx->vertCount + ctx->pointCount);
- }else
- _resize_vbo(ctx, ctx->vertCount + ctx->pointCount);
-
- _start_cmd_for_render_pass(ctx);
- }else
- _check_cmd_buff_state(ctx);
-
- CmdBindPipeline (ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelinePolyFill);
-
- uint32_t ptrPath = 0;
- Vertex v = {{0},ctx->curColor,{0,0},-1};
-
- while (ptrPath < ctx->pathPtr){
- if (ctx->pathes[ptrPath+1]&PATH_IS_CURVE_BIT){
- ptrPath += 2;
- continue;
- }
- //close path
- ctx->pathes[ptrPath] |= PATH_CLOSED_BIT;// ctx->pathes[ptrPath];//close path by setting start and end equal
-
- uint32_t firstPtIdx = ctx->pathes [ptrPath] & PATH_ELT_MASK;
- uint32_t lastPtIdx = ctx->pathes [ptrPath+1] & PATH_ELT_MASK;//_get_last_point_of_closed_path (ctx, ptrPath);
- uint32_t pathPointCount = lastPtIdx - firstPtIdx + 1;
-
- VKVG_IBO_INDEX_TYPE firstVertIdx = ctx->vertCount;
-
- for (uint i = 0; i < pathPointCount; i++) {
- v.pos = ctx->points [i+firstPtIdx];
- ctx->vertexCache[ctx->vertCount] = v;
- ctx->vertCount++;
- }
-
- LOG(LOG_INFO_PATH, "\tpoly fill: point count = %d; 1st vert = %d; vert count = %d\n", pathPointCount, firstVertIdx, ctx->vertCount - firstVertIdx);
- CmdDraw (ctx->cmd, pathPointCount, 1, firstVertIdx ,0);
-
- ptrPath+=2;
- }
- ctx->curVertOffset = ctx->vertCount;
+ //we anticipate the check for vbo buffer size
+ if (ctx->vertCount + ctx->pointCount > ctx->sizeVBO) {
+ if (ctx->cmdStarted) {
+ _end_render_pass(ctx);
+ _flush_vertices_caches(ctx);
+ vkh_cmd_end(ctx->cmd);
+ _wait_and_submit_cmd(ctx);
+ if (ctx->vertCount + ctx->pointCount > ctx->sizeVBO)
+ _resize_vbo(ctx, ctx->vertCount + ctx->pointCount);
+ }else
+ _resize_vbo(ctx, ctx->vertCount + ctx->pointCount);
+
+ _start_cmd_for_render_pass(ctx);
+ }else
+ _check_cmd_buff_state(ctx);
+
+ CmdBindPipeline (ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelinePolyFill);
+
+ uint32_t ptrPath = 0;
+ Vertex v = {{0},ctx->curColor,{0,0},-1};
+
+ while (ptrPath < ctx->pathPtr){
+ if (ctx->pathes[ptrPath+1]&PATH_IS_CURVE_BIT){
+ ptrPath += 2;
+ continue;
+ }
+ //close path
+ ctx->pathes[ptrPath] |= PATH_CLOSED_BIT;// ctx->pathes[ptrPath];//close path by setting start and end equal
+
+ uint32_t firstPtIdx = ctx->pathes [ptrPath] & PATH_ELT_MASK;
+ uint32_t lastPtIdx = ctx->pathes [ptrPath+1] & PATH_ELT_MASK;//_get_last_point_of_closed_path (ctx, ptrPath);
+ uint32_t pathPointCount = lastPtIdx - firstPtIdx + 1;
+
+ VKVG_IBO_INDEX_TYPE firstVertIdx = ctx->vertCount;
+
+ for (uint i = 0; i < pathPointCount; i++) {
+ v.pos = ctx->points [i+firstPtIdx];
+ ctx->vertexCache[ctx->vertCount] = v;
+ ctx->vertCount++;
+ }
+
+ LOG(LOG_INFO_PATH, "\tpoly fill: point count = %d; 1st vert = %d; vert count = %d\n", pathPointCount, firstVertIdx, ctx->vertCount - firstVertIdx);
+ CmdDraw (ctx->cmd, pathPointCount, 1, firstVertIdx ,0);
+
+ ptrPath+=2;
+ }
+ ctx->curVertOffset = ctx->vertCount;
}
void _fill_ec (VkvgContext ctx){
- uint32_t ptrPath = 0;;
- Vertex v = {{0},ctx->curColor,{0,0},-1};
-
- while (ptrPath < ctx->pathPtr){
- if (ctx->pathes[ptrPath+1]&PATH_IS_CURVE_BIT){
- ptrPath += 2;
- continue;
- }
- ctx->pathes[ptrPath]|=PATH_CLOSED_BIT;//close path
-
- uint32_t firstPtIdx = ctx->pathes[ptrPath]&PATH_ELT_MASK;
- uint32_t lastPtIdx = ctx->pathes[ptrPath+1]&PATH_ELT_MASK;
- uint32_t pathPointCount = lastPtIdx - firstPtIdx + 1;
- uint32_t firstVertIdx = ctx->vertCount-ctx->curVertOffset;
-
- ear_clip_point ecps[pathPointCount];
- uint32_t ecps_count = 0, i = 0;
-
- //init points link list
- while (i < pathPointCount-1){
- vec2 np = ctx->points[i+firstPtIdx];
- if (!vec2_equ(np, v.pos)){
- v.pos = np;
- ear_clip_point ecp = {v.pos, ecps_count+firstVertIdx, &ecps[ecps_count+1]};
- ecps[ecps_count] = ecp;
- _add_vertex(ctx, v);
- ecps_count++;
- }
- i++;
- }
-
- v.pos = ctx->points[i+firstPtIdx];
- ear_clip_point ecp = {v.pos, ecps_count+firstVertIdx, ecps};
- ecps[ecps_count] = ecp;
- _add_vertex(ctx, v);
- ecps_count++;
-
- ear_clip_point* ecp_current = ecps;
- uint32_t tries = 0;
-
- while (ecps_count > 3) {
- if (tries > ecps_count) {
- break;
- }
- ear_clip_point* v0 = ecp_current->next,
- *v1 = ecp_current, *v2 = ecp_current->next->next;
- if (ecp_zcross (v0, v2, v1)<0){
- ecp_current = ecp_current->next;
- tries++;
- continue;
- }
- ear_clip_point* vP = v2->next;
- bool isEar = true;
- while (vP!=v1){
- if (ptInTriangle (vP->pos, v0->pos, v2->pos, v1->pos)){
- isEar = false;
- break;
- }
- vP = vP->next;
- }
- if (isEar){
- _add_triangle_indices (ctx, v0->idx, v1->idx, v2->idx);
- v1->next = v2;
- ecps_count --;
- tries = 0;
- }else{
- ecp_current = ecp_current->next;
- tries++;
- }
- }
- if (ecps_count == 3)
- _add_triangle_indices(ctx, ecp_current->next->idx, ecp_current->idx, ecp_current->next->next->idx);
-
- ptrPath+=2;
- }
- //_record_draw_cmd(ctx);
+ uint32_t ptrPath = 0;;
+ Vertex v = {{0},ctx->curColor,{0,0},-1};
+
+ while (ptrPath < ctx->pathPtr){
+ if (ctx->pathes[ptrPath+1]&PATH_IS_CURVE_BIT){
+ ptrPath += 2;
+ continue;
+ }
+ ctx->pathes[ptrPath]|=PATH_CLOSED_BIT;//close path
+
+ uint32_t firstPtIdx = ctx->pathes[ptrPath]&PATH_ELT_MASK;
+ uint32_t lastPtIdx = ctx->pathes[ptrPath+1]&PATH_ELT_MASK;
+ uint32_t pathPointCount = lastPtIdx - firstPtIdx + 1;
+ uint32_t firstVertIdx = ctx->vertCount-ctx->curVertOffset;
+
+ ear_clip_point ecps[pathPointCount];
+ uint32_t ecps_count = 0, i = 0;
+
+ //init points link list
+ while (i < pathPointCount-1){
+ vec2 np = ctx->points[i+firstPtIdx];
+ if (!vec2_equ(np, v.pos)){
+ v.pos = np;
+ ear_clip_point ecp = {v.pos, ecps_count+firstVertIdx, &ecps[ecps_count+1]};
+ ecps[ecps_count] = ecp;
+ _add_vertex(ctx, v);
+ ecps_count++;
+ }
+ i++;
+ }
+
+ v.pos = ctx->points[i+firstPtIdx];
+ ear_clip_point ecp = {v.pos, ecps_count+firstVertIdx, ecps};
+ ecps[ecps_count] = ecp;
+ _add_vertex(ctx, v);
+ ecps_count++;
+
+ ear_clip_point* ecp_current = ecps;
+ uint32_t tries = 0;
+
+ while (ecps_count > 3) {
+ if (tries > ecps_count) {
+ break;
+ }
+ ear_clip_point* v0 = ecp_current->next,
+ *v1 = ecp_current, *v2 = ecp_current->next->next;
+ if (ecp_zcross (v0, v2, v1)<0){
+ ecp_current = ecp_current->next;
+ tries++;
+ continue;
+ }
+ ear_clip_point* vP = v2->next;
+ bool isEar = true;
+ while (vP!=v1){
+ if (ptInTriangle (vP->pos, v0->pos, v2->pos, v1->pos)){
+ isEar = false;
+ break;
+ }
+ vP = vP->next;
+ }
+ if (isEar){
+ _add_triangle_indices (ctx, v0->idx, v1->idx, v2->idx);
+ v1->next = v2;
+ ecps_count --;
+ tries = 0;
+ }else{
+ ecp_current = ecp_current->next;
+ tries++;
+ }
+ }
+ if (ecps_count == 3)
+ _add_triangle_indices(ctx, ecp_current->next->idx, ecp_current->idx, ecp_current->next->next->idx);
+
+ ptrPath+=2;
+ }
+ //_record_draw_cmd(ctx);
}
static const uint32_t one = 1;
static const uint32_t zero = 0;
void _draw_full_screen_quad (VkvgContext ctx, bool useScissor) {
- if (ctx->xMin < 0 || ctx->yMin < 0)
- useScissor = false;
- if (useScissor && ctx->xMin < FLT_MAX) {
- VkRect2D r = {ctx->xMin, ctx->yMin, ctx->xMax - ctx->xMin, ctx->yMax - ctx->yMin};
- CmdSetScissor(ctx->cmd, 0, 1, &r);
- }
- CmdPushConstants(ctx->cmd, ctx->pSurf->dev->pipelineLayout,
- VK_SHADER_STAGE_VERTEX_BIT, 28, 4,&one);
- CmdDraw (ctx->cmd,3,1,0,0);
- CmdPushConstants(ctx->cmd, ctx->pSurf->dev->pipelineLayout,
- VK_SHADER_STAGE_VERTEX_BIT, 28, 4,&zero);
- if (useScissor && ctx->xMin < FLT_MAX)
- CmdSetScissor(ctx->cmd, 0, 1, &ctx->bounds);
+ /*if (ctx->xMin < 0 || ctx->yMin < 0)
+ useScissor = false;
+ if (useScissor && ctx->xMin < FLT_MAX) {
+ VkRect2D r = {ctx->xMin, ctx->yMin, ctx->xMax - ctx->xMin, ctx->yMax - ctx->yMin};
+ CmdSetScissor(ctx->cmd, 0, 1, &r);
+ }*/
+ CmdPushConstants(ctx->cmd, ctx->pSurf->dev->pipelineLayout,
+ VK_SHADER_STAGE_VERTEX_BIT, 28, 4,&one);
+ CmdDraw (ctx->cmd,3,1,0,0);
+ CmdPushConstants(ctx->cmd, ctx->pSurf->dev->pipelineLayout,
+ VK_SHADER_STAGE_VERTEX_BIT, 28, 4,&zero);
+ /*if (useScissor && ctx->xMin < FLT_MAX)
+ CmdSetScissor(ctx->cmd, 0, 1, &ctx->bounds);*/
}