Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Unified Diff: src/gpu/vk/GrVkPipeline.cpp

Issue 1969693003: Revert of Separate user and raw stencil settings (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/text/GrStencilAndCoverTextContext.cpp ('k') | src/gpu/vk/GrVkPipelineState.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkPipeline.cpp
diff --git a/src/gpu/vk/GrVkPipeline.cpp b/src/gpu/vk/GrVkPipeline.cpp
index 8227e12cb1bda49b50844ea8857533d529c9312d..2a9c6e2dd46d069c1ca948d7ef3cea8c40ca0eb6 100644
--- a/src/gpu/vk/GrVkPipeline.cpp
+++ b/src/gpu/vk/GrVkPipeline.cpp
@@ -100,51 +100,51 @@
VkStencilOp stencil_op_to_vk_stencil_op(GrStencilOp op) {
static const VkStencilOp gTable[] = {
- VK_STENCIL_OP_KEEP, // kKeep
- VK_STENCIL_OP_ZERO, // kZero
- VK_STENCIL_OP_REPLACE, // kReplace
- VK_STENCIL_OP_INVERT, // kInvert
- VK_STENCIL_OP_INCREMENT_AND_WRAP, // kIncWrap
- VK_STENCIL_OP_DECREMENT_AND_WRAP, // kDecWrap
- VK_STENCIL_OP_INCREMENT_AND_CLAMP, // kIncClamp
- VK_STENCIL_OP_DECREMENT_AND_CLAMP, // kDecClamp
- };
- GR_STATIC_ASSERT(SK_ARRAY_COUNT(gTable) == kGrStencilOpCount);
- GR_STATIC_ASSERT(0 == (int)GrStencilOp::kKeep);
- GR_STATIC_ASSERT(1 == (int)GrStencilOp::kZero);
- GR_STATIC_ASSERT(2 == (int)GrStencilOp::kReplace);
- GR_STATIC_ASSERT(3 == (int)GrStencilOp::kInvert);
- GR_STATIC_ASSERT(4 == (int)GrStencilOp::kIncWrap);
- GR_STATIC_ASSERT(5 == (int)GrStencilOp::kDecWrap);
- GR_STATIC_ASSERT(6 == (int)GrStencilOp::kIncClamp);
- GR_STATIC_ASSERT(7 == (int)GrStencilOp::kDecClamp);
- SkASSERT(op < (GrStencilOp)kGrStencilOpCount);
- return gTable[(int)op];
-}
-
-VkCompareOp stencil_func_to_vk_compare_op(GrStencilTest test) {
+ VK_STENCIL_OP_KEEP, // kKeep_StencilOp
+ VK_STENCIL_OP_REPLACE, // kReplace_StencilOp
+ VK_STENCIL_OP_INCREMENT_AND_WRAP, // kIncWrap_StencilOp
+ VK_STENCIL_OP_INCREMENT_AND_CLAMP, // kIncClamp_StencilOp
+ VK_STENCIL_OP_DECREMENT_AND_WRAP, // kDecWrap_StencilOp
+ VK_STENCIL_OP_DECREMENT_AND_CLAMP, // kDecClamp_StencilOp
+ VK_STENCIL_OP_ZERO, // kZero_StencilOp
+ VK_STENCIL_OP_INVERT, // kInvert_StencilOp
+ };
+ GR_STATIC_ASSERT(SK_ARRAY_COUNT(gTable) == kStencilOpCnt);
+ GR_STATIC_ASSERT(0 == kKeep_StencilOp);
+ GR_STATIC_ASSERT(1 == kReplace_StencilOp);
+ GR_STATIC_ASSERT(2 == kIncWrap_StencilOp);
+ GR_STATIC_ASSERT(3 == kIncClamp_StencilOp);
+ GR_STATIC_ASSERT(4 == kDecWrap_StencilOp);
+ GR_STATIC_ASSERT(5 == kDecClamp_StencilOp);
+ GR_STATIC_ASSERT(6 == kZero_StencilOp);
+ GR_STATIC_ASSERT(7 == kInvert_StencilOp);
+ SkASSERT((unsigned)op < kStencilOpCnt);
+ return gTable[op];
+}
+
+VkCompareOp stencil_func_to_vk_compare_op(GrStencilFunc basicFunc) {
static const VkCompareOp gTable[] = {
- VK_COMPARE_OP_ALWAYS, // kAlways
- VK_COMPARE_OP_NEVER, // kNever
- VK_COMPARE_OP_GREATER, // kGreater
- VK_COMPARE_OP_GREATER_OR_EQUAL, // kGEqual
- VK_COMPARE_OP_LESS, // kLess
- VK_COMPARE_OP_LESS_OR_EQUAL, // kLEqual
- VK_COMPARE_OP_EQUAL, // kEqual
- VK_COMPARE_OP_NOT_EQUAL, // kNotEqual
- };
- GR_STATIC_ASSERT(SK_ARRAY_COUNT(gTable) == kGrStencilTestCount);
- GR_STATIC_ASSERT(0 == (int)GrStencilTest::kAlways);
- GR_STATIC_ASSERT(1 == (int)GrStencilTest::kNever);
- GR_STATIC_ASSERT(2 == (int)GrStencilTest::kGreater);
- GR_STATIC_ASSERT(3 == (int)GrStencilTest::kGEqual);
- GR_STATIC_ASSERT(4 == (int)GrStencilTest::kLess);
- GR_STATIC_ASSERT(5 == (int)GrStencilTest::kLEqual);
- GR_STATIC_ASSERT(6 == (int)GrStencilTest::kEqual);
- GR_STATIC_ASSERT(7 == (int)GrStencilTest::kNotEqual);
- SkASSERT(test < (GrStencilTest)kGrStencilTestCount);
-
- return gTable[(int)test];
+ VK_COMPARE_OP_ALWAYS, // kAlways_StencilFunc
+ VK_COMPARE_OP_NEVER, // kNever_StencilFunc
+ VK_COMPARE_OP_GREATER, // kGreater_StencilFunc
+ VK_COMPARE_OP_GREATER_OR_EQUAL, // kGEqual_StencilFunc
+ VK_COMPARE_OP_LESS, // kLess_StencilFunc
+ VK_COMPARE_OP_LESS_OR_EQUAL, // kLEqual_StencilFunc,
+ VK_COMPARE_OP_EQUAL, // kEqual_StencilFunc,
+ VK_COMPARE_OP_NOT_EQUAL, // kNotEqual_StencilFunc,
+ };
+ GR_STATIC_ASSERT(SK_ARRAY_COUNT(gTable) == kBasicStencilFuncCnt);
+ GR_STATIC_ASSERT(0 == kAlways_StencilFunc);
+ GR_STATIC_ASSERT(1 == kNever_StencilFunc);
+ GR_STATIC_ASSERT(2 == kGreater_StencilFunc);
+ GR_STATIC_ASSERT(3 == kGEqual_StencilFunc);
+ GR_STATIC_ASSERT(4 == kLess_StencilFunc);
+ GR_STATIC_ASSERT(5 == kLEqual_StencilFunc);
+ GR_STATIC_ASSERT(6 == kEqual_StencilFunc);
+ GR_STATIC_ASSERT(7 == kNotEqual_StencilFunc);
+ SkASSERT((unsigned)basicFunc < kBasicStencilFuncCnt);
+
+ return gTable[basicFunc];
}
void setup_depth_stencil_state(const GrVkGpu* gpu,
@@ -162,28 +162,24 @@
stencilInfo->stencilTestEnable = !stencilSettings.isDisabled();
if (!stencilSettings.isDisabled()) {
// Set front face
- const GrStencilSettings::Face& front = stencilSettings.front();
- stencilInfo->front.failOp = stencil_op_to_vk_stencil_op(front.fFailOp);
- stencilInfo->front.passOp = stencil_op_to_vk_stencil_op(front.fPassOp);
+ GrStencilSettings::Face face = GrStencilSettings::kFront_Face;
+ stencilInfo->front.failOp = stencil_op_to_vk_stencil_op(stencilSettings.failOp(face));
+ stencilInfo->front.passOp = stencil_op_to_vk_stencil_op(stencilSettings.passOp(face));
stencilInfo->front.depthFailOp = stencilInfo->front.failOp;
- stencilInfo->front.compareOp = stencil_func_to_vk_compare_op(front.fTest);
- stencilInfo->front.compareMask = front.fTestMask;
- stencilInfo->front.writeMask = front.fWriteMask;
- stencilInfo->front.reference = front.fRef;
+ stencilInfo->front.compareOp = stencil_func_to_vk_compare_op(stencilSettings.func(face));
+ stencilInfo->front.compareMask = stencilSettings.funcMask(face);
+ stencilInfo->front.writeMask = stencilSettings.writeMask(face);
+ stencilInfo->front.reference = stencilSettings.funcRef(face);
// Set back face
- if (!stencilSettings.isTwoSided()) {
- stencilInfo->back = stencilInfo->front;
- } else {
- const GrStencilSettings::Face& back = stencilSettings.back();
- stencilInfo->back.failOp = stencil_op_to_vk_stencil_op(back.fFailOp);
- stencilInfo->back.passOp = stencil_op_to_vk_stencil_op(back.fPassOp);
- stencilInfo->back.depthFailOp = stencilInfo->front.failOp;
- stencilInfo->back.compareOp = stencil_func_to_vk_compare_op(back.fTest);
- stencilInfo->back.compareMask = back.fTestMask;
- stencilInfo->back.writeMask = back.fWriteMask;
- stencilInfo->back.reference = back.fRef;
- }
+ face = GrStencilSettings::kBack_Face;
+ stencilInfo->back.failOp = stencil_op_to_vk_stencil_op(stencilSettings.failOp(face));
+ stencilInfo->back.passOp = stencil_op_to_vk_stencil_op(stencilSettings.passOp(face));
+ stencilInfo->back.depthFailOp = stencilInfo->front.failOp;
+ stencilInfo->back.compareOp = stencil_func_to_vk_compare_op(stencilSettings.func(face));
+ stencilInfo->back.compareMask = stencilSettings.funcMask(face);
+ stencilInfo->back.writeMask = stencilSettings.writeMask(face);
+ stencilInfo->back.reference = stencilSettings.funcRef(face);
}
stencilInfo->minDepthBounds = 0.0f;
stencilInfo->maxDepthBounds = 1.0f;
« no previous file with comments | « src/gpu/text/GrStencilAndCoverTextContext.cpp ('k') | src/gpu/vk/GrVkPipelineState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698