blob: 2d4725db7baed9183851548ef04d97369d1cba60 [file] [log] [blame]
Chia-I Wua5714e82014-08-11 15:33:42 +08001/*
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -06002 * Vulkan
Chia-I Wua5714e82014-08-11 15:33:42 +08003 *
4 * Copyright (C) 2014 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
Chia-I Wu44e42362014-09-02 08:32:09 +080023 *
24 * Authors:
25 * Chia-I Wu <olv@lunarg.com>
Chia-I Wua5714e82014-08-11 15:33:42 +080026 */
27
28#ifndef STATE_H
29#define STATE_H
30
31#include "intel.h"
32#include "obj.h"
33
Tony Barbourde4124d2015-07-03 10:33:54 -060034struct intel_dynamic_viewport {
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -060035 uint32_t viewport_count;
Chris Forbesaf56e162015-10-07 12:24:34 +130036 uint32_t scissor_count;
Courtney Goeltzenleuchter932cdb52015-09-21 11:44:06 -060037 VkViewport viewports[INTEL_MAX_VIEWPORTS];
38 VkRect2D scissors[INTEL_MAX_VIEWPORTS];
Chia-I Wua5714e82014-08-11 15:33:42 +080039 /* SF_CLIP_VIEWPORTs, CC_VIEWPORTs, and SCISSOR_RECTs */
Courtney Goeltzenleuchter09772bb2015-09-17 15:06:17 -060040 uint32_t cmd[INTEL_MAX_VIEWPORTS * (16 /* viewport */ + 2 /* cc */ + 2 /* scissor */)];
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -060041 uint32_t cmd_len;
42 uint32_t cmd_clip_pos;
43 uint32_t cmd_cc_pos;
44 uint32_t cmd_scissor_rect_pos;
Chia-I Wua5714e82014-08-11 15:33:42 +080045};
46
Cody Northrope4bc6942015-08-26 10:01:32 -060047struct intel_dynamic_line_width {
Courtney Goeltzenleuchter09772bb2015-09-17 15:06:17 -060048 float line_width;
Cody Northropf5bd2252015-08-17 11:10:49 -060049};
50
Cody Northrope4bc6942015-08-26 10:01:32 -060051struct intel_dynamic_depth_bias {
Courtney Goeltzenleuchter09772bb2015-09-17 15:06:17 -060052 float depth_bias;
53 float depth_bias_clamp;
54 float slope_scaled_depth_bias;
Chia-I Wua5714e82014-08-11 15:33:42 +080055};
56
Cody Northrope4bc6942015-08-26 10:01:32 -060057struct intel_dynamic_blend {
Courtney Goeltzenleuchter09772bb2015-09-17 15:06:17 -060058 float blend_const[4];
Chia-I Wua5714e82014-08-11 15:33:42 +080059};
60
Cody Northrope4bc6942015-08-26 10:01:32 -060061struct intel_dynamic_depth_bounds {
Courtney Goeltzenleuchter09772bb2015-09-17 15:06:17 -060062 float min_depth_bounds;
63 float max_depth_bounds;
64};
65
66struct intel_dynamic_stencil_face {
67 uint32_t stencil_compare_mask;
68 uint32_t stencil_write_mask;
69 uint32_t stencil_reference;
Cody Northrop2605cb02015-08-18 15:21:16 -060070};
71
72struct intel_dynamic_stencil {
Courtney Goeltzenleuchter09772bb2015-09-17 15:06:17 -060073 struct intel_dynamic_stencil_face front;
Cody Northrop2605cb02015-08-18 15:21:16 -060074 /* TODO: enable back facing stencil state */
Courtney Goeltzenleuchter09772bb2015-09-17 15:06:17 -060075 struct intel_dynamic_stencil_face back;
Chia-I Wua5714e82014-08-11 15:33:42 +080076};
Courtney Goeltzenleuchtere20aaa22015-09-21 17:19:25 -060077
78struct intel_cmd;
79void intel_set_viewport(struct intel_cmd *cmd, uint32_t count, const VkViewport *viewports);
80void intel_set_scissor(struct intel_cmd *cmd, uint32_t count, const VkRect2D *scissors);
81void intel_set_line_width(struct intel_cmd *cmd, float line_width);
82void intel_set_depth_bias(
83 struct intel_cmd *cmd,
84 float depthBias,
85 float depthBiasClamp,
86 float slopeScaledDepthBias);
87void intel_set_blend_constants(
88 struct intel_cmd *cmd,
89 const float blendConst[4]);
90void intel_set_depth_bounds(
91 struct intel_cmd *cmd,
92 float minDepthBounds,
93 float maxDepthBounds);
94void intel_set_stencil_compare_mask(
95 struct intel_cmd *cmd,
96 VkStencilFaceFlags faceMask,
97 uint32_t stencilCompareMask);
98void intel_set_stencil_write_mask(
99 struct intel_cmd *cmd,
100 VkStencilFaceFlags faceMask,
101 uint32_t stencilWriteMask);
102void intel_set_stencil_reference(
103 struct intel_cmd *cmd,
104 VkStencilFaceFlags faceMask,
105 uint32_t stencilReference);
106
Chia-I Wua5714e82014-08-11 15:33:42 +0800107#endif /* STATE_H */