122 {
124 return false;
125 }
126 if (!
src || !
src->supportsInputAttachmentUsage()) {
127 return false;
128 }
129
132 if (!this->createMSAALoadProgram(gpu)) {
133 SkDebugf(
"Failed to create copy program.\n");
134 return false;
135 }
136 }
138
140
143 fShaderStageInfo, fPipelineLayout);
144 if (!pipeline) {
145 return false;
146 }
148
149
150
159
160
166 commandBuffer->
setScissor(gpu, 0, 1, &scissor);
167
168
169 int w =
rect.width();
170 int h =
rect.height();
171
172
173 int dw =
dst->width();
174 int dh =
dst->height();
175 float dx0 = 2.f *
rect.fLeft / dw - 1.f;
176 float dx1 = 2.f * (
rect.fLeft +
w) / dw - 1.f;
177 float dy0 = 2.f *
rect.fTop / dh - 1.f;
178 float dy1 = 2.f * (
rect.fTop +
h) / dh - 1.f;
179
180 float uniData[] = {dx1 - dx0, dy1 - dy0, dx0, dy0};
181
183
184
185
187 sizeof(uniData),
190 if (!uniformBuffer) {
191 return false;
192 }
198 0, nullptr);
199 commandBuffer->
addGrBuffer(std::move(uniformBuffer));
200
201
203 if (!inputDS) {
204 return false;
205 }
208 inputDS->descriptorSet(),
209 0, nullptr);
210
211
212
214
215 commandBuffer->
draw(gpu, 4, 1, 0, 0);
216
217 return true;
218}
@ kDynamic_GrAccessPattern
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
GrResourceProvider * resourceProvider()
GrDirectContextPriv priv()
GrDirectContext * getContext()
sk_sp< GrGpuBuffer > createBuffer(size_t size, GrGpuBufferType, GrAccessPattern, ZeroInit)
const VkDescriptorSet * uniformDescriptorSet() const
void setViewport(const GrVkGpu *gpu, uint32_t firstViewport, uint32_t viewportCount, const VkViewport *viewports)
void bindPipeline(const GrVkGpu *gpu, sk_sp< const GrVkPipeline > pipeline)
void addRecycledResource(gr_rp< const GrRecycledResource > resource)
void setScissor(const GrVkGpu *gpu, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D *scissors)
void addGrBuffer(sk_sp< const GrBuffer > buffer)
void bindDescriptorSets(const GrVkGpu *gpu, VkPipelineLayout layout, uint32_t firstSet, uint32_t setCount, const VkDescriptorSet *descriptorSets, uint32_t dynamicOffsetCount, const uint32_t *dynamicOffsets)
void draw(const GrVkGpu *gpu, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance)
GrVkResourceProvider & resourceProvider()
sk_sp< const GrVkPipeline > findOrCreateMSAALoadPipeline(const GrVkRenderPass &renderPass, int numSamples, VkPipelineShaderStageCreateInfo *, VkPipelineLayout)
sk_sp< SkBlender > blender SkRect rect