blob: f14d2518e2ea7f76f189a4c2682ca54641693b94 [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 Barbourfa6cac72015-01-16 14:27:35 -070036struct intel_dynamic_vp {
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 Barbourfa6cac72015-01-16 14:27:35 -070048struct intel_dynamic_rs {
Chia-I Wua5714e82014-08-11 15:33:42 +080049 struct intel_obj obj;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060050 VK_DYNAMIC_RS_STATE_CREATE_INFO rs_info;
Chia-I Wua5714e82014-08-11 15:33:42 +080051};
52
Tony Barbourfa6cac72015-01-16 14:27:35 -070053struct intel_dynamic_cb {
Chia-I Wua5714e82014-08-11 15:33:42 +080054 struct intel_obj obj;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060055 VK_DYNAMIC_CB_STATE_CREATE_INFO cb_info;
Chia-I Wua5714e82014-08-11 15:33:42 +080056};
57
Tony Barbourfa6cac72015-01-16 14:27:35 -070058struct intel_dynamic_ds {
Chia-I Wua5714e82014-08-11 15:33:42 +080059 struct intel_obj obj;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060060 VK_DYNAMIC_DS_STATE_CREATE_INFO ds_info;
Chia-I Wua5714e82014-08-11 15:33:42 +080061};
62
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060063static inline struct intel_dynamic_vp *intel_dynamic_vp(VK_DYNAMIC_VP_STATE_OBJECT state)
Chia-I Wua5714e82014-08-11 15:33:42 +080064{
Tony Barbourfa6cac72015-01-16 14:27:35 -070065 return (struct intel_dynamic_vp *) state;
Chia-I Wua5714e82014-08-11 15:33:42 +080066}
67
Tony Barbourfa6cac72015-01-16 14:27:35 -070068static inline struct intel_dynamic_vp *intel_viewport_state_from_obj(struct intel_obj *obj)
Chia-I Wua5714e82014-08-11 15:33:42 +080069{
Tony Barbourfa6cac72015-01-16 14:27:35 -070070 return (struct intel_dynamic_vp *) obj;
Chia-I Wua5714e82014-08-11 15:33:42 +080071}
72
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060073static inline struct intel_dynamic_rs *intel_dynamic_rs(VK_DYNAMIC_RS_STATE_OBJECT state)
Chia-I Wua5714e82014-08-11 15:33:42 +080074{
Tony Barbourfa6cac72015-01-16 14:27:35 -070075 return (struct intel_dynamic_rs *) state;
Chia-I Wua5714e82014-08-11 15:33:42 +080076}
77
Tony Barbourfa6cac72015-01-16 14:27:35 -070078static inline struct intel_dynamic_rs *intel_raster_state_from_obj(struct intel_obj *obj)
Chia-I Wua5714e82014-08-11 15:33:42 +080079{
Tony Barbourfa6cac72015-01-16 14:27:35 -070080 return (struct intel_dynamic_rs *) obj;
Chia-I Wua5714e82014-08-11 15:33:42 +080081}
82
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060083static inline struct intel_dynamic_cb *intel_dynamic_cb(VK_DYNAMIC_CB_STATE_OBJECT state)
Chia-I Wua5714e82014-08-11 15:33:42 +080084{
Tony Barbourfa6cac72015-01-16 14:27:35 -070085 return (struct intel_dynamic_cb *) state;
Chia-I Wua5714e82014-08-11 15:33:42 +080086}
87
Tony Barbourfa6cac72015-01-16 14:27:35 -070088static inline struct intel_dynamic_cb *intel_blend_state_from_obj(struct intel_obj *obj)
Chia-I Wua5714e82014-08-11 15:33:42 +080089{
Tony Barbourfa6cac72015-01-16 14:27:35 -070090 return (struct intel_dynamic_cb *) obj;
Chia-I Wua5714e82014-08-11 15:33:42 +080091}
92
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060093static inline struct intel_dynamic_ds *intel_dynamic_ds(VK_DYNAMIC_DS_STATE_OBJECT state)
Chia-I Wua5714e82014-08-11 15:33:42 +080094{
Tony Barbourfa6cac72015-01-16 14:27:35 -070095 return (struct intel_dynamic_ds *) state;
Chia-I Wua5714e82014-08-11 15:33:42 +080096}
97
Tony Barbourfa6cac72015-01-16 14:27:35 -070098static inline struct intel_dynamic_ds *intel_ds_state_from_obj(struct intel_obj *obj)
Chia-I Wua5714e82014-08-11 15:33:42 +080099{
Tony Barbourfa6cac72015-01-16 14:27:35 -0700100 return (struct intel_dynamic_ds *) obj;
Chia-I Wua5714e82014-08-11 15:33:42 +0800101}
102
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600103VK_RESULT intel_viewport_state_create(struct intel_dev *dev,
104 const VK_DYNAMIC_VP_STATE_CREATE_INFO *info,
Tony Barbourfa6cac72015-01-16 14:27:35 -0700105 struct intel_dynamic_vp **state_ret);
106void intel_viewport_state_destroy(struct intel_dynamic_vp *state);
Chia-I Wua5714e82014-08-11 15:33:42 +0800107
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600108VK_RESULT intel_raster_state_create(struct intel_dev *dev,
109 const VK_DYNAMIC_RS_STATE_CREATE_INFO *info,
Tony Barbourfa6cac72015-01-16 14:27:35 -0700110 struct intel_dynamic_rs **state_ret);
111void intel_raster_state_destroy(struct intel_dynamic_rs *state);
Chia-I Wua5714e82014-08-11 15:33:42 +0800112
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600113VK_RESULT intel_blend_state_create(struct intel_dev *dev,
114 const VK_DYNAMIC_CB_STATE_CREATE_INFO *info,
Tony Barbourfa6cac72015-01-16 14:27:35 -0700115 struct intel_dynamic_cb **state_ret);
116void intel_blend_state_destroy(struct intel_dynamic_cb *state);
Chia-I Wua5714e82014-08-11 15:33:42 +0800117
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600118VK_RESULT intel_ds_state_create(struct intel_dev *dev,
119 const VK_DYNAMIC_DS_STATE_CREATE_INFO *info,
Tony Barbourfa6cac72015-01-16 14:27:35 -0700120 struct intel_dynamic_ds **state_ret);
121void intel_ds_state_destroy(struct intel_dynamic_ds *state);
Chia-I Wua5714e82014-08-11 15:33:42 +0800122
Chia-I Wua5714e82014-08-11 15:33:42 +0800123#endif /* STATE_H */