blob: 48a44f0623e64170cef52f21b9c627d3ab4f3664 [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
Chia-I Wuaabb3602014-08-19 14:18:23 +080034/* Should we add intel_state back, as the base class for dynamic states? */
35
Tony Barbourde4124d2015-07-03 10:33:54 -060036struct intel_dynamic_viewport {
Chia-I Wua5714e82014-08-11 15:33:42 +080037 struct intel_obj obj;
38
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -060039 uint32_t viewport_count;
Chia-I Wua5714e82014-08-11 15:33:42 +080040 /* SF_CLIP_VIEWPORTs, CC_VIEWPORTs, and SCISSOR_RECTs */
41 uint32_t *cmd;
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -060042 uint32_t cmd_len;
43 uint32_t cmd_clip_pos;
44 uint32_t cmd_cc_pos;
45 uint32_t cmd_scissor_rect_pos;
Chia-I Wua5714e82014-08-11 15:33:42 +080046};
47
Tony Barbourde4124d2015-07-03 10:33:54 -060048struct intel_dynamic_raster {
Chia-I Wua5714e82014-08-11 15:33:42 +080049 struct intel_obj obj;
Tony Barbourde4124d2015-07-03 10:33:54 -060050 VkDynamicRasterStateCreateInfo raster_info;
Chia-I Wua5714e82014-08-11 15:33:42 +080051};
52
Tony Barbourde4124d2015-07-03 10:33:54 -060053struct intel_dynamic_color_blend {
Chia-I Wua5714e82014-08-11 15:33:42 +080054 struct intel_obj obj;
Tony Barbourde4124d2015-07-03 10:33:54 -060055 VkDynamicColorBlendStateCreateInfo color_blend_info;
Chia-I Wua5714e82014-08-11 15:33:42 +080056};
57
Tony Barbourde4124d2015-07-03 10:33:54 -060058struct intel_dynamic_depth_stencil {
Chia-I Wua5714e82014-08-11 15:33:42 +080059 struct intel_obj obj;
Tony Barbourde4124d2015-07-03 10:33:54 -060060 VkDynamicDepthStencilStateCreateInfo depth_stencil_info;
Chia-I Wua5714e82014-08-11 15:33:42 +080061};
62
Tony Barbourde4124d2015-07-03 10:33:54 -060063static inline struct intel_dynamic_viewport *intel_dynamic_viewport(VkDynamicViewportState state)
Chia-I Wua5714e82014-08-11 15:33:42 +080064{
Tony Barbourde4124d2015-07-03 10:33:54 -060065 return *(struct intel_dynamic_viewport **) &state;
Chia-I Wua5714e82014-08-11 15:33:42 +080066}
67
Tony Barbourde4124d2015-07-03 10:33:54 -060068static inline struct intel_dynamic_viewport *intel_viewport_state_from_obj(struct intel_obj *obj)
Chia-I Wua5714e82014-08-11 15:33:42 +080069{
Tony Barbourde4124d2015-07-03 10:33:54 -060070 return (struct intel_dynamic_viewport *) obj;
Chia-I Wua5714e82014-08-11 15:33:42 +080071}
72
Tony Barbourde4124d2015-07-03 10:33:54 -060073static inline struct intel_dynamic_raster *intel_dynamic_raster(VkDynamicRasterState state)
Chia-I Wua5714e82014-08-11 15:33:42 +080074{
Tony Barbourde4124d2015-07-03 10:33:54 -060075 return *(struct intel_dynamic_raster **) &state;
Chia-I Wua5714e82014-08-11 15:33:42 +080076}
77
Tony Barbourde4124d2015-07-03 10:33:54 -060078static inline struct intel_dynamic_raster *intel_raster_state_from_obj(struct intel_obj *obj)
Chia-I Wua5714e82014-08-11 15:33:42 +080079{
Tony Barbourde4124d2015-07-03 10:33:54 -060080 return (struct intel_dynamic_raster *) obj;
Chia-I Wua5714e82014-08-11 15:33:42 +080081}
82
Tony Barbourde4124d2015-07-03 10:33:54 -060083static inline struct intel_dynamic_color_blend *intel_dynamic_color_blend(VkDynamicColorBlendState state)
Chia-I Wua5714e82014-08-11 15:33:42 +080084{
Tony Barbourde4124d2015-07-03 10:33:54 -060085 return *(struct intel_dynamic_color_blend **) &state;
Chia-I Wua5714e82014-08-11 15:33:42 +080086}
87
Tony Barbourde4124d2015-07-03 10:33:54 -060088static inline struct intel_dynamic_color_blend *intel_blend_state_from_obj(struct intel_obj *obj)
Chia-I Wua5714e82014-08-11 15:33:42 +080089{
Tony Barbourde4124d2015-07-03 10:33:54 -060090 return (struct intel_dynamic_color_blend *) obj;
Chia-I Wua5714e82014-08-11 15:33:42 +080091}
92
Tony Barbourde4124d2015-07-03 10:33:54 -060093static inline struct intel_dynamic_depth_stencil *intel_dynamic_depth_stencil(VkDynamicDepthStencilState state)
Chia-I Wua5714e82014-08-11 15:33:42 +080094{
Tony Barbourde4124d2015-07-03 10:33:54 -060095 return *(struct intel_dynamic_depth_stencil **) &state;
Chia-I Wua5714e82014-08-11 15:33:42 +080096}
97
Tony Barbourde4124d2015-07-03 10:33:54 -060098static inline struct intel_dynamic_depth_stencil *intel_depth_stencil_state_from_obj(struct intel_obj *obj)
Chia-I Wua5714e82014-08-11 15:33:42 +080099{
Tony Barbourde4124d2015-07-03 10:33:54 -0600100 return (struct intel_dynamic_depth_stencil *) obj;
Chia-I Wua5714e82014-08-11 15:33:42 +0800101}
102
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600103VkResult intel_viewport_state_create(struct intel_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600104 const VkDynamicViewportStateCreateInfo *info,
105 struct intel_dynamic_viewport **state_ret);
106void intel_viewport_state_destroy(struct intel_dynamic_viewport *state);
Chia-I Wua5714e82014-08-11 15:33:42 +0800107
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600108VkResult intel_raster_state_create(struct intel_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600109 const VkDynamicRasterStateCreateInfo *info,
110 struct intel_dynamic_raster **state_ret);
111void intel_raster_state_destroy(struct intel_dynamic_raster *state);
Chia-I Wua5714e82014-08-11 15:33:42 +0800112
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600113VkResult intel_blend_state_create(struct intel_dev *dev,
Tony Barbourde4124d2015-07-03 10:33:54 -0600114 const VkDynamicColorBlendStateCreateInfo *info,
115 struct intel_dynamic_color_blend **state_ret);
116void intel_blend_state_destroy(struct intel_dynamic_color_blend *state);
Chia-I Wua5714e82014-08-11 15:33:42 +0800117
Tony Barbourde4124d2015-07-03 10:33:54 -0600118VkResult intel_depth_stencil_state_create(struct intel_dev *dev,
119 const VkDynamicDepthStencilStateCreateInfo *info,
120 struct intel_dynamic_depth_stencil **state_ret);
121void intel_depth_stencil_state_destroy(struct intel_dynamic_depth_stencil *state);
Chia-I Wua5714e82014-08-11 15:33:42 +0800122
Chia-I Wua5714e82014-08-11 15:33:42 +0800123#endif /* STATE_H */