blob: e739ada55f6823036bd69db27f21326271167bb4 [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
Chia-I Wu97702a62014-08-11 15:33:42 +080028#include <math.h>
29#include "genhw/genhw.h"
Chia-I Wua5714e82014-08-11 15:33:42 +080030#include "dev.h"
31#include "state.h"
32
Chia-I Wu97702a62014-08-11 15:33:42 +080033static void
34viewport_get_guardband(const struct intel_gpu *gpu,
35 int center_x, int center_y,
36 int *min_gbx, int *max_gbx,
37 int *min_gby, int *max_gby)
38{
39 /*
40 * From the Sandy Bridge PRM, volume 2 part 1, page 234:
41 *
42 * "Per-Device Guardband Extents
43 *
44 * - Supported X,Y ScreenSpace "Guardband" Extent: [-16K,16K-1]
45 * - Maximum Post-Clamp Delta (X or Y): 16K"
46 *
47 * "In addition, in order to be correctly rendered, objects must have a
48 * screenspace bounding box not exceeding 8K in the X or Y direction.
49 * This additional restriction must also be comprehended by software,
50 * i.e., enforced by use of clipping."
51 *
52 * From the Ivy Bridge PRM, volume 2 part 1, page 248:
53 *
54 * "Per-Device Guardband Extents
55 *
56 * - Supported X,Y ScreenSpace "Guardband" Extent: [-32K,32K-1]
57 * - Maximum Post-Clamp Delta (X or Y): N/A"
58 *
59 * "In addition, in order to be correctly rendered, objects must have a
60 * screenspace bounding box not exceeding 8K in the X or Y direction.
61 * This additional restriction must also be comprehended by software,
62 * i.e., enforced by use of clipping."
63 *
64 * Combined, the bounding box of any object can not exceed 8K in both
65 * width and height.
66 *
67 * Below we set the guardband as a squre of length 8K, centered at where
68 * the viewport is. This makes sure all objects passing the GB test are
69 * valid to the renderer, and those failing the XY clipping have a
70 * better chance of passing the GB test.
71 */
72 const int max_extent = (intel_gpu_gen(gpu) >= INTEL_GEN(7)) ? 32768 : 16384;
73 const int half_len = 8192 / 2;
74
75 /* make sure the guardband is within the valid range */
76 if (center_x - half_len < -max_extent)
77 center_x = -max_extent + half_len;
78 else if (center_x + half_len > max_extent - 1)
79 center_x = max_extent - half_len;
80
81 if (center_y - half_len < -max_extent)
82 center_y = -max_extent + half_len;
83 else if (center_y + half_len > max_extent - 1)
84 center_y = max_extent - half_len;
85
86 *min_gbx = (float) (center_x - half_len);
87 *max_gbx = (float) (center_x + half_len);
88 *min_gby = (float) (center_y - half_len);
89 *max_gby = (float) (center_y + half_len);
90}
91
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060092static VkResult
Tony Barbourfa6cac72015-01-16 14:27:35 -070093viewport_state_alloc_cmd(struct intel_dynamic_vp *state,
Chia-I Wu7b566a42014-08-22 10:58:57 +080094 const struct intel_gpu *gpu,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060095 const VkDynamicVpStateCreateInfo *info)
Chia-I Wu7b566a42014-08-22 10:58:57 +080096{
97 INTEL_GPU_ASSERT(gpu, 6, 7.5);
98
Courtney Goeltzenleuchterc6e32f92015-02-11 14:13:34 -070099 state->viewport_count = info->viewportAndScissorCount;
Tony Barbourfa6cac72015-01-16 14:27:35 -0700100
Chris Forbes948bf602015-05-08 11:01:16 +1200101 assert(info->viewportAndScissorCount <= INTEL_MAX_VIEWPORTS);
Chia-I Wu7b566a42014-08-22 10:58:57 +0800102
103 if (intel_gpu_gen(gpu) >= INTEL_GEN(7)) {
Courtney Goeltzenleuchterc6e32f92015-02-11 14:13:34 -0700104 state->cmd_len = 16 * info->viewportAndScissorCount;
Chia-I Wu7b566a42014-08-22 10:58:57 +0800105
Chia-I Wub1d450a2014-09-09 13:48:03 +0800106 state->cmd_clip_pos = 8;
Chia-I Wu7b566a42014-08-22 10:58:57 +0800107 } else {
Courtney Goeltzenleuchterc6e32f92015-02-11 14:13:34 -0700108 state->cmd_len = 8 * info->viewportAndScissorCount;
Chia-I Wu7b566a42014-08-22 10:58:57 +0800109
Chia-I Wub1d450a2014-09-09 13:48:03 +0800110 state->cmd_clip_pos = state->cmd_len;
Courtney Goeltzenleuchterc6e32f92015-02-11 14:13:34 -0700111 state->cmd_len += 4 * info->viewportAndScissorCount;
Chia-I Wu7b566a42014-08-22 10:58:57 +0800112 }
113
Chia-I Wub1d450a2014-09-09 13:48:03 +0800114 state->cmd_cc_pos = state->cmd_len;
Courtney Goeltzenleuchterc6e32f92015-02-11 14:13:34 -0700115 state->cmd_len += 2 * info->viewportAndScissorCount;
Chia-I Wu7b566a42014-08-22 10:58:57 +0800116
Courtney Goeltzenleuchterc6e32f92015-02-11 14:13:34 -0700117 state->cmd_scissor_rect_pos = state->cmd_len;
118 state->cmd_len += 2 * info->viewportAndScissorCount;
Chia-I Wu7b566a42014-08-22 10:58:57 +0800119
Chia-I Wuf9c81ef2015-02-22 13:49:15 +0800120 state->cmd = intel_alloc(state, sizeof(uint32_t) * state->cmd_len,
Tony Barbour8205d902015-04-16 15:59:00 -0600121 0, VK_SYSTEM_ALLOC_TYPE_INTERNAL);
Chia-I Wu7b566a42014-08-22 10:58:57 +0800122 if (!state->cmd)
Tony Barbour8205d902015-04-16 15:59:00 -0600123 return VK_ERROR_OUT_OF_HOST_MEMORY;
Chia-I Wu7b566a42014-08-22 10:58:57 +0800124
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600125 return VK_SUCCESS;
Chia-I Wu7b566a42014-08-22 10:58:57 +0800126}
127
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600128static VkResult
Tony Barbourfa6cac72015-01-16 14:27:35 -0700129viewport_state_init(struct intel_dynamic_vp *state,
Chia-I Wu97702a62014-08-11 15:33:42 +0800130 const struct intel_gpu *gpu,
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600131 const VkDynamicVpStateCreateInfo *info)
Chia-I Wu97702a62014-08-11 15:33:42 +0800132{
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600133 const uint32_t sf_stride = (intel_gpu_gen(gpu) >= INTEL_GEN(7)) ? 16 : 8;
134 const uint32_t clip_stride = (intel_gpu_gen(gpu) >= INTEL_GEN(7)) ? 16 : 4;
Chia-I Wu97702a62014-08-11 15:33:42 +0800135 uint32_t *sf_viewport, *clip_viewport, *cc_viewport, *scissor_rect;
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600136 uint32_t i;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600137 VkResult ret;
Chia-I Wu97702a62014-08-11 15:33:42 +0800138
139 INTEL_GPU_ASSERT(gpu, 6, 7.5);
140
Chia-I Wu7b566a42014-08-22 10:58:57 +0800141 ret = viewport_state_alloc_cmd(state, gpu, info);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600142 if (ret != VK_SUCCESS)
Chia-I Wu7b566a42014-08-22 10:58:57 +0800143 return ret;
Chia-I Wu97702a62014-08-11 15:33:42 +0800144
145 sf_viewport = state->cmd;
Chia-I Wub1d450a2014-09-09 13:48:03 +0800146 clip_viewport = state->cmd + state->cmd_clip_pos;
147 cc_viewport = state->cmd + state->cmd_cc_pos;
148 scissor_rect = state->cmd + state->cmd_scissor_rect_pos;
Chia-I Wu97702a62014-08-11 15:33:42 +0800149
Courtney Goeltzenleuchterc6e32f92015-02-11 14:13:34 -0700150 for (i = 0; i < info->viewportAndScissorCount; i++) {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600151 const VkViewport *viewport = &info->pViewports[i];
Chia-I Wu97702a62014-08-11 15:33:42 +0800152 uint32_t *dw = NULL;
153 float translate[3], scale[3];
154 int min_gbx, max_gbx, min_gby, max_gby;
155
156 scale[0] = viewport->width / 2.0f;
157 scale[1] = viewport->height / 2.0f;
Chia-I Wue2504cb2015-04-22 14:20:52 +0800158 scale[2] = viewport->maxDepth - viewport->minDepth;
Chia-I Wu97702a62014-08-11 15:33:42 +0800159 translate[0] = viewport->originX + scale[0];
160 translate[1] = viewport->originY + scale[1];
Chia-I Wue2504cb2015-04-22 14:20:52 +0800161 translate[2] = viewport->minDepth;
Chia-I Wu97702a62014-08-11 15:33:42 +0800162
163 viewport_get_guardband(gpu, (int) translate[0], (int) translate[1],
164 &min_gbx, &max_gbx, &min_gby, &max_gby);
165
166 /* SF_VIEWPORT */
167 dw = sf_viewport;
168 dw[0] = u_fui(scale[0]);
169 dw[1] = u_fui(scale[1]);
170 dw[2] = u_fui(scale[2]);
171 dw[3] = u_fui(translate[0]);
172 dw[4] = u_fui(translate[1]);
173 dw[5] = u_fui(translate[2]);
174 dw[6] = 0;
175 dw[7] = 0;
176 sf_viewport += sf_stride;
177
178 /* CLIP_VIEWPORT */
179 dw = clip_viewport;
Chia-I Wu3a702202014-08-30 18:23:55 +0800180 dw[0] = u_fui(((float) min_gbx - translate[0]) / fabsf(scale[0]));
181 dw[1] = u_fui(((float) max_gbx - translate[0]) / fabsf(scale[0]));
182 dw[2] = u_fui(((float) min_gby - translate[1]) / fabsf(scale[1]));
183 dw[3] = u_fui(((float) max_gby - translate[1]) / fabsf(scale[1]));
Chia-I Wu97702a62014-08-11 15:33:42 +0800184 clip_viewport += clip_stride;
185
186 /* CC_VIEWPORT */
187 dw = cc_viewport;
188 dw[0] = u_fui(viewport->minDepth);
189 dw[1] = u_fui(viewport->maxDepth);
190 cc_viewport += 2;
Tony Barbourfa6cac72015-01-16 14:27:35 -0700191 }
Chia-I Wu97702a62014-08-11 15:33:42 +0800192
Courtney Goeltzenleuchterc6e32f92015-02-11 14:13:34 -0700193 for (i = 0; i < info->viewportAndScissorCount; i++) {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600194 const VkRect *scissor = &info->pScissors[i];
Chia-I Wu97702a62014-08-11 15:33:42 +0800195 /* SCISSOR_RECT */
Tony Barbourfa6cac72015-01-16 14:27:35 -0700196 int16_t max_x, max_y;
197 uint32_t *dw = NULL;
Chia-I Wu7b566a42014-08-22 10:58:57 +0800198
Tony Barbourfa6cac72015-01-16 14:27:35 -0700199 max_x = (scissor->offset.x + scissor->extent.width - 1) & 0xffff;
200 max_y = (scissor->offset.y + scissor->extent.height - 1) & 0xffff;
Chia-I Wu7b566a42014-08-22 10:58:57 +0800201
Tony Barbourfa6cac72015-01-16 14:27:35 -0700202 dw = scissor_rect;
203 if (scissor->extent.width && scissor->extent.height) {
204 dw[0] = (scissor->offset.y & 0xffff) << 16 |
205 (scissor->offset.x & 0xffff);
206 dw[1] = max_y << 16 | max_x;
207 } else {
208 dw[0] = 1 << 16 | 1;
209 dw[1] = 0;
Chia-I Wu97702a62014-08-11 15:33:42 +0800210 }
Tony Barbourfa6cac72015-01-16 14:27:35 -0700211 scissor_rect += 2;
Chia-I Wu97702a62014-08-11 15:33:42 +0800212 }
213
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600214 return VK_SUCCESS;
Chia-I Wu97702a62014-08-11 15:33:42 +0800215}
216
Chia-I Wua5714e82014-08-11 15:33:42 +0800217static void viewport_state_destroy(struct intel_obj *obj)
218{
Tony Barbourfa6cac72015-01-16 14:27:35 -0700219 struct intel_dynamic_vp *state = intel_viewport_state_from_obj(obj);
Chia-I Wua5714e82014-08-11 15:33:42 +0800220
221 intel_viewport_state_destroy(state);
222}
223
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600224VkResult intel_viewport_state_create(struct intel_dev *dev,
225 const VkDynamicVpStateCreateInfo *info,
Tony Barbourfa6cac72015-01-16 14:27:35 -0700226 struct intel_dynamic_vp **state_ret)
Chia-I Wua5714e82014-08-11 15:33:42 +0800227{
Tony Barbourfa6cac72015-01-16 14:27:35 -0700228 struct intel_dynamic_vp *state;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600229 VkResult ret;
Chia-I Wua5714e82014-08-11 15:33:42 +0800230
Chia-I Wu545c2e12015-02-22 13:19:54 +0800231 state = (struct intel_dynamic_vp *) intel_base_create(&dev->base.handle,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600232 sizeof(*state), dev->base.dbg, VK_OBJECT_TYPE_DYNAMIC_VP_STATE,
Chia-I Wua5714e82014-08-11 15:33:42 +0800233 info, 0);
234 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600235 return VK_ERROR_OUT_OF_HOST_MEMORY;
Chia-I Wua5714e82014-08-11 15:33:42 +0800236
237 state->obj.destroy = viewport_state_destroy;
238
Chia-I Wu97702a62014-08-11 15:33:42 +0800239 ret = viewport_state_init(state, dev->gpu, info);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600240 if (ret != VK_SUCCESS) {
Chia-I Wu97702a62014-08-11 15:33:42 +0800241 intel_viewport_state_destroy(state);
242 return ret;
243 }
Chia-I Wua5714e82014-08-11 15:33:42 +0800244
245 *state_ret = state;
246
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600247 return VK_SUCCESS;
Chia-I Wua5714e82014-08-11 15:33:42 +0800248}
249
Tony Barbourfa6cac72015-01-16 14:27:35 -0700250void intel_viewport_state_destroy(struct intel_dynamic_vp *state)
Chia-I Wua5714e82014-08-11 15:33:42 +0800251{
Chia-I Wuf9c81ef2015-02-22 13:49:15 +0800252 intel_free(state, state->cmd);
Chia-I Wua5714e82014-08-11 15:33:42 +0800253 intel_base_destroy(&state->obj.base);
254}
255
256static void raster_state_destroy(struct intel_obj *obj)
257{
Tony Barbourfa6cac72015-01-16 14:27:35 -0700258 struct intel_dynamic_rs *state = intel_raster_state_from_obj(obj);
Chia-I Wua5714e82014-08-11 15:33:42 +0800259
260 intel_raster_state_destroy(state);
261}
262
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600263VkResult intel_raster_state_create(struct intel_dev *dev,
264 const VkDynamicRsStateCreateInfo *info,
Tony Barbourfa6cac72015-01-16 14:27:35 -0700265 struct intel_dynamic_rs **state_ret)
Chia-I Wua5714e82014-08-11 15:33:42 +0800266{
Tony Barbourfa6cac72015-01-16 14:27:35 -0700267 struct intel_dynamic_rs *state;
Chia-I Wua5714e82014-08-11 15:33:42 +0800268
Chia-I Wu545c2e12015-02-22 13:19:54 +0800269 state = (struct intel_dynamic_rs *) intel_base_create(&dev->base.handle,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600270 sizeof(*state), dev->base.dbg, VK_OBJECT_TYPE_DYNAMIC_RS_STATE,
Chia-I Wua5714e82014-08-11 15:33:42 +0800271 info, 0);
272 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600273 return VK_ERROR_OUT_OF_HOST_MEMORY;
Chia-I Wua5714e82014-08-11 15:33:42 +0800274
275 state->obj.destroy = raster_state_destroy;
Tony Barbourfa6cac72015-01-16 14:27:35 -0700276 state->rs_info = *info;
Chia-I Wua5714e82014-08-11 15:33:42 +0800277
278 *state_ret = state;
279
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600280 return VK_SUCCESS;
Chia-I Wua5714e82014-08-11 15:33:42 +0800281}
282
Tony Barbourfa6cac72015-01-16 14:27:35 -0700283void intel_raster_state_destroy(struct intel_dynamic_rs *state)
Chia-I Wua5714e82014-08-11 15:33:42 +0800284{
285 intel_base_destroy(&state->obj.base);
286}
287
288static void blend_state_destroy(struct intel_obj *obj)
289{
Tony Barbourfa6cac72015-01-16 14:27:35 -0700290 struct intel_dynamic_cb *state = intel_blend_state_from_obj(obj);
Chia-I Wua5714e82014-08-11 15:33:42 +0800291
292 intel_blend_state_destroy(state);
293}
294
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600295VkResult intel_blend_state_create(struct intel_dev *dev,
296 const VkDynamicCbStateCreateInfo *info,
Tony Barbourfa6cac72015-01-16 14:27:35 -0700297 struct intel_dynamic_cb **state_ret)
Chia-I Wua5714e82014-08-11 15:33:42 +0800298{
Tony Barbourfa6cac72015-01-16 14:27:35 -0700299 struct intel_dynamic_cb *state;
Chia-I Wua5714e82014-08-11 15:33:42 +0800300
Chia-I Wu545c2e12015-02-22 13:19:54 +0800301 state = (struct intel_dynamic_cb *) intel_base_create(&dev->base.handle,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600302 sizeof(*state), dev->base.dbg, VK_OBJECT_TYPE_DYNAMIC_CB_STATE,
Chia-I Wua5714e82014-08-11 15:33:42 +0800303 info, 0);
304 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600305 return VK_ERROR_OUT_OF_HOST_MEMORY;
Chia-I Wua5714e82014-08-11 15:33:42 +0800306
307 state->obj.destroy = blend_state_destroy;
Tony Barbourfa6cac72015-01-16 14:27:35 -0700308 state->cb_info = *info;
Chia-I Wua5714e82014-08-11 15:33:42 +0800309
310 *state_ret = state;
311
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600312 return VK_SUCCESS;
Chia-I Wua5714e82014-08-11 15:33:42 +0800313}
314
Tony Barbourfa6cac72015-01-16 14:27:35 -0700315void intel_blend_state_destroy(struct intel_dynamic_cb *state)
Chia-I Wua5714e82014-08-11 15:33:42 +0800316{
317 intel_base_destroy(&state->obj.base);
318}
319
320static void ds_state_destroy(struct intel_obj *obj)
321{
Tony Barbourfa6cac72015-01-16 14:27:35 -0700322 struct intel_dynamic_ds *state = intel_ds_state_from_obj(obj);
Chia-I Wua5714e82014-08-11 15:33:42 +0800323
324 intel_ds_state_destroy(state);
325}
326
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600327VkResult intel_ds_state_create(struct intel_dev *dev,
328 const VkDynamicDsStateCreateInfo *info,
Tony Barbourfa6cac72015-01-16 14:27:35 -0700329 struct intel_dynamic_ds **state_ret)
Chia-I Wua5714e82014-08-11 15:33:42 +0800330{
Tony Barbourfa6cac72015-01-16 14:27:35 -0700331 struct intel_dynamic_ds *state;
Chia-I Wua5714e82014-08-11 15:33:42 +0800332
Chia-I Wu545c2e12015-02-22 13:19:54 +0800333 state = (struct intel_dynamic_ds *) intel_base_create(&dev->base.handle,
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600334 sizeof(*state), dev->base.dbg, VK_OBJECT_TYPE_DYNAMIC_DS_STATE,
Chia-I Wua5714e82014-08-11 15:33:42 +0800335 info, 0);
336 if (!state)
Tony Barbour8205d902015-04-16 15:59:00 -0600337 return VK_ERROR_OUT_OF_HOST_MEMORY;
Chia-I Wua5714e82014-08-11 15:33:42 +0800338
339 state->obj.destroy = ds_state_destroy;
340
Tony Barbourfa6cac72015-01-16 14:27:35 -0700341 /*
342 * From the Sandy Bridge PRM, volume 2 part 1, page 359:
343 *
344 * "If the Depth Buffer is either undefined or does not have a surface
345 * format of D32_FLOAT_S8X24_UINT or D24_UNORM_S8_UINT and separate
346 * stencil buffer is disabled, Stencil Test Enable must be DISABLED"
347 *
348 * From the Sandy Bridge PRM, volume 2 part 1, page 370:
349 *
350 * "This field (Stencil Test Enable) cannot be enabled if
351 * Surface Format in 3DSTATE_DEPTH_BUFFER is set to D16_UNORM."
352 *
353 * TODO We do not check these yet.
354 */
355
356 state->ds_info = *info;
Chia-I Wua5714e82014-08-11 15:33:42 +0800357
358 *state_ret = state;
359
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600360 return VK_SUCCESS;
Chia-I Wua5714e82014-08-11 15:33:42 +0800361}
362
Tony Barbourfa6cac72015-01-16 14:27:35 -0700363void intel_ds_state_destroy(struct intel_dynamic_ds *state)
Chia-I Wua5714e82014-08-11 15:33:42 +0800364{
365 intel_base_destroy(&state->obj.base);
366}
367
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600368ICD_EXPORT VkResult VKAPI vkCreateDynamicViewportState(
369 VkDevice device,
370 const VkDynamicVpStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -0600371 VkDynamicVpState* pState)
Chia-I Wua5714e82014-08-11 15:33:42 +0800372{
373 struct intel_dev *dev = intel_dev(device);
374
375 return intel_viewport_state_create(dev, pCreateInfo,
Tony Barbourfa6cac72015-01-16 14:27:35 -0700376 (struct intel_dynamic_vp **) pState);
Chia-I Wua5714e82014-08-11 15:33:42 +0800377}
378
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600379ICD_EXPORT VkResult VKAPI vkCreateDynamicRasterState(
380 VkDevice device,
381 const VkDynamicRsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -0600382 VkDynamicRsState* pState)
Chia-I Wua5714e82014-08-11 15:33:42 +0800383{
384 struct intel_dev *dev = intel_dev(device);
385
386 return intel_raster_state_create(dev, pCreateInfo,
Tony Barbourfa6cac72015-01-16 14:27:35 -0700387 (struct intel_dynamic_rs **) pState);
Chia-I Wua5714e82014-08-11 15:33:42 +0800388}
389
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600390ICD_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
391 VkDevice device,
392 const VkDynamicCbStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -0600393 VkDynamicCbState* pState)
Chia-I Wua5714e82014-08-11 15:33:42 +0800394{
395 struct intel_dev *dev = intel_dev(device);
396
397 return intel_blend_state_create(dev, pCreateInfo,
Tony Barbourfa6cac72015-01-16 14:27:35 -0700398 (struct intel_dynamic_cb **) pState);
Chia-I Wua5714e82014-08-11 15:33:42 +0800399}
400
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600401ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
402 VkDevice device,
403 const VkDynamicDsStateCreateInfo* pCreateInfo,
Courtney Goeltzenleuchterfcf855f2015-04-10 16:24:50 -0600404 VkDynamicDsState* pState)
Chia-I Wua5714e82014-08-11 15:33:42 +0800405{
406 struct intel_dev *dev = intel_dev(device);
407
408 return intel_ds_state_create(dev, pCreateInfo,
Tony Barbourfa6cac72015-01-16 14:27:35 -0700409 (struct intel_dynamic_ds **) pState);
Chia-I Wua5714e82014-08-11 15:33:42 +0800410}