Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/gallium/drivers/zink/zink_state.h
4570 views
1
/*
2
* Copyright 2018 Collabora Ltd.
3
*
4
* Permission is hereby granted, free of charge, to any person obtaining a
5
* copy of this software and associated documentation files (the "Software"),
6
* to deal in the Software without restriction, including without limitation
7
* on the rights to use, copy, modify, merge, publish, distribute, sub
8
* license, and/or sell copies of the Software, and to permit persons to whom
9
* the Software is furnished to do so, subject to the following conditions:
10
*
11
* The above copyright notice and this permission notice (including the next
12
* paragraph) shall be included in all copies or substantial portions of the
13
* Software.
14
*
15
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18
* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21
* USE OR OTHER DEALINGS IN THE SOFTWARE.
22
*/
23
24
#ifndef ZINK_STATE_H
25
#define ZINK_STATE_H
26
27
#include <vulkan/vulkan.h>
28
29
#include "pipe/p_state.h"
30
31
struct zink_vertex_elements_hw_state {
32
VkVertexInputAttributeDescription attribs[PIPE_MAX_ATTRIBS];
33
VkVertexInputBindingDivisorDescriptionEXT divisors[PIPE_MAX_ATTRIBS];
34
VkVertexInputBindingDescription bindings[PIPE_MAX_ATTRIBS]; // combination of element_state and stride
35
uint32_t num_bindings, num_attribs;
36
uint8_t divisors_present;
37
};
38
39
struct zink_vertex_elements_state {
40
struct {
41
uint32_t binding;
42
VkVertexInputRate inputRate;
43
} bindings[PIPE_MAX_ATTRIBS];
44
uint32_t divisor[PIPE_MAX_ATTRIBS];
45
uint8_t binding_map[PIPE_MAX_ATTRIBS];
46
struct zink_vertex_elements_hw_state hw_state;
47
};
48
49
struct zink_rasterizer_hw_state {
50
VkPolygonMode polygon_mode;
51
VkCullModeFlags cull_mode;
52
VkProvokingVertexModeEXT pv_mode;
53
VkLineRasterizationModeEXT line_mode;
54
unsigned depth_clamp : 1;
55
unsigned rasterizer_discard : 1;
56
unsigned force_persample_interp : 1;
57
unsigned line_stipple_factor : 8;
58
unsigned line_stipple_pattern : 16;
59
};
60
61
struct zink_rasterizer_state {
62
struct pipe_rasterizer_state base;
63
bool offset_point, offset_line, offset_tri;
64
float offset_units, offset_clamp, offset_scale;
65
float line_width;
66
VkFrontFace front_face;
67
struct zink_rasterizer_hw_state hw_state;
68
};
69
70
struct zink_blend_state {
71
VkPipelineColorBlendAttachmentState attachments[PIPE_MAX_COLOR_BUFS];
72
73
VkBool32 logicop_enable;
74
VkLogicOp logicop_func;
75
76
VkBool32 alpha_to_coverage;
77
VkBool32 alpha_to_one;
78
79
bool need_blend_constants;
80
bool dual_src_blend;
81
};
82
83
struct zink_depth_stencil_alpha_hw_state {
84
VkBool32 depth_test;
85
VkCompareOp depth_compare_op;
86
87
VkBool32 depth_bounds_test;
88
float min_depth_bounds, max_depth_bounds;
89
90
VkBool32 stencil_test;
91
VkStencilOpState stencil_front;
92
VkStencilOpState stencil_back;
93
94
VkBool32 depth_write;
95
};
96
97
struct zink_depth_stencil_alpha_state {
98
struct pipe_depth_stencil_alpha_state base;
99
struct zink_depth_stencil_alpha_hw_state hw_state;
100
};
101
102
void
103
zink_context_state_init(struct pipe_context *pctx);
104
105
#endif
106
107