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

Side by Side Diff: src/gpu/vk/GrVkCommandBuffer.cpp

Issue 1974983002: Refactor Vulkan image, texture, RTs so that create and getter handles match. (Closed) Base URL: https://skia.googlesource.com/skia.git@fixLayerVersion
Patch Set: nits 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 unified diff | Download patch
« no previous file with comments | « src/gpu/vk/GrVkCommandBuffer.h ('k') | src/gpu/vk/GrVkGpu.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 "GrVkCommandBuffer.h" 8 #include "GrVkCommandBuffer.h"
9 9
10 #include "GrVkFramebuffer.h" 10 #include "GrVkFramebuffer.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 VkImageLayout srcLayout, 244 VkImageLayout srcLayout,
245 GrVkImage* dstImage, 245 GrVkImage* dstImage,
246 VkImageLayout dstLayout, 246 VkImageLayout dstLayout,
247 uint32_t copyRegionCount, 247 uint32_t copyRegionCount,
248 const VkImageCopy* copyRegions) { 248 const VkImageCopy* copyRegions) {
249 SkASSERT(fIsActive); 249 SkASSERT(fIsActive);
250 SkASSERT(!fActiveRenderPass); 250 SkASSERT(!fActiveRenderPass);
251 this->addResource(srcImage->resource()); 251 this->addResource(srcImage->resource());
252 this->addResource(dstImage->resource()); 252 this->addResource(dstImage->resource());
253 GR_VK_CALL(gpu->vkInterface(), CmdCopyImage(fCmdBuffer, 253 GR_VK_CALL(gpu->vkInterface(), CmdCopyImage(fCmdBuffer,
254 srcImage->textureImage(), 254 srcImage->image(),
255 srcLayout, 255 srcLayout,
256 dstImage->textureImage(), 256 dstImage->image(),
257 dstLayout, 257 dstLayout,
258 copyRegionCount, 258 copyRegionCount,
259 copyRegions)); 259 copyRegions));
260 } 260 }
261 261
262 void GrVkCommandBuffer::blitImage(const GrVkGpu* gpu, 262 void GrVkCommandBuffer::blitImage(const GrVkGpu* gpu,
263 const GrVkImage::Resource* srcImage, 263 const GrVkResource* srcResource,
264 VkImage srcImage,
264 VkImageLayout srcLayout, 265 VkImageLayout srcLayout,
265 const GrVkImage::Resource* dstImage, 266 const GrVkResource* dstResource,
267 VkImage dstImage,
266 VkImageLayout dstLayout, 268 VkImageLayout dstLayout,
267 uint32_t blitRegionCount, 269 uint32_t blitRegionCount,
268 const VkImageBlit* blitRegions, 270 const VkImageBlit* blitRegions,
269 VkFilter filter) { 271 VkFilter filter) {
270 SkASSERT(fIsActive); 272 SkASSERT(fIsActive);
271 SkASSERT(!fActiveRenderPass); 273 SkASSERT(!fActiveRenderPass);
272 this->addResource(srcImage); 274 this->addResource(srcResource);
273 this->addResource(dstImage); 275 this->addResource(dstResource);
274 GR_VK_CALL(gpu->vkInterface(), CmdBlitImage(fCmdBuffer, 276 GR_VK_CALL(gpu->vkInterface(), CmdBlitImage(fCmdBuffer,
275 srcImage->fImage, 277 srcImage,
276 srcLayout, 278 srcLayout,
277 dstImage->fImage, 279 dstImage,
278 dstLayout, 280 dstLayout,
279 blitRegionCount, 281 blitRegionCount,
280 blitRegions, 282 blitRegions,
281 filter)); 283 filter));
282 } 284 }
283 285
284 void GrVkCommandBuffer::copyImageToBuffer(const GrVkGpu* gpu, 286 void GrVkCommandBuffer::copyImageToBuffer(const GrVkGpu* gpu,
285 GrVkImage* srcImage, 287 GrVkImage* srcImage,
286 VkImageLayout srcLayout, 288 VkImageLayout srcLayout,
287 GrVkTransferBuffer* dstBuffer, 289 GrVkTransferBuffer* dstBuffer,
288 uint32_t copyRegionCount, 290 uint32_t copyRegionCount,
289 const VkBufferImageCopy* copyRegions) { 291 const VkBufferImageCopy* copyRegions) {
290 SkASSERT(fIsActive); 292 SkASSERT(fIsActive);
291 SkASSERT(!fActiveRenderPass); 293 SkASSERT(!fActiveRenderPass);
292 this->addResource(srcImage->resource()); 294 this->addResource(srcImage->resource());
293 this->addResource(dstBuffer->resource()); 295 this->addResource(dstBuffer->resource());
294 GR_VK_CALL(gpu->vkInterface(), CmdCopyImageToBuffer(fCmdBuffer, 296 GR_VK_CALL(gpu->vkInterface(), CmdCopyImageToBuffer(fCmdBuffer,
295 srcImage->textureImage() , 297 srcImage->image(),
296 srcLayout, 298 srcLayout,
297 dstBuffer->buffer(), 299 dstBuffer->buffer(),
298 copyRegionCount, 300 copyRegionCount,
299 copyRegions)); 301 copyRegions));
300 } 302 }
301 303
302 void GrVkCommandBuffer::copyBufferToImage(const GrVkGpu* gpu, 304 void GrVkCommandBuffer::copyBufferToImage(const GrVkGpu* gpu,
303 GrVkTransferBuffer* srcBuffer, 305 GrVkTransferBuffer* srcBuffer,
304 GrVkImage* dstImage, 306 GrVkImage* dstImage,
305 VkImageLayout dstLayout, 307 VkImageLayout dstLayout,
306 uint32_t copyRegionCount, 308 uint32_t copyRegionCount,
307 const VkBufferImageCopy* copyRegions) { 309 const VkBufferImageCopy* copyRegions) {
308 SkASSERT(fIsActive); 310 SkASSERT(fIsActive);
309 SkASSERT(!fActiveRenderPass); 311 SkASSERT(!fActiveRenderPass);
310 this->addResource(srcBuffer->resource()); 312 this->addResource(srcBuffer->resource());
311 this->addResource(dstImage->resource()); 313 this->addResource(dstImage->resource());
312 GR_VK_CALL(gpu->vkInterface(), CmdCopyBufferToImage(fCmdBuffer, 314 GR_VK_CALL(gpu->vkInterface(), CmdCopyBufferToImage(fCmdBuffer,
313 srcBuffer->buffer(), 315 srcBuffer->buffer(),
314 dstImage->textureImage() , 316 dstImage->image(),
315 dstLayout, 317 dstLayout,
316 copyRegionCount, 318 copyRegionCount,
317 copyRegions)); 319 copyRegions));
318 } 320 }
319 321
320 void GrVkCommandBuffer::clearColorImage(const GrVkGpu* gpu, 322 void GrVkCommandBuffer::clearColorImage(const GrVkGpu* gpu,
321 GrVkImage* image, 323 GrVkImage* image,
322 const VkClearColorValue* color, 324 const VkClearColorValue* color,
323 uint32_t subRangeCount, 325 uint32_t subRangeCount,
324 const VkImageSubresourceRange* subRanges ) { 326 const VkImageSubresourceRange* subRanges ) {
325 SkASSERT(fIsActive); 327 SkASSERT(fIsActive);
326 SkASSERT(!fActiveRenderPass); 328 SkASSERT(!fActiveRenderPass);
327 this->addResource(image->resource()); 329 this->addResource(image->resource());
328 GR_VK_CALL(gpu->vkInterface(), CmdClearColorImage(fCmdBuffer, 330 GR_VK_CALL(gpu->vkInterface(), CmdClearColorImage(fCmdBuffer,
329 image->textureImage(), 331 image->image(),
330 image->currentLayout(), 332 image->currentLayout(),
331 color, 333 color,
332 subRangeCount, 334 subRangeCount,
333 subRanges)); 335 subRanges));
334 } 336 }
335 337
336 void GrVkCommandBuffer::clearDepthStencilImage(const GrVkGpu* gpu, 338 void GrVkCommandBuffer::clearDepthStencilImage(const GrVkGpu* gpu,
337 GrVkImage* image, 339 GrVkImage* image,
338 const VkClearDepthStencilValue* c olor, 340 const VkClearDepthStencilValue* c olor,
339 uint32_t subRangeCount, 341 uint32_t subRangeCount,
340 const VkImageSubresourceRange* su bRanges) { 342 const VkImageSubresourceRange* su bRanges) {
341 SkASSERT(fIsActive); 343 SkASSERT(fIsActive);
342 SkASSERT(!fActiveRenderPass); 344 SkASSERT(!fActiveRenderPass);
343 this->addResource(image->resource()); 345 this->addResource(image->resource());
344 GR_VK_CALL(gpu->vkInterface(), CmdClearDepthStencilImage(fCmdBuffer, 346 GR_VK_CALL(gpu->vkInterface(), CmdClearDepthStencilImage(fCmdBuffer,
345 image->textureImage (), 347 image->image(),
346 image->currentLayou t(), 348 image->currentLayou t(),
347 color, 349 color,
348 subRangeCount, 350 subRangeCount,
349 subRanges)); 351 subRanges));
350 } 352 }
351 353
352 void GrVkCommandBuffer::clearAttachments(const GrVkGpu* gpu, 354 void GrVkCommandBuffer::clearAttachments(const GrVkGpu* gpu,
353 int numAttachments, 355 int numAttachments,
354 const VkClearAttachment* attachments, 356 const VkClearAttachment* attachments,
355 int numRects, 357 int numRects,
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 } 465 }
464 466
465 void GrVkCommandBuffer::setBlendConstants(const GrVkGpu* gpu, 467 void GrVkCommandBuffer::setBlendConstants(const GrVkGpu* gpu,
466 const float blendConstants[4]) { 468 const float blendConstants[4]) {
467 SkASSERT(fIsActive); 469 SkASSERT(fIsActive);
468 if (memcmp(blendConstants, fCachedBlendConstant, 4 * sizeof(float))) { 470 if (memcmp(blendConstants, fCachedBlendConstant, 4 * sizeof(float))) {
469 GR_VK_CALL(gpu->vkInterface(), CmdSetBlendConstants(fCmdBuffer, blendCon stants)); 471 GR_VK_CALL(gpu->vkInterface(), CmdSetBlendConstants(fCmdBuffer, blendCon stants));
470 memcpy(fCachedBlendConstant, blendConstants, 4 * sizeof(float)); 472 memcpy(fCachedBlendConstant, blendConstants, 4 * sizeof(float));
471 } 473 }
472 } 474 }
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkCommandBuffer.h ('k') | src/gpu/vk/GrVkGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698