summaryrefslogtreecommitdiffstatsci
path: root/src/vkvg_pattern.h
blob: d686b580efb2c6b763c8458983976006104e58b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) 2018-2026 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
#ifndef VKVG_PATTERN_H
#define VKVG_PATTERN_H

#include "vkvg_internal.h"

typedef struct _vkvg_pattern_t {
    vkvg_status_t       status;
    atomic_int          references;
    vkvg_pattern_type_t type;
    vkvg_extend_t       extend;
    vkvg_filter_t       filter;
    vkvg_matrix_t       matrix;
    bool                hasMatrix;

} vkvg_pattern_t;

typedef struct _surface_pattern_t {
    vkvg_pattern_t      base;
    VkvgSurface         surf;
    VkDescriptorPool    descPool;
    VkDescriptorSet     dsSource;
    VkSampler           sampler;
    bool                samplerIsDirty;
} surface_pattern_t;

typedef struct _vkvg_gradient_t {
    vkvg_color_t colors[16];
#ifdef VKVG_ENABLE_VK_SCALAR_BLOCK_LAYOUT
    float stops[16];
#else
    vec4 stops[16];
#endif
    vec4     cp[2];
    uint32_t count;
} vkvg_gradient_t;

typedef struct _vkvg_gradient_pattern_t {
    vkvg_pattern_t      base;
    uint32_t            offset; //descriptor offset for dyn uniform
    vkvg_gradient_t     gradient;
} vkvg_gradient_pattern_t;

void _surface_pattern_update_sampler (surface_pattern_t* pat);
#endif