Lines Matching refs:alloc
48 GrVkAlloc* alloc,
51 GrVkAlloc* alloc) {
71 allocator->getAllocInfo(memory, alloc);
74 alloc->fBytes = size;
80 GR_VK_CALL_RESULT(gpu, err, BindBufferMemory(gpu->device(), buffer, alloc->fMemory,
81 alloc->fOffset));
83 FreeBufferMemory(gpu, *alloc);
93 GrVkAlloc* alloc) {
137 alloc->fMemory = memory;
138 alloc->fOffset = 0;
139 alloc->fSize = memReqs.size;
140 alloc->fFlags = 0;
141 alloc->fIsExternalMemory = true;
146 void GrVkMemory::FreeBufferMemory(const GrVkGpu* gpu, const GrVkAlloc& alloc) {
148 ((GrVkGpu*)gpu)->removeAllocBufferBytes(alloc.fBytes);
150 if (alloc.fIsExternalMemory) {
151 VK_CALL(gpu, FreeMemory(gpu->device(), alloc.fMemory, nullptr));
153 SkASSERT(alloc.fBackendMemory);
155 if (alloc.fAllocator != nullptr) {
156 allocator = alloc.fAllocator;
158 allocator->freeMemory(alloc.fBackendMemory);
165 GrVkAlloc* alloc,
210 allocator->getAllocInfo(memory, alloc);
212 alloc->fBytes = memorySize;
220 GR_VK_CALL_RESULT(gpu, err, BindImageMemory(gpu->device(), image, alloc->fMemory,
221 alloc->fOffset));
223 FreeImageMemory(gpu, *alloc);
231 void GrVkMemory::FreeImageMemory(const GrVkGpu* gpu, const GrVkAlloc& alloc) {
233 ((GrVkGpu*)gpu)->removeAllocImageBytes(alloc.fBytes);
235 SkASSERT(alloc.fBackendMemory);
237 if (alloc.fAllocator != nullptr) {
238 allocator = alloc.fAllocator;
240 allocator->freeMemory(alloc.fBackendMemory);
243 void* GrVkMemory::MapAlloc(GrVkGpu* gpu, const GrVkAlloc& alloc) {
244 SkASSERT(GrVkAlloc::kMappable_Flag & alloc.fFlags);
245 SkASSERT(alloc.fBackendMemory);
247 if (alloc.fAllocator != nullptr) {
248 allocator = alloc.fAllocator;
251 VkResult result = allocator->mapMemory(alloc.fBackendMemory, &mapPtr);
258 void GrVkMemory::UnmapAlloc(const GrVkGpu* gpu, const GrVkAlloc& alloc) {
259 SkASSERT(alloc.fBackendMemory);
261 if (alloc.fAllocator != nullptr) {
262 allocator = alloc.fAllocator;
264 allocator->unmapMemory(alloc.fBackendMemory);
267 void GrVkMemory::GetNonCoherentMappedMemoryRange(const GrVkAlloc& alloc, VkDeviceSize offset,
270 SkASSERT(alloc.fFlags & GrVkAlloc::kNoncoherent_Flag);
271 offset = offset + alloc.fOffset;
276 SkASSERT(offset >= alloc.fOffset);
277 SkASSERT(offset + size <= alloc.fOffset + alloc.fSize);
285 range->memory = alloc.fMemory;
290 void GrVkMemory::FlushMappedAlloc(GrVkGpu* gpu, const GrVkAlloc& alloc, VkDeviceSize offset,
292 if (alloc.fFlags & GrVkAlloc::kNoncoherent_Flag) {
294 SkASSERT(size <= alloc.fSize);
295 SkASSERT(alloc.fBackendMemory);
297 if (alloc.fAllocator != nullptr) {
298 allocator = alloc.fAllocator;
300 VkResult result = allocator->flushMemory(alloc.fBackendMemory, offset, size);
305 void GrVkMemory::InvalidateMappedAlloc(GrVkGpu* gpu, const GrVkAlloc& alloc,
307 if (alloc.fFlags & GrVkAlloc::kNoncoherent_Flag) {
309 SkASSERT(size <= alloc.fSize);
310 SkASSERT(alloc.fBackendMemory);
312 if (alloc.fAllocator != nullptr) {
313 allocator = alloc.fAllocator;
315 VkResult result = allocator->invalidateMemory(alloc.fBackendMemory, offset, size);