82 {
83
84
85
86
87
88
89
90 bool renderTargetsMatch = (first.texture == second.texture);
91 bool storeActionsValid = first.storeAction == MTLStoreActionStore ||
92 first.storeAction == MTLStoreActionDontCare;
93 bool loadActionsValid = second.loadAction == MTLLoadActionLoad ||
94 second.loadAction == MTLLoadActionDontCare;
95 bool secondDoesntSampleFirst = (!pipelineState ||
97
98
99
100 bool secondStoreValid = true;
101 if (second.storeAction == MTLStoreActionDontCare) {
102 secondStoreValid = (first.storeAction == MTLStoreActionDontCare);
103
104
105 } else if (second.storeAction == MTLStoreActionStore) {
106 if (@available(macOS 10.12, iOS 10.0, tvOS 10.0, *)) {
107 secondStoreValid = (first.storeAction == MTLStoreActionStore ||
108 first.storeAction == MTLStoreActionStoreAndMultisampleResolve);
109 } else {
110 secondStoreValid = (first.storeAction == MTLStoreActionStore);
111 }
112
113
114 } else if (second.storeAction == MTLStoreActionMultisampleResolve) {
115 if (@available(macOS 10.12, iOS 10.0, tvOS 10.0, *)) {
116 secondStoreValid = (first.resolveTexture == second.resolveTexture) &&
117 (first.storeAction == MTLStoreActionMultisampleResolve ||
118 first.storeAction == MTLStoreActionStoreAndMultisampleResolve);
119 } else {
120 secondStoreValid = (first.resolveTexture == second.resolveTexture) &&
121 (first.storeAction == MTLStoreActionMultisampleResolve);
122 }
123
124
125 storeActionsValid = secondStoreValid;
126 } else {
127 if (@available(macOS 10.12, iOS 10.0, tvOS 10.0, *)) {
128 if (second.storeAction == MTLStoreActionStoreAndMultisampleResolve) {
129 secondStoreValid = (first.resolveTexture == second.resolveTexture) &&
130 (first.storeAction == MTLStoreActionStoreAndMultisampleResolve);
131
132
133
134
135
136
137 storeActionsValid = secondStoreValid;
138 }
139 }
140 }
141
142 return renderTargetsMatch &&
143 (nil == first.texture ||
144 (storeActionsValid && loadActionsValid && secondDoesntSampleFirst && secondStoreValid));
145}
bool doesntSampleAttachment(const MTLRenderPassAttachmentDescriptor *) const