Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
GrMtlDepthStencil.mm File Reference
#include "src/gpu/ganesh/GrStencilSettings.h"
#include "src/gpu/ganesh/mtl/GrMtlDepthStencil.h"
#include "src/gpu/ganesh/mtl/GrMtlGpu.h"

Go to the source code of this file.

Functions

GR_NORETAIN_BEGIN MTLStencilOperation skia_stencil_op_to_mtl (GrStencilOp op)
 
MTLStencilDescriptor * skia_stencil_to_mtl (GrStencilSettings::Face face)
 
void skia_stencil_to_key (GrStencilSettings::Face face, GrMtlDepthStencil::Key::Face *faceKey)
 

Function Documentation

◆ skia_stencil_op_to_mtl()

GR_NORETAIN_BEGIN MTLStencilOperation skia_stencil_op_to_mtl ( GrStencilOp  op)

Definition at line 18 of file GrMtlDepthStencil.mm.

18 {
19 switch (op) {
21 return MTLStencilOperationKeep;
23 return MTLStencilOperationZero;
25 return MTLStencilOperationReplace;
27 return MTLStencilOperationInvert;
29 return MTLStencilOperationIncrementWrap;
31 return MTLStencilOperationDecrementWrap;
33 return MTLStencilOperationIncrementClamp;
35 return MTLStencilOperationDecrementClamp;
36 }
37}

◆ skia_stencil_to_key()

void skia_stencil_to_key ( GrStencilSettings::Face  face,
GrMtlDepthStencil::Key::Face faceKey 
)

Definition at line 93 of file GrMtlDepthStencil.mm.

93 {
94 const int kPassOpShift = 3;
95 const int kFailOpShift = 6;
96
97 faceKey->fReadMask = face.fTestMask;
98 faceKey->fWriteMask = face.fWriteMask;
99
100 SkASSERT(static_cast<int>(face.fTest) <= 7);
101 faceKey->fOps = static_cast<uint32_t>(face.fTest);
102
103 SkASSERT(static_cast<int>(face.fPassOp) <= 7);
104 faceKey->fOps |= (static_cast<uint32_t>(face.fPassOp) << kPassOpShift);
105
106 SkASSERT(static_cast<int>(face.fFailOp) <= 7);
107 faceKey->fOps |= (static_cast<uint32_t>(face.fFailOp) << kFailOpShift);
108}
#define SkASSERT(cond)
Definition SkAssert.h:116

◆ skia_stencil_to_mtl()

MTLStencilDescriptor * skia_stencil_to_mtl ( GrStencilSettings::Face  face)

Definition at line 39 of file GrMtlDepthStencil.mm.

39 {
40 MTLStencilDescriptor* result = [[MTLStencilDescriptor alloc] init];
41 switch (face.fTest) {
43 result.stencilCompareFunction = MTLCompareFunctionAlways;
44 break;
46 result.stencilCompareFunction = MTLCompareFunctionNever;
47 break;
49 result.stencilCompareFunction = MTLCompareFunctionGreater;
50 break;
52 result.stencilCompareFunction = MTLCompareFunctionGreaterEqual;
53 break;
55 result.stencilCompareFunction = MTLCompareFunctionLess;
56 break;
58 result.stencilCompareFunction = MTLCompareFunctionLessEqual;
59 break;
61 result.stencilCompareFunction = MTLCompareFunctionEqual;
62 break;
64 result.stencilCompareFunction = MTLCompareFunctionNotEqual;
65 break;
66 }
67 result.readMask = face.fTestMask;
68 result.writeMask = face.fWriteMask;
69 result.depthStencilPassOperation = skia_stencil_op_to_mtl(face.fPassOp);
70 result.stencilFailureOperation = skia_stencil_op_to_mtl(face.fFailOp);
71 return result;
72}
GR_NORETAIN_BEGIN MTLStencilOperation skia_stencil_op_to_mtl(GrStencilOp op)
GAsyncResult * result
init(device_serial, adb_binary)
Definition _adb_path.py:12