Chia-I Wu | a5714e8 | 2014-08-11 15:33:42 +0800 | [diff] [blame] | 1 | /* |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 2 | * Vulkan |
Chia-I Wu | a5714e8 | 2014-08-11 15:33:42 +0800 | [diff] [blame] | 3 | * |
| 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 Wu | 44e4236 | 2014-09-02 08:32:09 +0800 | [diff] [blame] | 23 | * |
| 24 | * Authors: |
| 25 | * Chia-I Wu <olv@lunarg.com> |
Chia-I Wu | a5714e8 | 2014-08-11 15:33:42 +0800 | [diff] [blame] | 26 | */ |
| 27 | |
| 28 | #ifndef STATE_H |
| 29 | #define STATE_H |
| 30 | |
| 31 | #include "intel.h" |
| 32 | #include "obj.h" |
| 33 | |
Tony Barbour | de4124d | 2015-07-03 10:33:54 -0600 | [diff] [blame] | 34 | struct intel_dynamic_viewport { |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 35 | uint32_t viewport_count; |
Chris Forbes | af56e16 | 2015-10-07 12:24:34 +1300 | [diff] [blame] | 36 | uint32_t scissor_count; |
Courtney Goeltzenleuchter | 932cdb5 | 2015-09-21 11:44:06 -0600 | [diff] [blame] | 37 | VkViewport viewports[INTEL_MAX_VIEWPORTS]; |
| 38 | VkRect2D scissors[INTEL_MAX_VIEWPORTS]; |
Chia-I Wu | a5714e8 | 2014-08-11 15:33:42 +0800 | [diff] [blame] | 39 | /* SF_CLIP_VIEWPORTs, CC_VIEWPORTs, and SCISSOR_RECTs */ |
Courtney Goeltzenleuchter | 09772bb | 2015-09-17 15:06:17 -0600 | [diff] [blame] | 40 | uint32_t cmd[INTEL_MAX_VIEWPORTS * (16 /* viewport */ + 2 /* cc */ + 2 /* scissor */)]; |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 41 | 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 Wu | a5714e8 | 2014-08-11 15:33:42 +0800 | [diff] [blame] | 45 | }; |
| 46 | |
Cody Northrop | e4bc694 | 2015-08-26 10:01:32 -0600 | [diff] [blame] | 47 | struct intel_dynamic_line_width { |
Courtney Goeltzenleuchter | 09772bb | 2015-09-17 15:06:17 -0600 | [diff] [blame] | 48 | float line_width; |
Cody Northrop | f5bd225 | 2015-08-17 11:10:49 -0600 | [diff] [blame] | 49 | }; |
| 50 | |
Cody Northrop | e4bc694 | 2015-08-26 10:01:32 -0600 | [diff] [blame] | 51 | struct intel_dynamic_depth_bias { |
Courtney Goeltzenleuchter | 09772bb | 2015-09-17 15:06:17 -0600 | [diff] [blame] | 52 | float depth_bias; |
| 53 | float depth_bias_clamp; |
| 54 | float slope_scaled_depth_bias; |
Chia-I Wu | a5714e8 | 2014-08-11 15:33:42 +0800 | [diff] [blame] | 55 | }; |
| 56 | |
Cody Northrop | e4bc694 | 2015-08-26 10:01:32 -0600 | [diff] [blame] | 57 | struct intel_dynamic_blend { |
Courtney Goeltzenleuchter | 09772bb | 2015-09-17 15:06:17 -0600 | [diff] [blame] | 58 | float blend_const[4]; |
Chia-I Wu | a5714e8 | 2014-08-11 15:33:42 +0800 | [diff] [blame] | 59 | }; |
| 60 | |
Cody Northrop | e4bc694 | 2015-08-26 10:01:32 -0600 | [diff] [blame] | 61 | struct intel_dynamic_depth_bounds { |
Courtney Goeltzenleuchter | 09772bb | 2015-09-17 15:06:17 -0600 | [diff] [blame] | 62 | float min_depth_bounds; |
| 63 | float max_depth_bounds; |
| 64 | }; |
| 65 | |
| 66 | struct intel_dynamic_stencil_face { |
| 67 | uint32_t stencil_compare_mask; |
| 68 | uint32_t stencil_write_mask; |
| 69 | uint32_t stencil_reference; |
Cody Northrop | 2605cb0 | 2015-08-18 15:21:16 -0600 | [diff] [blame] | 70 | }; |
| 71 | |
| 72 | struct intel_dynamic_stencil { |
Courtney Goeltzenleuchter | 09772bb | 2015-09-17 15:06:17 -0600 | [diff] [blame] | 73 | struct intel_dynamic_stencil_face front; |
Cody Northrop | 2605cb0 | 2015-08-18 15:21:16 -0600 | [diff] [blame] | 74 | /* TODO: enable back facing stencil state */ |
Courtney Goeltzenleuchter | 09772bb | 2015-09-17 15:06:17 -0600 | [diff] [blame] | 75 | struct intel_dynamic_stencil_face back; |
Chia-I Wu | a5714e8 | 2014-08-11 15:33:42 +0800 | [diff] [blame] | 76 | }; |
Courtney Goeltzenleuchter | e20aaa2 | 2015-09-21 17:19:25 -0600 | [diff] [blame] | 77 | |
| 78 | struct intel_cmd; |
| 79 | void intel_set_viewport(struct intel_cmd *cmd, uint32_t count, const VkViewport *viewports); |
| 80 | void intel_set_scissor(struct intel_cmd *cmd, uint32_t count, const VkRect2D *scissors); |
| 81 | void intel_set_line_width(struct intel_cmd *cmd, float line_width); |
| 82 | void intel_set_depth_bias( |
| 83 | struct intel_cmd *cmd, |
| 84 | float depthBias, |
| 85 | float depthBiasClamp, |
| 86 | float slopeScaledDepthBias); |
| 87 | void intel_set_blend_constants( |
| 88 | struct intel_cmd *cmd, |
| 89 | const float blendConst[4]); |
| 90 | void intel_set_depth_bounds( |
| 91 | struct intel_cmd *cmd, |
| 92 | float minDepthBounds, |
| 93 | float maxDepthBounds); |
| 94 | void intel_set_stencil_compare_mask( |
| 95 | struct intel_cmd *cmd, |
| 96 | VkStencilFaceFlags faceMask, |
| 97 | uint32_t stencilCompareMask); |
| 98 | void intel_set_stencil_write_mask( |
| 99 | struct intel_cmd *cmd, |
| 100 | VkStencilFaceFlags faceMask, |
| 101 | uint32_t stencilWriteMask); |
| 102 | void intel_set_stencil_reference( |
| 103 | struct intel_cmd *cmd, |
| 104 | VkStencilFaceFlags faceMask, |
| 105 | uint32_t stencilReference); |
| 106 | |
Chia-I Wu | a5714e8 | 2014-08-11 15:33:42 +0800 | [diff] [blame] | 107 | #endif /* STATE_H */ |