OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrVkPipeline.h" | 8 #include "GrVkPipeline.h" |
9 | 9 |
10 #include "GrGeometryProcessor.h" | 10 #include "GrGeometryProcessor.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 static const VkStencilOp gTable[] = { | 102 static const VkStencilOp gTable[] = { |
103 VK_STENCIL_OP_KEEP, // kKeep_StencilOp | 103 VK_STENCIL_OP_KEEP, // kKeep_StencilOp |
104 VK_STENCIL_OP_REPLACE, // kReplace_StencilOp | 104 VK_STENCIL_OP_REPLACE, // kReplace_StencilOp |
105 VK_STENCIL_OP_INCREMENT_AND_WRAP, // kIncWrap_StencilOp | 105 VK_STENCIL_OP_INCREMENT_AND_WRAP, // kIncWrap_StencilOp |
106 VK_STENCIL_OP_INCREMENT_AND_CLAMP, // kIncClamp_StencilOp | 106 VK_STENCIL_OP_INCREMENT_AND_CLAMP, // kIncClamp_StencilOp |
107 VK_STENCIL_OP_DECREMENT_AND_WRAP, // kDecWrap_StencilOp | 107 VK_STENCIL_OP_DECREMENT_AND_WRAP, // kDecWrap_StencilOp |
108 VK_STENCIL_OP_DECREMENT_AND_CLAMP, // kDecClamp_StencilOp | 108 VK_STENCIL_OP_DECREMENT_AND_CLAMP, // kDecClamp_StencilOp |
109 VK_STENCIL_OP_ZERO, // kZero_StencilOp | 109 VK_STENCIL_OP_ZERO, // kZero_StencilOp |
110 VK_STENCIL_OP_INVERT, // kInvert_StencilOp | 110 VK_STENCIL_OP_INVERT, // kInvert_StencilOp |
111 }; | 111 }; |
112 GR_STATIC_ASSERT(SK_ARRAY_COUNT(gTable) == kStencilOpCount); | 112 GR_STATIC_ASSERT(SK_ARRAY_COUNT(gTable) == kStencilOpCnt); |
113 GR_STATIC_ASSERT(0 == kKeep_StencilOp); | 113 GR_STATIC_ASSERT(0 == kKeep_StencilOp); |
114 GR_STATIC_ASSERT(1 == kReplace_StencilOp); | 114 GR_STATIC_ASSERT(1 == kReplace_StencilOp); |
115 GR_STATIC_ASSERT(2 == kIncWrap_StencilOp); | 115 GR_STATIC_ASSERT(2 == kIncWrap_StencilOp); |
116 GR_STATIC_ASSERT(3 == kIncClamp_StencilOp); | 116 GR_STATIC_ASSERT(3 == kIncClamp_StencilOp); |
117 GR_STATIC_ASSERT(4 == kDecWrap_StencilOp); | 117 GR_STATIC_ASSERT(4 == kDecWrap_StencilOp); |
118 GR_STATIC_ASSERT(5 == kDecClamp_StencilOp); | 118 GR_STATIC_ASSERT(5 == kDecClamp_StencilOp); |
119 GR_STATIC_ASSERT(6 == kZero_StencilOp); | 119 GR_STATIC_ASSERT(6 == kZero_StencilOp); |
120 GR_STATIC_ASSERT(7 == kInvert_StencilOp); | 120 GR_STATIC_ASSERT(7 == kInvert_StencilOp); |
121 SkASSERT((unsigned)op < kStencilOpCount); | 121 SkASSERT((unsigned)op < kStencilOpCnt); |
122 return gTable[op]; | 122 return gTable[op]; |
123 } | 123 } |
124 | 124 |
125 VkCompareOp stencil_func_to_vk_compare_op(GrStencilFunc basicFunc) { | 125 VkCompareOp stencil_func_to_vk_compare_op(GrStencilFunc basicFunc) { |
126 static const VkCompareOp gTable[] = { | 126 static const VkCompareOp gTable[] = { |
127 VK_COMPARE_OP_ALWAYS, // kAlways_StencilFunc | 127 VK_COMPARE_OP_ALWAYS, // kAlways_StencilFunc |
128 VK_COMPARE_OP_NEVER, // kNever_StencilFunc | 128 VK_COMPARE_OP_NEVER, // kNever_StencilFunc |
129 VK_COMPARE_OP_GREATER, // kGreater_StencilFunc | 129 VK_COMPARE_OP_GREATER, // kGreater_StencilFunc |
130 VK_COMPARE_OP_GREATER_OR_EQUAL, // kGEqual_StencilFunc | 130 VK_COMPARE_OP_GREATER_OR_EQUAL, // kGEqual_StencilFunc |
131 VK_COMPARE_OP_LESS, // kLess_StencilFunc | 131 VK_COMPARE_OP_LESS, // kLess_StencilFunc |
132 VK_COMPARE_OP_LESS_OR_EQUAL, // kLEqual_StencilFunc, | 132 VK_COMPARE_OP_LESS_OR_EQUAL, // kLEqual_StencilFunc, |
133 VK_COMPARE_OP_EQUAL, // kEqual_StencilFunc, | 133 VK_COMPARE_OP_EQUAL, // kEqual_StencilFunc, |
134 VK_COMPARE_OP_NOT_EQUAL, // kNotEqual_StencilFunc, | 134 VK_COMPARE_OP_NOT_EQUAL, // kNotEqual_StencilFunc, |
135 }; | 135 }; |
136 GR_STATIC_ASSERT(SK_ARRAY_COUNT(gTable) == kBasicStencilFuncCount); | 136 GR_STATIC_ASSERT(SK_ARRAY_COUNT(gTable) == kBasicStencilFuncCnt); |
137 GR_STATIC_ASSERT(0 == kAlways_StencilFunc); | 137 GR_STATIC_ASSERT(0 == kAlways_StencilFunc); |
138 GR_STATIC_ASSERT(1 == kNever_StencilFunc); | 138 GR_STATIC_ASSERT(1 == kNever_StencilFunc); |
139 GR_STATIC_ASSERT(2 == kGreater_StencilFunc); | 139 GR_STATIC_ASSERT(2 == kGreater_StencilFunc); |
140 GR_STATIC_ASSERT(3 == kGEqual_StencilFunc); | 140 GR_STATIC_ASSERT(3 == kGEqual_StencilFunc); |
141 GR_STATIC_ASSERT(4 == kLess_StencilFunc); | 141 GR_STATIC_ASSERT(4 == kLess_StencilFunc); |
142 GR_STATIC_ASSERT(5 == kLEqual_StencilFunc); | 142 GR_STATIC_ASSERT(5 == kLEqual_StencilFunc); |
143 GR_STATIC_ASSERT(6 == kEqual_StencilFunc); | 143 GR_STATIC_ASSERT(6 == kEqual_StencilFunc); |
144 GR_STATIC_ASSERT(7 == kNotEqual_StencilFunc); | 144 GR_STATIC_ASSERT(7 == kNotEqual_StencilFunc); |
145 SkASSERT((unsigned)basicFunc < kBasicStencilFuncCount); | 145 SkASSERT((unsigned)basicFunc < kBasicStencilFuncCnt); |
146 | 146 |
147 return gTable[basicFunc]; | 147 return gTable[basicFunc]; |
148 } | 148 } |
149 | 149 |
150 void setup_depth_stencil_state(const GrVkGpu* gpu, | 150 void setup_depth_stencil_state(const GrVkGpu* gpu, |
151 const GrStencilSettings& stencilSettings, | 151 const GrStencilSettings& stencilSettings, |
152 VkPipelineDepthStencilStateCreateInfo* stencilInf
o) { | 152 VkPipelineDepthStencilStateCreateInfo* stencilInf
o) { |
153 memset(stencilInfo, 0, sizeof(VkPipelineDepthStencilStateCreateInfo)); | 153 memset(stencilInfo, 0, sizeof(VkPipelineDepthStencilStateCreateInfo)); |
154 stencilInfo->sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_I
NFO; | 154 stencilInfo->sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_I
NFO; |
155 stencilInfo->pNext = nullptr; | 155 stencilInfo->pNext = nullptr; |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 } | 548 } |
549 | 549 |
550 void GrVkPipeline::SetDynamicState(GrVkGpu* gpu, | 550 void GrVkPipeline::SetDynamicState(GrVkGpu* gpu, |
551 GrVkCommandBuffer* cmdBuffer, | 551 GrVkCommandBuffer* cmdBuffer, |
552 const GrPipeline& pipeline) { | 552 const GrPipeline& pipeline) { |
553 const GrRenderTarget& target = *pipeline.getRenderTarget(); | 553 const GrRenderTarget& target = *pipeline.getRenderTarget(); |
554 set_dynamic_scissor_state(gpu, cmdBuffer, pipeline, target); | 554 set_dynamic_scissor_state(gpu, cmdBuffer, pipeline, target); |
555 set_dynamic_viewport_state(gpu, cmdBuffer, target); | 555 set_dynamic_viewport_state(gpu, cmdBuffer, target); |
556 set_dynamic_blend_constant_state(gpu, cmdBuffer, pipeline); | 556 set_dynamic_blend_constant_state(gpu, cmdBuffer, pipeline); |
557 } | 557 } |
OLD | NEW |