2 * Copyright 2018 Collabora Ltd.
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:
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
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.
27 #include <vulkan/vulkan.h>
29 #include "pipe/p_state.h"
31 struct zink_vertex_elements_hw_state
{
32 VkVertexInputAttributeDescription attribs
[PIPE_MAX_ATTRIBS
];
33 uint32_t num_bindings
, num_attribs
;
36 struct zink_vertex_elements_state
{
39 VkVertexInputRate inputRate
;
40 } bindings
[PIPE_MAX_ATTRIBS
];
41 uint8_t binding_map
[PIPE_MAX_ATTRIBS
];
42 struct zink_vertex_elements_hw_state hw_state
;
45 struct zink_rasterizer_hw_state
{
47 VkBool32 rasterizer_discard
;
48 VkFrontFace front_face
;
49 VkPolygonMode polygon_mode
;
50 VkCullModeFlags cull_mode
;
53 struct zink_rasterizer_state
{
54 struct pipe_rasterizer_state base
;
55 bool offset_point
, offset_line
, offset_tri
;
56 float offset_units
, offset_clamp
, offset_scale
;
58 struct zink_rasterizer_hw_state hw_state
;
61 struct zink_blend_state
{
62 VkPipelineColorBlendAttachmentState attachments
[PIPE_MAX_COLOR_BUFS
];
64 VkBool32 logicop_enable
;
65 VkLogicOp logicop_func
;
67 VkBool32 alpha_to_coverage
;
68 VkBool32 alpha_to_one
;
70 bool need_blend_constants
;
73 struct zink_depth_stencil_alpha_state
{
75 VkCompareOp depth_compare_op
;
77 VkBool32 depth_bounds_test
;
78 float min_depth_bounds
, max_depth_bounds
;
80 VkBool32 stencil_test
;
81 VkStencilOpState stencil_front
;
82 VkStencilOpState stencil_back
;
88 zink_context_state_init(struct pipe_context
*pctx
);