OLD | NEW |
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 "GrVkGpu.h" | 8 #include "GrVkGpu.h" |
9 | 9 |
10 #include "GrContextOptions.h" | 10 #include "GrContextOptions.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 } | 72 } |
73 } else { | 73 } else { |
74 vkBackendContext->ref(); | 74 vkBackendContext->ref(); |
75 } | 75 } |
76 | 76 |
77 return new GrVkGpu(context, options, vkBackendContext); | 77 return new GrVkGpu(context, options, vkBackendContext); |
78 } | 78 } |
79 | 79 |
80 //////////////////////////////////////////////////////////////////////////////// | 80 //////////////////////////////////////////////////////////////////////////////// |
81 | 81 |
82 GrVkGpu::GrVkGpu(GrContext* context, const GrContextOptions& options, | 82 GrVkGpu::GrVkGpu(GrContext* context, const GrContextOptions& options, |
83 const GrVkBackendContext* backendCtx) | 83 const GrVkBackendContext* backendCtx) |
84 : INHERITED(context) | 84 : INHERITED(context) |
85 , fVkInstance(backendCtx->fInstance) | 85 , fVkInstance(backendCtx->fInstance) |
86 , fDevice(backendCtx->fDevice) | 86 , fDevice(backendCtx->fDevice) |
87 , fQueue(backendCtx->fQueue) | 87 , fQueue(backendCtx->fQueue) |
88 , fResourceProvider(this) { | 88 , fResourceProvider(this) { |
89 fBackendContext.reset(backendCtx); | 89 fBackendContext.reset(backendCtx); |
90 | 90 |
91 #ifdef ENABLE_VK_LAYERS | 91 #ifdef ENABLE_VK_LAYERS |
92 if (backendCtx->fExtensions & kEXT_debug_report_GrVkExtensionFlag) { | 92 if (backendCtx->fExtensions & kEXT_debug_report_GrVkExtensionFlag) { |
(...skipping 22 matching lines...) Expand all Loading... |
115 fCaps.reset(SkRef(fVkCaps.get())); | 115 fCaps.reset(SkRef(fVkCaps.get())); |
116 | 116 |
117 VK_CALL(GetPhysicalDeviceMemoryProperties(backendCtx->fPhysicalDevice, &fPhy
sDevMemProps)); | 117 VK_CALL(GetPhysicalDeviceMemoryProperties(backendCtx->fPhysicalDevice, &fPhy
sDevMemProps)); |
118 | 118 |
119 const VkCommandPoolCreateInfo cmdPoolInfo = { | 119 const VkCommandPoolCreateInfo cmdPoolInfo = { |
120 VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, // sType | 120 VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, // sType |
121 nullptr, // pNext | 121 nullptr, // pNext |
122 VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, // CmdPoolCreateFlags | 122 VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, // CmdPoolCreateFlags |
123 backendCtx->fQueueFamilyIndex, // queueFamilyIndex | 123 backendCtx->fQueueFamilyIndex, // queueFamilyIndex |
124 }; | 124 }; |
125 GR_VK_CALL_ERRCHECK(this->vkInterface(), CreateCommandPool(fDevice, &cmdPool
Info, nullptr, | 125 GR_VK_CALL_ERRCHECK(this->vkInterface(), CreateCommandPool(fDevice, &cmdPool
Info, nullptr, |
126 &fCmdPool)); | 126 &fCmdPool)); |
127 | 127 |
128 // must call this after creating the CommandPool | 128 // must call this after creating the CommandPool |
129 fResourceProvider.init(); | 129 fResourceProvider.init(); |
130 fCurrentCmdBuffer = fResourceProvider.createCommandBuffer(); | 130 fCurrentCmdBuffer = fResourceProvider.createCommandBuffer(); |
131 SkASSERT(fCurrentCmdBuffer); | 131 SkASSERT(fCurrentCmdBuffer); |
132 fCurrentCmdBuffer->begin(this); | 132 fCurrentCmdBuffer->begin(this); |
133 } | 133 } |
134 | 134 |
135 GrVkGpu::~GrVkGpu() { | 135 GrVkGpu::~GrVkGpu() { |
136 fCurrentCmdBuffer->end(this); | 136 fCurrentCmdBuffer->end(this); |
137 fCurrentCmdBuffer->unref(this); | 137 fCurrentCmdBuffer->unref(this); |
138 | 138 |
139 // wait for all commands to finish | 139 // wait for all commands to finish |
140 fResourceProvider.checkCommandBuffers(); | 140 fResourceProvider.checkCommandBuffers(); |
141 SkDEBUGCODE(VkResult res =) VK_CALL(QueueWaitIdle(fQueue)); | 141 SkDEBUGCODE(VkResult res =) VK_CALL(QueueWaitIdle(fQueue)); |
142 // VK_ERROR_DEVICE_LOST is acceptable when tearing down (see 4.2.4 in spec) | 142 // VK_ERROR_DEVICE_LOST is acceptable when tearing down (see 4.2.4 in spec) |
143 SkASSERT(VK_SUCCESS == res || VK_ERROR_DEVICE_LOST == res); | 143 SkASSERT(VK_SUCCESS == res || VK_ERROR_DEVICE_LOST == res); |
144 | 144 |
145 // must call this just before we destroy the VkDevice | 145 // must call this just before we destroy the VkDevice |
146 fResourceProvider.destroyResources(); | 146 fResourceProvider.destroyResources(); |
147 | 147 |
148 VK_CALL(DestroyCommandPool(fDevice, fCmdPool, nullptr)); | 148 VK_CALL(DestroyCommandPool(fDevice, fCmdPool, nullptr)); |
149 | 149 |
150 shaderc_compiler_release(fCompiler); | 150 shaderc_compiler_release(fCompiler); |
151 | 151 |
152 #ifdef ENABLE_VK_LAYERS | 152 #ifdef ENABLE_VK_LAYERS |
153 VK_CALL(DestroyDebugReportCallbackEXT(fVkInstance, fCallback, nullptr)); | 153 VK_CALL(DestroyDebugReportCallbackEXT(fVkInstance, fCallback, nullptr)); |
154 #endif | 154 #endif |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 if (kIndex_8_GrPixelConfig == srcConfig || GrPixelConfigIsCompressed(dstSurf
ace->config())) { | 201 if (kIndex_8_GrPixelConfig == srcConfig || GrPixelConfigIsCompressed(dstSurf
ace->config())) { |
202 return false; | 202 return false; |
203 } | 203 } |
204 | 204 |
205 // Currently we don't handle draws, so if the caller wants/needs to do a dra
w we need to fail | 205 // Currently we don't handle draws, so if the caller wants/needs to do a dra
w we need to fail |
206 if (kNoDraw_DrawPreference != *drawPreference) { | 206 if (kNoDraw_DrawPreference != *drawPreference) { |
207 return false; | 207 return false; |
208 } | 208 } |
209 | 209 |
210 if (dstSurface->config() != srcConfig) { | 210 if (dstSurface->config() != srcConfig) { |
211 // TODO: This should fall back to drawing or copying to change config of
dstSurface to | 211 // TODO: This should fall back to drawing or copying to change config of
dstSurface to |
212 // match that of srcConfig. | 212 // match that of srcConfig. |
213 return false; | 213 return false; |
214 } | 214 } |
215 | 215 |
216 return true; | 216 return true; |
217 } | 217 } |
218 | 218 |
219 bool GrVkGpu::onWritePixels(GrSurface* surface, | 219 bool GrVkGpu::onWritePixels(GrSurface* surface, |
220 int left, int top, int width, int height, | 220 int left, int top, int width, int height, |
221 GrPixelConfig config, | 221 GrPixelConfig config, |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 GR_VK_CALL(interface, GetImageSubresourceLayout(fDevice, | 312 GR_VK_CALL(interface, GetImageSubresourceLayout(fDevice, |
313 tex->textureImage(), | 313 tex->textureImage(), |
314 &subres, | 314 &subres, |
315 &layout)); | 315 &layout)); |
316 | 316 |
317 int texTop = kBottomLeft_GrSurfaceOrigin == desc.fOrigin ? tex->height()
- top - height | 317 int texTop = kBottomLeft_GrSurfaceOrigin == desc.fOrigin ? tex->height()
- top - height |
318 : top; | 318 : top; |
319 VkDeviceSize offset = texTop*layout.rowPitch + left*bpp; | 319 VkDeviceSize offset = texTop*layout.rowPitch + left*bpp; |
320 VkDeviceSize size = height*layout.rowPitch; | 320 VkDeviceSize size = height*layout.rowPitch; |
321 void* mapPtr; | 321 void* mapPtr; |
322 err = GR_VK_CALL(interface, MapMemory(fDevice, tex->textureMemory(), off
set, size, 0, | 322 err = GR_VK_CALL(interface, MapMemory(fDevice, tex->textureMemory(), off
set, size, 0, |
323 &mapPtr)); | 323 &mapPtr)); |
324 if (err) { | 324 if (err) { |
325 return false; | 325 return false; |
326 } | 326 } |
327 | 327 |
328 if (kBottomLeft_GrSurfaceOrigin == desc.fOrigin) { | 328 if (kBottomLeft_GrSurfaceOrigin == desc.fOrigin) { |
329 // copy into buffer by rows | 329 // copy into buffer by rows |
330 const char* srcRow = reinterpret_cast<const char*>(data); | 330 const char* srcRow = reinterpret_cast<const char*>(data); |
331 char* dstRow = reinterpret_cast<char*>(mapPtr)+(height - 1)*layout.r
owPitch; | 331 char* dstRow = reinterpret_cast<char*>(mapPtr)+(height - 1)*layout.r
owPitch; |
332 for (int y = 0; y < height; y++) { | 332 for (int y = 0; y < height; y++) { |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 surfDesc.fHeight = desc.fHeight; | 549 surfDesc.fHeight = desc.fHeight; |
550 surfDesc.fConfig = desc.fConfig; | 550 surfDesc.fConfig = desc.fConfig; |
551 surfDesc.fSampleCnt = SkTMin(desc.fSampleCnt, this->caps()->maxSampleCount()
); | 551 surfDesc.fSampleCnt = SkTMin(desc.fSampleCnt, this->caps()->maxSampleCount()
); |
552 bool renderTarget = SkToBool(desc.fFlags & kRenderTarget_GrBackendTextureFla
g); | 552 bool renderTarget = SkToBool(desc.fFlags & kRenderTarget_GrBackendTextureFla
g); |
553 // In GL, Chrome assumes all textures are BottomLeft | 553 // In GL, Chrome assumes all textures are BottomLeft |
554 // In VK, we don't have this restriction | 554 // In VK, we don't have this restriction |
555 surfDesc.fOrigin = resolve_origin(desc.fOrigin); | 555 surfDesc.fOrigin = resolve_origin(desc.fOrigin); |
556 | 556 |
557 GrVkTexture* texture = nullptr; | 557 GrVkTexture* texture = nullptr; |
558 if (renderTarget) { | 558 if (renderTarget) { |
559 texture = GrVkTextureRenderTarget::CreateWrappedTextureRenderTarget(this
, surfDesc, | 559 texture = GrVkTextureRenderTarget::CreateWrappedTextureRenderTarget(this
, surfDesc, |
560 life
Cycle, format, | 560 life
Cycle, format, |
561 info
); | 561 info
); |
562 } else { | 562 } else { |
563 texture = GrVkTexture::CreateWrappedTexture(this, surfDesc, lifeCycle, f
ormat, | 563 texture = GrVkTexture::CreateWrappedTexture(this, surfDesc, lifeCycle, f
ormat, |
564 info); | 564 info); |
565 } | 565 } |
566 if (!texture) { | 566 if (!texture) { |
567 return nullptr; | 567 return nullptr; |
568 } | 568 } |
569 | 569 |
570 return texture; | 570 return texture; |
571 } | 571 } |
572 | 572 |
573 GrRenderTarget* GrVkGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDe
sc& wrapDesc, | 573 GrRenderTarget* GrVkGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDe
sc& wrapDesc, |
574 GrWrapOwnership ownership) { | 574 GrWrapOwnership ownership) { |
575 | 575 |
576 const GrVkTextureInfo* info = | 576 const GrVkTextureInfo* info = |
577 reinterpret_cast<const GrVkTextureInfo*>(wrapDesc.fRenderTargetHandle); | 577 reinterpret_cast<const GrVkTextureInfo*>(wrapDesc.fRenderTargetHandle); |
578 if (VK_NULL_HANDLE == info->fImage || | 578 if (VK_NULL_HANDLE == info->fImage || |
579 (VK_NULL_HANDLE == info->fAlloc && kAdopt_GrWrapOwnership == ownership))
{ | 579 (VK_NULL_HANDLE == info->fAlloc && kAdopt_GrWrapOwnership == ownership))
{ |
580 return nullptr; | 580 return nullptr; |
581 } | 581 } |
582 | 582 |
583 GrGpuResource::LifeCycle lifeCycle = (kAdopt_GrWrapOwnership == ownership) | 583 GrGpuResource::LifeCycle lifeCycle = (kAdopt_GrWrapOwnership == ownership) |
584 ? GrGpuResource::kAdopted_LifeCycle | 584 ? GrGpuResource::kAdopted_LifeCycle |
585 : GrGpuResource::kBorrowed_LifeCycle; | 585 : GrGpuResource::kBorrowed_LifeCycle; |
586 | 586 |
587 GrSurfaceDesc desc; | 587 GrSurfaceDesc desc; |
588 desc.fConfig = wrapDesc.fConfig; | 588 desc.fConfig = wrapDesc.fConfig; |
589 desc.fFlags = kCheckAllocation_GrSurfaceFlag; | 589 desc.fFlags = kCheckAllocation_GrSurfaceFlag; |
590 desc.fWidth = wrapDesc.fWidth; | 590 desc.fWidth = wrapDesc.fWidth; |
591 desc.fHeight = wrapDesc.fHeight; | 591 desc.fHeight = wrapDesc.fHeight; |
592 desc.fSampleCnt = SkTMin(wrapDesc.fSampleCnt, this->caps()->maxSampleCount()
); | 592 desc.fSampleCnt = SkTMin(wrapDesc.fSampleCnt, this->caps()->maxSampleCount()
); |
593 | 593 |
594 desc.fOrigin = resolve_origin(wrapDesc.fOrigin); | 594 desc.fOrigin = resolve_origin(wrapDesc.fOrigin); |
595 | 595 |
596 GrVkRenderTarget* tgt = GrVkRenderTarget::CreateWrappedRenderTarget(this, de
sc, | 596 GrVkRenderTarget* tgt = GrVkRenderTarget::CreateWrappedRenderTarget(this, de
sc, |
597 lifeCycl
e, | 597 lifeCycl
e, |
598 info); | 598 info); |
599 if (tgt && wrapDesc.fStencilBits) { | 599 if (tgt && wrapDesc.fStencilBits) { |
600 if (!createStencilAttachmentForRenderTarget(tgt, desc.fWidth, desc.fHeig
ht)) { | 600 if (!createStencilAttachmentForRenderTarget(tgt, desc.fWidth, desc.fHeig
ht)) { |
601 tgt->unref(); | 601 tgt->unref(); |
602 return nullptr; | 602 return nullptr; |
603 } | 603 } |
604 } | 604 } |
605 return tgt; | 605 return tgt; |
606 } | 606 } |
607 | 607 |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 | 968 |
969 return; | 969 return; |
970 } | 970 } |
971 | 971 |
972 void GrVkGpu::onClear(GrRenderTarget* target, const SkIRect& rect, GrColor color
) { | 972 void GrVkGpu::onClear(GrRenderTarget* target, const SkIRect& rect, GrColor color
) { |
973 // parent class should never let us get here with no RT | 973 // parent class should never let us get here with no RT |
974 SkASSERT(target); | 974 SkASSERT(target); |
975 | 975 |
976 VkClearColorValue vkColor; | 976 VkClearColorValue vkColor; |
977 GrColorToRGBAFloat(color, vkColor.float32); | 977 GrColorToRGBAFloat(color, vkColor.float32); |
978 | 978 |
979 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(target); | 979 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(target); |
980 VkImageLayout origDstLayout = vkRT->currentLayout(); | 980 VkImageLayout origDstLayout = vkRT->currentLayout(); |
981 | 981 |
982 if (rect.width() != target->width() || rect.height() != target->height()) { | 982 if (rect.width() != target->width() || rect.height() != target->height()) { |
983 VkAccessFlags srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(origDstL
ayout); | 983 VkAccessFlags srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(origDstL
ayout); |
984 VkAccessFlags dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; | 984 VkAccessFlags dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; |
985 VkPipelineStageFlags srcStageMask = | 985 VkPipelineStageFlags srcStageMask = |
986 GrVkMemory::LayoutToPipelineStageFlags(origDstLayout); | 986 GrVkMemory::LayoutToPipelineStageFlags(origDstLayout); |
987 VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; | 987 VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; |
988 vkRT->setImageLayout(this, | 988 vkRT->setImageLayout(this, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 | 1038 |
1039 | 1039 |
1040 VkImageSubresourceRange subRange; | 1040 VkImageSubresourceRange subRange; |
1041 memset(&subRange, 0, sizeof(VkImageSubresourceRange)); | 1041 memset(&subRange, 0, sizeof(VkImageSubresourceRange)); |
1042 subRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; | 1042 subRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; |
1043 subRange.baseMipLevel = 0; | 1043 subRange.baseMipLevel = 0; |
1044 subRange.levelCount = 1; | 1044 subRange.levelCount = 1; |
1045 subRange.baseArrayLayer = 0; | 1045 subRange.baseArrayLayer = 0; |
1046 subRange.layerCount = 1; | 1046 subRange.layerCount = 1; |
1047 | 1047 |
1048 // In the future we may not actually be doing this type of clear at all. If
we are inside a | 1048 // In the future we may not actually be doing this type of clear at all. If
we are inside a |
1049 // render pass or doing a non full clear then we will use CmdClearColorAttac
hment. The more | 1049 // render pass or doing a non full clear then we will use CmdClearColorAttac
hment. The more |
1050 // common use case will be clearing an attachment at the start of a render p
ass, in which case | 1050 // common use case will be clearing an attachment at the start of a render p
ass, in which case |
1051 // we will use the clear load ops. | 1051 // we will use the clear load ops. |
1052 fCurrentCmdBuffer->clearColorImage(this, | 1052 fCurrentCmdBuffer->clearColorImage(this, |
1053 vkRT, | 1053 vkRT, |
1054 &vkColor, | 1054 &vkColor, |
1055 1, &subRange); | 1055 1, &subRange); |
1056 } | 1056 } |
1057 | 1057 |
1058 inline bool can_copy_image(const GrSurface* dst, | 1058 inline bool can_copy_image(const GrSurface* dst, |
(...skipping 25 matching lines...) Expand all Loading... |
1084 VkImageLayout origDstLayout = dstTex->currentLayout(); | 1084 VkImageLayout origDstLayout = dstTex->currentLayout(); |
1085 VkImageLayout origSrcLayout = srcTex->currentLayout(); | 1085 VkImageLayout origSrcLayout = srcTex->currentLayout(); |
1086 | 1086 |
1087 VkPipelineStageFlags srcStageMask = GrVkMemory::LayoutToPipelineStageFlags(o
rigDstLayout); | 1087 VkPipelineStageFlags srcStageMask = GrVkMemory::LayoutToPipelineStageFlags(o
rigDstLayout); |
1088 VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_TRANSFER_BIT; | 1088 VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_TRANSFER_BIT; |
1089 | 1089 |
1090 // These flags are for flushing/invalidating caches and for the dst image it
doesn't matter if | 1090 // These flags are for flushing/invalidating caches and for the dst image it
doesn't matter if |
1091 // the cache is flushed since it is only being written to. | 1091 // the cache is flushed since it is only being written to. |
1092 VkAccessFlags srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(origDstLayou
t);; | 1092 VkAccessFlags srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(origDstLayou
t);; |
1093 VkAccessFlags dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; | 1093 VkAccessFlags dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; |
1094 | 1094 |
1095 dstTex->setImageLayout(this, | 1095 dstTex->setImageLayout(this, |
1096 VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, | 1096 VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, |
1097 srcAccessMask, | 1097 srcAccessMask, |
1098 dstAccessMask, | 1098 dstAccessMask, |
1099 srcStageMask, | 1099 srcStageMask, |
1100 dstStageMask, | 1100 dstStageMask, |
1101 false); | 1101 false); |
1102 | 1102 |
1103 srcStageMask = GrVkMemory::LayoutToPipelineStageFlags(origSrcLayout); | 1103 srcStageMask = GrVkMemory::LayoutToPipelineStageFlags(origSrcLayout); |
1104 dstStageMask = VK_PIPELINE_STAGE_TRANSFER_BIT; | 1104 dstStageMask = VK_PIPELINE_STAGE_TRANSFER_BIT; |
1105 | 1105 |
1106 srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(origSrcLayout); | 1106 srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(origSrcLayout); |
1107 dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; | 1107 dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; |
1108 | 1108 |
1109 srcTex->setImageLayout(this, | 1109 srcTex->setImageLayout(this, |
1110 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, | 1110 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, |
1111 srcAccessMask, | 1111 srcAccessMask, |
1112 dstAccessMask, | 1112 dstAccessMask, |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1218 VkAccessFlags srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(layout); | 1218 VkAccessFlags srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(layout); |
1219 VkAccessFlags dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; | 1219 VkAccessFlags dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; |
1220 tgt->setImageLayout(this, | 1220 tgt->setImageLayout(this, |
1221 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, | 1221 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, |
1222 srcAccessMask, | 1222 srcAccessMask, |
1223 dstAccessMask, | 1223 dstAccessMask, |
1224 srcStageMask, | 1224 srcStageMask, |
1225 dstStageMask, | 1225 dstStageMask, |
1226 false); | 1226 false); |
1227 | 1227 |
1228 GrVkTransferBuffer* transferBuffer = | 1228 GrVkTransferBuffer* transferBuffer = |
1229 static_cast<GrVkTransferBuffer*>(this->createBuffer(kXferGpuToCpu_GrBuff
erType, | 1229 static_cast<GrVkTransferBuffer*>(this->createBuffer(kXferGpuToCpu_GrBuff
erType, |
1230 rowBytes * height, | 1230 rowBytes * height, |
1231 kStream_GrAccessPatt
ern)); | 1231 kStream_GrAccessPatt
ern)); |
1232 | 1232 |
1233 bool flipY = kBottomLeft_GrSurfaceOrigin == surface->origin(); | 1233 bool flipY = kBottomLeft_GrSurfaceOrigin == surface->origin(); |
1234 VkOffset3D offset = { | 1234 VkOffset3D offset = { |
1235 left, | 1235 left, |
1236 flipY ? surface->height() - top - height : top, | 1236 flipY ? surface->height() - top - height : top, |
1237 0 | 1237 0 |
1238 }; | 1238 }; |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1434 aglSwapBuffers(aglGetCurrentContext()); | 1434 aglSwapBuffers(aglGetCurrentContext()); |
1435 int set_a_break_pt_here = 9; | 1435 int set_a_break_pt_here = 9; |
1436 aglSwapBuffers(aglGetCurrentContext()); | 1436 aglSwapBuffers(aglGetCurrentContext()); |
1437 #elif defined(SK_BUILD_FOR_WIN32) | 1437 #elif defined(SK_BUILD_FOR_WIN32) |
1438 SwapBuf(); | 1438 SwapBuf(); |
1439 int set_a_break_pt_here = 9; | 1439 int set_a_break_pt_here = 9; |
1440 SwapBuf(); | 1440 SwapBuf(); |
1441 #endif | 1441 #endif |
1442 #endif | 1442 #endif |
1443 } | 1443 } |
1444 | |
OLD | NEW |