• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    uint32_t num_bindings, num_attribs;
34 };
35 
36 struct zink_vertex_elements_state {
37    struct {
38       uint32_t binding;
39       VkVertexInputRate inputRate;
40    } bindings[PIPE_MAX_ATTRIBS];
41    uint32_t divisor[PIPE_MAX_ATTRIBS];
42    uint8_t binding_map[PIPE_MAX_ATTRIBS];
43    struct zink_vertex_elements_hw_state hw_state;
44 };
45 
46 struct zink_rasterizer_hw_state {
47    VkBool32 depth_clamp;
48    VkBool32 rasterizer_discard;
49    VkFrontFace front_face;
50    VkPolygonMode polygon_mode;
51    VkCullModeFlags cull_mode;
52 };
53 
54 struct zink_rasterizer_state {
55    struct pipe_rasterizer_state base;
56    bool offset_point, offset_line, offset_tri;
57    float offset_units, offset_clamp, offset_scale;
58    float line_width;
59    struct zink_rasterizer_hw_state hw_state;
60 };
61 
62 struct zink_blend_state {
63    VkPipelineColorBlendAttachmentState attachments[PIPE_MAX_COLOR_BUFS];
64 
65    VkBool32 logicop_enable;
66    VkLogicOp logicop_func;
67 
68    VkBool32 alpha_to_coverage;
69    VkBool32 alpha_to_one;
70 
71    bool need_blend_constants;
72 };
73 
74 struct zink_depth_stencil_alpha_hw_state {
75    VkBool32 depth_test;
76    VkCompareOp depth_compare_op;
77 
78    VkBool32 depth_bounds_test;
79    float min_depth_bounds, max_depth_bounds;
80 
81    VkBool32 stencil_test;
82    VkStencilOpState stencil_front;
83    VkStencilOpState stencil_back;
84 
85    VkBool32 depth_write;
86 };
87 
88 struct zink_depth_stencil_alpha_state {
89    struct pipe_depth_stencil_alpha_state base;
90    struct zink_depth_stencil_alpha_hw_state hw_state;
91 };
92 
93 void
94 zink_context_state_init(struct pipe_context *pctx);
95 
96 #endif
97