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